[Bug]: Files tab always shows "No files in 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, the conversation Files tab always shows "No files in workspace", even when the workspace contains files. The agent can see and run those files.
useLocalWorkspaceFiles lists files by sending a POSIX pipeline to the agent-server /api/bash/execute_bash_command endpoint:
find . \( -name '.git' -prune -o ... \) -o -type f -print 2>/dev/null | sort | head -n 2000On Windows the agent-server runs this endpoint through cmd.exe, not a POSIX shell. find resolves to Windows find.exe (a text search tool), and head and /dev/null don't exist there. The command exits with 255, the query throws, and the tab falls back to the empty state.
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).
- Ask the agent to create a few files, e.g. "create a.py, b.py and c.py".
- Open the Files tab in the conversation side panel.
- It shows "No files in workspace". The files exist on disk and the agent can read and run them.
The endpoint behavior can be reproduced directly (any existing directory as cwd):
POST /api/bash/execute_bash_command
{"command": "find . \\( -name '.git' -prune \\) -o -type f -print 2>/dev/null | sort | head -n 2000", "cwd": "<workspace>", "timeout": 30}
-> {"exit_code": 255, "stdout": null, "stderr": "The system cannot find the path specified.\r\n"}It confirms the command is interpreted by cmd.exe:
{"command": "$PSVersionTable.PSVersion.ToString()", ...}
-> {"exit_code": 1, "stderr": "'$PSVersionTable.PSVersion.ToString' is not recognized as an internal or external command,\r\noperable program or batch file.\r\n"}Actual Behavior
The Files tab shows "No files in workspace" for every local conversation on Windows. The workspace path row above the tree shows the correct directory.
Expected Behavior
The Files tab lists the workspace files (relative paths, same exclusions and 2000-file cap) on Windows, as it does on macOS and Linux.
Relevant Logs
execute_bash_command response for the listing command:
{"kind": "BashOutput", "exit_code": 255, "stdout": null, "stderr": "The system cannot find the path specified.\r\n"}Acceptance Criteria
No response
Screenshots
What it sholud be
Additional Context
No response
OpenHands AI triage
The following comments and acceptance criteria were added by the OpenHands AI agent.
Triage
The Files tab lists local-backend workspace files by sending a POSIX find … | sort | head pipeline to the agent-server's POST /api/bash/execute_bash_command (src/hooks/query/use-workspace-files.ts, useLocalWorkspaceFiles). The agent-server runs that endpoint through asyncio.create_subprocess_shell(..., shell=True), which resolves to cmd.exe on Windows, where find, head, and /dev/null do not exist; the command exits 255, the query throws, and the tab falls back to the empty state. The reporter reproduced this with the exact endpoint response and attached a screenshot.
Bounded scope: make the local file-listing path produce the workspace listing on Windows so the Files tab renders files instead of the empty state. Explicit non-goals: do not add or change agent-server endpoints, wire contracts, or SDK behavior (backend behavior belongs to OpenHands/software-agent-sdk); do not change the cloud listing path (useCloudWorkspaceFiles); do not change the exclusion list, the 2000-file cap, or the Files-tab tree/content-viewer UI; do not introduce a new transport beyond the existing AgentServerRuntimeService.executeCommand path. The Windows-compatible listing mechanism and how the agent-server platform is detected are left to the implementer.
Acceptance Criteria
- On a Windows host with a local backend, opening the Files tab for a conversation whose workspace contains files lists those files as workspace-relative paths (e.g.
src/index.ts) instead of showing "No files in workspace". - The Windows listing returns the same file set as the macOS/Linux listing for the same workspace:
.git,node_modules,.venv,venv,__pycache__,dist,build,.next,.cache,.pytest_cache,.mypy_cache,.turbo,.parcel-cache, andtargetare excluded, and results are capped at 2000 files. - Paths returned on Windows are normalized for display the same way as the current path handling (forward slashes, no leading
./, no absolute drive/workspace prefix), so the tree and file selection work unchanged. - macOS and Linux local backends are unaffected: the Files tab still lists the same files with the same exclusions and cap.
- A workspace that genuinely contains no files still shows the empty state rather than an error.
- An automated test in the existing
__tests__/hooks/query/use-workspace-files.test.tsxcovers the Windows local listing path and asserts the resulting file list, mocking the underlying runtime/transport service rather than the hook. - The PR includes Windows evidence: a screenshot or video showing the Files tab populated on the PR branch (with the bug replicated on main), per the bug template's
ready-for-devevidence requirement.
Source: OpenHands/OpenHands