Repository navigation
Fix remote-runtime terminal pane split authority - #13867
Conversation
|
@coderabbitai review |
|
|
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:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
🚧 Files skipped from review as they are similar to previous changes (9)
📝 WalkthroughWalkthroughTerminal split creation resolves source authority across persisted, mounted, and projected terminal state. Persistence validates source tab, worktree, leaf, PTY, and incarnation data before admitting bindings. PTY startup propagates expected source metadata and reports 🚥 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/main/runtime/headless-terminal-split-layout.test.ts (1)
155-156: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert mapping values instead of key order.
Object.keys(...)compared withtoEqualpins the insertion order ofptyIdsByLeafId. Key order is an implementation detail of how the map is rebuilt, not part of the split-layout contract. A later refactor that reorders the spread would fail this test without any behavior change. The test also does not assert thatleaf-cis rebound fromprovisional-ptytopty-c, which is the point of this scenario.♻️ Proposed assertion change
expect(countTerminalLayoutLeaves(next.root)).toBe(3) - expect(Object.keys(next.ptyIdsByLeafId!)).toEqual(['leaf-a', 'leaf-b', 'leaf-c']) + expect(next.ptyIdsByLeafId).toEqual({ + 'leaf-a': 'pty-a', + 'leaf-b': 'pty-b', + 'leaf-c': 'pty-c' + })src/main/persistence.ts (1)
6792-6808: 🗄️ Data Integrity & Integration | 🔵 Trivial | 💤 Low valueConsider binding the source expectation to the target tab.
The validation confirms the source tab, leaf, PTY, and incarnation. It does not confirm that
args.tabIdequalsexpected.tabId. The write path below usesbindingWorktreeId, which is derived from the source expectation, for tab lookup, minimal tab creation, and the active-tab bookkeeping. If a future caller passes a source expectation from one tab while binding a leaf into a different tab, this method would create that unrelated tab inside the source worktree and advance the source repo's topology fence.The current runtime caller passes the same
parentTabIdfor both, so this is defensive only.🛡️ Proposed guard
if (args.expectedSourceBinding) { const expected = args.expectedSourceBinding + if (expected.tabId !== args.tabId) { + return false + } const sourceTab = session.tabsByWorktree?.[bindingWorktreeId]?.find(
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: fe0156e0-bce1-4b17-a26e-ec9e853040c0
📒 Files selected for processing (9)
src/main/ipc/pty.test.tssrc/main/ipc/pty.tssrc/main/persistence.test.tssrc/main/persistence.tssrc/main/runtime/headless-terminal-split-layout.test.tssrc/main/runtime/headless-terminal-split-layout.tssrc/main/runtime/orca-runtime-terminal-split-authority.test.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.ts
a427d9a to
d8cfee4
Compare
|
@coderabbitai review |
|
|
@coderabbitai review |
|
|
@coderabbitai review |
|
|
@coderabbitai review |
|
|
@coderabbitai review |
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
d8cfee4 to
bce911d
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 7b7c25f9-39ae-4b73-b635-656c7f02be90
📥 Commits
Reviewing files that changed from the base of the PR and between d8cfee4 and bce911d5c200efcc33cff35502ac9f60e89529c1.
📒 Files selected for processing (4)
src/main/ipc/pty.test.tssrc/main/ipc/pty.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- src/main/ipc/pty.ts
- src/main/ipc/pty.test.ts
- src/main/runtime/orca-runtime.test.ts
|
@coderabbitai review |
|
|
@coderabbitai review |
|
580ee22 to
a379dfc
Compare
|
@coderabbitai review |
|
|
@coderabbitai review |
|
|
@coderabbitai review |
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
a379dfc to
a658867
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
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. |
* fix(runtime): preserve remote terminal pane splits * test(runtime): tighten split authority guards * fix(runtime): revalidate transient split sources --------- Co-authored-by: E2E Test <[email protected]> (cherry picked from commit 7a58f72)
* fix(runtime): preserve remote terminal pane splits * test(runtime): tighten split authority guards * fix(runtime): revalidate transient split sources --------- Co-authored-by: E2E Test <[email protected]>
Fixes #13743
Problem and invariant
A live terminal pane owned by the host's persisted workspace session must be splittable even when the host renderer has not mounted that tab. Conversely, a source pane that is not authoritatively owned must be rejected before a replacement PTY is spawned.
The remote-runtime CLI path previously spawned the new PTY and asked the host renderer to reveal/apply the split. For workspaces absent from that renderer's in-memory tab graph, the renderer rejected the tab lookup, causing the new PTY to be killed. A later stale one-leaf renderer replay could also overwrite an accepted main-process layout.
Although the report was captured on Windows, the failure is platform-neutral: it is a main/renderer ownership mismatch, not a Windows, ConPTY, filesystem, or window-lifecycle primitive.
Reproduction evidence
The same byte-identical authority test was run in all three states:
On the final rebase onto
origin/mainat444638d96b, the fix-disabled run again failed 2/2: the persisted-but-unmounted split consulted the renderer and spawned then killed its PTY, while the unowned source also spawned before rejection. Restoring the candidate returned the oracle to GREEN 2/2.Command:
pnpm exec vitest run --config config/vitest.config.ts \ src/main/runtime/orca-runtime-terminal-split-authority.test.tsDesign
This keeps authoritative truth in the main-process session/persistence boundary, preserves the existing crash-ordering guarantee, and avoids a remote wire or persistence-schema change. A renderer-only patch would retain the spawn-before-validation race; routing every split through a transient mobile projection would use a non-authoritative surface and broaden coupling.
Risk and compatibility
The main risks are concurrent source close, persisted/live incarnation skew, normalized worktree keys, SSH host partitioning, and stale renderer replay. Tests cover those cases, including legacy sessions without a persisted incarnation. No remote protocol opcode/field, storage schema, Git behavior, provider-specific behavior, or UI styling changes are introduced. Folder workspaces, git worktrees, local hosts, SSH hosts, Windows/macOS/Linux behavior, and mixed client/server versions retain their existing interfaces.
Validation
On the final merge base:
pnpm run typecheck:nodepnpm run check:code-quality:changedpnpm run check:max-lines-ratchetpnpm run check:reliability-gatesgit diff --checkFresh architecture/adversarial, platform/performance/security, and readiness/UX reviews completed cleanly after addressing source CAS/crash ordering, renderer-mount adoption, legacy-incarnation compatibility, and stale-replay fencing.