Repository navigation
fix(terminals): park a remote pty only for the worktree that owns it - #13253
kunsanglee wants to merge 13 commits into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughTerminal parking now resolves worktree ownership for local, SSH, and runtime terminals. Shared PTY restoration checks validate owner authority, runtime capabilities, SSH connections, and pane identity. Cold-parking candidates, retention checks, activation, and parked-tab watchers pass ownership into these checks. Web-session authority state now supports exact pane validation, scoped revisions, cleanup, and parking recalculation. Tests cover matching and foreign owners, missing ownership, connection and environment mismatches, authority changes, and retention behavior. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: add32eb1-3450-4ac0-8cba-55930b7f75bd
📥 Commits
Reviewing files that changed from the base of the PR and between 6da7b8e and d3795242a853df38770b7d6fbb9ead1bbffd1c90.
📒 Files selected for processing (16)
src/renderer/src/components/Terminal.tsxsrc/renderer/src/components/terminal-pane/manual-terminal-worktree-park-eligibility.tssrc/renderer/src/components/terminal-pane/terminal-cold-park-verdict-loop.test.tsxsrc/renderer/src/components/terminal-pane/terminal-hidden-view-parking.test.tssrc/renderer/src/components/terminal-pane/terminal-hidden-view-parking.tssrc/renderer/src/components/terminal-pane/terminal-hidden-worktree-retention.tssrc/renderer/src/components/terminal-pane/terminal-park-pty-restore-eligibility.tssrc/renderer/src/components/terminal-pane/terminal-park-worktree-owner.tssrc/renderer/src/components/terminal-pane/terminal-parked-pty-watcher.tssrc/renderer/src/components/terminal-pane/terminal-parked-tab-watchers.test.tssrc/renderer/src/components/terminal-pane/terminal-parked-tab-watchers.tssrc/renderer/src/components/terminal-pane/terminal-parked-watcher-partial-reconciliation.test.tssrc/renderer/src/components/terminal-pane/use-terminal-tab-cold-parking.test.tssrc/renderer/src/components/terminal-pane/use-terminal-tab-cold-parking.tssrc/renderer/src/components/terminal/background-terminal-worktree-mount.test.tssrc/renderer/src/lib/connection-owner-resolution.ts
`isParkRestorableTerminalPty` took a worktreeId and ignored it on both remote branches. The paired branch asked only whether the pty's environment advertises bounded restore; the SSH branch asked only whether SSH parking is on and the id parses. A worktree could therefore park — and later reveal — a remote session whose id names a connection or environment that is demonstrably not its own. The guard now compares the owner embedded in the pty id against the pair the spawn path resolves for the worktree: `getConnectionIdFromState` for the connection and `getRuntimeEnvironmentIdForWorktree` for the runtime environment. It rejects only on a proven mismatch. An owner the resolver leaves unproven (`undefined` before the repo hydrates, `null` for a local or ambiguous worktree) does not reject, because the predicate also gates `canWatcherCoverParkedTerminalTab`: a worktree it refuses becomes retention-budget force-park material, so the pane is torn down anyway with no watcher attached and its bells, titles, and agent-completion notifications go silent. A missed comparison costs less than that. This does not catch a relay reusing `pty-1` after a restart. That collision is between two worktrees on the same connection, which share a connection id, so no owner comparison can separate them. What it does catch is a pty positively known to belong to another connection or environment. Why the transport owner and not the resolved execution host: a worktree reached through a paired HUB deliberately keeps its `ssh:` host while the HUB owns its ptys, and a mirrored web-surface pane inside a local repo has a remote-runtime pty with no remote host at all. Comparing the execution host refuses both. - The per-pty predicate moves to `terminal-park-pty-restore-eligibility`; the original module was one line under its max-lines limit and owns the timing policy, which is a separate concern from the ownership question. - `terminal-park-worktree-owner` resolves the owner pair from store state, plus a memoized hook for the two React call sites, so no caller assembles the pair by hand and the predicate module stays free of the store. - The owner is a required argument. Required, not optional: an optional one lets a future caller drop the guard with no signal. The many-worktree pass in Terminal carries it per candidate rather than per policy, since the policy is shared across worktrees and the owner is not. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Mu6j33LNsd4Mvv8a1NuFoo
d379524 to
063fe20
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/renderer/src/components/terminal-pane/terminal-park-owner-oracle.test.ts (1)
20-46: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove the
ascasts so the oracle type-checks against the production contract. Both sites re-declare a shape locally and cast to reach the imported type. Each cast breaks the compile-time link between this oracle and theterminal-park-pty-restore-eligibilitycontract it exists to pin, so a field rename would keep compiling and flip an assertion silently instead of failing the build.
src/renderer/src/components/terminal-pane/terminal-park-owner-oracle.test.ts#L20-L46: deleteoracleOwnerand the legacy{connectionId, runtimeEnvironmentId}bag, then annotate the five constants directly asTerminalParkWorktreeOwner. Production reads onlykind,connectionIdon the ssh variant, andenvironmentIdon the runtime variant, so no assertion changes.src/renderer/src/components/terminal-pane/terminal-park-owner-oracle.test.ts#L156-L161: delete theownerAwareExemptionalias and callisEvictionExemptTerminalPtydirectly at line 166. The production signature already acceptspaneIdentityas{tabId: string; leafId: string | null}, and the call passes a concrete string, so the narrowing alias adds nothing.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 6dc3df46-90bd-4169-b522-6c8345769500
📒 Files selected for processing (29)
config/reliability-gates.jsoncsrc/renderer/src/components/Terminal.tsxsrc/renderer/src/components/terminal-pane/manual-terminal-worktree-park-eligibility.tssrc/renderer/src/components/terminal-pane/terminal-cold-park-verdict-loop.test.tsxsrc/renderer/src/components/terminal-pane/terminal-eviction-exempt-tabs.test.tssrc/renderer/src/components/terminal-pane/terminal-eviction-exempt-tabs.tssrc/renderer/src/components/terminal-pane/terminal-hidden-view-parking.test.tssrc/renderer/src/components/terminal-pane/terminal-hidden-view-parking.tssrc/renderer/src/components/terminal-pane/terminal-hidden-worktree-retention.test.tssrc/renderer/src/components/terminal-pane/terminal-hidden-worktree-retention.tssrc/renderer/src/components/terminal-pane/terminal-park-authority-dependencies.test.tssrc/renderer/src/components/terminal-pane/terminal-park-authority-revision.tssrc/renderer/src/components/terminal-pane/terminal-park-owner-oracle.test.tssrc/renderer/src/components/terminal-pane/terminal-park-pty-restore-eligibility.tssrc/renderer/src/components/terminal-pane/terminal-park-worktree-owner.test.tsxsrc/renderer/src/components/terminal-pane/terminal-park-worktree-owner.tssrc/renderer/src/components/terminal-pane/terminal-parked-pty-watcher.tssrc/renderer/src/components/terminal-pane/terminal-parked-tab-watchers.test.tssrc/renderer/src/components/terminal-pane/terminal-parked-tab-watchers.tssrc/renderer/src/components/terminal-pane/terminal-parked-watcher-partial-reconciliation.test.tssrc/renderer/src/components/terminal-pane/terminal-rendered-parked-tab-ids.tssrc/renderer/src/components/terminal-pane/use-terminal-force-park-exempt-tabs.tssrc/renderer/src/components/terminal-pane/use-terminal-tab-cold-parking.test.tssrc/renderer/src/components/terminal-pane/use-terminal-tab-cold-parking.tssrc/renderer/src/components/terminal/background-terminal-worktree-mount.test.tssrc/renderer/src/lib/connection-owner-resolution.tssrc/renderer/src/runtime/web-session-tabs-sync.tssrc/renderer/src/runtime/web-session-terminal-park-authority.test.tssrc/renderer/src/runtime/web-session-terminal-park-authority.ts
🚧 Files skipped from review as they are similar to previous changes (9)
- src/renderer/src/components/terminal-pane/manual-terminal-worktree-park-eligibility.ts
- src/renderer/src/components/terminal/background-terminal-worktree-mount.test.ts
- src/renderer/src/components/terminal-pane/terminal-cold-park-verdict-loop.test.tsx
- src/renderer/src/lib/connection-owner-resolution.ts
- src/renderer/src/components/terminal-pane/terminal-parked-watcher-partial-reconciliation.test.ts
- src/renderer/src/components/terminal-pane/terminal-parked-pty-watcher.ts
- src/renderer/src/components/terminal-pane/terminal-hidden-view-parking.test.ts
- src/renderer/src/components/terminal-pane/terminal-parked-tab-watchers.ts
- src/renderer/src/components/terminal-pane/terminal-hidden-view-parking.ts
The same testFiles array listed use-terminal-tab-cold-parking.test.ts twice. Manifest check passes for all 74 gates. Addresses the CodeRabbit note on config/reliability-gates.jsonc.
One conflicting file, src/renderer/src/runtime/web-session-tabs-sync.ts, four hunks. Both sides add to the same lifecycle points and none of them interact: this branch tracks per-worktree terminal park authority, main added a window-visibility parking subscription and an index over the host tab-id map. Resolutions: - imports: both blocks kept. - accepted snapshot: main's trackWebSessionTabsWorktree and recordAcceptedWebSessionTabsEnvironment, then this branch's replaceWebSessionTerminalParkAuthority. Independent maps, no ordering dependency. - test reset: both reset calls kept. - clearWebSessionTabsTrackingForWorktree: main's clearHostSessionTabIdMappings replaces this branch's inline prefix loop over hostSessionTabIdByLocalKey. The helper drains the same map and also maintains the new per-worktree mapping-key index the loop knew nothing about, so the loop would have leaked it. This branch's clearWebSessionTerminalParkAuthorityForWorktree stays. Verified: src/renderer/src/runtime plus the four park suites, 78 files / 757 tests all passing. tsconfig.node, tsconfig.tc.cli, tsconfig.tc.web 0 errors. oxlint clean. max-lines ratchet OK. Reliability gate manifest passes for all 74 gates.
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 89742e9b-a966-4dcb-90dc-df0ce20ee5ac
📒 Files selected for processing (29)
config/reliability-gates.jsoncsrc/renderer/src/components/Terminal.tsxsrc/renderer/src/components/terminal-pane/manual-terminal-worktree-park-eligibility.tssrc/renderer/src/components/terminal-pane/terminal-cold-park-verdict-loop.test.tsxsrc/renderer/src/components/terminal-pane/terminal-eviction-exempt-tabs.test.tssrc/renderer/src/components/terminal-pane/terminal-eviction-exempt-tabs.tssrc/renderer/src/components/terminal-pane/terminal-hidden-view-parking.test.tssrc/renderer/src/components/terminal-pane/terminal-hidden-view-parking.tssrc/renderer/src/components/terminal-pane/terminal-hidden-worktree-retention.test.tssrc/renderer/src/components/terminal-pane/terminal-hidden-worktree-retention.tssrc/renderer/src/components/terminal-pane/terminal-park-authority-dependencies.test.tssrc/renderer/src/components/terminal-pane/terminal-park-authority-revision.tssrc/renderer/src/components/terminal-pane/terminal-park-owner-oracle.test.tssrc/renderer/src/components/terminal-pane/terminal-park-pty-restore-eligibility.tssrc/renderer/src/components/terminal-pane/terminal-park-worktree-owner.test.tsxsrc/renderer/src/components/terminal-pane/terminal-park-worktree-owner.tssrc/renderer/src/components/terminal-pane/terminal-parked-pty-watcher.tssrc/renderer/src/components/terminal-pane/terminal-parked-tab-watchers.test.tssrc/renderer/src/components/terminal-pane/terminal-parked-tab-watchers.tssrc/renderer/src/components/terminal-pane/terminal-parked-watcher-partial-reconciliation.test.tssrc/renderer/src/components/terminal-pane/terminal-rendered-parked-tab-ids.tssrc/renderer/src/components/terminal-pane/use-terminal-force-park-exempt-tabs.tssrc/renderer/src/components/terminal-pane/use-terminal-tab-cold-parking.test.tssrc/renderer/src/components/terminal-pane/use-terminal-tab-cold-parking.tssrc/renderer/src/components/terminal/background-terminal-worktree-mount.test.tssrc/renderer/src/lib/connection-owner-resolution.tssrc/renderer/src/runtime/web-session-tabs-sync.tssrc/renderer/src/runtime/web-session-terminal-park-authority.test.tssrc/renderer/src/runtime/web-session-terminal-park-authority.ts
🚧 Files skipped from review as they are similar to previous changes (25)
- src/renderer/src/components/terminal-pane/terminal-cold-park-verdict-loop.test.tsx
- src/renderer/src/components/terminal/background-terminal-worktree-mount.test.ts
- src/renderer/src/components/terminal-pane/manual-terminal-worktree-park-eligibility.ts
- src/renderer/src/components/terminal-pane/terminal-eviction-exempt-tabs.test.ts
- src/renderer/src/components/terminal-pane/terminal-parked-watcher-partial-reconciliation.test.ts
- src/renderer/src/components/terminal-pane/terminal-rendered-parked-tab-ids.ts
- src/renderer/src/components/terminal-pane/terminal-park-owner-oracle.test.ts
- src/renderer/src/lib/connection-owner-resolution.ts
- src/renderer/src/components/terminal-pane/terminal-parked-pty-watcher.ts
- src/renderer/src/runtime/web-session-terminal-park-authority.test.ts
- src/renderer/src/components/terminal-pane/terminal-parked-tab-watchers.ts
- src/renderer/src/components/terminal-pane/terminal-park-authority-dependencies.test.ts
- src/renderer/src/components/Terminal.tsx
- src/renderer/src/components/terminal-pane/terminal-park-worktree-owner.test.tsx
- src/renderer/src/runtime/web-session-tabs-sync.ts
- src/renderer/src/components/terminal-pane/terminal-park-worktree-owner.ts
- src/renderer/src/components/terminal-pane/terminal-hidden-view-parking.test.ts
- src/renderer/src/components/terminal-pane/terminal-park-authority-revision.ts
- src/renderer/src/components/terminal-pane/terminal-parked-tab-watchers.test.ts
- src/renderer/src/runtime/web-session-terminal-park-authority.ts
- src/renderer/src/components/terminal-pane/terminal-park-pty-restore-eligibility.ts
- src/renderer/src/components/terminal-pane/terminal-hidden-worktree-retention.test.ts
- src/renderer/src/components/terminal-pane/terminal-hidden-worktree-retention.ts
- src/renderer/src/components/terminal-pane/terminal-eviction-exempt-tabs.ts
- src/renderer/src/components/terminal-pane/use-terminal-tab-cold-parking.ts
Two conflicting files. main refactored the same cold-park hook this branch is extending, so both sides moved code out of the one function. src/renderer/src/runtime/web-session-tabs-sync.ts — two hunks, both a reset and a per-environment clear where main added browser-placement cleanup next to this branch's park-authority cleanup. Distinct state, both kept. src/renderer/src/components/terminal-pane/use-terminal-tab-cold-parking.ts: - selectPairedRuntimeParkingEnvironmentIds: main still imports it from terminal-hidden-view-parking, which no longer exports it — this branch moved it to terminal-park-pty-restore-eligibility and already imports it there. Took this branch's import; main's would not resolve. - Candidate building: main extracted the inline map into buildTerminalTabColdParkCandidates, which does not carry the activeLeafId this branch's park-owner check reads. Took main's builder and attach activeLeafId at the call site, where the leaf key is already subscribed. The builder maps terminalTabs in order, so the index stays aligned. - canWatcherCoverParkedTerminalTab: main uses it inline in the rendered-parked selection; this branch extracted that whole selection into terminal-rendered-parked-tab-ids, which carries the same activationDeferredMountTabIds clause and the same call. Verified the clause survived, then dropped the now-unused import from the hook. terminal-hidden-view-parking.test.ts: main's two new activation-order cases call selectColdParkedTerminalTabs without worktreeOwner, which this branch made required. Added LOCAL_WORKTREE_OWNER to match every sibling call in the file. Verified: src/renderer/src/runtime and src/renderer/src/components/terminal-pane, 345 files / 4183 tests, 65 failing. All 65 are in seven terminal-ime-xterm suites that fail identically on untouched b19d99b (7 files, 65 failed / 41 passed) — this merge introduces none of them. tsconfig.node, tsconfig.tc.cli, tsconfig.tc.web 0 errors. oxlint clean. max-lines ratchet OK. Reliability gate manifest passes for all 80 gates.
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/components/terminal-pane/use-terminal-tab-cold-parking.ts (1)
192-194: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueReduce the added implementation walkthroughs.
src/renderer/src/components/terminal-pane/use-terminal-tab-cold-parking.ts#L192-L194: Replace this with one short comment that states the owner check requires the active leaf ID.src/renderer/src/components/terminal-pane/use-terminal-tab-cold-parking.ts#L288-L291: Replace this with one short comment that states rendering and watcher synchronization use the same parked-tab set.As per coding guidelines: “Comments must be concise, non-obvious, and brief—prefer one line; do not explain obvious behavior or walk through code.”
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 766f83fb-e7a8-445c-8133-b2bdc12428b9
📒 Files selected for processing (29)
config/reliability-gates.jsoncsrc/renderer/src/components/Terminal.tsxsrc/renderer/src/components/terminal-pane/manual-terminal-worktree-park-eligibility.tssrc/renderer/src/components/terminal-pane/terminal-cold-park-verdict-loop.test.tsxsrc/renderer/src/components/terminal-pane/terminal-eviction-exempt-tabs.test.tssrc/renderer/src/components/terminal-pane/terminal-eviction-exempt-tabs.tssrc/renderer/src/components/terminal-pane/terminal-hidden-view-parking.test.tssrc/renderer/src/components/terminal-pane/terminal-hidden-view-parking.tssrc/renderer/src/components/terminal-pane/terminal-hidden-worktree-retention.test.tssrc/renderer/src/components/terminal-pane/terminal-hidden-worktree-retention.tssrc/renderer/src/components/terminal-pane/terminal-park-authority-dependencies.test.tssrc/renderer/src/components/terminal-pane/terminal-park-authority-revision.tssrc/renderer/src/components/terminal-pane/terminal-park-owner-oracle.test.tssrc/renderer/src/components/terminal-pane/terminal-park-pty-restore-eligibility.tssrc/renderer/src/components/terminal-pane/terminal-park-worktree-owner.test.tsxsrc/renderer/src/components/terminal-pane/terminal-park-worktree-owner.tssrc/renderer/src/components/terminal-pane/terminal-parked-pty-watcher.tssrc/renderer/src/components/terminal-pane/terminal-parked-tab-watchers.test.tssrc/renderer/src/components/terminal-pane/terminal-parked-tab-watchers.tssrc/renderer/src/components/terminal-pane/terminal-parked-watcher-partial-reconciliation.test.tssrc/renderer/src/components/terminal-pane/terminal-rendered-parked-tab-ids.tssrc/renderer/src/components/terminal-pane/use-terminal-force-park-exempt-tabs.tssrc/renderer/src/components/terminal-pane/use-terminal-tab-cold-parking.test.tssrc/renderer/src/components/terminal-pane/use-terminal-tab-cold-parking.tssrc/renderer/src/components/terminal/background-terminal-worktree-mount.test.tssrc/renderer/src/lib/connection-owner-resolution.tssrc/renderer/src/runtime/web-session-tabs-sync.tssrc/renderer/src/runtime/web-session-terminal-park-authority.test.tssrc/renderer/src/runtime/web-session-terminal-park-authority.ts
🚧 Files skipped from review as they are similar to previous changes (27)
- src/renderer/src/components/terminal/background-terminal-worktree-mount.test.ts
- src/renderer/src/lib/connection-owner-resolution.ts
- src/renderer/src/components/terminal-pane/terminal-parked-watcher-partial-reconciliation.test.ts
- src/renderer/src/components/terminal-pane/terminal-rendered-parked-tab-ids.ts
- src/renderer/src/components/terminal-pane/terminal-hidden-worktree-retention.test.ts
- src/renderer/src/components/terminal-pane/terminal-park-worktree-owner.test.tsx
- src/renderer/src/components/terminal-pane/terminal-park-authority-dependencies.test.ts
- src/renderer/src/components/terminal-pane/use-terminal-force-park-exempt-tabs.ts
- src/renderer/src/components/terminal-pane/terminal-cold-park-verdict-loop.test.tsx
- src/renderer/src/components/Terminal.tsx
- src/renderer/src/components/terminal-pane/terminal-eviction-exempt-tabs.ts
- src/renderer/src/components/terminal-pane/terminal-hidden-worktree-retention.ts
- src/renderer/src/runtime/web-session-terminal-park-authority.test.ts
- src/renderer/src/components/terminal-pane/manual-terminal-worktree-park-eligibility.ts
- src/renderer/src/components/terminal-pane/terminal-park-worktree-owner.ts
- src/renderer/src/components/terminal-pane/terminal-eviction-exempt-tabs.test.ts
- src/renderer/src/components/terminal-pane/terminal-parked-tab-watchers.test.ts
- src/renderer/src/components/terminal-pane/terminal-park-authority-revision.ts
- src/renderer/src/components/terminal-pane/terminal-parked-pty-watcher.ts
- src/renderer/src/runtime/web-session-tabs-sync.ts
- src/renderer/src/components/terminal-pane/terminal-hidden-view-parking.ts
- src/renderer/src/components/terminal-pane/terminal-park-pty-restore-eligibility.ts
- src/renderer/src/runtime/web-session-terminal-park-authority.ts
- src/renderer/src/components/terminal-pane/terminal-park-owner-oracle.test.ts
- src/renderer/src/components/terminal-pane/terminal-hidden-view-parking.test.ts
- src/renderer/src/components/terminal-pane/use-terminal-tab-cold-parking.test.ts
- src/renderer/src/components/terminal-pane/terminal-parked-tab-watchers.ts
Two conflicts, both in import blocks, both from main splitting src/shared/types.ts into per-domain modules while this branch was adding imports of its own beside the same lines. - terminal-hidden-view-parking.ts — main only repointed TerminalTab to shared/terminal-tab-types here; its other four imports belong to the functions this branch moved out to terminal-park-pty-restore-eligibility, so they are dropped rather than carried as unused. Verified against base..upstream/main that main changed nothing else in this file, so the extracted copies are not behind. - terminal-hidden-worktree-retention.ts — same TerminalTab repoint beside this branch's park-ownership imports; both kept. Three files this branch added still imported the deleted shared/types and had to follow the split: TerminalTab to shared/terminal-tab-types in terminal-park-authority-revision.ts and terminal-rendered-parked-tab-ids.ts, Repo to shared/repo-types in terminal-park-worktree-owner.test.tsx. Local: tsc clean on all three projects; the 12 test files this branch touches pass 187/187; src/renderer/src/components/terminal-pane and src/renderer/src/runtime are 348 files / 4287 passed, 0 failed. The 65 failures seen before this run were a stale shared node_modules resolving the xterm patch hash the lockfile does not ask for; installing in this worktree resolved 8a2d562c and they all pass. Reliability gate manifest passes for 84 gates, max-lines ratchet OK at 340, oxlint and oxfmt clean. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
stablyai#14676 replaced the exemption predicate with a route classifier so the force-park breadcrumb can say WHY a force-park freed nothing. This branch adds a reason that classifier did not have: a remote or SSH pty whose owner this worktree cannot prove. Folded in as a `remote-unowned` route rather than left out — a remote pty exempt by ownership would otherwise bucket as `split-pane`, which is the one bucket that means "the tab-level pty classified clean". The counts feed field triage, so a silently mis-bucketed route sends it the wrong way. The classifier and the tab-route counter now take the worktree owner, and Terminal.tsx resolves it from the same owner state the exemption selector reads. The two eviction-exemption describes moved to terminal-eviction-exempt-tabs.ts's own test file: both sides appended to terminal-parked-tab-watchers.test.ts and the merged file crossed the 800-line budget. They test a different module anyway.
Both sides appended a per-environment cleanup call to the same teardown, so the merge keeps both. stablyai#15644 clears the host session mirror hydration; this branch clears the park authority it records for that environment. Neither reads the other's state. No test covers either call at this site — the clear functions are exercised directly, not through the teardown that reaches them.
stablyai#16138 stopped reading tabsByWorktree through the effect deps, reading it once from the store instead so terminal load cannot stall navigation. This branch enriches the same list with each tab's active leaf, which the owner check needs as pane identity. Kept both: the tabs come from main's single store read, and the layout map is read beside it rather than per tab, which is what the branch's inline getState was doing. Taking main's side wholesale here would compile and pass every test — activeLeafId is optional, so every ownership check would silently fall back to a null leaf. Nothing in the suite covers this call site.
|
Closing this submitted branch and routing the bug to owner issue #17554. We will carry the fix ourselves on current main and will not request any contributor follow-up. Full contributor credit is preserved for @kunsanglee. No action is requested from you. Thank you. |
What
Remote terminal parking now requires authoritative PTY ownership across ordinary per-tab parking, retention force-parking, and parked watcher coverage. A worktree can park a tagged SSH or paired-runtime PTY only when its resolved transport owner exactly matches the owner embedded in the PTY ID.
Local, missing, unknown, ambiguous, and proven-foreign owners fail closed. The only local exception is an accepted host session snapshot matching the exact worktree, mirrored tab, pane leaf, and PTY session; that authority is revoked on remint, recreation, pending legacy state, disconnect, or removal and restored only by a new exact snapshot.
Why the transport owner
A paired HUB may own PTYs for an SSH worktree, and a mirrored web-surface pane may use a remote-runtime PTY inside a local repo. The guard therefore uses the same connection/runtime ownership resolvers as spawn and mirror synchronization instead of the resolved execution host.
Shape
terminal-park-pty-restore-eligibilityowns per-PTY restore and authority decisions.terminal-park-worktree-ownerresolves tagged local/SSH/runtime authority from store state.Verification
main, the affected React parking/watcher suite passed: 9 files / 53 tests.typecheck:web, targetedoxlint, reliability-gate validation, max-lines ratchet, andgit diff --checkpass.Renderer-side policy only; no RPC, stream-frame, or remote wire payload changed. WSL remains held, and physical Windows/Linux desktop validation remains an explicit gap.