Skip to content

fix(cli): orca file open opens PDFs and other binaries like the File Explorer - #24445

Merged
AmethystLiang merged 4 commits into
mainfrom
jinjing/sta-9113-bug-orca-file-open-silently-skips-pdfs-kind-binary-opened
Oct 3, 2026
Merged

AmethystLiang merged 4 commits into
mainfrom
jinjing/sta-9113-bug-orca-file-open-silently-skips-pdfs-kind-binary-opened

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #24328

Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​96 $\color{#cf222e}{\Huge{\mathbf{−}}}$​14 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​82
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​24 $\color{#cf222e}{\Huge{\mathbf{−}}}$​17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​7

Problem

orca file open on PDFs and binary files would exit 0 and print "Opened..." even though the Orca app declined the file. Older versions return opened:false for binaries, but the CLI treated it as success and silently failed.

Solution

The CLI now fails with ok:false and exit code 1 when a file open returns opened:false. The mobile runtime was also updated to stop blocking binaries—now PDFs, ZIPs, and other binaries open through the desktop editor, matching the File Explorer.

What Changed

  • orca file open errors if the app declines a file instead of silently succeeding
  • Removed conditional success/failure messages; only the success path remains
  • Mobile runtime now opens all binaries (PDFs, ZIPs) through the desktop editor, not block-listed
  • Tests updated to verify failure on opened:false and that binaries now open successfully

Why

When a CLI command fails silently, users can't tell what went wrong. By failing loudly with a helpful error message, users know to update their Orca app, which now opens every file type the File Explorer does.

Testing

  • Tests verify opened:false causes exit code 1 and ok:false in JSON mode
  • Tests confirm PDFs and ZIPs now open successfully on mobile
  • Tests confirm missing files are rejected before opening a ghost tab

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • N/A: Before/after screenshots or videos—CLI-only fix, no UI changes
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

📝 Walkthrough

Walkthrough

Mobile binary files now pass through existence validation and are sent to the editor host. The CLI file open handler now reports a runtime response with opened: false as an error.

Priority: ⬇️ Low

Merge Risk: 🔵 Low · up to f675b

File diff can incorrectly say it opened an editor when it did not. Restore the declined-open message; this is a bounded reporting issue rather than a failure to return diff data.

Security Architecture Review

Security architecture risk: 🔵 Low · up to f675b

The change retains existing file-access checks and editor routing. No introduced security flaw was established, but end-to-end binary viewing, particularly for remote files, remains incompletely verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated exposure expansion is binary content entering the editor from caller-selected runtime file-open requests. The pre-dispatch path remains scoped to resolved worktree and filesystem routes; binary-specific parsing and remote loading exposure remain unverified.

Trust Boundaries and Controls

  • observed — Removing the binary decline does not remove the relative-path validation or route-specific authorized existence check. Those controls still precede the editor handoff.
  • observed — Although the runtime sends no environment hint, renderer ownership capture first uses explicit worktree routing and rejects ambiguous ownership. Later editor operation context checks provenance currency and requires an SSH connection generation. These controls counter a blanket claim that undefined environment identity automatically selects the wrong host.

Resilience and Maintainability Implications

  • observed — Existence-check failures propagate before editor dispatch. Tests assert that missing local and remote files do not call the editor host, containing the pre-dispatch ghost-tab failure without proving post-dispatch recovery.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely identifies the CLI change: opening PDFs and other binary files with orca file open.
Description check ✅ Passed The description explains the problem, changes, rationale, and tests. It links the issue and states that visual proof is not applicable. Some template sections, including ELI5 and Review, are omitted, …
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 50e71ce9-21d0-4b71-99b4-48adae643c93

📥 Commits

Reviewing files that changed from the base of the PR and between 9912042 and f675b2e.

📒 Files selected for processing (4)
  • src/cli/handlers/file.test.ts
  • src/cli/handlers/file.ts
  • src/main/runtime/orca-runtime-files-mobile-explorer-reads.test.ts
  • src/main/runtime/runtime-file-commands-constructor.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Comment thread src/cli/handlers/file.ts Resolved
@greptile-apps

greptile-apps Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Medium risk] Changes how the file open command handles binary files.

The PR should not merge until direct file diffs retain correct reporting when a host declines them.

Findings

  1. P1 Declined diffs report success ▶

Summary

The PR makes direct file open fail when a host declines a file and lets mobile binary opens reach the desktop editor.

  • It adds a JSON regression test for declined opens and tests PDF, ZIP, and missing-file behavior.
  • Direct file diff loses its declined-result formatting without gaining the new failure check.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
    A[CLI file command] --> B{Command}
    B -->|open| C{opened?}
    C -->|false| D[Error and exit 1]
    C -->|true| E[Report opened]
    B -->|diff| F[Report opened without checking result]
Loading

Reviews (1) · Last reviewed commit: "refactor(cli): remove requireOpened chec..."

Comment thread src/cli/handlers/file.ts Resolved

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one minor consistency question inline.

Reviewed changes

  • Binaries now open on the host: RuntimeFileCommands.openMobileFile drops the mobile-preview gate, so PDFs, ZIPs, and other binaries open in the desktop editor and return opened:true; kind becomes description-only.
  • orca file open fails loudly: the handler throws file_not_opened (exit 1, ok:false in --json) when an older host still declines the file, carrying an "update the app" next step.
  • Failure copy trimmed: formatFileOpen / formatFileDiff no longer render their "Did not open…" branches.
  • Tests: an unopened file open asserts ok:false + exit 1; PDF/ZIP opens and a missing-binary ENOENT rejection cover the runtime change.

The "like the File Explorer" parity claim holds by construction — both routes call store.openFile(mode:'edit'), and the editor renders PDFs via ImageViewer/PdfViewer and other binaries as "Binary file — cannot display". The host-side wire change is safe for old paired clients, which already handle both opened values.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

Comment thread src/cli/handlers/file.ts Resolved
AmethystLiang and others added 4 commits October 3, 2026 11:56
…Explorer (STA-9113)

files.open gated the desktop open on the mobile client's preview list, so
PDFs returned opened:false with ok:true. The host now always opens (after the
existence check); the CLI fails loudly if an older host still declines.

Co-Authored-By: Claude <[email protected]>
file diff returns data regardless of whether the file can be opened in the editor. The check is only necessary for file open, which is a direct user request to open a file.
Apply unopened-file validation to `file diff` command to prevent binaries
from silently succeeding, matching `file open` behavior. Reject directory
opens in mobile file operations. Extract common file-open validation.
@AmethystLiang
AmethystLiang force-pushed the jinjing/sta-9113-bug-orca-file-open-silently-skips-pdfs-kind-binary-opened branch from f675b2e to 72328f2 Compare October 3, 2026 18:56
@AmethystLiang
AmethystLiang merged commit c5d298a into main Oct 3, 2026
16 of 27 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 silently skips PDFs (kind: binary, opened: false) although the UI opens them in the PDF viewer

1 participant