Managed Claude actor: a resume that comes back under a new session id is retried forever (no fresh-session fallback, no backoff, nothing recorded)
Summary
A managed Claude actor (Agent View) became unable to start and stayed that way for hours: claude --bg --resume <stored id> came back as a new job with a new session id. cccc rejects that ("Claude Agent View copied a requested session instead of resuming it exactly"), kills the job and fails the start. Nothing then gives up or falls back, so the same resume is tried again and again.
Under 0.4.41 we counted 171 jobs launched and killed in 8.5 minutes, one about every 3 seconds, until we intervened. During that time the actor list said running: true, effective_working_reason: managed_agent_session_pending, runtime_session_last_resume_error: null, the daemon printed nothing, and messages for the actor were not delivered. actor_new_session fixed it at once.
I don't know why Claude Code stopped resuming that session in place (details below), and I could not reproduce it with a fresh session. This report is about what cccc does when it happens.
Environment
Linux (WSL2, Ubuntu 24.04). cccc built from main at c36a4e4c; the launcher, supervisor, trust watcher, delivery worker and runtime-session code are unmodified. Claude Code 2.1.286 (2.1.280 when it started).
What happened
Times are UTC, from Claude Code's own ~/.claude/daemon.log.
- The session was created on 2026-09-21 and resumed in place ten times, the last time on 09-30 18:06Z:
[2026-09-30T18:06:10.947Z] [bg] bg adopt: adopted=0 respawned=0 dead=1 [2026-09-30T18:06:11.061Z] [bg] bg spawned 7dd7751c (fleet) - After the next reboot the same command, with the same Claude Code (2.1.280), produced a new job, which cccc (0.4.40 then, same check) killed:
The actor was down. Messages addressed to it then made the delivery worker try to wake it: 102 launches killed in about six minutes.[2026-10-01T03:27:39.725Z] [bg] bg adopt: adopted=0 respawned=0 dead=1 [2026-10-01T03:27:39.809Z] [bg] bg spawned e7a39b73 (shell) [2026-10-01T03:27:41.315Z] [bg] bg settled e7a39b73 (killed) - At 04:13Z Claude Code updated itself to 2.1.286, which refuses
--bgin an untrusted workspace. We moved to 0.4.41 at 05:10Z, and it showed the trust prompt in the actor's terminal, as designed. - At 07:41Z the operator accepted the prompt. From then on:
171 launches, all killed, until[2026-10-01T07:41:08.901Z] [bg] bg spawned 5ef4d16d (shell) [2026-10-01T07:41:09.582Z] [bg] bg settled 5ef4d16d (killed) [2026-10-01T07:41:11.329Z] [bg] bg claimed-spare 12e6ed9c (shell) [2026-10-01T07:41:12.459Z] [bg] bg settled 12e6ed9c (killed) [2026-10-01T07:41:13.963Z] [bg] bg claimed-spare cfaf724e (shell) [2026-10-01T07:41:16.476Z] [bg] bg settled cfaf724e (killed) ... [2026-10-01T07:49:44.243Z] [bg] bg claimed-spare c94861bf (shell) [2026-10-01T07:49:45.986Z] [bg] bg settled c94861bf (killed)actor_new_sessionat 07:49:46Z. Each of those jobs has its own newsessionId, an emptyrespawnFlagsand no name in~/.claude/jobs/<short>/state.json.
What I could not find out: why Claude Code answered the same --resume with a copy from 03:27Z on (same binary as nine hours earlier). A session created under 2.1.286 resumes in place, both with Claude's daemon running (bg claimed-spare <id> (fleet)) and after it has exited (bg spawned <id> (fleet)). So the trigger is on Claude Code's side.
Why it does not stop
The stored id is asked for on every attempt, so no retry can succeed. Two things retry:
- The trust watcher (
local_headless/workspace_trust.rs).wait_for_trustrelaunches whenever the(mtime, len)signature of~/.claude.jsonchanges, andrecover()answers "keep waiting" for any launch error while the prompt terminal is open. Claude Code rewrites~/.claude.jsonon every start, so once a launch fails for a reason other than trust, each failed launch triggers the next one. That is the 3-second cycle above. Meanwhile the prompt terminal, by now an ordinary interactive Claude, keeps the actorrunning. As far as I can read,actor_runtime::apply("actor.start")then returns early throughactor_is_running,process_managed_batchgives up on the batch, and deliveries are not handed over. - The delivery auto-wake (
actor_delivery_worker.rs,process_managed_batch→actor_runtime::apply("actor.start")). When the actor is not running and a delivery is pending, every retry is anotherclaude --bg --resumeand kill; the backoff is capped at 4 s. This is what I saw on 0.4.40; the code onmainlooks the same.
And nothing records it:
prepare_managedstampslast_resume_attempt_atbefore each attempt, but I found no code that writeslast_resume_errororfailure_countwith anything but""and0. The actor list'sruntime_session_last_resume_erroris therefore always null.- The failures are
tracing::warn!/debug!only, so withoutRUST_LOGthe daemon prints nothing. - On Claude's side each attempt leaves a job directory under
~/.claude/jobs(275 here).
Suggested fix
- In
codex_voice_analyst/claude.rs(launch_inner), whenjob.session_id != expected: afterkill_and_confirm, start a fresh session with the full launch configuration and record it (record_managed(..., resumed = false)), or at least mark the stored session as not resumable so the next attempt starts fresh. As far as I can see the Claude path has nothing like thethread/startfallback of the Codex path mentioned in #124. - Write
last_resume_error/failure_countwhen a resume fails, so the actor list and the web UI can show it. - In
wait_for_trust, look at the trust decision itself rather than the file's(mtime, len), or stop relaunching after a launch error that is not a trust refusal. - Back the delivery auto-wake off further after repeated start failures.
Workaround
actor_new_session ends it immediately (the stored record is dropped and the actor starts fresh). From outside the daemon the state can be recognised by last_resume_attempt_at in state/runtime_sessions/<actor>.json: it is cleared by every launch that succeeds, so a stamp that keeps moving while the session is pending is a resume that is failing.
I can provide more of the logs or test a patch if that helps.
Thank you for the detailed report, especially for tracing both the delivery auto-wake and workspace-trust retry paths.
We have implemented a fix, awaiting publication. When Claude returns a different session ID or cannot expose verifiable saved history, CCCC now records a safe diagnostic and failure count, pauses automatic recovery, and preserves the original conversation and pending messages.
The trust watcher now continues waiting only for an actual workspace-trust refusal. Other launch failures end recovery and clean up its temporary terminal. That terminal cannot receive task messages, including after a saved Runtime configuration change.
We chose explicit recovery because automatically starting fresh would silently replace the conversation’s context. Start/Restart retries the saved conversation; New session deliberately starts a fresh one.
Isolated regression tests and packaged CLI/IPC smoke tests passed. This addresses CCCC’s recovery behavior; we have not established why Claude began copying your original session. Once the fix is published, a retest against that affected session would be valuable.