Skip to content

terminal: two cursors in the architect terminal on Windows (Spec 1658 finding M2) #1917

Closed

Description

@amrmelsayed

Problem

On native Windows the architect terminal in the dashboard shows two cursors at once: claude's own drawn cursor and the terminal's cursor. Cosmetic; input and output are correct. Recorded 2026-11-02 on the owner's machine as finding M2 (scenario 3) in codev/reviews/1658-windows-native-non-wsl-support.md, still present at the 2026-11-10 re-check.

What we know

From the Spec 1658 ConPTY render-gate work (finding M15): under ConPTY, claude 2.1.326 sometimes draws a software cursor (an inverse cell over the dim command suggestion) with the hardware cursor hidden, and ConPTY's repaints park that hidden hardware cursor at the end of the last row. The six committed ConPTY captures (packages/codev/src/agent-farm/__tests__/fixtures/gate/conpty/) show the byte stream. The dashboard terminal (xterm.js) may be rendering the hardware cursor even when the stream hid it, or ConPTY may re-show it on repaint; which one is the first thing to establish from the captures.

Fix shape

  1. Replay the committed idle capture in the dashboard terminal and confirm whether the second cursor is drawn by xterm.js (cursor visibility state not tracking DECTCEM across ConPTY repaints) or arrives in the stream (ConPTY re-showing the cursor).
  2. If xterm.js: track cursor visibility from the stream in the terminal component and hide the block cursor while the app has hidden it. If ConPTY: decide whether a Tower-side normalisation is warranted or whether this stays documented as a known cosmetic.
  3. Confirm POSIX terminals are unaffected (the existing macOS render-gate fixtures).

Acceptance

  • One cursor in the architect terminal on Windows while claude is idle with a command suggestion showing and while it is drawing output.
  • No change to POSIX rendering; the ConPTY replay suite stays green.
  • The review's M2 entry records the cause.

Related: Spec 1658 (M2, M15), #1658.

Activity

  1. added
    area/terminal
    on Nov 17, 2026
  2. amrmelsayed commented on Nov 17, 2026

    @amrmelsayed
    CollaboratorAuthor

    Architect finding (2026-11-18): one confirmed cause, one open question

    Confirmed: Tower's replay snapshot drops the cursor-hidden state. On every attach (dashboard load, tab reopen, VS Code terminal open) Tower sends SessionScreen.serialize() (packages/codev/src/terminal/session-screen.ts:207, used by PtySession.replaySnapshot) instead of the raw history. @xterm/addon-serialize 0.14.0 does not carry DECTCEM. Minimal check against the repo's installed @xterm/headless 6.0.0:

    write:      ESC[?25l hello ESC[7m T ESC[27m ry ESC[5;40H
    serialize:  "hello \x1b[7mT\x1b[0mry\x1b[4B\x1b[30C"     (no ESC[?25l)
    

    So after an attach the client xterm.js draws its block cursor although the app hid it. This fits the empty-prompt symptom: in fixtures/gate/claude-conpty-ghost-idle.replay.bin.gz claude hides the cursor once at startup (last DECTCEM in the stream is ?25l), draws its software cursor at the composer's first input cell, and ConPTY leaves the hidden hardware cursor parked at the end of the last row, which is where M2 reports the second cursor. An idle claude never re-sends the hide, so it persists. On POSIX the hardware cursor sits under the inverse cell (per M15), so the same loss would be invisible there; that is an inference, not tested.

    So the issue's "xterm.js or ConPTY" fork has a third answer for this part: neither, it is the snapshot.

    Open: the second cursor "beside it while typing". In conpty-claude-draft.capture.jsonl.gz ConPTY explicitly shows the hardware cursor next to the typed text (?25l r ESC[K ... ESC[38;4H ?25h). That capture was recorded unfocused and has no software cursor (no ESC[7m), so it cannot say what the live stream does when both are on screen. One capture recorded with the window focused, while typing, discriminates this. If the live stream really shows the cursor there, that half is ConPTY/claude behaviour and the fix-or-document decision in the issue's step 2 still applies to it.

    Fix shape for the confirmed part: have the snapshot append ESC[?25l when the mirror's cursor is hidden (the headless terminal knows the state). This touches reconnect replay on every platform, so the round-trip suite (session-screen-serialize.test.ts) needs a hidden-cursor case, and POSIX replay must be shown unchanged otherwise.

  3. amrmelsayed commented on Nov 17, 2026

    @amrmelsayed
    CollaboratorAuthor

    On it! Working on this with the PIR protocol (plan + dev-approval gates before PR).

  4. added 16 commits that reference this issue on Nov 17, 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

    area/terminal

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions