You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Tab close confirmation is bypassed when using the close button or middle-click #10142
Closing a tab with Cmd+W shows a confirmation warning, but closing the same tab using the tab's X button or the middle mouse button closes it immediately without showing the warning.
I am not sure whether this difference is intentional, but the behavior is inconsistent and allows mouse-based tab closing to bypass the existing close confirmation safeguard.
Steps to reproduce
Open a terminal tab in a state where closing it with Cmd+W triggers a confirmation warning.
Press Cmd+W.
Observe that a close confirmation dialog appears.
Cancel the dialog.
Click the X button on the same tab.
Observe that the tab closes immediately without confirmation.
Repeat with another tab, using the middle mouse button on the tab.
Observe that the tab again closes immediately without confirmation.
Expected behavior
All methods of closing the same tab should follow the same confirmation policy:
Cmd+W
Clicking the tab's X button
Middle-clicking the tab
If the warning is intentionally shown only for keyboard-based closing, it would be helpful to clarify the intended behavior.
Actual behavior
Cmd+W: shows a close confirmation warning.
Tab X button: closes immediately without warning.
Middle mouse button: closes immediately without warning.
Impact
The X button and middle-click can bypass a safeguard that is present when using Cmd+W. This makes it easier to accidentally close a tab, especially because middle-clicking may happen unintentionally.
Additional context
Middle-click-to-close itself appears to be an intended tab behavior. The issue is specifically that it does not use the same confirmation flow as Cmd+W.
Could you confirm whether this behavior is intentional? If not, mouse-initiated tab closes should probably go through the same close-confirmation logic as the keyboard shortcut.
Plan: Cmd+W already routes through handleRequestClosePane (child-process / agent confirm via CloseTerminalDialog). Tab X and middle-click call closeTerminalTab directly, which only has the pinned guard. I'll put the same running-process confirmation on closeTerminalTab (store-driven dialog so keyboard/menu/X/middle-click share one policy), and ensure the already-confirmed Cmd+W path re-enters with force so we don't double-prompt.
Verified on current tree / Orca 1.4.154. Running-process close confirmation only runs on the Cmd/Ctrl+W → pane close path. Tab X and middle-click skip the process probe and close immediately.
Click the tab X → tab closes immediately with no dialog.
Start another long command; middle-click the tab → same immediate close.
Automated re-run
# Show keyboard path has inspectRuntimeTerminalProcess / handleRequestClosePane
rg -n "handleRequestClosePane|inspectRuntimeTerminalProcess|closeActivePane" \
src/renderer/src/components/terminal-pane/
# Show mouse path closes via closeTerminalTab without that probe
rg -n "handleCloseTab|closeTerminalTab|button === 1" \
src/renderer/src/components/Terminal.tsx \
src/renderer/src/components/tab-bar/SortableTab.tsx
pnpm exec vitest run --config config/vitest.config.ts \
src/renderer/src/components/terminal/repro-10142-close-confirm-keyboard-vs-mouse.test.ts
Fix direction
Route tab X / middle-click through the same handleRequestClosePane / process-confirm policy as Cmd+W (or call a shared helper before closeTerminalTab when the tab has a live PTY with children).
Activity
innocarpe commentedon Jul 23, 2026
I'd like to take this.
Plan: Cmd+W already routes through
handleRequestClosePane(child-process / agent confirm viaCloseTerminalDialog). Tab X and middle-click callcloseTerminalTabdirectly, which only has the pinned guard. I'll put the same running-process confirmation oncloseTerminalTab(store-driven dialog so keyboard/menu/X/middle-click share one policy), and ensure the already-confirmed Cmd+W path re-enters withforceso we don't double-prompt.PR shortly.
nwparker commentedon Jul 24, 2026
Reproduction status: has_repro (code-path conclusive)
Verified on current tree / Orca 1.4.154. Running-process close confirmation only runs on the Cmd/Ctrl+W → pane close path. Tab X and middle-click skip the process probe and close immediately.
Policy split
keyboard-handlers.ts→onRequestClosePane→TerminalPane.handleRequestClosePaneinspectRuntimeTerminalProcess+CloseTerminalDialog)SortableTab→onClose→Terminal.handleCloseTab→closeTerminalTabguardPinnedTabClosefor pinned tabs)Key code
src/renderer/src/components/terminal-pane/TerminalPane.tsx(~1289–1317) — probes child processes, may openCloseTerminalDialogsrc/renderer/src/components/tab-bar/SortableTab.tsx(e.button === 1→onClose)onClosesrc/renderer/src/components/Terminal.tsxhandleCloseTab→closeTerminalTab(no process inspection)UI re-run
sleep 300(or any long-running process).Automated re-run
Fix direction
Route tab X / middle-click through the same
handleRequestClosePane/ process-confirm policy as Cmd+W (or call a shared helper beforecloseTerminalTabwhen the tab has a live PTY with children).fix(terminal): confirm running process on tab X / middle-click close
fix(terminal): adopt the double-activation guard and layout pty looku…
fix(terminal): apply the running-process close confirmation to every …
fix(terminal): bound the window-close probe so a stalled inspect cann…
fix(terminal): apply the running-process close confirmation to every …