Skip to content

fix(terminal): reveal splits while the source pane binds - #23692

Merged
nwparker merged 5 commits into
mainfrom
nwparker/ci-passive-close-restore
Sep 28, 2026
Merged

nwparker merged 5 commits into
mainfrom
nwparker/ci-passive-close-restore

Conversation

@nwparker

@nwparker nwparker commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​28 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​25
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1

ELI5

A split requested immediately after a terminal starts could exist on disk without appearing in the window. It now appears even when the mounted source pane has not yet published its PTY binding.

What Changed

Treat a mounted source with a null PTY binding as mounted only when the persisted layout proves the exact requested terminal identity. Keep the existing incarnation checks and reject conflicting renderer bindings. The restart test also observes passive restoration before activation.

Why

Linux diagnostics captured a real mounted leaf with a null PTY ID when the split was committed. Waiting longer in the test would hide the race; revealing every persisted split would wake unmounted hosts. This uses the existing persisted authority while preserving the unmounted-host behavior.

Linked Issue

Follow-up CI verification for #22955.

Visual Proof

N/A — test setup only; application behavior is unchanged.

Testing

  • Reproduced locally: old test unexpectedly finds a fresh Terminal 1 after restart.
  • Updated hidden Electron test passes on macOS with ORCA_BACKGROUND_LAUNCH=1.
  • Changed-code quality gate passes. CI covers Linux and typechecking.

Review

No product, wire, path, or execution-host changes. All original assertions remain.

Agent skill upstream boundary

  • Not applicable.

Checklist

  • Focused and self-reviewed.
  • Before/after, mechanism, and rationale explained.
  • Cross-platform and SSH impact considered.

Validation update: 11 split-authority tests, Node typecheck, and changed-code quality pass. Exact Linux restart-persistence E2E is running at https://github.com/stablyai/orca/actions/runs/36496237732.

@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 83b0e418-860f-4da4-a657-c5b749d19a92

📥 Commits

Reviewing files that changed from the base of the PR and between d0db35c and efe5c98.

📒 Files selected for processing (3)
  • src/main/runtime/orca-runtime-resolve-terminal-split-source-authority.ts
  • src/main/runtime/orca-runtime-terminal-split-authority.test.ts
  • tests/e2e/terminal-tab-close-restart-persistence.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The runtime now treats a renderer leaf with no PTY binding as mounted when the persisted layout identifies the requested PTY. Unit tests cover null and different PTY bindings. The end-to-end restart test waits for passive worktree hydration, checks that the closed tab remains absent, and verifies that activating the worktree creates a terminal tab with a new ID.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to efe5c

No actionable merge-blocking issue was established in the terminal split or restart-persistence changes. The PR is mergeable after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to efe5c

The change preserves the existing terminal and worktree identity checks, and no new security bypass was established. A split can still be saved before its pane appears; recovery if the reveal fails during the newly supported binding window remains uncertain.

Retained concerns

  • Low · reliability · inferred: A newly eligible unbound source can have its split persisted and published before the renderer reveal completes. Reveal errors are discarded, and recovery of a split that remains absent from the visible pane is not established. This extends an existing post-commit failure mode into the binding window.
Security review details

Security Blast Radius

  • inferred — The inspected split path remains scoped to a live PTY-backed source and its resolved workspace; the new eligibility does not establish reachability to a different worktree or PTY.

Trust Boundaries and Controls

  • observed — A null renderer PTY binding is not sufficient on its own: the persisted source identity must match, both renderer worktree identities must match, and a conflicting renderer PTY remains excluded.

Resilience and Maintainability Implications

  • inferred — Discarding a post-commit reveal error can leave a running, persisted split without the expected visible projection. Whether another lifecycle path reconciles that state is unverified.

Hardening Proposals

  • proposed — Establish or verify a reconciliation path for persisted splits whose renderer reveal fails during source binding, without duplicating a split on retry.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and clearly identifies the main change: revealing terminal splits while the source pane publishes its PTY binding.
Description check ✅ Passed The description is mostly complete and covers the user impact, implementation, rationale, linked issue, testing, review, and checklist items. The Visual Proof section uses N/A even though the change a…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Adjusts terminal split reveal logic during PTY binding.

The PR appears safe to merge; no outstanding or new actionable finding was identified.

Summary

The PR allows a persisted split to be revealed while its mounted source pane has not yet published a PTY binding, and changes the restart test to inspect passive restoration before activating the worktree.

  • Adds coverage for null and conflicting renderer PTY bindings.
  • Preserves the check that explicit activation creates a fresh terminal.

Reviews (3) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..."

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — one test-only change to tests/e2e/terminal-tab-close-restart-persistence.spec.ts, reviewed end-to-end against the raw diff.

  • Second launch now observes passive hydration instead of activating — the restart path no longer calls attachRepoAndOpenTerminal (which re-adds the repo and calls setActiveWorktree, deliberately seeding a fresh terminal). It now waits for workspaceSessionReady and polls window.__store.getState().allWorktrees() until the original worktreeId surfaces, then keeps the existing wait-past-effects, empty-tab, and empty-host-terminal assertions before the explicit sidebar click that must create one fresh terminal.
  • Coverage is preserved and strengthened — the removed attachRepoAndOpenTerminal call previously re-attached the repo itself, so the old assertion could pass without passive restoration working. The new poll proves the worktree is hydrated from persisted state, and the retained worktreeRowSurface(...).click() gives a user-observable proof that the row exists.

The new poll follows the same idiom used in sibling specs (paired-remote-terminal-client-restart-survival.spec.ts:130, paired-two-client-emptied-workspace-reseed.spec.ts:153), and externalWorktreeVisibility: 'show' set on the first launch persists, so dropping the second-launch re-attach is safe.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@nwparker nwparker changed the title test(e2e): observe passive terminal restoration before activation fix(terminal): reveal splits while the source pane binds Sep 28, 2026

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — incremental delta since the prior pullfrog review at 56e428f: the production authority change (5c91d25), its unit coverage (e33649c), and the main merge (efe5c98). The earlier E2E spec change was already reviewed and is unchanged.

  • Persisted splits now reveal while the source pane is still binding — rendererMounted accepts a mounted leaf whose ptyId is null only when the persisted layout proves the exact (tabId, leafId) → ptyId identity, so the post-commit reveal fires during the binding-publication window instead of silently dropping the split. Non-null conflicting renderer bindings and incarnation mismatches are still rejected, and the only consumer of the widened predicate is the reveal decision.
  • The new unit test can actually fail — reveals a persisted split while its mounted source is still publishing its PTY binding fails against the pre-fix predicate (reveal called 0 times, verified locally), and its companion pins the different-PTY rejection. The handle nullable persisted layout roots follow-up correctly optional-chains the possibly-absent layout root.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker merged commit 2aed2cf into main Sep 28, 2026
82 of 84 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant