Skip to content

Show close button for single terminal panes - #22770

Merged
AmethystLiang merged 2 commits into
mainfrom
fix-missing-x-button
Sep 25, 2026
Merged

AmethystLiang merged 2 commits into
mainfrom
fix-missing-x-button

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​65 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​59
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​30 $\color{#cf222e}{\Huge{\mathbf{−}}}$​17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​13

Problem

Single terminal panes lacked a visible close affordance, making them harder to close without using context menus or keyboard shortcuts.

Solution

Added a close button ("Close tab") to the header overlay for single terminal panes. The button respects the pinned state—pinned single panes don't show a close button. Multi-pane scenarios continue to show "Close Pane" for clarity.

Implementation:

  • Track tab pinned state through selectUnifiedTerminalTabFields (renamed from selectUnifiedTerminalTabChatFields)
  • Updated close button condition to show for single panes when not pinned
  • Label adapts based on pane count: "Close tab" (single) vs "Close Pane" (multiple)
  • Comprehensive test coverage for single pane, pinned pane, and multi-pane scenarios

Single-pane terminals previously had no close affordance; now display "Close tab" button while multi-pane terminals show "Close Pane". Pinned tabs omit the close button. Refactored terminal-unified-tab-lookup to include tab pinned state alongside chat view fields.

@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 critical issues — one design question inline, plus two nitpicks.

Reviewed changes

  • Single-pane close control — TerminalPaneHeaderOverlay now renders a close button for an untitled, unpinned single pane, labelled "Close tab"; multi-pane headers keep "Close Pane".
  • Pinned guard — the single-pane branch requires !isTabPinned, so pinned single panes keep no close button.
  • Ephemeral suppression — the same branch requires showSplitButton, so one-off command terminals (showSplitButton={false}) still get no close.
  • Pin plumbed through — selectUnifiedTerminalTabChatFields became selectUnifiedTerminalTabFields and now returns isTabPinned, threaded through useTerminalPaneChatState → controller → TerminalPaneSurface → overlay.
  • Tests — added single-pane close, pinned, and ephemeral cases, plus a pin-invalidation test for the lookup.

ℹ️ Nitpicks

  • showSplitButton is named for the split control, but it now also decides whether a single pane gets a close button. A caller that hides split for a real, non-ephemeral pane would silently lose the close affordance; a one-line note on the prop would make the second job explicit.
  • In the pinned it.each, the titled case asserts button[aria-label="Close tab"] is absent, but titled panes never take the close branch regardless of isTabPinned, so only the untitled case actually exercises the new guard.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Sep 25, 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: 717f0d39-d99d-4842-b7a3-bbdb505503fb

📥 Commits

Reviewing files that changed from the base of the PR and between c8acce9 and 5b1e4b4.

📒 Files selected for processing (2)
  • src/renderer/src/components/terminal-pane/TerminalPaneHeaderOverlay.test.tsx
  • src/renderer/src/components/terminal-pane/TerminalPaneHeaderOverlay.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/renderer/src/components/terminal-pane/TerminalPaneHeaderOverlay.tsx
  • src/renderer/src/components/terminal-pane/TerminalPaneHeaderOverlay.test.tsx

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


📝 Walkthrough

Walkthrough

The unified terminal tab selector now returns the selected tab’s pinned status. The hook and terminal surface pass that status to the header overlay. The overlay updates close-control visibility based on pane count, split-control visibility, and pin status. Its close button and tooltip use “Close Pane” for multiple panes and “Close tab” for a single pane. Tests cover the updated single-pane, pinned-tab, and hidden-control cases.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 5b1e4

The close control behaves as intended for pinned tabs, single panes, and split panes. No issue identified here prevents merging after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to c8acc

The new button uses the existing guarded tab-close path, and no security bypass was identified. Repeated-click behavior and some downstream cleanup effects remain unverified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The added reachability is a renderer control for closing the currently selected terminal tab; no new service dependency or privilege was identified in the assessed path.

Trust Boundaries and Controls

  • observed — The shared close operation rechecks pin state and applies its running-process guard after a close request; the new header control does not itself enforce those policies.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the problem, solution, user-facing behavior, pinned-tab handling, multi-pane behavior, implementation changes, and test coverage. However, it omits most required template sect… Complete the required template sections. Add the issue link after “Fixes #”, attach before-and-after visual proof or write “N/A” with a reason, document manual and automated testing with tested platforms, complete the applicable checkboxes,…
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: adding a close button for single terminal panes.
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.
Full details: Description check

Explanation

The description explains the problem, solution, user-facing behavior, pinned-tab handling, multi-pane behavior, implementation changes, and test coverage. However, it omits most required template sections, including ELI5, Why, Linked Issue, Visual Proof, Testing details and checkboxes, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist.

Resolution

Complete the required template sections. Add the issue link after “Fixes #”, attach before-and-after visual proof or write “N/A” with a reason, document manual and automated testing with tested platforms, complete the applicable checkboxes, and address AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist.

  • 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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 00eb8401-f5a3-43c4-a89f-7267633072dc

📥 Commits

Reviewing files that changed from the base of the PR and between a05649d and c8acce9.

📒 Files selected for processing (6)
  • src/renderer/src/components/terminal-pane/TerminalPaneHeaderOverlay.test.tsx
  • src/renderer/src/components/terminal-pane/TerminalPaneHeaderOverlay.tsx
  • src/renderer/src/components/terminal-pane/TerminalPaneSurface.tsx
  • src/renderer/src/components/terminal-pane/terminal-unified-tab-lookup.test.ts
  • src/renderer/src/components/terminal-pane/terminal-unified-tab-lookup.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-chat-state.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

For split panes, the X button remains remove-title only. For single panes
with titles (including agent terminals that acquire runtime titles), a
close tab button is needed to close the pane.

@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

Re-reviewed the delta since the prior Pullfrog review (c8acce9 → 5b1e4b4), which extends the close affordance to titled single panes.

  • Extended the close control to titled single panes — showCloseButton now renders beside the remove-title X for a titled single pane, so agent terminals (which receive runtime titles) are no longer the one shape without a visible close affordance.
  • Extracted the close label — closeLabel resolves once to Close tab for a single pane and Close Pane for multi-pane, replacing the two inline translations.
  • Realigned the tests — the titled single-pane case now asserts both controls and a working close, the pinned it.each exercises the !isTabPinned guard for titled panes too, and titled split panes assert remove-title only.

Verification: the two changed test files pass (12 tests) and pnpm tc:web is clean.

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

@AmethystLiang
AmethystLiang merged commit 56dfddc into main Sep 25, 2026
30 checks passed
OmarHung pushed a commit to OmarHung/orca that referenced this pull request Sep 26, 2026
* Show close button for single terminal panes

Single-pane terminals previously had no close affordance; now display "Close tab" button while multi-pane terminals show "Close Pane". Pinned tabs omit the close button. Refactored terminal-unified-tab-lookup to include tab pinned state alongside chat view fields.

* Show close button for titled single terminal panes

For split panes, the X button remains remove-title only. For single panes
with titles (including agent terminals that acquire runtime titles), a
close tab button is needed to close the pane.

(cherry picked from commit 56dfddc)
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