Skip to content

Same-id wake of a mounted terminal-view agent leaves the xterm frozen on the dead process #1281

Closed

Description

@Juliusolsson05

cleanupSessionState deletes agentPtyAttachCounts[P] when the process exits, while the terminal-view pane stays mounted (AgentTerminalLeaf attaches once per sessionId). A same-id wake (deliverTextToSession, control/agents.ts, requestServerRestart) starts a new process whose bytes are buffered but never forwarded (count > 0 is false): the screen stays on the dead process while keystrokes reach the new one unseen, until a remount. Plain terminals do the same via terminalAttached. Severity P2.

Found by the Stage 3 C2 hunt; lines are origin/main 9c6e48f. Findings file: temp/quality-loop/hunt-c2.md.

🤖 Generated with Claude Code

Activity

  1. Juliusolsson05 commented on Sep 25, 2026

    @Juliusolsson05
    OwnerAuthor

    PR #1311 fixes the agent half: the raw PTY attach count and restore size now survive process cleanup, and only the view's own detach releases them. Residual: plain terminals (terminalAttached) have no renderer detach call at all, so the same fix would leak one id per closed terminal. That half needs a detach first and stays open here.

  2. added
    type:bugSomething works wrong
    class:C2-identityIdentity/ownership across reload, replace, restore, wake
    sev:P2Real bug with a workaround
    on Sep 25, 2026
  3. Juliusolsson05 commented on Sep 25, 2026

    @Juliusolsson05
    OwnerAuthor

    Status after #1311 (merged via batch #1318, 2026-09-25).

    Fixed (agent terminal view): PTY attach counts are owned by the renderer page and survive a same-id wake. A reload or crash releases a page's attaches, and each attach carries its page document, so a late detach from a dead page cannot take the live page's reference. The debug inline terminal releases only an attach main accepted. A mounted agent terminal keeps receiving the new process's output.

    Still open: plain terminals have the same frozen-after-wake shape via terminalAttached.

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 isn't workingclass:C2-identityIdentity/ownership across reload, replace, restore, wakesev:P2Real bug with a workaroundtype:bugSomething works wrong

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions