#17774·OpenHands

[Bug]: Planner tab fails with "Conversation file path must stay inside the workspace" on Windows local backend

Author: min23asdwCreated Sep 28, 2026Updated Sep 29, 2026
Labelsbugpriority:mediumready-for-dev

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 workspace

This happens even though the requested file is inside the conversation workspace.

readConversationFile builds ${workingDir}/.agents_tmp/PLAN.md and validates it with requirePathInsideDirectory:

https://github.com/OpenHands/OpenHands/blob/f174ba8465233e46e66ab2c5667b358f1d6676d6/src/api/conversation-service/agent-server-conversation-service.api.ts#L834-L839

That check relies on normalizeAbsolutePath, which only accepts POSIX paths:

https://github.com/OpenHands/OpenHands/blob/f174ba8465233e46e66ab2c5667b358f1d6676d6/src/api/conversation-service/agent-server-conversation-service.api.ts#L252-L283

typescript
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

  1. npm ci && npm run dev
  2. Open http://localhost:8000 and start a conversation (with or without Open Workspace).
  3. Send any message so the conversation has a workspace.
  4. Open the Planner tab in the conversation side panel.
  5. 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

bash
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

Image

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.md renders the plan content instead of Conversation file path must stay inside the workspace, and a /api/file/download request 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.md exists, 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 filePath outside workingDir, a .. traversal that escapes it, a sibling sharing the directory-name prefix (e.g. .../ws-evil/PLAN.md against .../ws), and a path on a different drive each still throw Conversation file path must stay inside the workspace and send no /api/file/download request.
  • 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 readConversationFile coverage 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-dev evidence requirement.