Skip to content

fix(runtime): fail orca file open for missing paths (#8844)#9006

Merged
nwparker merged 1 commit into
mainfrom
nwparker/fix-8844-file-open-exists
Jul 17, 2026
Merged

fix(runtime): fail orca file open for missing paths (#8844)#9006
nwparker merged 1 commit into
mainfrom
nwparker/fix-8844-file-open-exists

Conversation

@nwparker

Copy link
Copy Markdown
Contributor

Description

orca file open <missing-path> was reporting ok: true / opened: true and creating a ghost editor tab because RuntimeFileCommands.openMobileFile only 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 host openFile / returning success. Missing paths throw, so the RPC returns ok: false with a nonzero CLI exit and no tab is created. Existing files still open as before.

Fixes #8844.

Evidence

  • Unit tests in src/main/runtime/orca-runtime-files.test.ts:
    • existing local text/image open paths still call openFile and return opened: true (with successful stat mocks)
    • missing local path rejects with ENOENT: no such file or directory, open '…' and never calls openFile
    • missing remote (SSH) path rejects the same way and never calls openFile
    • non-previewable binaries still short-circuit with opened: false without statting
  • npx vitest run src/main/runtime/orca-runtime-files.test.ts — 71 passed
  • npx vitest run src/main/runtime/rpc/methods/files.test.ts — 40 passed
  • Did not run live orca file open on 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.openDiff is intentionally untouched (deleted/changed files can still be viewed as diffs).

Screenshots

No visual change (CLI/RPC error path only).

Testing

  • Added unit tests for missing local/remote open targets
  • npx vitest run src/main/runtime/orca-runtime-files.test.ts
  • npx vitest run src/main/runtime/rpc/methods/files.test.ts
  • Full pnpm lint / pnpm typecheck / pnpm test / pnpm build not run in this focused fix (pre-commit oxlint + oxfmt passed on touched files)

AI Review Report

Self-reviewed for:

  • Cross-platform path joining via existing joinWorktreeRelativePath
  • Local vs SSH existence checks reusing the same stat helpers as terminal path resolution
  • Not creating tabs on failure (openFile only after successful existence assert)
  • No hard-coded Meta/Ctrl shortcuts or platform-specific UI labels (N/A)

Security Audit

  • Existence check goes through resolveAuthorizedPath for local paths (same authorization boundary as other runtime file IO).
  • Remote path uses the existing SSH filesystem provider bound to the worktree’s connectionId.
  • No new command execution, secrets handling, or IPC surface; only an extra pre-open stat on an already-resolved worktree-relative path.

Notes

  • Error surfaces as runtime_error with message ENOENT: no such file or directory, open '<abs-path>' (matches existing plain-Errorruntime_error mapping; not added to the passthrough code allowlist).
  • SSH use case covered via remote not-found message matching used elsewhere in this module.

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.
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 28913b2b-6439-49c4-978f-915bdd92b476

📥 Commits

Reviewing files that changed from the base of the PR and between cf02cc4 and 3eee626.

📒 Files selected for processing (2)
  • src/main/runtime/orca-runtime-files.test.ts
  • src/main/runtime/orca-runtime-files.ts

📝 Walkthrough

Walkthrough

openMobileFile now checks that resolved local or remote targets exist before calling the renderer host. Local checks use authorized-path resolution and stat; remote checks use statRemoteTerminalPath. Missing targets produce normalized ENOENT errors, while other errors propagate. Tests cover text files, previewable images, non-previewable binaries, and missing local or remote files.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: failing file open on missing paths.
Description check ✅ Passed All required sections are present and the PR describes the change, testing, security, and notes.
Linked Issues check ✅ Passed The implementation matches #8844 by checking existence first and failing missing opens without creating tabs.
Out of Scope Changes check ✅ Passed The changes stay focused on runtime file-open validation and tests, with no clear unrelated additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker

Copy link
Copy Markdown
Contributor Author

Agent handoff

Fixes: #8844

Reproduce (before / regression after merge)

Branch with kits: nwparker/bug-repro-handoffs

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 PR

Already includes Description / Evidence / ELI5 / User-regression-tradeoffs in the body. Review that section first; re-run the issue's repro-* test after pulling this branch to confirm the fix.

@nwparker
nwparker merged commit 655f846 into main Jul 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: orca file open reports ok:true / exit 0 for a path that resolves to a non-existent file (creates a ghost tab)

1 participant