Skip to content

fix(runtime): make sibling-workspace terminal-path resolution an explicit client opt-in - #12616

Merged
Jinwoo-H merged 1 commit into
mainfrom
fix/resolve-terminal-path-client-gate
Aug 5, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
fix/resolve-terminal-path-client-gate

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Problem

files.resolveTerminalPath (new in the 1.4.169 cycle) returns a foreign worktree id + relativePath when a tapped absolute path belongs to a sibling workspace — with no protocol bump or capability gate. src/shared/protocol-version.ts's own rules say a response-nullability/meaning change like this requires one.

Fielded mobile 0.0.36 ignores resolved.worktree and reuses its own worktree id for the follow-up files.open, so with two worktrees of the same repo sharing a relative path, tapping the sibling's absolute path opens the wrong worktree's copy in the desktop editor. On 1.4.168 the same tap was a safe no-op. Found by the v1.4.169-rc.0 release scan; proven end-to-end with a runtime test (foreign id returned ungated for any clientId; 0.0.36 flow then opens its own worktree).

Fix

New optional crossWorkspace request field on files.resolveTerminalPath; the sibling-workspace lookup only runs when the client opts in. The mobile tap flow (the one production caller that honors resolved.worktree) now sends it; the artifact-grant refresh intentionally does not (it only consumes grant resolutions).

Compat matrix — every pairing is safe:

  • new desktop + old mobile (0.0.36): flag absent → legacy contract (relativePath: null, caller worktree) → safe no-op
  • old desktop + new mobile: zod strips the unknown field → legacy behavior
  • new + new: sibling-workspace resolution works as designed

Optional-field addition ⇒ no RUNTIME_PROTOCOL_VERSION bump (per the rules in protocol-version.ts).

Tests

  • New legacy-contract test: without the flag, resolveKnownWorkspaceFileTarget is never called and the response keeps the caller worktree + null relativePath. Mutation-checked: removing the gate fails this test.
  • Existing sibling-workspace tests updated to opt in; RPC forwarding pinned both ways (absent → false, true → true).
  • Terminal-path RPC tests moved to files-terminal-path-resolution.test.ts — files.test.ts is at the max-lines cap and per AGENTS.md that cap must not be bumped.
  • 128 server + 23 mobile tests green; tsc (node project), oxlint, oxfmt clean.

Release note

Cherry-pick candidate for the 1.4.169 release line (protects users during desktop↔mobile version skew); tracked in the v1.4.169-rc.0 release-scan tracker.

…icit client opt-in

files.resolveTerminalPath began returning a foreign worktree id + relativePath
for absolute paths owned by a sibling workspace, with no protocol or capability
gate. Mobile 0.0.36 in the field ignores resolved.worktree and reuses its own
worktree id for the follow-up files.open, so a tap on a sibling-worktree path
opened the WRONG worktree's copy of that file (on 1.4.168 the tap was a safe
no-op).

Gate the sibling-workspace lookup behind a new optional crossWorkspace request
field: clients that honor resolved.worktree opt in; everything else keeps the
pre-sibling-resolution contract. Old servers strip the unknown field (zod), so
every version pairing degrades to the safe legacy behavior. Optional-field
addition, so no RUNTIME_PROTOCOL_VERSION bump per protocol-version.ts rules.

The terminal-path RPC tests move to files-terminal-path-resolution.test.ts
because files.test.ts sits at the max-lines cap.
@Jinwoo-H
Jinwoo-H merged commit 5ed4573 into main Aug 5, 2026
42 checks passed
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 29f83f7e-db9a-4f02-905a-af4591b85846

📥 Commits

Reviewing files that changed from the base of the PR and between 39c3c58 and 819183a.

📒 Files selected for processing (9)
  • mobile/src/session/mobile-file-tap-open.test.ts
  • mobile/src/session/mobile-file-tap-open.ts
  • mobile/src/session/mobile-native-chat-open-file.test.ts
  • mobile/src/session/use-mobile-file-tap-handlers.test.ts
  • src/main/runtime/orca-runtime-files.test.ts
  • src/main/runtime/orca-runtime-files.ts
  • src/main/runtime/rpc/methods/files-terminal-path-resolution.test.ts
  • src/main/runtime/rpc/methods/files.test.ts
  • src/main/runtime/rpc/methods/files.ts

📝 Walkthrough

Walkthrough

Terminal path resolution now accepts an optional crossWorkspace flag. The RPC method normalizes and forwards this flag to the runtime. Sibling-workspace lookup occurs only when the flag is enabled. Mobile terminal and chat file requests opt in with crossWorkspace: true. Tests cover RPC forwarding, local and SSH workspace resolution, host scoping, and legacy behavior.

✨ 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.

enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…icit client opt-in (stablyai#12616)

files.resolveTerminalPath began returning a foreign worktree id + relativePath
for absolute paths owned by a sibling workspace, with no protocol or capability
gate. Mobile 0.0.36 in the field ignores resolved.worktree and reuses its own
worktree id for the follow-up files.open, so a tap on a sibling-worktree path
opened the WRONG worktree's copy of that file (on 1.4.168 the tap was a safe
no-op).

Gate the sibling-workspace lookup behind a new optional crossWorkspace request
field: clients that honor resolved.worktree opt in; everything else keeps the
pre-sibling-resolution contract. Old servers strip the unknown field (zod), so
every version pairing degrades to the safe legacy behavior. Optional-field
addition, so no RUNTIME_PROTOCOL_VERSION bump per protocol-version.ts rules.

The terminal-path RPC tests move to files-terminal-path-resolution.test.ts
because files.test.ts sits at the max-lines cap.

Co-authored-by: OrcaWin <[email protected]>
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.

2 participants