Repository navigation
fix(runtime): resolve session tab workspace path aliases - #29543
Merged
Merged
Conversation
An explicit worktree ID that differs from the host's stored spelling only by Windows path separators (or another worktreeIdsEqual-equivalent form) returned an empty session tab snapshot, hiding a workspace's existing tabs from paired clients. Resolve explicit session selectors against the IDs the host already knows (published snapshots, saved session tabs, surviving renderer-owned PTYs) with the shared worktreeIdsEqual comparison, keep the host's stored spelling, reject ambiguous aliases, and refuse alias adoption across execution hosts. Session-tab subscriptions match and clean up by the normalized key. Fixes #27260 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nder local owners Addresses Codex review of the #27264 alias resolver.
7 of 9 tasks
7 of 8 tasks
Merged
9 tasks done
Closed
7 of 9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
On a Windows host, the same workspace folder can be spelled
G:\git\exampleorG:/git/example. The host saves its tabs under one spelling. When a paired client (phone, web, or another desktop) asked for that workspace's tabs using the other spelling, the host answered "no tabs", even though the tabs and their processes were still running.What Changed
Before: asking for a workspace's tabs by explicit id only matched the exact characters, so a separator-only difference returned an empty tab list (11 tabs vs. 0 in the report).
After: when the requested id has no exact match, the host looks for one already-known id (published tab snapshots, saved session tabs, live PTYs) that is the same workspace under the shared
worktreeIdsEqualcomparison, and answers with the host's own stored spelling. Tab list, activate, close, move, rename, create-and-select, subscribe/unsubscribe and terminal listing all go through this one resolver (getExplicitSessionWorktreeIdSelector).Guard rails:
selector_ambiguousinstead of guessing.worktree_execution_host_unresolved, so an alias can never adopt a foreign terminal.This is the contributor fix from #27264 by @SimonSQLML (commit cherry-picked with authorship intact), rebased onto current main, plus one follow-up commit from review: keep exact live-PTY spellings and reject unattributed remote PTYs under a local owner.
Why
The host already has the correct comparison (
worktreeIdsEqual, used bypath:selectors); the explicit-id fast path just skipped it. Resolving to the host's stored spelling, rather than renaming stored sessions, keeps live processes and saved state untouched and needs no Git/SSH scan during polling. Normalizing ids on clients was rejected because clients and hosts update independently: an older client would still send the old spelling.Wire compatibility: no RPC param or stream frame changes. The only visible difference to older clients is that a reply may name the host's spelling instead of the alias they sent; mobile already reuses the returned id for follow-up calls.
Linked Issue
Fixes #27260
Visual Proof
N/A: host-side id resolution with no UI change. The issue includes the contributor's before/after screenshots from a controlled Windows-host reproduction.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
src/main/runtime/orca-runtime-session-tabs-path-alias.test.ts(new) fails on main and passes here: both slash directions, activation without a second process, early subscribers, ambiguity, cross-host refusal (SSH, runtime, unattributed remote), folder instances, POSIX case.The session-tabs subscribe/unsubscribe suites were updated for the comparison-key cleanup prefix.
The 3 suites (80 tests) also pass natively on a Windows 11 host under Node.
pnpm tc:nodeandpnpm run check:code-quality:changedpass.AI Disclosure
Review
Codex review (gpt-6.1-sol, high): round 1 raised two P2s, both fixed in the follow-up commit with regression tests. Round 2 raised one P2, which was dismissed: if a host has separately stored snapshots under two spellings of the same folder, a legacy unsubscribe that sends no
subscriptionIdon that connection ends both streams. Both spellings name the same directory, and the client resubscribes. Fixing it would need cross-spelling subscription bookkeeping for a state the alias resolver already treats as ambiguous.Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)