Skip to content

[Bug]: Cursor ACP backgrounds a shell, ends the turn, and never comes back #13284

Description

@Jonathanm10

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Use the Cursor provider (agent acp / cursor-agent ACP).
  2. Ask it to run a long shell with block_until_ms: 0 (or otherwise background the shell) and to end the turn saying it will come back when finished.
  3. Wait well past when the shell would complete. Do not send another message.

Minimal bare-ACP repro (no T3 involved) also reproduces the silence:

# Prompt Cursor ACP to Shell `sleep 15 && echo BG_DONE` with block_until_ms: 0,
# reply BACKGROUND_STARTED_WILL_COME_BACK, end turn, no AwaitShell.
# After session/prompt returns stopReason=end_turn, wait 20s: zero session/update
# and zero cursor/* notifications follow. A later user prompt can report BG_DONE.

Expected behavior

After backgrounding work and promising to continue, the agent resumes when the shell finishes (same as Cursor’s interactive CLI harness), or clearly does not promise a comeback when the harness cannot wake it.

Actual behavior

session/prompt returns stopReason: end_turn. Nothing arrives afterward. The thread looks idle until the user prompts again; then Cursor can inspect the finished shell and report status.

Impact

Major degradation or frequent failure

Environment

  • Cursor CLI / agent acp (reproduced on 2026.09.18-9a7762b)
  • T3 Code Cursor provider (ACP adapter) — symptom matches; root cause is in Cursor ACP, not T3 dropping events

Additional context

Duplicate check (not duplicates):

Item Why related / why not a duplicate
#6644 (closed) Cursor subagent/Task Agents-panel + parent wake. Same “won’t continue without a nudge” class, but Task/subagent lifecycle — not background shells.
#9107 / #10295 Claude run_in_background shells missing from the timeline UI. Different provider and symptom.
#9139 Grok background shell task.* lifecycle. Different provider.
#13133 ACP assistant-segment fragmentation when background tools update mid-stream. Different failure mode.
#9047 Cursor adapter turn-lifecycle races / missing terminal events. Unrelated to post-end_turn shell wake.

Root cause (investigated against Cursor ACP + bare client):

  • Interactive Cursor CLI wakes via backgroundTaskCompletionAction when background work finishes.
  • Cursor ACP’s completion drain (subagent-completion-drain) only processes subagent completions and requeues non-subagent (shell) completions.
  • A bare agent acp client (no T3) sees the same silence after end_turn, so T3 is not dropping a wake notification — Cursor ACP never emits one for shells.
  • Shell tool calls often present as completed with empty stdout immediately when backgrounded, so T3 also has no live in_progress signal to keep backgroundLiveness honest.

T3-shaped options (not mutually exclusive):

  1. Upstream / protocol: Cursor ACP should drain shell completions into a follow-up turn the way interactive CLI does (and the way ACP already does for subagents).
  2. Adapter-boundary mitigation: Cursor-specific runtime instructions that the ACP harness will not resume after a backgrounded shell — await in-turn, or tell the user to send another message. Matches how T3 already patches harness gaps; does not invent synthetic user turns.
  3. Not preferred: Host-invented synthetic sendTurn without a provider wake signal — fights orchestration and Claude/Grok patterns (those continue only when the provider keeps streaming / emits task lifecycle).

Contribution

  • I would be open to helping implement this.

No activity

Activity on this issue will appear here.

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

    bugSomething is broken or behaving incorrectly.upstreamvia-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