Repository navigation
fix(runtime): project the PTY incarnation onto mobile session tabs - #24413
Conversation
Paired clients read RuntimeMobileSessionTab.incarnationId to fence remote identity observations (#18078), but projectRuntimeMobileSessionTabs never set it, so remote-runtime-pty-transport always saw null and the fence never engaged. The projection now publishes the incarnation of the PTY record that owns the issued handle, never a stale incarnation persisted on the tab. Ported from #16741 (a68b6f3).
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- PTY incarnation on projected mobile session tabs —
projectRuntimeMobileSessionTabsnow keeps the resolved PTY record (terminalPty) instead of only the handle string, and publishesterminalPty.incarnationIdon terminal tabs. The field was already in the sharedRuntimeMobileSessionTerminalTabcontract but had never been populated, soremote-runtime-pty-transport.tsreadselected.incarnationId ?? nulland the identity fence never engaged. - Absence is deliberate — the incarnation is only emitted when truthy, and is never copied from the snapshot tab's persisted
incarnationId(which can be stale after a respawn), matching the intent stated in the PR body. - New test —
runtime-mobile-session-incarnation-projection.test.tscoverspty,leaf,unknown, anddisconnectedcases with exact assertions (toHaveProperty('incarnationId', 'live-incarnation')/not.toHaveProperty('incarnationId')), seeding astale-incarnationon the snapshot that must not surface.
The handle-resolution logic is behavior-preserving (terminalPty = liveLeafPtyId ? recordPty(...) : livePty; handle = terminalPty ? issuePtyHandle(terminalPty) : null), and the source (recordPtyWorktree returning the live record with its incarnationId intact) agrees with the sibling buildPtyTerminalSummary path. Adding an optional field is wire-safe. Verified the new test (4 passed) and orca-runtime-cold-restore-terminal-membership.test.ts (11 passed).
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (1)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The change exposes live terminal identity without copying stale tab state or changing readiness behavior. No actionable merge-blocking risk was identified; normal checks should complete before merging. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The projection now pairs terminal handles with their live owner’s identity rather than stale saved identity. Terminal access and readiness behavior are preserved. Whether every subsequent attachment response preserves that identity remains unverified. Retained concerns Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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 |
* Revert "feat(orcad): source-side dormant export of a relay-hosted SSH target (#16741 T6-8) (#24519)" This reverts commit 783101b. * Revert "feat(ssh): update, roll back, recover and stop a managed orcad server (#16741 T6-5 follow-up) (#24463)" This reverts commit 38c2d1d. * Revert "feat(ssh): deploy and pair an empty managed orcad server over SSH (#16741 T6-5) (#24453)" This reverts commit 8b76683. * Revert "fix(ssh): orcad GC honors the activation journal; readiness requires proven daemon coverage (#16741 T6 follow-up) (#24451)" This reverts commit d3f8c50. * Revert "feat(ssh): remote orcad stop by request file and journaled decommission (#16741 T6-4) (#24449)" This reverts commit 43d9b43. * Revert "feat(orcad): supervisable server: stop requests, managed stop receipts and a lifetime that keeps its lock on failed teardown (#16741 T6-3) (#24433)" This reverts commit b093d3a. * Revert "feat(ssh): crash-safe orcad activation, rollback and recovery (#16741 T6-2) (#24423)" This reverts commit 1a9ac0e. * Revert "feat(runtime): SSH access links for paired servers in a downgrade-safe sidecar (#16741 T5-1+T5-2) (#24420)" This reverts commit 99db2bf. * Revert "feat(relay): capability-gated owner reset with a durable preparation journal (#16741 T3 R1) (#24418)" This reverts commit 34a582b. * Revert "feat(ssh): track connection-manager drains, test probes and provider continuations (#16741 T2 P3+P8a) (#24407)" This reverts commit d53063d. * Revert "feat(daemon): idle retirement, session census and recovery-only provider (#16741 T2 P4b) (#24409)" This reverts commit ff212db. * Revert "feat(ssh): add pty.resumeClient and split SSH PTY process listing (#16741 T2 P5+P6) (#24414)" This reverts commit 92cb717. * Revert "feat(relay): await owned watcher and agent children on shutdown (#16741 T2 P1) (#24400)" This reverts commit 6b36e4f. * Revert "feat(session): retry failed renderer session writes and verify local folder PTYs (#16741 T2 P9) (#24406)" This reverts commit d23ecef. * Revert "feat(ssh): remote orcad primitives on the pinned Node runtime (#16741 T6-1) (#24419)" This reverts commit dd87ae5. * Revert "fix(runtime): fence runtime-environment subscriptions and status probes by identity (#16741 T5-3) (#24421)" This reverts commit ece9e4d. * Revert "feat(orcad): migration manifest and dormant-state contracts (#16741 T6-7) (#24422)" This reverts commit 3fbdaba. * Revert "feat(ssh): wire SshConnection through the work and transport close ledgers (#16741 T2 P2) (#24401)" This reverts commit 4e8edc8. * Revert "feat(profiles): carry markdown frontmatter visibility in project transfers (#16741 T2 P7) (#24405)" This reverts commit 60c9326. * Revert "fix(runtime): project the PTY incarnation onto mobile session tabs (#24413)" This reverts commit 99e0303. * Revert "feat(daemon): tag daemon stream data with the PTY incarnation id (#16741 T2 P4a) (#24402)" This reverts commit 817af76. * Revert "feat(ssh): port the SSH connection work ledger and transport close ledger (#16741 T2) (#24210)" This reverts commit c991893. * Revert "feat(relay): fence and drain file and git response streams on shutdown (#24185)" This reverts commit dc08ffe. * Revert "refactor(runtime-rpc): extract the Node WebSocket lifecycle; opt-in pinned port (#24186)" This reverts commit a789233. * Revert "feat(relay): route relay handlers through work admission; producer publication drain (#24181)" This reverts commit 0b812bd. * Revert "feat(relay): land the #16741 T1 seam (work drain, publication drain, release gate) (#24156)" This reverts commit 3aa2d3a. --------- Co-authored-by: m4air <[email protected]>

This is a small, standalone fix carried over from #16741, where it was one of the T2 "runtime leftovers".
ELI5
Each running terminal has a unique "incarnation" id. A paired client (web or mobile) uses it to make sure that terminal updates come from the exact terminal it is attached to, not from an older one that happened to reuse the same name. The desktop app was supposed to include that id when it listed terminals for paired clients, but it never did. As a result, the client's check never switched on.
What Changed
Before:
projectRuntimeMobileSessionTabsnever setincarnationIdon the terminal tabs it published, even though the shared contract has the field (RuntimeMobileSessionTab.incarnationId, added for host-stamped remote identity in feat(ssh): host-stamped remote foreground identity #18078).remote-runtime-pty-transport.tsreadsselected.incarnationIdfrom those tabs. So for a terminal picked from the session list, paired clients always gotnull, and identity fencing never engaged.After:
incarnationIdis published.Mechanism: the projection now keeps the PTY record it already resolved for the handle, instead of only the handle string, and reads that record's
incarnationId.Why
Taking the id from the same record that owns the handle keeps the two consistent by construction. Copying the tab's stored
incarnationIdwould have been simpler, but it can be stale after a respawn. That is exactly the case the fence exists to catch.Linked Issue
Follow-up to #18078. Ported from #16741 (a68b6f3), whose remaining T2 "runtime leftovers" were folded into later tracks.
Visual Proof
N/A. This changes data sent to paired clients and has no UI change on its own.
Testing
New
runtime-mobile-session-incarnation-projection.test.tscovers four cases:The two live cases fail on main without this change.
Regression: 42 mobile-session, web-session-terminal and remote-runtime transport test files, 415 tests, all passing.
The changed-code quality gate passes.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)