fix(files): fail files.open for a missing path instead of opening a ghost tab#8850
fix(files): fail files.open for a missing path instead of opening a ghost tab#8850xianjianlf2 wants to merge 1 commit into
files.open for a missing path instead of opening a ghost tab#8850Conversation
…host tab `orca file open` returned ok:true / opened:true / exit 0 for a path that resolves to a non-existent file, creating a tab that only failed at render time with an ENOENT card. Callers that trust the exit code or JSON (agents driving the CLI) were misled into thinking the open succeeded (stablyai#8844). Stat the resolved path — via the SSH filesystem provider for remote worktrees, plain stat for local ones — before opening. Missing paths and directories now fail with a stable `file_not_found` code (added to the RPC passthrough allowlist) and no tab is created. Transport or permission failures still propagate as errors rather than reading as "file missing", and `file open-changed` is unaffected because it already skips deleted entries before calling files.open. Fixes stablyai#8844 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthrough
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thanks for the early fix and for adding a stable Merged #9006 instead: same fail-before-tab outcome for local and SSH missing paths, reuses Closing as a duplicate for #8844. Appreciate the solid first cut. |
Summary
Fixes #8844.
orca file open <path>reportedok: true/opened: truewith exit code 0 even when the resolved file does not exist. A ghost editor tab was created, and the failure only surfaced later inside the editor as anfs:readFile … ENOENTcard. Agents driving the CLI treated the result as success.Fix
openMobileFile(thefiles.openhandler) now stats the resolved path before opening:staton the joined path.provider.stat), mirroring howfiles.resolveTerminalPathalready probes existence remotely.file_not_founderror code (added to the RPC passthrough allowlist), a nonzero exit, and no tab.file open-changedis unaffected: it already skipsdeletedentries before callingfiles.open.Testing
file_not_found+ no open; directory target →file_not_found; SSH remote not-found →file_not_found; existing open tests updated to stat a real file.vitest run src/main/runtime/orca-runtime-files.test.ts src/main/runtime/rpc/methods/files.test.ts src/cli/handlers/file.test.ts— 121 tests pass.npm run typecheck— no new findings.🤖 Generated with Claude Code