[Bug] Stopped background agents resurface as "no completion record" warnings after CLI restart
Bug Description
A background agent that the user manually stopped resurfaces after a Claude Code
process restart with a "No completion record was found for background agent …"
warning, which suggests resuming it via SendMessage. The agent had been
deliberately stopped days earlier and its work was already superseded by a
relaunched agent. Impact is cosmetic — no data loss — but the warning is
confusing, since it implies an unknown-state task that was in fact intentionally
terminated.
Steps to Reproduce
- Launch a background agent (e.g., via the Agent tool).
- Manually stop it from the UI while it is running.
- Restart the Claude Code process (quit and reopen, continuing the same conversation).
- Observe the task notifications in the resumed session.
Expected Behavior
The user-initiated stop is persisted as a terminal state; no warning appears
after restart.
Actual Behavior
The resumed session emits "No completion record was found for background agent
… It may have been stopped, or it may have been running when the previous
Claude Code process exited …" and suggests resuming the agent.
Environment
- Platform: macOS (Darwin arm64)
- Terminal: Apple_Terminal
- Claude Code version: 2.1.220
- Related Feedback ID: 97b6b226-fae5-4dd5-977a-a7b7fb73d033 (background agents
missing from terminal status area — likely the same task-ledger subsystem)