fix(runtime): fail orca file open for missing paths (#8844)#9006
Conversation
Stat the resolved local/SSH path in openMobileFile before creating an editor tab so `orca file open` returns ok:false for ENOENT instead of a ghost tab. Fixes #8844.
|
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 (2)
📝 WalkthroughWalkthrough
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
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 |
Agent handoffFixes: #8844 Reproduce (before / regression after merge)Branch with kits: Full issue kit (summary + re-run + file links): see the Agent handoff — reproduction kit comment on #8844. Writeup: https://github.com/stablyai/orca/blob/nwparker/bug-repro-handoffs/docs/bug-reproductions/8844.md This PRAlready includes Description / Evidence / ELI5 / User-regression-tradeoffs in the body. Review that section first; re-run the issue's |
Description
orca file open <missing-path>was reportingok: true/opened: trueand creating a ghost editor tab becauseRuntimeFileCommands.openMobileFileonly classified by extension and never checked that the resolved path exists.This change stats the resolved absolute path (local via authorized path +
stat, SSH via remote filesystem provider) before calling the hostopenFile/ returning success. Missing paths throw, so the RPC returnsok: falsewith a nonzero CLI exit and no tab is created. Existing files still open as before.Fixes #8844.
Evidence
src/main/runtime/orca-runtime-files.test.ts:openFileand returnopened: true(with successful stat mocks)ENOENT: no such file or directory, open '…'and never callsopenFileopenFileopened: falsewithout stattingnpx vitest run src/main/runtime/orca-runtime-files.test.ts— 71 passednpx vitest run src/main/runtime/rpc/methods/files.test.ts— 40 passedorca file openon missing paths (avoids ghost tabs in the user’s UI during development)ELI5
When you ask Orca to open a file that isn’t there, it used to smile and open an empty broken tab anyway. Now it checks “does this file actually exist?” first. If no, it says “nope” right away and doesn’t open a tab.
User-regression-tradeoffs
Ideally zero: only changes false-success on missing paths to true-failure. Existing files keep the same success path. Binary “not openable on mobile” behavior is unchanged.
files.openDiffis intentionally untouched (deleted/changed files can still be viewed as diffs).Screenshots
No visual change (CLI/RPC error path only).
Testing
npx vitest run src/main/runtime/orca-runtime-files.test.tsnpx vitest run src/main/runtime/rpc/methods/files.test.tspnpm lint/pnpm typecheck/pnpm test/pnpm buildnot run in this focused fix (pre-commit oxlint + oxfmt passed on touched files)AI Review Report
Self-reviewed for:
joinWorktreeRelativePathopenFileonly after successful existence assert)Security Audit
resolveAuthorizedPathfor local paths (same authorization boundary as other runtime file IO).connectionId.Notes
runtime_errorwith messageENOENT: no such file or directory, open '<abs-path>'(matches existing plain-Error→runtime_errormapping; not added to the passthrough code allowlist).