Repository navigation
Fix serve-created mobile terminals on desktop - #4843
Conversation
Co-authored-by: Orca <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds conditional headless mobile-session hydration, serve-owned PTY filtering and identity-based merging, a predicate to materialize preserved headless tabs, and renderer-sync logic that preserves and merges serve-owned headless tabs; includes E2E tests covering preservation, split-sibling behavior, epoch idempotency, and in-attach hydration activation. ChangesServe-owned mobile terminal persistence
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/main/runtime/orca-runtime.ts`:
- Around line 12570-12587: getMergedMobileSessionPublicationEpoch currently
appends ":headless-merge:<signature>" onto snapshot.publicationEpoch every call,
causing non-idempotent growth; change it to first normalize
snapshot.publicationEpoch by removing any existing trailing
":headless-merge:<...>" segment (e.g. via regex strip) before computing the new
signature and returning
`${normalizedPublicationEpoch}:headless-merge:${signature}` so repeated merges
are idempotent; update references in getMergedMobileSessionPublicationEpoch to
use normalizedPublicationEpoch instead of snapshot.publicationEpoch when
building the returned epoch.
- Around line 2246-2249: The terminal identity key currently returns [tab.id,
tab.parentTabId], which causes sibling split leaves to collide; in
getMobileSessionSnapshotTabIdentityKeys change the identity to include a
split-specific identifier instead of parentTabId (e.g., tab.splitLeafId or
tab.splitIndex) so each split leaf is unique—use [tab.id, tab.splitLeafId] when
splitLeafId exists, otherwise fall back to [tab.id]; update
RuntimeMobileSessionSnapshotTab usages to read the split identifier property.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 170ab79e-c74d-4fe3-abf1-367984e9f209
📒 Files selected for processing (2)
src/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.ts
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — preserves headless-created serve-* terminal session tabs when a desktop renderer publishes its tab graph, and materializes pending serve-owned terminals on activation rather than silently focusing an unknown tab.
- Preserve serve-owned tabs during
syncMobileSessionTabs— hydrates serve-owned terminal bindings from the workspace session before processing the renderer snapshot, then merges preserved tabs into the incoming snapshot. When a worktree is absent from the renderer's snapshots, a preserved snapshot is built from surviving serve-owned terminals instead of deleting the entry. - Materialize pending serve-owned terminals on activation —
activateMobileSessionTabnow spawns the PTY for serve-owned terminals that the renderer has never adopted, instead of callingfocusTerminalwhich would silently no-op. - New merge helpers —
mergeMobileSessionSnapshotTabs,mergeMobileSessionTabGroups,mergePreservedHeadlessMobileSessionTabs, andbuildPreservedHeadlessMobileSessionSnapshothandle deduplication, active-tab selection, and group merging with a deterministicpublicationEpochvia SHA1.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
Co-authored-by: Orca <[email protected]>
There was a problem hiding this comment.
Reviewed changes — addressed CodeRabbit feedback by fixing terminal identity-key collisions for split panes and making publication epoch merges idempotent.
- Disambiguate terminal identity keys with
leafId—getMobileSessionSnapshotTabIdentityKeysnow includesleafIdin the composite key for terminal tabs so split sibling panes don't collide during preservation dedup. - Normalize publication epoch before merge —
getMergedMobileSessionPublicationEpochstrips any existing:headless-merge:suffix viasplit(':headless-merge:')[0]before computing the new signature, keeping repeated merges of the same preserved tabs idempotent.
✅ No new issues found.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/main/runtime/orca-runtime.ts`:
- Around line 2246-2248: Add brief "why" comments inside
getMobileSessionSnapshotTabIdentityKeys explaining the merge invariants: note
that for terminal tabs we must keep split siblings leaf-scoped (so we return
[tab.id, `${tab.parentTabId}::${tab.leafId}`]) and document that any preserved
headless-merge passes must first normalize prior `:headless-merge:` suffixes
before recomputing epoch; place the comments adjacent to the existing
conditional and the identity key construction so future readers understand these
subtle constraints and won't "simplify" them away.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d1da51c7-4275-4e6d-9a68-c29a860f3246
📒 Files selected for processing (2)
src/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.ts
Co-authored-by: Orca <[email protected]>

Summary
serve-*terminal session tabs when an attached desktop renderer publishes its tab graph.session.tabs.Fixes #4760
Context
PR #4825 improved paired web session-tab mirroring, but it did not touch the host runtime path that was replacing/deleting headless serve-owned session snapshots. This fix keeps the host-created terminal visible in the authoritative session-tab snapshot so desktop clients can discover it.
Test plan
pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/orca-runtime.test.ts src/main/runtime/rpc/methods/session-tabs.test.ts src/main/runtime/rpc/methods/session-tabs-move-validation.test.tspnpm run typecheck:nodepnpm exec oxlint src/main/runtime/orca-runtime.ts src/main/runtime/orca-runtime.test.tsgit diff --checkMade with Orca 🐋
Summary by CodeRabbit
New Tests
Bug Fixes
Improvements