fix(server): don't forward host directory to remote workspace - #40136
Open
jamesmurdza wants to merge 1 commit into
Open
fix(server): don't forward host directory to remote workspace#40136jamesmurdza wants to merge 1 commit into
jamesmurdza wants to merge 1 commit into
Conversation
When proxying a request to a remote workspace, workspaceProxyURL kept the `directory` query param — the *host's* working directory (e.g. a Windows path `F:\proj`). The Linux sandbox then `path.resolve`d it against its own cwd, yielding a bogus dir like `/home/daytona/workspace/repo/F:\proj` that doesn't exist. Sessions were created against that path, and the first prompt crashed in SystemPrompt.environment (realPath -> ENOENT), which the prompt handler converts to a defect -> opaque 500 -> 'Failed to send prompt' toast. Strip the `directory` param when forwarding so the remote falls back to its own project root, mirroring ProxyUtil.headers already stripping the `x-opencode-directory` header. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
jamesmurdza
added a commit
to jamesmurdza/integrations
that referenced
this pull request
Aug 2, 2026
… symlink Reference opencode PR anomalyco/opencode#40136, which strips the host `directory` query param before proxying to the remote — the upstream fix for the bug the worktree->REPO_PATH symlink works around. Once it ships in a release and OPENCODE_VERSION is bumped to include it, the symlink can be removed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Related to #36902
Type of change
What does this PR do?
When a request is proxied to a remote workspace,
workspaceProxyURLcopied the whole query string and only deletedworkspace. That left thedirectoryparam in place — butdirectoryis the host's cwd. From a Windows host it's a path likeF:\proj, which is meaningless on the remote Linux sandbox.On the remote, that value flows into
defaultDirectory()and getspath.resolved against the sandbox cwd, producing something like/home/daytona/workspace/repo/F:\proj. The session is created against thatnon-existent dir, and the first prompt blows up in
SystemPrompt.environment(realPath-> ENOENT). The prompt handler turns that into a defect -> opaque 500, which the TUI shows as a bare "Failed to send prompt" toast.The fix is one line: strip
directorybefore forwarding, so the remote falls back to its own project root. This mirrors whatProxyUtil.headersalready does for thex-opencode-directoryheader — the query param was just the one path that slipped through.How did you verify your code works?
workspace-routing.test.tsassertingdirectoryis dropped (and an unrelated param likekeepis preserved) byworkspaceProxyURL.Screenshots / recordings
N/A — not a UI change.
Checklist