Skip to content

Claude ACP background task progress is dropped on the stable line #291

@tiagoefreitas

Description

@tiagoefreitas

Summary

Claude ACP sessions can appear to stall in sandbox-agent after Claude transitions into background task notifications.

On the stable sandbox-agent v0.4.2 line, the observed failure mode is:

  • long-running Claude turns stop producing persisted ACP updates after background task activity begins
  • sandbox-agent can still be working underneath, but downstream consumers only see a stale event stream
  • this leads to stalled turns and transcript-only recovery paths instead of normal ACP completion

Root Cause

The installed Claude ACP adapter drops these Claude system events instead of surfacing them as ACP session/update notifications:

  • task_started
  • task_notification
  • task_progress
  • hook_progress
  • files_persisted

That means sandbox-agent persistence receives no new ACP envelopes while Claude is still actively working in the background.

Separately, older Claude ACP installs also need to opt into session_state_changed so idle can terminate the turn cleanly.

Repro Shape

  1. Run sandbox-agent stable v0.4.2 with a Claude agent process install from the older Zed package line.
  2. Start a Claude session that runs long enough to hand work to background tasks.
  3. Observe that normal assistant text may have already streamed, but persisted ACP events stop advancing during the background-task window.
  4. Downstream consumers see an apparently stalled session until transcript-based recovery or manual intervention.

Expected

  • Claude background task activity continues to arrive via ACP session/update
  • session persistence keeps advancing during background work
  • the turn finishes via normal ACP completion (end_turn / idle path), without transcript-only recovery

Proposed Fix

In the stable line installer path:

  • patch installed Claude ACP adapter builds to opt into CLAUDE_CODE_EMIT_SESSION_STATE_EVENTS=1 when needed
  • forward dropped Claude background-task system events as ACP session/update notifications instead of discarding them
  • keep the fallback Claude ACP pin current enough to include the idle/end-turn behavior (0.23.1 instead of 0.20.0)

I have a fork-side patch prepared for this and will open a PR linked to this issue.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions