Skip to content

Terminal button needs two clicks after another client closed the hidden drawer's terminal #28

Open

Description

@viktorce

If another client closes the terminal while your drawer is hidden, the next click on the terminal button does nothing. A second click opens the drawer with a new terminal.

hidden-drawer.mp4

Steps

  1. Open a thread, open the drawer with the terminal button, then hide it again.
  2. Close that terminal from another client: another browser, the phone app, or t3 on the server.
  3. Click the terminal button.

Expected: the drawer opens with a new terminal.
Actual: nothing visible happens. The second click opens it.

Reproduced in the web app with the fix from pingdotgg#39260 applied (b7ba5aac22). That fix doesn't touch this path, so main should behave the same, but I only checked that by reading the code.

Cause

A hidden drawer unmounts, so reconcileTerminalIds stops running for that thread. The store still lists term-1 locally and still remembers seeing it on the server. The terminal button finds a local terminal and only opens the drawer. The drawer mounts, its first reconcile sees the server dropped term-1, and it closes it. With no terminals left, the drawer closes.

The same stale id can affect project scripts. From the same state, findReusableProjectScriptTerminal can pick term-1, and the first reconcile closes it, so the script runs in a terminal the drawer no longer shows. This part was found in review and checked in a store test, not in the app.

Suggested fix

Bring the thread's terminal ids up to date with the server before the drawer opens or a script picks a terminal.

Activity

  1. added
    bugSomething is broken or behaving incorrectly.
    readyReproduced in the app, with a recording
    on Nov 19, 2026
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.readyReproduced in the app, with a recordingseverity: mediumProblem is real but containedvalue: mediumWorth doing when nearby

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions