Skip to content

A kept-alive claude CLI that stops reading stdin hangs the turn silently, forever #178

Closed

Description

@currentbits

Problem

Recorded as the standing remainder in docs/ISSUES.md:9: a kept-alive claude CLI child that stops reading stdin without ever exiting hangs the turn silently, forever. The respawn-on-exit fix only triggers on process exit, and the phantom-hold only resolves on exit or real content. Grep for any watchdog/stall timer in electron/runner.js: nothing. Wall-clock watchdogs were rejected for good reasons (slow first tokens, see ISSUES.md:6), so this needs a different signal.

Impact

This is the same "turn checkmarks then nothing happens" class as #17, which took three rounds to fix; the remaining variant has no detection at all. The thread sits at "working" with all activity lost to the void.

Fix direction

Options to evaluate: a stdin-write ACK from the CLI protocol, a per-turn correlation id if the CLI grows one, or a very long (10+ min) stall that at least surfaces the state to the user without auto-killing.

Activity

  1. added
    bug
    plan:todo
    plan:doing
    and removed
    plan:todo
    on Aug 16, 2026
  2. currentbits commented on Aug 17, 2026

    @currentbits
    OwnerAuthor

    Probe of the real claude CLI 2.1.219 (grok worker, logs /tmp/solenta-178-probe.log) settles the fix direction: a reused kept-alive child ACKs a stdin turn in milliseconds, long before any model work.

    Turn 2 delivered on the live child's stdin:

    • command_lifecycle {"state":"queued"} at +0ms (carries command_uuid = the uuid we set on the user line — the per-turn correlation id ISSUES.md wished for)
    • system/init at +31ms (+46ms in a second run without the uuid)
    • first thinking_tokens only ~800ms later

    So the old objection ("no timeout can be short enough to catch a dead CLI and long enough to survive a slow first token") does not apply: we time the first LINE of any kind, not the first token, and only on the warm reuse path.

    Fix: on reuse only, a 60s no-any-event timer kills the wedged child; the existing exit-triggered respawn at electron/runner.js:2040 then resumes the same session. No new respawn logic, no CLI flag.

    Rejected: --replay-user-messages (echo arrives late, after thinking, and would feed our own prompt back through the <task-notification> scan at runner.js:1642).

    Aside: the comment at runner.js:2205 ("a reused process emits no second system/init") is wrong for 2.1.219 — turn 2 does emit one.

  3. added
    plan:done
    and removed
    plan:doing
    on Aug 17, 2026
  4. added a commit that references this issue on Aug 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

    bugplan:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions