Skip to content

Cursor CLI turns stall: pin-task hook waits for stdin EOF, then the watchdog fires #691

Closed

Description

@currentbits

Symptom

Cursor provider threads (especially GPT-5.6 Sol High) keep showing the #314 watchdog banner: "No output from the cursor CLI for 10 min — the turn may be hung." Users Stop and retry. The queued follow-up sits behind the hung turn.

This is not a one-off. Live store forensics today: 11 Cursor stall events on 4 threads. Two current Sol High threads stalled 2x and 5x respectively this morning.

What the transcripts show

Two stall shapes, both Cursor-specific:

  1. After an assistant line, no next tool_call. The CLI stays alive until Stop. sessionId is never persisted (we only write it on exit 0), so retry cannot --resume.
  2. During / between Task calls. Some of those later resume on their own after ~10–14 min (false hung). Others the user kills. Several Task/Shell cards stay OPEN forever next to a second card with the same call_id marked done.

checkStalls is doing what #314 asked: it is advisory and does not kill. The banner is correct that stdout is quiet. The CLI is often blocked before the next tool_call.started, so Solenta has nothing to stamp.

Root cause

Cursor -p suppresses thinking events, so long model think is already silent. On top of that, Solenta injects --plugin-dir for #686 (solenta-pin-task-parent). The hook script waits for stdin end before writing {permission:"allow"}.

Cursor hook docs: command hooks get JSON on stdin and must reply on stdout. Tests drive the hook with execFileSync({input}), which closes stdin. Live Cursor may write one JSON object and keep the pipe open. Then:

  • hook never replies
  • Cursor blocks in preToolUse (matcher Task|Agent)
  • no tool_call.started is emitted
  • last visible event is the previous assistant / completed Task
  • 10 min later the watchdog fires

That matches the after-assistant stalls (next tool never appears) and the stalls that later resume (platform hook timeout, fail-open).

Related Solenta bugs that make the same hang worse:

  • Cursor call_id is call_…\nfc_…. We store the whole thing. Duplicate started events overwrite toolMsgById and leave the first card OPEN.
  • AskQuestion is treated as a normal tool. It completes with empty output (--force / no TTY). The user never sees a question card. Not the 10-minute block itself, but the Screenify-shaped "I'll show you mockups" turn started from an unanswered question.

Fix

  1. Pin-task hook: reply as soon as one JSON object is parseable. Do not wait for EOF. Fail-open on a short timeout. Set timeout on hooks.json.
  2. Persist sessionId from system/init, not only on successful exit, so Stop+retry can --resume.
  3. Normalize Cursor call_id to the first line and ignore duplicate started events.

Do not weaken checkStalls by treating leftover OPEN tools as liveness — those leftovers are the pairing bug.

Test plan

  • Hook: write JSON to stdin and do not close the pipe; expect {permission:"allow"} promptly.
  • Cursor run: system/init stores sessionId while status is still working; Stop keeps it.
  • Duplicate tool_call.started with the same (newline) call_id produces one done tool card, not an OPEN leftover.

Activity

  1. added
    bug
    plan:doing
    on Aug 24, 2026
  2. currentbits commented on Aug 24, 2026

    @currentbits
    OwnerAuthor

    Implemented on this branch. Live store had 11 Cursor stall events (4 threads); two Sol High threads stalled 2x and 5x this morning.

    What landed:

    1. Pin-task hook replies as soon as one JSON object parses. It no longer waits for stdin EOF. 2s fail-open + hooks.json timeout 5s.
    2. sessionId is written from system/init, so Stop+retry can --resume.
    3. call_id is normalized to the first line; duplicate started events do not leave an OPEN leftover card.

    Verified: node --test electron/test/cursor-pin-task-parent.test.js electron/test/cursor-parse.test.js electron/test/cursor.test.js — 45 pass / 0 fail.

    Still open, not this PR: Cursor AskQuestion completes with empty output under --force and never becomes a question card. Separate from the 10-minute block.

  3. added
    plan:done
    and removed
    plan:doing
    on Sep 6, 2026
  4. currentbits commented on Sep 6, 2026

    @currentbits
    OwnerAuthor

    Shipped. electron/cursorPinTaskParent.js replies as soon as one JSON object parses, with a 2s fail-open; it no longer waits for stdin EOF. The file cites this issue in the comment at the hook.

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