[Bug]: Planner tab fails with "Conversation file path must stay inside the workspace" on Windows local backend
Operating System
Windows
Installation Method
npm (npx @openhands/agent-canvas or npm install -g @openhands/agent-canvas)
Agent Canvas Version
1.24.0 (source checkout at f174ba8), agent-server 1.49.6
Bug Description
On a Windows host with the local backend, opening the Planner tab of any conversation fails with:
Conversation file path must stay inside the workspaceThis happens even though the requested file is inside the conversation workspace.
readConversationFile builds ${workingDir}/.agents_tmp/PLAN.md and validates it with requirePathInsideDirectory:
That check relies on normalizeAbsolutePath, which only accepts POSIX paths:
function normalizeAbsolutePath(path: string): string | null {
if (!path.startsWith("/")) return null;
...
}On Windows the agent-server reports working directories as drive-letter paths, often with mixed separators, e.g.:
C:\Users\me\.openhands\agent-canvas\workspaces/b2a09b0a0192409587a5d9eddaf963e6(scratch conversation workspace)D:\tese(workspace opened with Open Workspace)
Both the file path and the directory normalize to null, so requirePathInsideDirectory always throws before any request is sent to the agent-server.
This is the same class of problem as #17773 (the Files tab assumes a POSIX shell). Both come from Canvas assuming the local agent-server runs on a POSIX host. They are separate code paths with separate fixes.
Steps to Reproduce
Run method: npm run dev on Windows 11
npm ci && npm run dev- Open http://localhost:8000 and start a conversation (with or without Open Workspace).
- Send any message so the conversation has a workspace.
- Open the Planner tab in the conversation side panel.
- The error "Conversation file path must stay inside the workspace" is shown.
Actual Behavior
The Planner tab shows "Conversation file path must stay inside the workspace" for every local conversation on Windows. No /api/file/download request is made.
Expected Behavior
The Planner tab reads <workspace>/.agents_tmp/PLAN.md on Windows the same way it does on macOS and Linux. It shows the plan if one exists, and otherwise "There is currently no plan for this repo".
Relevant Logs
Error: Conversation file path must stay inside the workspace
at requirePathInsideDirectory (src/api/conversation-service/agent-server-conversation-service.api.ts:280)
at AgentServerConversationService.readConversationFile (src/api/conversation-service/agent-server-conversation-service.api.ts:835)Acceptance Criteria
No response
Screenshots
Additional Context
No response
OpenHands AI triage
The following comments and acceptance criteria were added by the OpenHands AI agent.
Triage
The Planner tab reads <workingDir>/.agents_tmp/PLAN.md through AgentServerConversationService.readConversationFile (src/api/conversation-service/agent-server-conversation-service.api.ts), which guards the resolved path with requirePathInsideDirectory → normalizeAbsolutePath. That helper returns null for any path that does not start with /, so on a Windows local backend both the drive-letter working_dir reported by the agent-server (e.g. C:\Users\me\.openhands\agent-canvas\workspaces/<hex>, often with mixed separators, or D:\tese) and the derived plan path normalize to null, and the guard throws before any /api/file/download request is sent. The cloud branch is unaffected because it hardcodes /workspace/project.
Bounded scope: make the local readConversationFile path accept Windows absolute working directories and normalize separators so the Planner tab reads <workspace>/.agents_tmp/PLAN.md on Windows exactly as on macOS/Linux, while keeping the workspace-containment guard intact. No compatibility.minimumAgentServer bump is expected, because no new agent-server endpoint, field, or behavior is required.
Explicit non-goals: no agent-server, SDK, or wire-contract changes (backend behavior belongs to OpenHands/software-agent-sdk); no change to the cloud read path; no change to the Files tab or the other POSIX-shell assumptions tracked separately in #17773; no change to Planner-tab UI, empty-state copy, or markdown rendering; do not weaken the guard — paths outside the workspace must still be rejected.
Acceptance Criteria
- On a Windows host with the local backend, opening the Planner tab for a conversation whose workspace contains
.agents_tmp/PLAN.mdrenders the plan content instead ofConversation file path must stay inside the workspace, and a/api/file/downloadrequest is issued for<workingDir>/.agents_tmp/PLAN.md. - This works both for a scratch conversation workspace (drive-letter path with mixed separators, e.g.
C:\Users\me\.openhands\agent-canvas\workspaces/<hex>) and for a workspace opened via Open Workspace (e.g.D:\tese). - When no
PLAN.mdexists, the tab shows the existing empty state (There is currently no plan for this repo) with no error toast, matching macOS and Linux. - The containment guard still rejects paths outside the workspace on Windows: an explicit
filePathoutsideworkingDir, a..traversal that escapes it, a sibling sharing the directory-name prefix (e.g..../ws-evil/PLAN.mdagainst.../ws), and a path on a different drive each still throwConversation file path must stay inside the workspaceand send no/api/file/downloadrequest. - macOS and Linux local backends and the cloud read path are unchanged: the resolved download path and the guard behavior are identical to today.
- An automated test covering the Windows drive-letter/mixed-separator resolution and the rejection cases extends the existing
readConversationFilecoverage in__tests__/api/agent-server-conversation-service.test.ts, exercising the real service and mocking the underlying HTTP/FileClient rather than the service itself. - The PR includes Windows evidence (screenshot or video) of the Planner tab populated on the PR branch, with the bug replicated on main, per the bug template's
ready-for-devevidence requirement.
Source: OpenHands/OpenHands