Completed background-agent sessions can't be removed from the `claude agents` fleet view (persist as status:null; stop/close/rm don't clear them) — confirmed 2.1.210
Status Fixed / completed
Reported on v2.1.210
Maintainer reply ✓ Yes — bcherny
Activity 3 comments · opened Jul 15, 2026 · closed Aug 19, 2026
💡 Likely answer: A maintainer (bcherny, collaborator)
responded on this thread — see the highlighted reply below.
Summary
On the claude agents (fleet) view, a completed background session cannot be removed. It persists in the Completed list as status: null, the interactive close (Ctrl+X) clears the row but it reappears on refresh, claude stop <id> reports success yet leaves the entry listed, and there is no claude agents rm. The only way out is to manually delete the on-disk job record. Confirmed reproducing on 2.1.210 with a throwaway job (steps below).
Environment
- Claude Code
2.1.210, macOS (darwin). - Background/daemon mode. Job records live under
<config-dir>/jobs/<id>/.
Steps to reproduce (confirmed on 2.1.210)
claude --bg --name repro-delete-test "Output exactly REPRO_A_DONE then stop. Do not use any tools."- Let it finish.
<config-dir>/jobs/<id>/state.jsonshows"state": "done", andclaude agents --json --alllists it (status: "idle", settling tonull). claude stop <id>→ printsstopped <id>, butclaude agents --json --allstill lists it (status: null), and<config-dir>/jobs/<id>/state.jsonis still present on disk.stopnulls the status but does not remove the record.- There is no
claude agents rm/delete, and the fleet-view close (Ctrl+X) doesn't persist — the entry stays. Over repeated use the Completed list accumulates un-removable entries.
Only working removal: move <config-dir>/jobs/<id>/ aside on disk; the daemon then drops it from claude agents --json --all and the fleet view.
Expected vs. actual
- Expected: a finished session can be dismissed from the fleet view (via close,
stop, or anrm), and its record is removed. - Actual: no supported command removes a completed record; it lingers as
status: nulluntil the on-disk directory is manually deleted.
Not a duplicate of the auto-flagged issues
- #75540 — closed
NOT_PLANNEDas account-scoping / user error (switching between two accounts surfaced the other account's sessions; switching back cleared them). This report is a genuine on-diskstate: "done"record under a single account/config-dir that only clears by deleting the directory — a different, still-open problem. - #71562 — a different trust-flag persistence bug (
hasTrustDialogAcceptedstaying false in the same~/.claude.json). Related theme, not this defect. - #77649 — a different background-daemon lifecycle bundle (un-settled worker pins daemon;
--continuedrops permission mode; forks inherit auto/computer-use). Adjacent area, not the fleet-view removal defect.
Related secondary observations (lower priority; happy to split out)
- With the daemon running under a non-default
CLAUDE_CONFIG_DIR, accepting the interactive trust dialog writeshasTrustDialogAcceptedinto~/.claude.json, while the daemon reads<config-dir>/.claude.json. So the on-screen "run Claude Code interactively here once and accept the trust dialog" remediation targets a file the daemon doesn't consult. (Config-specific, not the core bug.) - Resuming a session into a workspace the daemon treats as untrusted loops
[bg] bg claimed-spare <id> (fleet)→[bg] bg settled <id> (killed)with no surfaced reason, leaving the session wedged onSession is starting — showing its transcript until it appears.
Suggested fixes
- Add a supported way to delete a completed record —
claude agents rm <id>and/or make the fleet-view close (and/orclaude stop) actually removestate: "done"/status: nullrecords from disk rather than just nulling status. - Point the trust remediation message at the config dir the daemon actually reads.
- Surface untrusted-resume failures with the remediation instead of silently retrying
claimed-spare → settled (killed).
3 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Not a duplicate — I reviewed all three flagged issues:
NOT_PLANNEDas account-scoping / user error (another account's sessions appearing after an account switch), explicitly not a delete bug.hasTrustDialogAcceptedstaying false in the same~/.claude.json).--continueperm-mode, fork inheritance).This report is the fleet-view completed-session removal defect, and I've confirmed it reproduces on 2.1.210:
claude --bga job that finishes →state: "done".claude agents --json --alllists it asstatus: null.claude stop <id>printsstopped <id>but the entry is still listed andjobs/<id>/state.jsonis still on disk —stopnulls the status without removing the record.claude agents rmexists; the only removal is manually deleting<config-dir>/jobs/<id>/.I've updated the issue body with the full repro. 👎'ing the auto-duplicate flag to keep it open.
Fixed in 2.1.214 — changelog: "Fixed completed background sessions being impossible to remove via
claude rmor the agent view once the background service had gone idle" (https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md). Closing — reply to reopen if it still happens on the latest version.🤖 Generated with Claude Code