Skip to content

fix(app): ignore collapsed side-panel tabs when closing a tab - #54695

Merged
Hona merged 1 commit into
devfrom
side-panel-close
Oct 12, 2026
Merged

Hona merged 1 commit into
devfrom
side-panel-close

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

Why

When a session has an unpinned file, context, or search tab selected in the side panel and the user collapses the side panel, pressing ⌘W (Ctrl+W) to close the active session tab fails to close the session tab. Instead, file.close remains registered for the hidden side-panel tab, and because its when guard gives it higher priority than tab.close, each ⌘W silently closes a hidden side-panel tab in the background before the session tab finally closes.

What Changes

closableTab() in useSessionCommands now checks actions.session.layout.view().side.opened() before returning the selected unpinned side-panel tab. file.close is only registered while the side panel is open.

Side panel state Selected side-panel tab Pressing ⌘W (Ctrl+W) — Before Pressing ⌘W (Ctrl+W) — After
Open Unpinned tab (guide.md, Context, Open file) Closes the side-panel tab Closes the side-panel tab
Open Pinned Changes tab Closes the active session tab Closes the active session tab
Collapsed Unpinned tab (guide.md, Context, Open file) Silently closes the hidden side-panel tab; session tab stays open Closes the active session tab and preserves the side-panel tab
flowchart TD
    A["User presses ⌘W / Ctrl+W"] --> B{"Side panel open?<br/>view().side.opened()"}
    B -- "No (collapsed)" --> C["tab.close closes active session tab"]
    B -- "Yes (open)" --> D{"Selected side tab unpinned?"}
    D -- "No (Changes)" --> C
    D -- "Yes (file / Context / Open file)" --> E{"Focus inside extension scope?"}
    E -- "No" --> F["file.close closes selected side-panel tab"]
    E -- "Yes" --> G["Extension-scoped shortcut handles event"]
Loading

Demo

Side-by-side Playwright capture comparing origin/dev (03cb9b9946) on the left and this branch (b657c94e89) on the right using a mocked workspace server:

side-panel-close-demo.mp4

Scope

This PR scopes file.close (closableTab()) in packages/app/src/session/commands/use-session-commands.tsx to require an open side panel and extends the session review state E2E regression test in packages/app/e2e/regression/review.spec.ts.

Verification

bunx playwright test e2e/regression/review.spec.ts e2e/regression/tabs.spec.ts e2e/regression/command-palette.spec.ts
bun run --cwd packages/app test:unit
bun run check
  • Confirmed the updated restores review state and the side-panel tab per session E2E test in packages/app/e2e/regression/review.spec.ts fails against origin/dev ([data-titlebar-tab-slot] for Alpha review state remains at count 1 after pressing Ctrl+W with the side panel collapsed) and passes with the fix.
  • e2e/regression/review.spec.ts, e2e/regression/tabs.spec.ts, and e2e/regression/command-palette.spec.ts: 41 passed.
  • packages/app unit suite: 742 passed across 107 files.
  • Full bun run check: 0 errors across all 36 typecheck and lint tasks.

@opencode-agent opencode-agent 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.

The fix works. I reproduced the bug on the base by running the PR's updated review.spec.ts against it: with the side panel collapsed, Ctrl+W left the Alpha review state session tab open. On this branch, e2e/regression/review.spec.ts and e2e/regression/tabs.spec.ts pass (34 tests), and packages/app type-checks cleanly.

Both closeTab and the registration of file.close read closableTab(), so the one guard covers both. The test addition is small and uses auto-waiting assertions only.

Public API: unchanged (this only changes how the app scopes a command internally).

No concerns.

@Hona
Hona merged commit 3e78cd5 into dev Oct 12, 2026
11 checks passed
@Hona
Hona deleted the side-panel-close branch October 12, 2026 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants