Skip to content

Terminal shortcuts can reopen the drawer on a terminal that is still closing #27

Closed as duplicate

Description

@viktorce

The new-terminal and split shortcuts can open the drawer on a terminal that is still closing. That terminal then disappears once its close finishes.

Found in review of #26. Not reproduced in the app.

When it happens

All of these must hold:

  1. terminal.new, terminal.split or terminal.splitVertical is bound without when: "terminalFocus". The defaults (mod+n, mod+d) have that condition, so they never reach this path with the drawer closed.
  2. The drawer is closed and the thread has no terminals.
  3. The shortcut fires before the server finishes closing the thread's last terminal, which is within one round trip of the close.

Cause

The shortcuts open the drawer with openTerminalIfClosed in apps/web/src/components/chat/useChatTerminalActions.ts, which calls setTerminalOpen(true). On an empty drawer the store fills in term-1 without checking closingTerminalIds. The terminal button avoids this: toggleTerminalVisibility skips ids that are still closing.

While the close is in flight the server still lists term-1, so the drawer records it. When the close lands, the server drops it, and the drawer closes the new term-1 as closed elsewhere.

Suggested fix

On a closed, empty drawer, have the shortcuts open it through toggleTerminalVisibility, as the button does.

Activity

  1. viktorce commented on Nov 19, 2026

    @viktorce
    OwnerAuthor

    Closing as a duplicate of #22, which #26 fixes.

    I tried this in the real app with a scenario that matches the steps above: a New Terminal rule without when: "terminalFocus", and a shell that ignores SIGHUP, so the server takes its full 1 s grace period to close it. The shortcut was pressed right after Confirm, while the old terminal was still closing.

    The code path described above is still there, but it has no visible effect once #26 is in. Only New Terminal on a local connection was tested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken or behaving incorrectly.severity: lowMinor problemvalue: lowSmall payoff

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions