A new terminal could reattach to an old shell after a refresh

Fixkamo-internal
Shipped
September 3, 2026 at 8:08 PM UTC
Author
Kamo
Commit
80d8a02

The shell was keyed on the tool window's id, and @kamo/tool-core builds those as `${toolId}-${++idCounter}` from a counter that RESETS on every page load. So the first terminal opened after a refresh was `terminal-1` again and reattached to whatever the last `terminal-1` had left running — opening a terminal would sometimes hand you half-finished work belonging to a window you had closed. That is the opposite of what was asked for: each instance opened should be a new terminal instance. The shell now has an identity of its own, minted at the click and passed as a window PROP. The tool-window snapshot persists props verbatim, so both halves hold: a newly opened window is a new shell, and a window that comes back from a refresh, a restore or a dropped connection reattaches to exactly its own. The id is random, and constrained to the character class SecurityService and the agent both enforce — tmux reads `.` and `:` as window and pane addressing, so a name carrying them names the wrong thing rather than failing. Tests pin the behaviour rather than the implementation: two clicks produce two different session ids, the id never matches the `terminal-<n>` window-id shape, and 500 successive ids are distinct and all within the accepted character class. 411 test files / 5139 tests, tsc and the production build all clean.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing