Repository navigation
fix: read a remote session's @fix_plan.md on its host, refuse remote Ralph writes - #728
Conversation
…Ralph writes A remote-SSH session's workingDir is a path on the remote host, but the Ralph file routes used local fs on it: fix-plan/read imported a same-named LOCAL @fix_plan.md (or 404'd), and fix-plan/write and ralph-prompt/write wrote their files into the local twin of the remote folder. Same root cause as the Ralph @fix_plan.md watcher fix. - fix-plan/read reads the file on the remote host through src/remote-files.ts (the File Viewer's ssh path): one probe of the file and the workspace, the File Viewer's confinement (a file resolving outside the workspace is treated as missing), then a capped read (1 MB). A missing remote file is the same NOT_FOUND as a missing local one; a non-file, an oversized file or an unreachable host is a failed read, never a local fallback. - fix-plan/write and ralph-prompt/write refuse a remote session (INVALID_INPUT): remote writes are out of scope by design, as for the File Viewer's remote edit. The Ralph panel already shows the error.
|
Thank you, @timkjr, for following up #722 with this. It makes the Ralph file routes treat a remote (SSH) session's working directory as a path on the remote host: The change is correct and lines up with the existing remote-file rules: the host comes from the session, the probe resolves both the file and the workspace remotely and fails closed, the cap applies to the remote size, and there is no local fallback. The local twin in the test is a good way to prove that, and I confirmed the remote cases fail against master and pass here. Typecheck, lint, format and the route tests are all green. A few small things I will take care of at merge time, so there is nothing you need to push:
The watcher half of this bug is #722, which is still open; this PR stands on its own and does not need it to merge. This merges as it stands, with the three items above applied on top. Thanks again for tracking both halves down. |
Export isPathWithinRoot from file-routes.ts and use it for the remote @fix_plan.md confinement, so the two checks cannot drift; rewrap the readRemoteFixPlan JSDoc and say NOT_FOUND; list fix-plan/read and the two write refusals in docs/remote-sessions.md and architecture-invariants. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… its host, refuse remote Ralph writes
|
Merged in 1.47.0 (https://github.com/Ark0N/Codeman/releases/tag/codeman%401.47.0). Thank you, this closes the remote half of the Ralph file routes. At merge I applied the three items from the review (79a7f49): |
What
Follow-up to #722, same root cause. The Ralph file routes in
ralph-routes.tsuse localfson a remote-SSH session'sworkingDir, which is a path on the remote host:POST .../fix-plan/readimports a same-named local@fix_plan.md, or answers 404 when there is none;POST .../fix-plan/writeandPOST .../ralph-prompt/writewrite@fix_plan.mdand@ralph_prompt.mdinto a local folder with the remote path, or fail when there is none.Fix
fix-plan/readreads the file on the remote host throughsrc/remote-files.ts, the same ssh path the File Viewer uses. The steps are:@fix_plan.mdand the workspace root.NOT_FOUNDas a missing local one. A non-file, an oversized file or an unreachable host is a failed read (OPERATION_FAILED, with theRemoteFileAccessErrormessage). There is never a local fallback.fix-plan/writeandralph-prompt/writerefuse a remote session withINVALID_INPUT. Remote writes are out of scope by design:remote-files.tsis read-only, and the File Viewer refuses a remote edit for the same reason. The Ralph panel already shows the error text.ralph-prompt/writehas no caller in the UI, but it has the same issue, so it gets the same refusal.Depends on #722
#722 stops the
@fix_plan.mdwatcher from watching the local copy of a remote session's folder. Without it, the watcher can still auto-import the local file after this route has read the remote one correctly.Tests
test/routes/ralph-routes-remote.test.tsmocks the ssh layer and keeps the pure builders andRemoteFileAccessErrorreal. The workspace path also exists locally, holding a different@fix_plan.md, so any fallback to localfswould import or overwrite the wrong file. It covers:NOT_FOUND, and a file resolving outside the workspace is treated as missing. A directory, a special file, an oversized file and an unreachable host are each a failed read with nothing imported, and the error text omits the internal error-class name.On master the six remote cases fail and the two local ones pass.
🤖 Generated with Claude Code