Skip to content

A pane close by its terminal handle closes only that pane, even before the window lists it (dark, layout-owner build only) - #30920

Merged
Jinwoo-H merged 4 commits into
mainfrom
e2-6/close-relist-no-widening
Oct 20, 2026
Merged

Jinwoo-H merged 4 commits into
mainfrom
e2-6/close-relist-no-widening

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

In the test build where the main process owns the pane layout, closing one pane of a split tab by its terminal handle could close the whole tab. That happened when the window had listed the tab but not that pane yet. Now only that pane closes. Shipped builds don't change.

What Changed

Before (layout-owner build only): a tab is split into two panes. The window has listed the tab but not the new pane. A command closes one pane by its terminal handle, and both panes close along with the tab.

After: only the named pane closes. The other pane and the tab stay open.

Mechanism: #30786 made such a close work by having the main process add a list entry for the pane it holds, so the close can find it. That entry was built with a layout that holds only that one pane. The close reads the tab's listed layout first, so it took the pane for the tab's last one and turned the pane close into a tab close. Now, after adding the entry, every entry of that tab takes the main process's layout for the tab, which has both panes. So the close sees a sibling and closes just the one pane.

  • The layout is only written when the entry for that pane was actually added. If membership checks refused it, the window's list stays as it was.
  • Each entry gets its own copy of the layout.
  • Nothing is stored and no version is bumped when nothing changed.

All of the new code sits inside the layout-owner switch branch, so the shipped build drops it.

Why

The fix sits at the same place #30786 added the entry, and it only adds the pane the handle names. That keeps the boundary in one spot.

Alternatives considered:

One trade-off: the layout written here is the main process's. Under the switch the main process writes a split before the window does, so its layout is the tab's newest. While the switch is on, this deliberately overrides the "window's list first" order noted in terminal-surface-close.ts.

Linked Issue

Blocks the layout-owner switch-on flip (#30861). Follows #30786.

Visual Proof

N/A. This affects only the layout-owner build, which is not shipped, and the change is in close logic covered by tests below.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • New file orca-runtime-terminal-close-no-widening-layout-owner.test.ts runs the whole "a close never widens" table with the switch on.

    • On main, the "cli-pty close, nothing-published" row fails.
    • With this fix, every row passes.
  • New table row "cli-pty close, pane-unlisted": the window lists the tab with only the sibling and no layout. It fails without the fix and passes with it, in the switch-on run.

  • fix: a tab close by the handle a split returned finds the new pane (dark, layout-owner build only) #30786's close-by-split-handle tests still pass.

  • Full vitest suite with the switch on by default (a temporary vitest define of the switch, not committed), compared to main with the same define.

    • Main: 126 failing files. This branch: 125.
    • The only difference is the no-widening table, which this fixes. No file fails here that passes on main.
    • The other failures are tests that are already red with the switch on and are tracked by the flip work, plus 13 files that fail on this Mac either way (for example temp-folder path spelling and packaged-asset checks).
  • Full vitest suite with the switch off fails only in those 13 files.

  • Switch-off unminified main bundle compared to main, with build hashes normalised: the only change is the source commit stamp, plus asset manifest order. So the shipped build is unchanged.

  • Typecheck, the changed-code quality gate, oxlint, the formatting check, and the anti-slop lint all pass.

  • tests/e2e/terminal-tab-close-restart-persistence.spec.ts, run locally with hidden windows and 2 workers:

    • Switch on: 10 of 10 passed.
    • Switch off: 3 of 3 passed.
  • I also merged current main once, so CI runs this on the current base.

AI Disclosure

Review

An independent review found no blockers. Its minor points were applied: guard on the entry being present, copy the layout, skip no-op stores, and a test row that fails without the fix.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Security, mobile, SSH, and cross-platform: no change in shipped builds. The new code is dropped when the switch is off.
  • In the layout-owner build, a close requested from mobile or from the command line goes through the same path, so it gets the same fix.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

E2E Test and others added 3 commits October 19, 2026 19:02
@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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: db9823f1-e2fc-46ce-b14a-b4febabd43d6
📥 Commits

Reviewing files that changed from the base of the PR and between f3a1238 and b040dc8.

📒 Files selected for processing: 4
  • src/main/runtime/orca-runtime-terminal-close-no-widening-layout-owner.test.ts
  • src/main/runtime/orca-runtime-terminal-close-no-widening.test.ts
  • src/main/runtime/terminal/view/layout-owner-close-relisting.ts
  • src/main/runtime/terminal/view/mobile-terminal-surface.ts

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

📝 Walkthrough

Main-owner relisting now passes the validated pane layout to its callback. The mobile terminal surface applies the layout to terminal rows that match the relisted tab and PTY. The close-continuity test matrix adds a pane-unlisted condition and a test entry point with the main layout owner enabled.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to b040d

The relisted split remains available when the close target is chosen, so the reviewed change is mergeable after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly describes the main behavior change and limits it to the layout-owner build. It is somewhat long, but it remains specific and relevant.
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.
Description check Passed The pull request description is complete and follows the repository template. It explains the problem, user-visible behavior, mechanism, alternatives, linked issues, visual-proof rationale, testing, s…
Full details: Description check

Explanation

The pull request description is complete and follows the repository template. It explains the problem, user-visible behavior, mechanism, alternatives, linked issues, visual-proof rationale, testing, scope, compatibility considerations, and checklist status. The Review section is empty, but this is non-critical because the description includes an independent review summary.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@Jinwoo-H
Jinwoo-H merged commit af6fe23 into main Oct 20, 2026
35 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