Skip to content

v2 UI: closing a pane destroys a builder session with no confirmation and no undo (proposed FR-49) #66

Open

Description

@pseudoseed

Proposed requirement for the Codev v2 UI (#37). Independent of which tiling library is adopted.

Rewritten after the main architect argued the first version's fix was wrong. It was. The original proposal — confirm-or-undo on close — is preserved at the bottom along with why it was rejected.

The observation

Found during the iPad spike (#62), on first contact with a real finger: the human tapped a tab and closed it. Measured gap between the tab's hit region and the close button's is 0 pt — the X is a child of the tab, nested rather than adjacent, so CSS cannot fix it.

That is a dockview detail. This issue is the part that is not.

The actual defect

Closing a pane must not destroy a builder session. The pane is a viewer. It has never been the owner.

Tower already works this way. PtySession holds its clients in a Set and adds and removes them independently of the process (pty-session.ts:153,615,698). Spike 1 (#38) confirmed attach fans out to multiple clients. FR-8 already states the principle for hiding: a pane hidden by tab-switching keeps its process, scrollback and connection.

So a client that destroys a session when its pane closes is inventing an ownership relationship the server does not have. The bug is not a missing safeguard; it is a coupling that should never exist.

Proposed FR-49

FR-49 (MUST) Closing a pane detaches a viewer. It MUST NOT terminate the PTY, the process, or the builder session behind it. Reopening a pane for that node reattaches to the same live session, with scrollback intact.

Destroying a builder MUST be a separate, explicitly-named action — the UI equivalent of afx cleanup — and MUST NOT be reachable from the pane's close control.

Consequences, all of which fall out rather than needing to be designed:

  • Close is non-destructive, so it needs no confirmation and cannot cause confirm fatigue.
  • Undo becomes trivially correct, because there is nothing to restore.
  • FR-22's separation problem stops being safety-critical. Mis-tapping close becomes an annoyance rather than data loss, which is the right severity for a gesture that easy to trigger.
  • The tab-hit-region question returns to being a usability issue that any library must satisfy, decided on its own merits.

Why undo was the wrong fix

The first version of this issue proposed confirm-or-undo. main rejected both, correctly.

Confirm-on-close trains dismissal; by the time it is reflexive it protects nothing.

Undo is worse, because it cannot work here. Undo requires the thing to be restorable, and a destroyed builder is not: cleanup-and-respawn is forbidden by this repo's irreversible-acts rules, --resume reattaches the same conversation rather than giving a fresh context, and on the opencode harness (#60) there is no recovery at all. So "undo" would mint a fresh builder wearing the same name with an empty head — and report success.

That is this codebase's signature failure mode, in a new place: an operation that cannot distinguish "I restored it" from "I made a new one" and returns the reassuring answer. lessons-critical.md already names it — "I could not tell" must never be spelled the same way as "no" — and an undo that silently hands back a lookalike is exactly that.

If sessions must die with their pane

If some constraint I do not know about forces that coupling, then undo beats confirm — but the undo must state plainly what it restored and what it could not, rather than returning a lookalike silently. That is the fallback, not the plan.

Credit

The defect was recorded by the #62 spike as an FR-22 separation failure against dockview. The observation that it is library-independent, and the argument that undo is the wrong remedy and decoupling is the right one, are both the main architect's.

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

    area/dashboardfork-only

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions