Repository navigation
fix(diff): show an agent's edit on an ssh workspace instead of "Invalid path" - #476
Merged
amirlehmam merged 2 commits intoNov 25, 2026
Merged
Conversation
…ead of Invalid path An agent's edit hook reports the file as an absolute path on its host, and the Diff tab asks for exactly that on the next refresh. On an ssh workspace the remote diff only took a relative path, so every edit ended in 'Invalid path'. A path below the target's checkout is now taken as the relative one; anything outside it, or not canonical after the prefix is cut, is still refused. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…s raw path The hook reports the file by an absolute path in the agent's own file system. For a devbox session that is the container's mount (/workspaces/<repo>), not the checkout path of the ssh target on the host, so stripping the target path (the previous commit) cannot always work. The Diff tab now picks the changed file the hook path ends with from the list git printed, and leaves the selection alone when none matches. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Fixes
Invalid pathin the Diff tab of an ssh workspace after an agent edits a file.Cause
The agent's edit hook reports the file it wrote as an absolute path in the agent's own file system (
tool_input.file_path). The Diff tab selected that path and asked for it. An ssh workspace only takes a path relative to the checkout (remoteFileDiff→canonicalRemoteRelPath), so every edit ended inInvalid path.The two roots need not even be the same directory: a devbox session edits
/workspaces/<repo>/...inside its container, while the ssh target's path is the checkout on the devbox host.Fix
diff-hook-file.ts(pickHookFile): the Diff tab now selects the changed file whose relative path the hook path ends with (at a path segment,\read as a separator, longest match wins, folder entries never match), taken from the list git printed. It never asks for the hook's own path, so the checkout jail is unchanged, and a file the list lacks leaves the selection alone.ssh-diff.ts(relativeToCheckout): an absolute path undertarget.pathis also taken as the relative one, so the remote handler accepts it directly. The result still goes throughcanonicalRemoteRelPath, so<root>/../x,<root>-evil/xand paths outside the checkout stay refused. This is a second line of defence: the Diff tab no longer sends such a path.Verification
pickHookFileandrelativeToCheckout, and a component test that mountsDiffPane, fires an edit event with a container path and checks the file asked for. The component test and thessh-difftests fail without their change.tscandeslintclean; the related Diff and ssh suites pass; merges cleanly ontomasteratd1eda84.Confirmed
Checked in a live ssh workspace (devbox session) on Windows from this branch: after the agent edits a file, the Diff tab shows that file's diff and no longer shows
Invalid path.🤖 Generated with Claude Code