Skip to content

P1: Isolate terminal replies, drafts and command history when switching threads #1182

Closed

Description

@currentbits

Audit #1180, 2026-09-10. Baseline: checkout 9fc8645; fetched origin/main bf6fb02 has identical relevant implementation. This is implementation backlog, not a shipped fix.

Reproduced

Mounted the actual TerminalPane with the existing DOM harness:

  1. Open A, submit echo A, and defer the write promise.
  2. Switch the same pane to B; its open reply displays B.
  3. Resolve A's write with non-reset text "late A" and its new cursor.
  4. B now contains A's output. ArrowUp in B also recalls echo A.

Both outcomes were asserted against the rendered component. This is a deterministic simulated-transport check, not a desktop screenshot test.

Cause

src/components/TerminalPane.tsx: submit/restart promise chains call applyState without checking the current thread/session generation. Open/poll have cleanup guards; mutations do not. The thread-change effect also retains draft and history refs. Late replies can overwrite B's cursor, cwd and running state. Rejected writes clear the draft and silently swallow errors.

Acceptance

  • Old thread/restart replies never alter the active pane, including A to B to A.
  • Scope history and preserve unsent command drafts by thread.
  • Recover the draft on rejected write and show actionable errors for write/restart failures.
  • Cover delayed write/restart, thread switches and failed submission.
  • Preserve cursor/reset recovery and integrate the same-session overlap work from Overlapping terminal reads duplicate scrollback on slow connections #934.

Distinct from #934: that ticket concerns overlapping deltas within one session. This concerns session ownership and unsent command state. Check its landed branch before editing shared cursor handling.

Activity

  1. added
    plan:doing
    plan:done
    and removed
    plan:todo
    plan:doing
    on Oct 9, 2026
  2. currentbits commented on Oct 9, 2026

    @currentbits
    OwnerAuthor

    Obsolete: the piped line-input terminal with its own history was replaced by the xterm PTY, and pushes are filtered by threadId + termId (TerminalPane.tsx:162). Closing in the 2026-10-09 board cleanup (#1532).

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

    plan:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions