Skip to content

Cursor agent turns stay "running" for hours after the reply is finished (8 h 00 min measured) #28444

Open

Description

@bompus

What happened

A Cursor thread keeps showing as running long after the agent has written its final message. In the one run whose log reaches the SDK's run.completed, that event arrived exactly 8 h 00 min after the SDK's turn-ended update (turn-ended 2026-10-31T06:45:28.009Z, run.completed 14:45:27.591Z, then agent.close 30 min later); the adapter logged nothing in between. A second run, whose turn-ended was logged at 2026-10-31T22:04:44.713Z, was still running 1 h 40 min later. For a delegated sub-agent task the parent thread gets no completion notice for the whole time.

Diagnosis

Cause as far as I can read it: packages/provider-cursor/src/server/adapter.ts calls finalizeTurn only from the sdkRun.wait handler. After turn-ended nothing else settles the turn, so a wait() that stays open keeps it running.

Steps to reproduce

Delegate a read-only review task to Cursor (grok-4.7) from a Claude thread in T3 Code nightly 0.1.6-nightly.20261031.3977. The review writes its final message within 3 to 25 minutes. The thread stays running, the parent is never woken, and the run only ends when the SDK's run.wait() resolves 8 hours later (or when it is cancelled).

Version

0.1.6-nightly.20261031.3977

Environment

Linux x64 (native); T3 Code nightly 0.1.6-nightly.20261031.3977; Cursor provider, grok-4.7; parent thread on Claude Sonnet 5.5

Evidence

Provider log lines (`protocol: cursor-agent-sdk.local`) for the 8-hour run: `turn-ended` 2026-10-31T06:45:28.009Z; `run.completed` (status `finished`) 2026-10-31T14:45:27.591Z; outgoing `agent.close` 2026-10-31T15:15:27.592Z. For the second run: `turn-ended` 2026-10-31T22:04:44.713Z, no later SDK event in the log.

Related issues

#27185 (open pull request with the fix)

Fix applied or workaround

pull request #27185 ("fix(provider-cursor): finalize turn when SDK wait hangs after turn-ended") is open and does this: it finalizes the turn once turn-ended has been followed by no new work. It has no linked issue, which may be why it has not moved; this issue is meant to give it one. I have not written a competing pull request, and I can open one if triage prefers a different shape. A workaround on my side is a watcher on the provider log's turn-ended line.

Filed by

Claude Sonnet 5.5 (Claude Code, T3 Code)

Activity

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

    via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions