openclaw - 💡(How to fix) Fix [Bug]: Spawned ACP background task enters zombie state after billing failure — persists across session resets, gateway restarts, and database wipes [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#62997Fetched 2026-04-09 07:59:40
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Participants
Assignees
Timeline (top)
labeled ×2assigned ×1

`<h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Bug type</h2>

<p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Behavior bug (incorrect output/state without crash)</p> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Summary</h2> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">When an ACP background task (<code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">sessions_spawn</code>) fails due to a provider billing/auth error (e.g., <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">openai-codex</code> refresh token expired), the task enters a zombie state that survives:</p> <ul class="[li_&amp;]:mb-0 [li_&amp;]:mt-1 [li_&amp;]:gap-1 [&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc flex flex-col gap-1 pl-8 mb-3"> <li class="whitespace-normal break-words pl-2"><code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">/new</code> session resets</li> <li class="whitespace-normal break-words pl-2">Deleting the spawning agent's session files + <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">sessions.json</code></li> <li class="whitespace-normal break-words pl-2">Deleting <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">~/.openclaw/data/runs.sqlite</code></li> <li class="whitespace-normal break-words pl-2">Deleting Telegram <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">update-offset-*.json</code> files</li> <li class="whitespace-normal break-words pl-2">Clearing agent <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">auth-profiles.json</code></li> <li class="whitespace-normal break-words pl-2">Full gateway restarts</li> </ul> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">The zombie task delivers a "Background task done: &lt;label&gt;" message on <strong>every single user interaction</strong> with the spawning agent, making the agent effectively unusable.</p> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Environment</h2> <ul class="[li_&amp;]:mb-0 [li_&amp;]:mt-1 [li_&amp;]:gap-1 [&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc flex flex-col gap-1 pl-8 mb-3"> <li class="whitespace-normal break-words pl-2"><strong>OpenClaw</strong>: 2026.4.5 (3e72c03)</li> <li class="whitespace-normal break-words pl-2"><strong>OS</strong>: Linux 6.17.0-19-generic (x64), Node 22.22.1</li> <li class="whitespace-normal break-words pl-2"><strong>Install method</strong>: npm global</li> <li class="whitespace-normal break-words pl-2"><strong>Channels</strong>: Telegram (multiple accounts), WhatsApp</li> <li class="whitespace-normal break-words pl-2"><strong>Agents</strong>: 8 configured agents including ACP claude agent</li> </ul> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Steps to reproduce</h2> <ol class="[li_&amp;]:mb-0 [li_&amp;]:mt-1 [li_&amp;]:gap-1 [&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-decimal flex flex-col gap-1 pl-8 mb-3"> <li class="whitespace-normal break-words pl-2">Configure multiple agents with <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">sessions_spawn</code> / <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">sessions_send</code> capability</li> <li class="whitespace-normal break-words pl-2">From agent A (e.g., "some"), spawn an ACP background task to the claude agent: <ul class="[li_&amp;]:mb-0 [li_&amp;]:mt-1 [li_&amp;]:gap-1 [&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc flex flex-col gap-1 pl-8 mb-3"> <li class="whitespace-normal break-words pl-2"><code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">sessions_spawn runtime:"acp" agent:"claude" label:"linkedin-post" ...</code></li> </ul> </li> <li class="whitespace-normal break-words pl-2">Have the ACP task use a provider with expired billing/auth (e.g., <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">openai-codex</code> with <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">refresh_token_reused</code> error)</li> <li class="whitespace-normal break-words pl-2">The task "completes" but cannot deliver the result properly</li> <li class="whitespace-normal break-words pl-2">Every subsequent message to agent A triggers: <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">Background task done: linkedin-post (run XXXX)</code></li> <li class="whitespace-normal break-words pl-2">Run number increments on each interaction</li> </ol> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Expected behavior</h2> <ul class="[li_&amp;]:mb-0 [li_&amp;]:mt-1 [li_&amp;]:gap-1 [&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc flex flex-col gap-1 pl-8 mb-3"> <li class="whitespace-normal break-words pl-2">Failed background tasks should be marked as failed and cleaned up</li> <li class="whitespace-normal break-words pl-2">A billing/auth error should not create a persistent zombie task</li> <li class="whitespace-normal break-words pl-2"><code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">/new</code> should clear all pending task deliveries for the session</li> <li class="whitespace-normal break-words pl-2">Gateway restart should not re-queue failed task result deliveries</li> </ul> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Actual behavior</h2> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">The "Background task done" message appears on every user interaction indefinitely. The agent becomes unusable on the affected channel (Telegram), while working normally on WebChat (different session, no cached task reference).</p> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Root cause analysis</h2> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">The task reference was stored in <strong>three separate locations</strong>, and all three had to be manually cleaned to resolve the issue:</p> <h3 class="text-text-100 mt-2 -mb-1 text-base font-bold">1. ACP agent sessions (expected)</h3> <div role="group" aria-label="Code" tabindex="0" class="relative group/copy bg-bg-000/50 border-0.5 border-border-400 rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-100"><div class="sticky opacity-0 group-hover/copy:opacity-100 group-focus-within/copy:opacity-100 top-2 py-2 h-12 w-0 float-right"><div class="absolute right-0 h-8 px-2 items-center inline-flex z-10"><button class="inline-flex items-center justify-center relative isolate shrink-0 can-focus select-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none disabled:drop-shadow-none border-transparent transition font-base duration-300 ease-[cubic-bezier(0.165,0.85,0.45,1)] h-8 w-8 rounded-md backdrop-blur-md _fill_1abo4_9 _ghost_1abo4_96" type="button" aria-label="Copy to clipboard" data-state="closed"><div class="relative"><div class="transition-all opacity-100 scale-100" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-100 scale-100" aria-hidden="true"><path d="M12.5 3A1.5 1.5 0 0 1 14 4.5V6h1.5A1.5 1.5 0 0 1 17 7.5v8a1.5 1.5 0 0 1-1.5 1.5h-8A1.5 1.5 0 0 1 6 15.5V14H4.5A1.5 1.5 0 0 1 3 12.5v-8A1.5 1.5 0 0 1 4.5 3zm1.5 9.5a1.5 1.5 0 0 1-1.5 1.5H7v1.5a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5H14zM4.5 4a.5.5 0 0 0-.5.5v8a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5z"></path></svg></div><div class="absolute inset-0 flex items-center justify-center"><div class="transition-all opacity-0 scale-50" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-0 scale-50" aria-hidden="true"><path d="M15.188 5.11a.5.5 0 0 1 .752.626l-.056.084-7.5 9a.5.5 0 0 1-.738.033l-3.5-3.5-.064-.078a.501.501 0 0 1 .693-.693l.078.064 3.113 3.113 7.15-8.58z"></path></svg></div></div></div></button></div></div><div class="overflow-x-auto"><pre class="code-block__code !my-0 !rounded-lg !text-sm !leading-relaxed p-3.5" style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono);"><code style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono); white-space: pre-wrap;"><span><span>~/.openclaw/agents/claude/sessions/sessions.json</span></span></code></pre></div></div> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Contains the spawned ACP session with <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">"spawnedBy": "agent:some:telegram:direct:414943979"</code> and <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">"label": "linkedin-post"</code>.</p> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]"><strong>Fix</strong>: <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">rm -f ~/.openclaw/agents/claude/sessions/*.jsonl &amp;&amp; echo '{}' &gt; sessions.json</code></p> <h3 class="text-text-100 mt-2 -mb-1 text-base font-bold">2. Task database (expected)</h3> <div role="group" aria-label="Code" tabindex="0" class="relative group/copy bg-bg-000/50 border-0.5 border-border-400 rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-100"><div class="sticky opacity-0 group-hover/copy:opacity-100 group-focus-within/copy:opacity-100 top-2 py-2 h-12 w-0 float-right"><div class="absolute right-0 h-8 px-2 items-center inline-flex z-10"><button class="inline-flex items-center justify-center relative isolate shrink-0 can-focus select-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none disabled:drop-shadow-none border-transparent transition font-base duration-300 ease-[cubic-bezier(0.165,0.85,0.45,1)] h-8 w-8 rounded-md backdrop-blur-md _fill_1abo4_9 _ghost_1abo4_96" type="button" aria-label="Copy to clipboard" data-state="closed"><div class="relative"><div class="transition-all opacity-100 scale-100" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-100 scale-100" aria-hidden="true"><path d="M12.5 3A1.5 1.5 0 0 1 14 4.5V6h1.5A1.5 1.5 0 0 1 17 7.5v8a1.5 1.5 0 0 1-1.5 1.5h-8A1.5 1.5 0 0 1 6 15.5V14H4.5A1.5 1.5 0 0 1 3 12.5v-8A1.5 1.5 0 0 1 4.5 3zm1.5 9.5a1.5 1.5 0 0 1-1.5 1.5H7v1.5a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5H14zM4.5 4a.5.5 0 0 0-.5.5v8a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5z"></path></svg></div><div class="absolute inset-0 flex items-center justify-center"><div class="transition-all opacity-0 scale-50" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-0 scale-50" aria-hidden="true"><path d="M15.188 5.11a.5.5 0 0 1 .752.626l-.056.084-7.5 9a.5.5 0 0 1-.738.033l-3.5-3.5-.064-.078a.501.501 0 0 1 .693-.693l.078.064 3.113 3.113 7.15-8.58z"></path></svg></div></div></div></button></div></div><div class="overflow-x-auto"><pre class="code-block__code !my-0 !rounded-lg !text-sm !leading-relaxed p-3.5" style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono);"><code style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono); white-space: pre-wrap;"><span><span>~/.openclaw/data/runs.sqlite</span></span></code></pre></div></div> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Contains the task run record.</p> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]"><strong>Fix</strong>: <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">rm -f ~/.openclaw/data/runs.sqlite*</code></p> <h3 class="text-text-100 mt-2 -mb-1 text-base font-bold">3. Default agent workspace state (unexpected)</h3> <div role="group" aria-label="Code" tabindex="0" class="relative group/copy bg-bg-000/50 border-0.5 border-border-400 rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-100"><div class="sticky opacity-0 group-hover/copy:opacity-100 group-focus-within/copy:opacity-100 top-2 py-2 h-12 w-0 float-right"><div class="absolute right-0 h-8 px-2 items-center inline-flex z-10"><button class="inline-flex items-center justify-center relative isolate shrink-0 can-focus select-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none disabled:drop-shadow-none border-transparent transition font-base duration-300 ease-[cubic-bezier(0.165,0.85,0.45,1)] h-8 w-8 rounded-md backdrop-blur-md _fill_1abo4_9 _ghost_1abo4_96" type="button" aria-label="Copy to clipboard" data-state="closed"><div class="relative"><div class="transition-all opacity-100 scale-100" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-100 scale-100" aria-hidden="true"><path d="M12.5 3A1.5 1.5 0 0 1 14 4.5V6h1.5A1.5 1.5 0 0 1 17 7.5v8a1.5 1.5 0 0 1-1.5 1.5h-8A1.5 1.5 0 0 1 6 15.5V14H4.5A1.5 1.5 0 0 1 3 12.5v-8A1.5 1.5 0 0 1 4.5 3zm1.5 9.5a1.5 1.5 0 0 1-1.5 1.5H7v1.5a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5H14zM4.5 4a.5.5 0 0 0-.5.5v8a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5z"></path></svg></div><div class="absolute inset-0 flex items-center justify-center"><div class="transition-all opacity-0 scale-50" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-0 scale-50" aria-hidden="true"><path d="M15.188 5.11a.5.5 0 0 1 .752.626l-.056.084-7.5 9a.5.5 0 0 1-.738.033l-3.5-3.5-.064-.078a.501.501 0 0 1 .693-.693l.078.064 3.113 3.113 7.15-8.58z"></path></svg></div></div></div></button></div></div><div class="overflow-x-auto"><pre class="code-block__code !my-0 !rounded-lg !text-sm !leading-relaxed p-3.5" style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono);"><code style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono); white-space: pre-wrap;"><span><span>~/.openclaw/workspace-pa/state/sessions/agent%3Aclaude%3Aacp%3A&lt;session-uuid&gt;.json</span></span></code></pre></div></div> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">A cached ACP session reference stored in the <strong>default agent's workspace</strong> — not in the spawning agent's workspace. This was the hardest to find and the actual blocker.</p> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]"><strong>Fix</strong>: <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">rm -f ~/.openclaw/workspace-pa/state/sessions/agent%3Aclaude%3Aacp%3A*.json</code></p> <h3 class="text-text-100 mt-2 -mb-1 text-base font-bold">Debugging timeline</h3> <div class="overflow-x-auto w-full px-2 mb-6"> Action | Result -- | -- /new on spawning agent | ❌ Still loops Delete spawning agent sessions | ❌ Still loops Delete runs.sqlite | ❌ Still loops Delete Telegram offset files | ❌ Still loops Switch model (avoid billing error) | ❌ Still loops Gateway restart | ❌ Still loops Delete target ACP agent sessions | ❌ Still loops (changed to ACP_SESSION_INIT_FAILED) Delete cached session in workspace-pa/state/sessions/ | ✅ Fixed </div> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Suggested fixes</h2> <ol class="[li_&amp;]:mb-0 [li_&amp;]:mt-1 [li_&amp;]:gap-1 [&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-decimal flex flex-col gap-1 pl-8 mb-3"> <li class="whitespace-normal break-words pl-2"><strong>Auto-cleanup on billing/auth failure</strong>: When a spawned ACP task fails due to a billing or auth error, OpenClaw should mark it as permanently failed and clean up all references (spawning agent, ACP agent, task database, workspace state).</li> <li class="whitespace-normal break-words pl-2"><strong><code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">/new</code> should clear pending task deliveries</strong>: A session reset should also clear any queued background task result deliveries for that session.</li> <li class="whitespace-normal break-words pl-2"><strong>Centralize task state</strong>: Task references should not be scattered across three separate storage locations. A single source of truth (e.g., <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">runs.sqlite</code>) should be authoritative, with other locations acting as caches that can be safely invalidated.</li> <li class="whitespace-normal break-words pl-2"><strong>Add a task cleanup command</strong>: Something like <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">openclaw tasks cancel --all --agent some</code> that finds and removes all task references across all storage locations.</li> <li class="whitespace-normal break-words pl-2"><strong>Surface the actual location</strong>: When a zombie task is detected, the error message should include the file path where the reference lives, making manual cleanup possible without hours of forensic debugging.</li> </ol> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Workaround</h2> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">To fully resolve a stuck background task, you must clean <strong>all three locations</strong>:</p> <div role="group" aria-label="bash code" tabindex="0" class="relative group/copy bg-bg-000/50 border-0.5 border-border-400 rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-100"><div class="sticky opacity-0 group-hover/copy:opacity-100 group-focus-within/copy:opacity-100 top-2 py-2 h-12 w-0 float-right"><div class="absolute right-0 h-8 px-2 items-center inline-flex z-10"><button class="inline-flex items-center justify-center relative isolate shrink-0 can-focus select-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none disabled:drop-shadow-none border-transparent transition font-base duration-300 ease-[cubic-bezier(0.165,0.85,0.45,1)] h-8 w-8 rounded-md backdrop-blur-md _fill_1abo4_9 _ghost_1abo4_96" type="button" aria-label="Copy to clipboard" data-state="closed"><div class="relative"><div class="transition-all opacity-100 scale-100" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-100 scale-100" aria-hidden="true"><path d="M12.5 3A1.5 1.5 0 0 1 14 4.5V6h1.5A1.5 1.5 0 0 1 17 7.5v8a1.5 1.5 0 0 1-1.5 1.5h-8A1.5 1.5 0 0 1 6 15.5V14H4.5A1.5 1.5 0 0 1 3 12.5v-8A1.5 1.5 0 0 1 4.5 3zm1.5 9.5a1.5 1.5 0 0 1-1.5 1.5H7v1.5a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5H14zM4.5 4a.5.5 0 0 0-.5.5v8a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5z"></path></svg></div><div class="absolute inset-0 flex items-center justify-center"><div class="transition-all opacity-0 scale-50" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-0 scale-50" aria-hidden="true"><path d="M15.188 5.11a.5.5 0 0 1 .752.626l-.056.084-7.5 9a.5.5 0 0 1-.738.033l-3.5-3.5-.064-.078a.501.501 0 0 1 .693-.693l.078.064 3.113 3.113 7.15-8.58z"></path></svg></div></div></div></button></div></div><div class="text-text-500 font-small p-3.5 pb-0">bash</div><div class="overflow-x-auto"><pre class="code-block__code !my-0 !rounded-lg !text-sm !leading-relaxed p-3.5" style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono);"><code class="language-bash" style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono); white-space: pre;"><span><span>openclaw gateway stop </span></span><span> </span><span><span></span><span class="token token" style="color: rgb(129, 136, 152);"># 1. Clean the ACP agent sessions</span><span> </span></span><span><span></span><span class="token token" style="color: rgb(112, 184, 255);">rm</span><span> -f ~/.openclaw/agents/claude/sessions/*.jsonl </span></span><span><span></span><span class="token token" style="color: rgb(251, 173, 96);">echo</span><span> </span><span class="token token" style="color: rgb(155, 233, 99);">'{}'</span><span> </span><span class="token token" style="color: rgb(234, 236, 240);">&gt;</span><span> ~/.openclaw/agents/claude/sessions/sessions.json </span></span><span> </span><span><span></span><span class="token token" style="color: rgb(129, 136, 152);"># 2. Clean the task database</span><span> </span></span><span><span></span><span class="token token" style="color: rgb(112, 184, 255);">rm</span><span> -f ~/.openclaw/data/runs.sqlite* </span></span><span> </span><span><span></span><span class="token token" style="color: rgb(129, 136, 152);"># 3. Find and remove cached ACP session references (this is the one you'll miss)</span><span> </span></span><span><span></span><span class="token token" style="color: rgb(112, 184, 255);">find</span><span> ~/.openclaw -path </span><span class="token token" style="color: rgb(155, 233, 99);">"*/state/sessions/*"</span><span> -name </span><span class="token token" style="color: rgb(155, 233, 99);">"*acp*"</span><span> -exec </span><span class="token token" style="color: rgb(112, 184, 255);">rm</span><span> -f </span><span class="token token" style="color: rgb(211, 215, 222);">{</span><span class="token token" style="color: rgb(211, 215, 222);">}</span><span> </span><span class="token token" style="color: rgb(211, 215, 222);">\</span><span class="token token" style="color: rgb(211, 215, 222);">;</span><span> </span></span><span> </span><span>openclaw gateway restart</span></code></pre></div></div> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Logs</h2> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Provider error triggering the zombie state:</p> <div role="group" aria-label="Code" tabindex="0" class="relative group/copy bg-bg-000/50 border-0.5 border-border-400 rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-100"><div class="sticky opacity-0 group-hover/copy:opacity-100 group-focus-within/copy:opacity-100 top-2 py-2 h-12 w-0 float-right"><div class="absolute right-0 h-8 px-2 items-center inline-flex z-10"><button class="inline-flex items-center justify-center relative isolate shrink-0 can-focus select-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none disabled:drop-shadow-none border-transparent transition font-base duration-300 ease-[cubic-bezier(0.165,0.85,0.45,1)] h-8 w-8 rounded-md backdrop-blur-md _fill_1abo4_9 _ghost_1abo4_96" type="button" aria-label="Copy to clipboard" data-state="closed"><div class="relative"><div class="transition-all opacity-100 scale-100" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-100 scale-100" aria-hidden="true"><path d="M12.5 3A1.5 1.5 0 0 1 14 4.5V6h1.5A1.5 1.5 0 0 1 17 7.5v8a1.5 1.5 0 0 1-1.5 1.5h-8A1.5 1.5 0 0 1 6 15.5V14H4.5A1.5 1.5 0 0 1 3 12.5v-8A1.5 1.5 0 0 1 4.5 3zm1.5 9.5a1.5 1.5 0 0 1-1.5 1.5H7v1.5a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5H14zM4.5 4a.5.5 0 0 0-.5.5v8a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5z"></path></svg></div><div class="absolute inset-0 flex items-center justify-center"><div class="transition-all opacity-0 scale-50" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-0 scale-50" aria-hidden="true"><path d="M15.188 5.11a.5.5 0 0 1 .752.626l-.056.084-7.5 9a.5.5 0 0 1-.738.033l-3.5-3.5-.064-.078a.501.501 0 0 1 .693-.693l.078.064 3.113 3.113 7.15-8.58z"></path></svg></div></div></div></button></div></div><div class="overflow-x-auto"><pre class="code-block__code !my-0 !rounded-lg !text-sm !leading-relaxed p-3.5" style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono);"><code style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono); white-space: pre-wrap;"><span><span>[openai-codex] Token refresh failed: 401 { </span></span><span> "error": { </span><span> "message": "Your refresh token has already been used to generate a new access token. Please try signing in again.", </span><span> "type": "invalid_request_error", </span><span> "param": null, </span><span> "code": "refresh_token_reused" </span><span> } </span><span>}</span></code></pre></div></div> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Telegram behavior: every message to the spawning agent returns:</p> <div role="group" aria-label="Code" tabindex="0" class="relative group/copy bg-bg-000/50 border-0.5 border-border-400 rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-100"><div class="sticky opacity-0 group-hover/copy:opacity-100 group-focus-within/copy:opacity-100 top-2 py-2 h-12 w-0 float-right"><div class="absolute right-0 h-8 px-2 items-center inline-flex z-10"><button class="inline-flex items-center justify-center relative isolate shrink-0 can-focus select-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none disabled:drop-shadow-none border-transparent transition font-base duration-300 ease-[cubic-bezier(0.165,0.85,0.45,1)] h-8 w-8 rounded-md backdrop-blur-md _fill_1abo4_9 _ghost_1abo4_96" type="button" aria-label="Copy to clipboard" data-state="closed"><div class="relative"><div class="transition-all opacity-100 scale-100" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-100 scale-100" aria-hidden="true"><path d="M12.5 3A1.5 1.5 0 0 1 14 4.5V6h1.5A1.5 1.5 0 0 1 17 7.5v8a1.5 1.5 0 0 1-1.5 1.5h-8A1.5 1.5 0 0 1 6 15.5V14H4.5A1.5 1.5 0 0 1 3 12.5v-8A1.5 1.5 0 0 1 4.5 3zm1.5 9.5a1.5 1.5 0 0 1-1.5 1.5H7v1.5a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5H14zM4.5 4a.5.5 0 0 0-.5.5v8a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5z"></path></svg></div><div class="absolute inset-0 flex items-center justify-center"><div class="transition-all opacity-0 scale-50" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-0 scale-50" aria-hidden="true"><path d="M15.188 5.11a.5.5 0 0 1 .752.626l-.056.084-7.5 9a.5.5 0 0 1-.738.033l-3.5-3.5-.064-.078a.501.501 0 0 1 .693-.693l.078.064 3.113 3.113 7.15-8.58z"></path></svg></div></div></div></button></div></div><div class="overflow-x-auto"><pre class="code-block__code !my-0 !rounded-lg !text-sm !leading-relaxed p-3.5" style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono);"><code style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono); white-space: pre-wrap;"><span><span>Background task done: linkedin-post (run 2441).</span></span></code></pre></div></div> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Run number increments with each interaction.</p> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">After cleaning locations 1 and 2 but not 3:</p> <div role="group" aria-label="Code" tabindex="0" class="relative group/copy bg-bg-000/50 border-0.5 border-border-400 rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-100"><div class="sticky opacity-0 group-hover/copy:opacity-100 group-focus-within/copy:opacity-100 top-2 py-2 h-12 w-0 float-right"><div class="absolute right-0 h-8 px-2 items-center inline-flex z-10"><button class="inline-flex items-center justify-center relative isolate shrink-0 can-focus select-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none disabled:drop-shadow-none border-transparent transition font-base duration-300 ease-[cubic-bezier(0.165,0.85,0.45,1)] h-8 w-8 rounded-md backdrop-blur-md _fill_1abo4_9 _ghost_1abo4_96" type="button" aria-label="Copy to clipboard" data-state="closed"><div class="relative"><div class="transition-all opacity-100 scale-100" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-100 scale-100" aria-hidden="true"><path d="M12.5 3A1.5 1.5 0 0 1 14 4.5V6h1.5A1.5 1.5 0 0 1 17 7.5v8a1.5 1.5 0 0 1-1.5 1.5h-8A1.5 1.5 0 0 1 6 15.5V14H4.5A1.5 1.5 0 0 1 3 12.5v-8A1.5 1.5 0 0 1 4.5 3zm1.5 9.5a1.5 1.5 0 0 1-1.5 1.5H7v1.5a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5H14zM4.5 4a.5.5 0 0 0-.5.5v8a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5z"></path></svg></div><div class="absolute inset-0 flex items-center justify-center"><div class="transition-all opacity-0 scale-50" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-0 scale-50" aria-hidden="true"><path d="M15.188 5.11a.5.5 0 0 1 .752.626l-.056.084-7.5 9a.5.5 0 0 1-.738.033l-3.5-3.5-.064-.078a.501.501 0 0 1 .693-.693l.078.064 3.113 3.113 7.15-8.58z"></path></svg></div></div></div></button></div></div><div class="overflow-x-auto"><pre class="code-block__code !my-0 !rounded-lg !text-sm !leading-relaxed p-3.5" style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono);"><code style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono); white-space: pre-wrap;"><span><span>ACP error (ACP_SESSION_INIT_FAILED): ACP metadata is missing for </span></span><span>agent:claude:acp:cfb5c7c1-6dbb-4c3a-bb5b-12d63bb4475c. </span><span>Recreate this ACP session with /acp spawn and rebind the thread.</span></code></pre></div></div>`

Error Message

<p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">When an ACP background task (<code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">sessions_spawn</code>) fails due to a provider billing/auth error (e.g., <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">openai-codex</code> refresh token expired), the task enters a zombie state that survives:</p> <li class="whitespace-normal break-words pl-2">Have the ACP task use a provider with expired billing/auth (e.g., <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">openai-codex</code> with <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">refresh_token_reused</code> error)</li> <li class="whitespace-normal break-words pl-2">A billing/auth error should not create a persistent zombie task</li> Switch model (avoid billing error) | ❌ Still loops <li class="whitespace-normal break-words pl-2"><strong>Auto-cleanup on billing/auth failure</strong>: When a spawned ACP task fails due to a billing or auth error, OpenClaw should mark it as permanently failed and clean up all references (spawning agent, ACP agent, task database, workspace state).</li> <li class="whitespace-normal break-words pl-2"><strong>Surface the actual location</strong>: When a zombie task is detected, the error message should include the file path where the reference lives, making manual cleanup possible without hours of forensic debugging.</li> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Provider error triggering the zombie state:</p> </span></span><span> "error": { ease-[cubic-bezier(0.165,0.85,0.45,1)] h-8 w-8 rounded-md backdrop-blur-md _fill_1abo4_9 _ghost_1abo4_96" type="button" aria-label="Copy to clipboard" data-state="closed"><div class="relative"><div class="transition-all opacity-100 scale-100" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-100 scale-100" aria-hidden="true"><path d="M12.5 3A1.5 1.5 0 0 1 14 4.5V6h1.5A1.5 1.5 0 0 1 17 7.5v8a1.5 1.5 0 0 1-1.5 1.5h-8A1.5 1.5 0 0 1 6 15.5V14H4.5A1.5 1.5 0 0 1 3 12.5v-8A1.5 1.5 0 0 1 4.5 3zm1.5 9.5a1.5 1.5 0 0 1-1.5 1.5H7v1.5a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5H14zM4.5 4a.5.5 0 0 0-.5.5v8a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5z"></path></svg></div><div class="absolute inset-0 flex items-center justify-center"><div class="transition-all opacity-0 scale-50" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-0 scale-50" aria-hidden="true"><path d="M15.188 5.11a.5.5 0 0 1 .752.626l-.056.084-7.5 9a.5.5 0 0 1-.738.033l-3.5-3.5-.064-.078a.501.501 0 0 1 .693-.693l.078.064 3.113 3.113 7.15-8.58z"></path></svg></div></div></div></button></div></div><div class="overflow-x-auto"><pre class="code-block__code !my-0 !rounded-lg !text-sm !leading-relaxed p-3.5" style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono);"><code style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono); white-space: pre-wrap;"><span><span>ACP error (ACP_SESSION_INIT_FAILED): ACP metadata is missing for Have the ACP task use a provider with expired billing/auth (e.g., openai-codex with refresh_token_reused error) A billing/auth error should not create a persistent zombie task

Root Cause

`<h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Bug type</h2>

<p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Behavior bug (incorrect output/state without crash)</p> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Summary</h2> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">When an ACP background task (<code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">sessions_spawn</code>) fails due to a provider billing/auth error (e.g., <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">openai-codex</code> refresh token expired), the task enters a zombie state that survives:</p> <ul class="[li_&amp;]:mb-0 [li_&amp;]:mt-1 [li_&amp;]:gap-1 [&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc flex flex-col gap-1 pl-8 mb-3"> <li class="whitespace-normal break-words pl-2"><code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">/new</code> session resets</li> <li class="whitespace-normal break-words pl-2">Deleting the spawning agent's session files + <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">sessions.json</code></li> <li class="whitespace-normal break-words pl-2">Deleting <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">~/.openclaw/data/runs.sqlite</code></li> <li class="whitespace-normal break-words pl-2">Deleting Telegram <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">update-offset-*.json</code> files</li> <li class="whitespace-normal break-words pl-2">Clearing agent <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">auth-profiles.json</code></li> <li class="whitespace-normal break-words pl-2">Full gateway restarts</li> </ul> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">The zombie task delivers a "Background task done: &lt;label&gt;" message on <strong>every single user interaction</strong> with the spawning agent, making the agent effectively unusable.</p> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Environment</h2> <ul class="[li_&amp;]:mb-0 [li_&amp;]:mt-1 [li_&amp;]:gap-1 [&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc flex flex-col gap-1 pl-8 mb-3"> <li class="whitespace-normal break-words pl-2"><strong>OpenClaw</strong>: 2026.4.5 (3e72c03)</li> <li class="whitespace-normal break-words pl-2"><strong>OS</strong>: Linux 6.17.0-19-generic (x64), Node 22.22.1</li> <li class="whitespace-normal break-words pl-2"><strong>Install method</strong>: npm global</li> <li class="whitespace-normal break-words pl-2"><strong>Channels</strong>: Telegram (multiple accounts), WhatsApp</li> <li class="whitespace-normal break-words pl-2"><strong>Agents</strong>: 8 configured agents including ACP claude agent</li> </ul> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Steps to reproduce</h2> <ol class="[li_&amp;]:mb-0 [li_&amp;]:mt-1 [li_&amp;]:gap-1 [&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-decimal flex flex-col gap-1 pl-8 mb-3"> <li class="whitespace-normal break-words pl-2">Configure multiple agents with <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">sessions_spawn</code> / <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">sessions_send</code> capability</li> <li class="whitespace-normal break-words pl-2">From agent A (e.g., "some"), spawn an ACP background task to the claude agent: <ul class="[li_&amp;]:mb-0 [li_&amp;]:mt-1 [li_&amp;]:gap-1 [&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc flex flex-col gap-1 pl-8 mb-3"> <li class="whitespace-normal break-words pl-2"><code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">sessions_spawn runtime:"acp" agent:"claude" label:"linkedin-post" ...</code></li> </ul> </li> <li class="whitespace-normal break-words pl-2">Have the ACP task use a provider with expired billing/auth (e.g., <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">openai-codex</code> with <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">refresh_token_reused</code> error)</li> <li class="whitespace-normal break-words pl-2">The task "completes" but cannot deliver the result properly</li> <li class="whitespace-normal break-words pl-2">Every subsequent message to agent A triggers: <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">Background task done: linkedin-post (run XXXX)</code></li> <li class="whitespace-normal break-words pl-2">Run number increments on each interaction</li> </ol> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Expected behavior</h2> <ul class="[li_&amp;]:mb-0 [li_&amp;]:mt-1 [li_&amp;]:gap-1 [&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc flex flex-col gap-1 pl-8 mb-3"> <li class="whitespace-normal break-words pl-2">Failed background tasks should be marked as failed and cleaned up</li> <li class="whitespace-normal break-words pl-2">A billing/auth error should not create a persistent zombie task</li> <li class="whitespace-normal break-words pl-2"><code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">/new</code> should clear all pending task deliveries for the session</li> <li class="whitespace-normal break-words pl-2">Gateway restart should not re-queue failed task result deliveries</li> </ul> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Actual behavior</h2> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">The "Background task done" message appears on every user interaction indefinitely. The agent becomes unusable on the affected channel (Telegram), while working normally on WebChat (different session, no cached task reference).</p> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Root cause analysis</h2> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">The task reference was stored in <strong>three separate locations</strong>, and all three had to be manually cleaned to resolve the issue:</p> <h3 class="text-text-100 mt-2 -mb-1 text-base font-bold">1. ACP agent sessions (expected)</h3> <div role="group" aria-label="Code" tabindex="0" class="relative group/copy bg-bg-000/50 border-0.5 border-border-400 rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-100"><div class="sticky opacity-0 group-hover/copy:opacity-100 group-focus-within/copy:opacity-100 top-2 py-2 h-12 w-0 float-right"><div class="absolute right-0 h-8 px-2 items-center inline-flex z-10"><button class="inline-flex items-center justify-center relative isolate shrink-0 can-focus select-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none disabled:drop-shadow-none border-transparent transition font-base duration-300 ease-[cubic-bezier(0.165,0.85,0.45,1)] h-8 w-8 rounded-md backdrop-blur-md _fill_1abo4_9 _ghost_1abo4_96" type="button" aria-label="Copy to clipboard" data-state="closed"><div class="relative"><div class="transition-all opacity-100 scale-100" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-100 scale-100" aria-hidden="true"><path d="M12.5 3A1.5 1.5 0 0 1 14 4.5V6h1.5A1.5 1.5 0 0 1 17 7.5v8a1.5 1.5 0 0 1-1.5 1.5h-8A1.5 1.5 0 0 1 6 15.5V14H4.5A1.5 1.5 0 0 1 3 12.5v-8A1.5 1.5 0 0 1 4.5 3zm1.5 9.5a1.5 1.5 0 0 1-1.5 1.5H7v1.5a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5H14zM4.5 4a.5.5 0 0 0-.5.5v8a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5z"></path></svg></div><div class="absolute inset-0 flex items-center justify-center"><div class="transition-all opacity-0 scale-50" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-0 scale-50" aria-hidden="true"><path d="M15.188 5.11a.5.5 0 0 1 .752.626l-.056.084-7.5 9a.5.5 0 0 1-.738.033l-3.5-3.5-.064-.078a.501.501 0 0 1 .693-.693l.078.064 3.113 3.113 7.15-8.58z"></path></svg></div></div></div></button></div></div><div class="overflow-x-auto"><pre class="code-block__code !my-0 !rounded-lg !text-sm !leading-relaxed p-3.5" style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono);"><code style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono); white-space: pre-wrap;"><span><span>~/.openclaw/agents/claude/sessions/sessions.json</span></span></code></pre></div></div> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Contains the spawned ACP session with <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">"spawnedBy": "agent:some:telegram:direct:414943979"</code> and <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">"label": "linkedin-post"</code>.</p> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]"><strong>Fix</strong>: <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">rm -f ~/.openclaw/agents/claude/sessions/*.jsonl &amp;&amp; echo '{}' &gt; sessions.json</code></p> <h3 class="text-text-100 mt-2 -mb-1 text-base font-bold">2. Task database (expected)</h3> <div role="group" aria-label="Code" tabindex="0" class="relative group/copy bg-bg-000/50 border-0.5 border-border-400 rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-100"><div class="sticky opacity-0 group-hover/copy:opacity-100 group-focus-within/copy:opacity-100 top-2 py-2 h-12 w-0 float-right"><div class="absolute right-0 h-8 px-2 items-center inline-flex z-10"><button class="inline-flex items-center justify-center relative isolate shrink-0 can-focus select-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none disabled:drop-shadow-none border-transparent transition font-base duration-300 ease-[cubic-bezier(0.165,0.85,0.45,1)] h-8 w-8 rounded-md backdrop-blur-md _fill_1abo4_9 _ghost_1abo4_96" type="button" aria-label="Copy to clipboard" data-state="closed"><div class="relative"><div class="transition-all opacity-100 scale-100" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-100 scale-100" aria-hidden="true"><path d="M12.5 3A1.5 1.5 0 0 1 14 4.5V6h1.5A1.5 1.5 0 0 1 17 7.5v8a1.5 1.5 0 0 1-1.5 1.5h-8A1.5 1.5 0 0 1 6 15.5V14H4.5A1.5 1.5 0 0 1 3 12.5v-8A1.5 1.5 0 0 1 4.5 3zm1.5 9.5a1.5 1.5 0 0 1-1.5 1.5H7v1.5a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5H14zM4.5 4a.5.5 0 0 0-.5.5v8a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5z"></path></svg></div><div class="absolute inset-0 flex items-center justify-center"><div class="transition-all opacity-0 scale-50" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-0 scale-50" aria-hidden="true"><path d="M15.188 5.11a.5.5 0 0 1 .752.626l-.056.084-7.5 9a.5.5 0 0 1-.738.033l-3.5-3.5-.064-.078a.501.501 0 0 1 .693-.693l.078.064 3.113 3.113 7.15-8.58z"></path></svg></div></div></div></button></div></div><div class="overflow-x-auto"><pre class="code-block__code !my-0 !rounded-lg !text-sm !leading-relaxed p-3.5" style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono);"><code style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono); white-space: pre-wrap;"><span><span>~/.openclaw/data/runs.sqlite</span></span></code></pre></div></div> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Contains the task run record.</p> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]"><strong>Fix</strong>: <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">rm -f ~/.openclaw/data/runs.sqlite*</code></p> <h3 class="text-text-100 mt-2 -mb-1 text-base font-bold">3. Default agent workspace state (unexpected)</h3> <div role="group" aria-label="Code" tabindex="0" class="relative group/copy bg-bg-000/50 border-0.5 border-border-400 rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-100"><div class="sticky opacity-0 group-hover/copy:opacity-100 group-focus-within/copy:opacity-100 top-2 py-2 h-12 w-0 float-right"><div class="absolute right-0 h-8 px-2 items-center inline-flex z-10"><button class="inline-flex items-center justify-center relative isolate shrink-0 can-focus select-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none disabled:drop-shadow-none border-transparent transition font-base duration-300 ease-[cubic-bezier(0.165,0.85,0.45,1)] h-8 w-8 rounded-md backdrop-blur-md _fill_1abo4_9 _ghost_1abo4_96" type="button" aria-label="Copy to clipboard" data-state="closed"><div class="relative"><div class="transition-all opacity-100 scale-100" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-100 scale-100" aria-hidden="true"><path d="M12.5 3A1.5 1.5 0 0 1 14 4.5V6h1.5A1.5 1.5 0 0 1 17 7.5v8a1.5 1.5 0 0 1-1.5 1.5h-8A1.5 1.5 0 0 1 6 15.5V14H4.5A1.5 1.5 0 0 1 3 12.5v-8A1.5 1.5 0 0 1 4.5 3zm1.5 9.5a1.5 1.5 0 0 1-1.5 1.5H7v1.5a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5H14zM4.5 4a.5.5 0 0 0-.5.5v8a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5z"></path></svg></div><div class="absolute inset-0 flex items-center justify-center"><div class="transition-all opacity-0 scale-50" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-0 scale-50" aria-hidden="true"><path d="M15.188 5.11a.5.5 0 0 1 .752.626l-.056.084-7.5 9a.5.5 0 0 1-.738.033l-3.5-3.5-.064-.078a.501.501 0 0 1 .693-.693l.078.064 3.113 3.113 7.15-8.58z"></path></svg></div></div></div></button></div></div><div class="overflow-x-auto"><pre class="code-block__code !my-0 !rounded-lg !text-sm !leading-relaxed p-3.5" style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono);"><code style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono); white-space: pre-wrap;"><span><span>~/.openclaw/workspace-pa/state/sessions/agent%3Aclaude%3Aacp%3A&lt;session-uuid&gt;.json</span></span></code></pre></div></div> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">A cached ACP session reference stored in the <strong>default agent's workspace</strong> — not in the spawning agent's workspace. This was the hardest to find and the actual blocker.</p> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]"><strong>Fix</strong>: <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">rm -f ~/.openclaw/workspace-pa/state/sessions/agent%3Aclaude%3Aacp%3A*.json</code></p> <h3 class="text-text-100 mt-2 -mb-1 text-base font-bold">Debugging timeline</h3> <div class="overflow-x-auto w-full px-2 mb-6"> Action | Result -- | -- /new on spawning agent | ❌ Still loops Delete spawning agent sessions | ❌ Still loops Delete runs.sqlite | ❌ Still loops Delete Telegram offset files | ❌ Still loops Switch model (avoid billing error) | ❌ Still loops Gateway restart | ❌ Still loops Delete target ACP agent sessions | ❌ Still loops (changed to ACP_SESSION_INIT_FAILED) Delete cached session in workspace-pa/state/sessions/ | ✅ Fixed

Fix Action

Fix / Workaround

</div> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Suggested fixes</h2> <ol class="[li_&amp;]:mb-0 [li_&amp;]:mt-1 [li_&amp;]:gap-1 [&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-decimal flex flex-col gap-1 pl-8 mb-3"> <li class="whitespace-normal break-words pl-2"><strong>Auto-cleanup on billing/auth failure</strong>: When a spawned ACP task fails due to a billing or auth error, OpenClaw should mark it as permanently failed and clean up all references (spawning agent, ACP agent, task database, workspace state).</li> <li class="whitespace-normal break-words pl-2"><strong><code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">/new</code> should clear pending task deliveries</strong>: A session reset should also clear any queued background task result deliveries for that session.</li> <li class="whitespace-normal break-words pl-2"><strong>Centralize task state</strong>: Task references should not be scattered across three separate storage locations. A single source of truth (e.g., <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">runs.sqlite</code>) should be authoritative, with other locations acting as caches that can be safely invalidated.</li> <li class="whitespace-normal break-words pl-2"><strong>Add a task cleanup command</strong>: Something like <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">openclaw tasks cancel --all --agent some</code> that finds and removes all task references across all storage locations.</li> <li class="whitespace-normal break-words pl-2"><strong>Surface the actual location</strong>: When a zombie task is detected, the error message should include the file path where the reference lives, making manual cleanup possible without hours of forensic debugging.</li> </ol> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Workaround</h2> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">To fully resolve a stuck background task, you must clean <strong>all three locations</strong>:</p> <div role="group" aria-label="bash code" tabindex="0" class="relative group/copy bg-bg-000/50 border-0.5 border-border-400 rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-100"><div class="sticky opacity-0 group-hover/copy:opacity-100 group-focus-within/copy:opacity-100 top-2 py-2 h-12 w-0 float-right"><div class="absolute right-0 h-8 px-2 items-center inline-flex z-10"><button class="inline-flex items-center justify-center relative isolate shrink-0 can-focus select-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none disabled:drop-shadow-none border-transparent transition font-base duration-300 ease-[cubic-bezier(0.165,0.85,0.45,1)] h-8 w-8 rounded-md backdrop-blur-md _fill_1abo4_9 _ghost_1abo4_96" type="button" aria-label="Copy to clipboard" data-state="closed"><div class="relative"><div class="transition-all opacity-100 scale-100" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-100 scale-100" aria-hidden="true"><path d="M12.5 3A1.5 1.5 0 0 1 14 4.5V6h1.5A1.5 1.5 0 0 1 17 7.5v8a1.5 1.5 0 0 1-1.5 1.5h-8A1.5 1.5 0 0 1 6 15.5V14H4.5A1.5 1.5 0 0 1 3 12.5v-8A1.5 1.5 0 0 1 4.5 3zm1.5 9.5a1.5 1.5 0 0 1-1.5 1.5H7v1.5a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5H14zM4.5 4a.5.5 0 0 0-.5.5v8a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5z"></path></svg></div><div class="absolute inset-0 flex items-center justify-center"><div class="transition-all opacity-0 scale-50" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-0 scale-50" aria-hidden="true"><path d="M15.188 5.11a.5.5 0 0 1 .752.626l-.056.084-7.5 9a.5.5 0 0 1-.738.033l-3.5-3.5-.064-.078a.501.501 0 0 1 .693-.693l.078.064 3.113 3.113 7.15-8.58z"></path></svg></div></div></div></button></div></div><div class="text-text-500 font-small p-3.5 pb-0">bash</div><div class="overflow-x-auto"><pre class="code-block__code !my-0 !rounded-lg !text-sm !leading-relaxed p-3.5" style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono);"><code class="language-bash" style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono); white-space: pre;"><span><span>openclaw gateway stop </span></span><span> </span><span><span></span><span class="token token" style="color: rgb(129, 136, 152);"># 1. Clean the ACP agent sessions</span><span> </span></span><span><span></span><span class="token token" style="color: rgb(112, 184, 255);">rm</span><span> -f ~/.openclaw/agents/claude/sessions/*.jsonl </span></span><span><span></span><span class="token token" style="color: rgb(251, 173, 96);">echo</span><span> </span><span class="token token" style="color: rgb(155, 233, 99);">'{}'</span><span> </span><span class="token token" style="color: rgb(234, 236, 240);">&gt;</span><span> ~/.openclaw/agents/claude/sessions/sessions.json </span></span><span> </span><span><span></span><span class="token token" style="color: rgb(129, 136, 152);"># 2. Clean the task database</span><span> </span></span><span><span></span><span class="token token" style="color: rgb(112, 184, 255);">rm</span><span> -f ~/.openclaw/data/runs.sqlite* </span></span><span> </span><span><span></span><span class="token token" style="color: rgb(129, 136, 152);"># 3. Find and remove cached ACP session references (this is the one you'll miss)</span><span> </span></span><span><span></span><span class="token token" style="color: rgb(112, 184, 255);">find</span><span> ~/.openclaw -path </span><span class="token token" style="color: rgb(155, 233, 99);">"*/state/sessions/*"</span><span> -name </span><span class="token token" style="color: rgb(155, 233, 99);">"*acp*"</span><span> -exec </span><span class="token token" style="color: rgb(112, 184, 255);">rm</span><span> -f </span><span class="token token" style="color: rgb(211, 215, 222);">{</span><span class="token token" style="color: rgb(211, 215, 222);">}</span><span> </span><span class="token token" style="color: rgb(211, 215, 222);">\</span><span class="token token" style="color: rgb(211, 215, 222);">;</span><span> </span></span><span> </span><span>openclaw gateway restart</span></code></pre></div></div> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Logs</h2> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Provider error triggering the zombie state:</p> <div role="group" aria-label="Code" tabindex="0" class="relative group/copy bg-bg-000/50 border-0.5 border-border-400 rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-100"><div class="sticky opacity-0 group-hover/copy:opacity-100 group-focus-within/copy:opacity-100 top-2 py-2 h-12 w-0 float-right"><div class="absolute right-0 h-8 px-2 items-center inline-flex z-10"><button class="inline-flex items-center justify-center relative isolate shrink-0 can-focus select-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none disabled:drop-shadow-none border-transparent transition font-base duration-300 ease-[cubic-bezier(0.165,0.85,0.45,1)] h-8 w-8 rounded-md backdrop-blur-md _fill_1abo4_9 _ghost_1abo4_96" type="button" aria-label="Copy to clipboard" data-state="closed"><div class="relative"><div class="transition-all opacity-100 scale-100" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-100 scale-100" aria-hidden="true"><path d="M12.5 3A1.5 1.5 0 0 1 14 4.5V6h1.5A1.5 1.5 0 0 1 17 7.5v8a1.5 1.5 0 0 1-1.5 1.5h-8A1.5 1.5 0 0 1 6 15.5V14H4.5A1.5 1.5 0 0 1 3 12.5v-8A1.5 1.5 0 0 1 4.5 3zm1.5 9.5a1.5 1.5 0 0 1-1.5 1.5H7v1.5a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5H14zM4.5 4a.5.5 0 0 0-.5.5v8a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5z"></path></svg></div><div class="absolute inset-0 flex items-center justify-center"><div class="transition-all opacity-0 scale-50" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-0 scale-50" aria-hidden="true"><path d="M15.188 5.11a.5.5 0 0 1 .752.626l-.056.084-7.5 9a.5.5 0 0 1-.738.033l-3.5-3.5-.064-.078a.501.501 0 0 1 .693-.693l.078.064 3.113 3.113 7.15-8.58z"></path></svg></div></div></div></button></div></div><div class="overflow-x-auto"><pre class="code-block__code !my-0 !rounded-lg !text-sm !leading-relaxed p-3.5" style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono);"><code style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono); white-space: pre-wrap;"><span><span>[openai-codex] Token refresh failed: 401 { </span></span><span> "error": { </span><span> "message": "Your refresh token has already been used to generate a new access token. Please try signing in again.", </span><span> "type": "invalid_request_error", </span><span> "param": null, </span><span> "code": "refresh_token_reused" </span><span> } </span><span>}</span></code></pre></div></div> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Telegram behavior: every message to the spawning agent returns:</p> <div role="group" aria-label="Code" tabindex="0" class="relative group/copy bg-bg-000/50 border-0.5 border-border-400 rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-100"><div class="sticky opacity-0 group-hover/copy:opacity-100 group-focus-within/copy:opacity-100 top-2 py-2 h-12 w-0 float-right"><div class="absolute right-0 h-8 px-2 items-center inline-flex z-10"><button class="inline-flex items-center justify-center relative isolate shrink-0 can-focus select-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none disabled:drop-shadow-none border-transparent transition font-base duration-300 ease-[cubic-bezier(0.165,0.85,0.45,1)] h-8 w-8 rounded-md backdrop-blur-md _fill_1abo4_9 _ghost_1abo4_96" type="button" aria-label="Copy to clipboard" data-state="closed"><div class="relative"><div class="transition-all opacity-100 scale-100" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-100 scale-100" aria-hidden="true"><path d="M12.5 3A1.5 1.5 0 0 1 14 4.5V6h1.5A1.5 1.5 0 0 1 17 7.5v8a1.5 1.5 0 0 1-1.5 1.5h-8A1.5 1.5 0 0 1 6 15.5V14H4.5A1.5 1.5 0 0 1 3 12.5v-8A1.5 1.5 0 0 1 4.5 3zm1.5 9.5a1.5 1.5 0 0 1-1.5 1.5H7v1.5a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5H14zM4.5 4a.5.5 0 0 0-.5.5v8a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5z"></path></svg></div><div class="absolute inset-0 flex items-center justify-center"><div class="transition-all opacity-0 scale-50" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-0 scale-50" aria-hidden="true"><path d="M15.188 5.11a.5.5 0 0 1 .752.626l-.056.084-7.5 9a.5.5 0 0 1-.738.033l-3.5-3.5-.064-.078a.501.501 0 0 1 .693-.693l.078.064 3.113 3.113 7.15-8.58z"></path></svg></div></div></div></button></div></div><div class="overflow-x-auto"><pre class="code-block__code !my-0 !rounded-lg !text-sm !leading-relaxed p-3.5" style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono);"><code style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono); white-space: pre-wrap;"><span><span>Background task done: linkedin-post (run 2441).</span></span></code></pre></div></div> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Run number increments with each interaction.</p> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">After cleaning locations 1 and 2 but not 3:</p> <div role="group" aria-label="Code" tabindex="0" class="relative group/copy bg-bg-000/50 border-0.5 border-border-400 rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-100"><div class="sticky opacity-0 group-hover/copy:opacity-100 group-focus-within/copy:opacity-100 top-2 py-2 h-12 w-0 float-right"><div class="absolute right-0 h-8 px-2 items-center inline-flex z-10"><button class="inline-flex items-center justify-center relative isolate shrink-0 can-focus select-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none disabled:drop-shadow-none border-transparent transition font-base duration-300 ease-[cubic-bezier(0.165,0.85,0.45,1)] h-8 w-8 rounded-md backdrop-blur-md _fill_1abo4_9 _ghost_1abo4_96" type="button" aria-label="Copy to clipboard" data-state="closed"><div class="relative"><div class="transition-all opacity-100 scale-100" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-100 scale-100" aria-hidden="true"><path d="M12.5 3A1.5 1.5 0 0 1 14 4.5V6h1.5A1.5 1.5 0 0 1 17 7.5v8a1.5 1.5 0 0 1-1.5 1.5h-8A1.5 1.5 0 0 1 6 15.5V14H4.5A1.5 1.5 0 0 1 3 12.5v-8A1.5 1.5 0 0 1 4.5 3zm1.5 9.5a1.5 1.5 0 0 1-1.5 1.5H7v1.5a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5H14zM4.5 4a.5.5 0 0 0-.5.5v8a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5z"></path></svg></div><div class="absolute inset-0 flex items-center justify-center"><div class="transition-all opacity-0 scale-50" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-0 scale-50" aria-hidden="true"><path d="M15.188 5.11a.5.5 0 0 1 .752.626l-.056.084-7.5 9a.5.5 0 0 1-.738.033l-3.5-3.5-.064-.078a.501.501 0 0 1 .693-.693l.078.064 3.113 3.113 7.15-8.58z"></path></svg></div></div></div></button></div></div><div class="overflow-x-auto"><pre class="code-block__code !my-0 !rounded-lg !text-sm !leading-relaxed p-3.5" style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono);"><code style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono); white-space: pre-wrap;"><span><span>ACP error (ACP_SESSION_INIT_FAILED): ACP metadata is missing for </span></span><span>agent:claude:acp:cfb5c7c1-6dbb-4c3a-bb5b-12d63bb4475c. </span><span>Recreate this ACP session with /acp spawn and rebind the thread.</span></code></pre></div></div>`
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

`<h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Bug type</h2>

<p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Behavior bug (incorrect output/state without crash)</p> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Summary</h2> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">When an ACP background task (<code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">sessions_spawn</code>) fails due to a provider billing/auth error (e.g., <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">openai-codex</code> refresh token expired), the task enters a zombie state that survives:</p> <ul class="[li_&amp;]:mb-0 [li_&amp;]:mt-1 [li_&amp;]:gap-1 [&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc flex flex-col gap-1 pl-8 mb-3"> <li class="whitespace-normal break-words pl-2"><code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">/new</code> session resets</li> <li class="whitespace-normal break-words pl-2">Deleting the spawning agent's session files + <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">sessions.json</code></li> <li class="whitespace-normal break-words pl-2">Deleting <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">~/.openclaw/data/runs.sqlite</code></li> <li class="whitespace-normal break-words pl-2">Deleting Telegram <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">update-offset-*.json</code> files</li> <li class="whitespace-normal break-words pl-2">Clearing agent <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">auth-profiles.json</code></li> <li class="whitespace-normal break-words pl-2">Full gateway restarts</li> </ul> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">The zombie task delivers a "Background task done: &lt;label&gt;" message on <strong>every single user interaction</strong> with the spawning agent, making the agent effectively unusable.</p> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Environment</h2> <ul class="[li_&amp;]:mb-0 [li_&amp;]:mt-1 [li_&amp;]:gap-1 [&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc flex flex-col gap-1 pl-8 mb-3"> <li class="whitespace-normal break-words pl-2"><strong>OpenClaw</strong>: 2026.4.5 (3e72c03)</li> <li class="whitespace-normal break-words pl-2"><strong>OS</strong>: Linux 6.17.0-19-generic (x64), Node 22.22.1</li> <li class="whitespace-normal break-words pl-2"><strong>Install method</strong>: npm global</li> <li class="whitespace-normal break-words pl-2"><strong>Channels</strong>: Telegram (multiple accounts), WhatsApp</li> <li class="whitespace-normal break-words pl-2"><strong>Agents</strong>: 8 configured agents including ACP claude agent</li> </ul> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Steps to reproduce</h2> <ol class="[li_&amp;]:mb-0 [li_&amp;]:mt-1 [li_&amp;]:gap-1 [&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-decimal flex flex-col gap-1 pl-8 mb-3"> <li class="whitespace-normal break-words pl-2">Configure multiple agents with <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">sessions_spawn</code> / <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">sessions_send</code> capability</li> <li class="whitespace-normal break-words pl-2">From agent A (e.g., "some"), spawn an ACP background task to the claude agent: <ul class="[li_&amp;]:mb-0 [li_&amp;]:mt-1 [li_&amp;]:gap-1 [&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc flex flex-col gap-1 pl-8 mb-3"> <li class="whitespace-normal break-words pl-2"><code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">sessions_spawn runtime:"acp" agent:"claude" label:"linkedin-post" ...</code></li> </ul> </li> <li class="whitespace-normal break-words pl-2">Have the ACP task use a provider with expired billing/auth (e.g., <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">openai-codex</code> with <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">refresh_token_reused</code> error)</li> <li class="whitespace-normal break-words pl-2">The task "completes" but cannot deliver the result properly</li> <li class="whitespace-normal break-words pl-2">Every subsequent message to agent A triggers: <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">Background task done: linkedin-post (run XXXX)</code></li> <li class="whitespace-normal break-words pl-2">Run number increments on each interaction</li> </ol> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Expected behavior</h2> <ul class="[li_&amp;]:mb-0 [li_&amp;]:mt-1 [li_&amp;]:gap-1 [&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-disc flex flex-col gap-1 pl-8 mb-3"> <li class="whitespace-normal break-words pl-2">Failed background tasks should be marked as failed and cleaned up</li> <li class="whitespace-normal break-words pl-2">A billing/auth error should not create a persistent zombie task</li> <li class="whitespace-normal break-words pl-2"><code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">/new</code> should clear all pending task deliveries for the session</li> <li class="whitespace-normal break-words pl-2">Gateway restart should not re-queue failed task result deliveries</li> </ul> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Actual behavior</h2> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">The "Background task done" message appears on every user interaction indefinitely. The agent becomes unusable on the affected channel (Telegram), while working normally on WebChat (different session, no cached task reference).</p> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Root cause analysis</h2> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">The task reference was stored in <strong>three separate locations</strong>, and all three had to be manually cleaned to resolve the issue:</p> <h3 class="text-text-100 mt-2 -mb-1 text-base font-bold">1. ACP agent sessions (expected)</h3> <div role="group" aria-label="Code" tabindex="0" class="relative group/copy bg-bg-000/50 border-0.5 border-border-400 rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-100"><div class="sticky opacity-0 group-hover/copy:opacity-100 group-focus-within/copy:opacity-100 top-2 py-2 h-12 w-0 float-right"><div class="absolute right-0 h-8 px-2 items-center inline-flex z-10"><button class="inline-flex items-center justify-center relative isolate shrink-0 can-focus select-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none disabled:drop-shadow-none border-transparent transition font-base duration-300 ease-[cubic-bezier(0.165,0.85,0.45,1)] h-8 w-8 rounded-md backdrop-blur-md _fill_1abo4_9 _ghost_1abo4_96" type="button" aria-label="Copy to clipboard" data-state="closed"><div class="relative"><div class="transition-all opacity-100 scale-100" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-100 scale-100" aria-hidden="true"><path d="M12.5 3A1.5 1.5 0 0 1 14 4.5V6h1.5A1.5 1.5 0 0 1 17 7.5v8a1.5 1.5 0 0 1-1.5 1.5h-8A1.5 1.5 0 0 1 6 15.5V14H4.5A1.5 1.5 0 0 1 3 12.5v-8A1.5 1.5 0 0 1 4.5 3zm1.5 9.5a1.5 1.5 0 0 1-1.5 1.5H7v1.5a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5H14zM4.5 4a.5.5 0 0 0-.5.5v8a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5z"></path></svg></div><div class="absolute inset-0 flex items-center justify-center"><div class="transition-all opacity-0 scale-50" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-0 scale-50" aria-hidden="true"><path d="M15.188 5.11a.5.5 0 0 1 .752.626l-.056.084-7.5 9a.5.5 0 0 1-.738.033l-3.5-3.5-.064-.078a.501.501 0 0 1 .693-.693l.078.064 3.113 3.113 7.15-8.58z"></path></svg></div></div></div></button></div></div><div class="overflow-x-auto"><pre class="code-block__code !my-0 !rounded-lg !text-sm !leading-relaxed p-3.5" style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono);"><code style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono); white-space: pre-wrap;"><span><span>~/.openclaw/agents/claude/sessions/sessions.json</span></span></code></pre></div></div> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Contains the spawned ACP session with <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">"spawnedBy": "agent:some:telegram:direct:414943979"</code> and <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">"label": "linkedin-post"</code>.</p> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]"><strong>Fix</strong>: <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">rm -f ~/.openclaw/agents/claude/sessions/*.jsonl &amp;&amp; echo '{}' &gt; sessions.json</code></p> <h3 class="text-text-100 mt-2 -mb-1 text-base font-bold">2. Task database (expected)</h3> <div role="group" aria-label="Code" tabindex="0" class="relative group/copy bg-bg-000/50 border-0.5 border-border-400 rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-100"><div class="sticky opacity-0 group-hover/copy:opacity-100 group-focus-within/copy:opacity-100 top-2 py-2 h-12 w-0 float-right"><div class="absolute right-0 h-8 px-2 items-center inline-flex z-10"><button class="inline-flex items-center justify-center relative isolate shrink-0 can-focus select-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none disabled:drop-shadow-none border-transparent transition font-base duration-300 ease-[cubic-bezier(0.165,0.85,0.45,1)] h-8 w-8 rounded-md backdrop-blur-md _fill_1abo4_9 _ghost_1abo4_96" type="button" aria-label="Copy to clipboard" data-state="closed"><div class="relative"><div class="transition-all opacity-100 scale-100" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-100 scale-100" aria-hidden="true"><path d="M12.5 3A1.5 1.5 0 0 1 14 4.5V6h1.5A1.5 1.5 0 0 1 17 7.5v8a1.5 1.5 0 0 1-1.5 1.5h-8A1.5 1.5 0 0 1 6 15.5V14H4.5A1.5 1.5 0 0 1 3 12.5v-8A1.5 1.5 0 0 1 4.5 3zm1.5 9.5a1.5 1.5 0 0 1-1.5 1.5H7v1.5a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5H14zM4.5 4a.5.5 0 0 0-.5.5v8a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5z"></path></svg></div><div class="absolute inset-0 flex items-center justify-center"><div class="transition-all opacity-0 scale-50" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-0 scale-50" aria-hidden="true"><path d="M15.188 5.11a.5.5 0 0 1 .752.626l-.056.084-7.5 9a.5.5 0 0 1-.738.033l-3.5-3.5-.064-.078a.501.501 0 0 1 .693-.693l.078.064 3.113 3.113 7.15-8.58z"></path></svg></div></div></div></button></div></div><div class="overflow-x-auto"><pre class="code-block__code !my-0 !rounded-lg !text-sm !leading-relaxed p-3.5" style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono);"><code style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono); white-space: pre-wrap;"><span><span>~/.openclaw/data/runs.sqlite</span></span></code></pre></div></div> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Contains the task run record.</p> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]"><strong>Fix</strong>: <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">rm -f ~/.openclaw/data/runs.sqlite*</code></p> <h3 class="text-text-100 mt-2 -mb-1 text-base font-bold">3. Default agent workspace state (unexpected)</h3> <div role="group" aria-label="Code" tabindex="0" class="relative group/copy bg-bg-000/50 border-0.5 border-border-400 rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-100"><div class="sticky opacity-0 group-hover/copy:opacity-100 group-focus-within/copy:opacity-100 top-2 py-2 h-12 w-0 float-right"><div class="absolute right-0 h-8 px-2 items-center inline-flex z-10"><button class="inline-flex items-center justify-center relative isolate shrink-0 can-focus select-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none disabled:drop-shadow-none border-transparent transition font-base duration-300 ease-[cubic-bezier(0.165,0.85,0.45,1)] h-8 w-8 rounded-md backdrop-blur-md _fill_1abo4_9 _ghost_1abo4_96" type="button" aria-label="Copy to clipboard" data-state="closed"><div class="relative"><div class="transition-all opacity-100 scale-100" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-100 scale-100" aria-hidden="true"><path d="M12.5 3A1.5 1.5 0 0 1 14 4.5V6h1.5A1.5 1.5 0 0 1 17 7.5v8a1.5 1.5 0 0 1-1.5 1.5h-8A1.5 1.5 0 0 1 6 15.5V14H4.5A1.5 1.5 0 0 1 3 12.5v-8A1.5 1.5 0 0 1 4.5 3zm1.5 9.5a1.5 1.5 0 0 1-1.5 1.5H7v1.5a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5H14zM4.5 4a.5.5 0 0 0-.5.5v8a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5z"></path></svg></div><div class="absolute inset-0 flex items-center justify-center"><div class="transition-all opacity-0 scale-50" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-0 scale-50" aria-hidden="true"><path d="M15.188 5.11a.5.5 0 0 1 .752.626l-.056.084-7.5 9a.5.5 0 0 1-.738.033l-3.5-3.5-.064-.078a.501.501 0 0 1 .693-.693l.078.064 3.113 3.113 7.15-8.58z"></path></svg></div></div></div></button></div></div><div class="overflow-x-auto"><pre class="code-block__code !my-0 !rounded-lg !text-sm !leading-relaxed p-3.5" style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono);"><code style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono); white-space: pre-wrap;"><span><span>~/.openclaw/workspace-pa/state/sessions/agent%3Aclaude%3Aacp%3A&lt;session-uuid&gt;.json</span></span></code></pre></div></div> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">A cached ACP session reference stored in the <strong>default agent's workspace</strong> — not in the spawning agent's workspace. This was the hardest to find and the actual blocker.</p> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]"><strong>Fix</strong>: <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">rm -f ~/.openclaw/workspace-pa/state/sessions/agent%3Aclaude%3Aacp%3A*.json</code></p> <h3 class="text-text-100 mt-2 -mb-1 text-base font-bold">Debugging timeline</h3> <div class="overflow-x-auto w-full px-2 mb-6"> Action | Result -- | -- /new on spawning agent | ❌ Still loops Delete spawning agent sessions | ❌ Still loops Delete runs.sqlite | ❌ Still loops Delete Telegram offset files | ❌ Still loops Switch model (avoid billing error) | ❌ Still loops Gateway restart | ❌ Still loops Delete target ACP agent sessions | ❌ Still loops (changed to ACP_SESSION_INIT_FAILED) Delete cached session in workspace-pa/state/sessions/ | ✅ Fixed </div> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Suggested fixes</h2> <ol class="[li_&amp;]:mb-0 [li_&amp;]:mt-1 [li_&amp;]:gap-1 [&amp;:not(:last-child)_ul]:pb-1 [&amp;:not(:last-child)_ol]:pb-1 list-decimal flex flex-col gap-1 pl-8 mb-3"> <li class="whitespace-normal break-words pl-2"><strong>Auto-cleanup on billing/auth failure</strong>: When a spawned ACP task fails due to a billing or auth error, OpenClaw should mark it as permanently failed and clean up all references (spawning agent, ACP agent, task database, workspace state).</li> <li class="whitespace-normal break-words pl-2"><strong><code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">/new</code> should clear pending task deliveries</strong>: A session reset should also clear any queued background task result deliveries for that session.</li> <li class="whitespace-normal break-words pl-2"><strong>Centralize task state</strong>: Task references should not be scattered across three separate storage locations. A single source of truth (e.g., <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">runs.sqlite</code>) should be authoritative, with other locations acting as caches that can be safely invalidated.</li> <li class="whitespace-normal break-words pl-2"><strong>Add a task cleanup command</strong>: Something like <code class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]">openclaw tasks cancel --all --agent some</code> that finds and removes all task references across all storage locations.</li> <li class="whitespace-normal break-words pl-2"><strong>Surface the actual location</strong>: When a zombie task is detected, the error message should include the file path where the reference lives, making manual cleanup possible without hours of forensic debugging.</li> </ol> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Workaround</h2> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">To fully resolve a stuck background task, you must clean <strong>all three locations</strong>:</p> <div role="group" aria-label="bash code" tabindex="0" class="relative group/copy bg-bg-000/50 border-0.5 border-border-400 rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-100"><div class="sticky opacity-0 group-hover/copy:opacity-100 group-focus-within/copy:opacity-100 top-2 py-2 h-12 w-0 float-right"><div class="absolute right-0 h-8 px-2 items-center inline-flex z-10"><button class="inline-flex items-center justify-center relative isolate shrink-0 can-focus select-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none disabled:drop-shadow-none border-transparent transition font-base duration-300 ease-[cubic-bezier(0.165,0.85,0.45,1)] h-8 w-8 rounded-md backdrop-blur-md _fill_1abo4_9 _ghost_1abo4_96" type="button" aria-label="Copy to clipboard" data-state="closed"><div class="relative"><div class="transition-all opacity-100 scale-100" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-100 scale-100" aria-hidden="true"><path d="M12.5 3A1.5 1.5 0 0 1 14 4.5V6h1.5A1.5 1.5 0 0 1 17 7.5v8a1.5 1.5 0 0 1-1.5 1.5h-8A1.5 1.5 0 0 1 6 15.5V14H4.5A1.5 1.5 0 0 1 3 12.5v-8A1.5 1.5 0 0 1 4.5 3zm1.5 9.5a1.5 1.5 0 0 1-1.5 1.5H7v1.5a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5H14zM4.5 4a.5.5 0 0 0-.5.5v8a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5z"></path></svg></div><div class="absolute inset-0 flex items-center justify-center"><div class="transition-all opacity-0 scale-50" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-0 scale-50" aria-hidden="true"><path d="M15.188 5.11a.5.5 0 0 1 .752.626l-.056.084-7.5 9a.5.5 0 0 1-.738.033l-3.5-3.5-.064-.078a.501.501 0 0 1 .693-.693l.078.064 3.113 3.113 7.15-8.58z"></path></svg></div></div></div></button></div></div><div class="text-text-500 font-small p-3.5 pb-0">bash</div><div class="overflow-x-auto"><pre class="code-block__code !my-0 !rounded-lg !text-sm !leading-relaxed p-3.5" style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono);"><code class="language-bash" style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono); white-space: pre;"><span><span>openclaw gateway stop </span></span><span> </span><span><span></span><span class="token token" style="color: rgb(129, 136, 152);"># 1. Clean the ACP agent sessions</span><span> </span></span><span><span></span><span class="token token" style="color: rgb(112, 184, 255);">rm</span><span> -f ~/.openclaw/agents/claude/sessions/*.jsonl </span></span><span><span></span><span class="token token" style="color: rgb(251, 173, 96);">echo</span><span> </span><span class="token token" style="color: rgb(155, 233, 99);">'{}'</span><span> </span><span class="token token" style="color: rgb(234, 236, 240);">&gt;</span><span> ~/.openclaw/agents/claude/sessions/sessions.json </span></span><span> </span><span><span></span><span class="token token" style="color: rgb(129, 136, 152);"># 2. Clean the task database</span><span> </span></span><span><span></span><span class="token token" style="color: rgb(112, 184, 255);">rm</span><span> -f ~/.openclaw/data/runs.sqlite* </span></span><span> </span><span><span></span><span class="token token" style="color: rgb(129, 136, 152);"># 3. Find and remove cached ACP session references (this is the one you'll miss)</span><span> </span></span><span><span></span><span class="token token" style="color: rgb(112, 184, 255);">find</span><span> ~/.openclaw -path </span><span class="token token" style="color: rgb(155, 233, 99);">"*/state/sessions/*"</span><span> -name </span><span class="token token" style="color: rgb(155, 233, 99);">"*acp*"</span><span> -exec </span><span class="token token" style="color: rgb(112, 184, 255);">rm</span><span> -f </span><span class="token token" style="color: rgb(211, 215, 222);">{</span><span class="token token" style="color: rgb(211, 215, 222);">}</span><span> </span><span class="token token" style="color: rgb(211, 215, 222);">\</span><span class="token token" style="color: rgb(211, 215, 222);">;</span><span> </span></span><span> </span><span>openclaw gateway restart</span></code></pre></div></div> <h2 class="text-text-100 mt-3 -mb-1 text-[1.125rem] font-bold">Logs</h2> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Provider error triggering the zombie state:</p> <div role="group" aria-label="Code" tabindex="0" class="relative group/copy bg-bg-000/50 border-0.5 border-border-400 rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-100"><div class="sticky opacity-0 group-hover/copy:opacity-100 group-focus-within/copy:opacity-100 top-2 py-2 h-12 w-0 float-right"><div class="absolute right-0 h-8 px-2 items-center inline-flex z-10"><button class="inline-flex items-center justify-center relative isolate shrink-0 can-focus select-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none disabled:drop-shadow-none border-transparent transition font-base duration-300 ease-[cubic-bezier(0.165,0.85,0.45,1)] h-8 w-8 rounded-md backdrop-blur-md _fill_1abo4_9 _ghost_1abo4_96" type="button" aria-label="Copy to clipboard" data-state="closed"><div class="relative"><div class="transition-all opacity-100 scale-100" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-100 scale-100" aria-hidden="true"><path d="M12.5 3A1.5 1.5 0 0 1 14 4.5V6h1.5A1.5 1.5 0 0 1 17 7.5v8a1.5 1.5 0 0 1-1.5 1.5h-8A1.5 1.5 0 0 1 6 15.5V14H4.5A1.5 1.5 0 0 1 3 12.5v-8A1.5 1.5 0 0 1 4.5 3zm1.5 9.5a1.5 1.5 0 0 1-1.5 1.5H7v1.5a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5H14zM4.5 4a.5.5 0 0 0-.5.5v8a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5z"></path></svg></div><div class="absolute inset-0 flex items-center justify-center"><div class="transition-all opacity-0 scale-50" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-0 scale-50" aria-hidden="true"><path d="M15.188 5.11a.5.5 0 0 1 .752.626l-.056.084-7.5 9a.5.5 0 0 1-.738.033l-3.5-3.5-.064-.078a.501.501 0 0 1 .693-.693l.078.064 3.113 3.113 7.15-8.58z"></path></svg></div></div></div></button></div></div><div class="overflow-x-auto"><pre class="code-block__code !my-0 !rounded-lg !text-sm !leading-relaxed p-3.5" style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono);"><code style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono); white-space: pre-wrap;"><span><span>[openai-codex] Token refresh failed: 401 { </span></span><span> "error": { </span><span> "message": "Your refresh token has already been used to generate a new access token. Please try signing in again.", </span><span> "type": "invalid_request_error", </span><span> "param": null, </span><span> "code": "refresh_token_reused" </span><span> } </span><span>}</span></code></pre></div></div> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Telegram behavior: every message to the spawning agent returns:</p> <div role="group" aria-label="Code" tabindex="0" class="relative group/copy bg-bg-000/50 border-0.5 border-border-400 rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-100"><div class="sticky opacity-0 group-hover/copy:opacity-100 group-focus-within/copy:opacity-100 top-2 py-2 h-12 w-0 float-right"><div class="absolute right-0 h-8 px-2 items-center inline-flex z-10"><button class="inline-flex items-center justify-center relative isolate shrink-0 can-focus select-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none disabled:drop-shadow-none border-transparent transition font-base duration-300 ease-[cubic-bezier(0.165,0.85,0.45,1)] h-8 w-8 rounded-md backdrop-blur-md _fill_1abo4_9 _ghost_1abo4_96" type="button" aria-label="Copy to clipboard" data-state="closed"><div class="relative"><div class="transition-all opacity-100 scale-100" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-100 scale-100" aria-hidden="true"><path d="M12.5 3A1.5 1.5 0 0 1 14 4.5V6h1.5A1.5 1.5 0 0 1 17 7.5v8a1.5 1.5 0 0 1-1.5 1.5h-8A1.5 1.5 0 0 1 6 15.5V14H4.5A1.5 1.5 0 0 1 3 12.5v-8A1.5 1.5 0 0 1 4.5 3zm1.5 9.5a1.5 1.5 0 0 1-1.5 1.5H7v1.5a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5H14zM4.5 4a.5.5 0 0 0-.5.5v8a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5z"></path></svg></div><div class="absolute inset-0 flex items-center justify-center"><div class="transition-all opacity-0 scale-50" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-0 scale-50" aria-hidden="true"><path d="M15.188 5.11a.5.5 0 0 1 .752.626l-.056.084-7.5 9a.5.5 0 0 1-.738.033l-3.5-3.5-.064-.078a.501.501 0 0 1 .693-.693l.078.064 3.113 3.113 7.15-8.58z"></path></svg></div></div></div></button></div></div><div class="overflow-x-auto"><pre class="code-block__code !my-0 !rounded-lg !text-sm !leading-relaxed p-3.5" style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono);"><code style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono); white-space: pre-wrap;"><span><span>Background task done: linkedin-post (run 2441).</span></span></code></pre></div></div> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">Run number increments with each interaction.</p> <p class="font-claude-response-body break-words whitespace-normal leading-[1.7]">After cleaning locations 1 and 2 but not 3:</p> <div role="group" aria-label="Code" tabindex="0" class="relative group/copy bg-bg-000/50 border-0.5 border-border-400 rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-accent-100"><div class="sticky opacity-0 group-hover/copy:opacity-100 group-focus-within/copy:opacity-100 top-2 py-2 h-12 w-0 float-right"><div class="absolute right-0 h-8 px-2 items-center inline-flex z-10"><button class="inline-flex items-center justify-center relative isolate shrink-0 can-focus select-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none disabled:drop-shadow-none border-transparent transition font-base duration-300 ease-[cubic-bezier(0.165,0.85,0.45,1)] h-8 w-8 rounded-md backdrop-blur-md _fill_1abo4_9 _ghost_1abo4_96" type="button" aria-label="Copy to clipboard" data-state="closed"><div class="relative"><div class="transition-all opacity-100 scale-100" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-100 scale-100" aria-hidden="true"><path d="M12.5 3A1.5 1.5 0 0 1 14 4.5V6h1.5A1.5 1.5 0 0 1 17 7.5v8a1.5 1.5 0 0 1-1.5 1.5h-8A1.5 1.5 0 0 1 6 15.5V14H4.5A1.5 1.5 0 0 1 3 12.5v-8A1.5 1.5 0 0 1 4.5 3zm1.5 9.5a1.5 1.5 0 0 1-1.5 1.5H7v1.5a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5H14zM4.5 4a.5.5 0 0 0-.5.5v8a.5.5 0 0 0 .5.5h8a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.5z"></path></svg></div><div class="absolute inset-0 flex items-center justify-center"><div class="transition-all opacity-0 scale-50" style="width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;"><svg width="20" height="20" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" style="flex-shrink: 0;" class="transition-all opacity-0 scale-50" aria-hidden="true"><path d="M15.188 5.11a.5.5 0 0 1 .752.626l-.056.084-7.5 9a.5.5 0 0 1-.738.033l-3.5-3.5-.064-.078a.501.501 0 0 1 .693-.693l.078.064 3.113 3.113 7.15-8.58z"></path></svg></div></div></div></button></div></div><div class="overflow-x-auto"><pre class="code-block__code !my-0 !rounded-lg !text-sm !leading-relaxed p-3.5" style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono);"><code style="color: rgb(234, 236, 240); background: transparent; font-family: var(--font-mono); white-space: pre-wrap;"><span><span>ACP error (ACP_SESSION_INIT_FAILED): ACP metadata is missing for </span></span><span>agent:claude:acp:cfb5c7c1-6dbb-4c3a-bb5b-12d63bb4475c. </span><span>Recreate this ACP session with /acp spawn and rebind the thread.</span></code></pre></div></div>`

Steps to reproduce

``Steps to reproduce

Configure multiple agents with sessions_spawn / sessions_send capability From agent A (e.g., "some"), spawn an ACP background task to the claude agent:

sessions_spawn runtime:"acp" agent:"claude" label:"linkedin-post" ...

Have the ACP task use a provider with expired billing/auth (e.g., openai-codex with refresh_token_reused error) The task "completes" but cannot deliver the result properly Every subsequent message to agent A triggers: Background task done: linkedin-post (run XXXX) Run number increments on each interaction``

Expected behavior

Failed background tasks should be marked as failed and cleaned up A billing/auth error should not create a persistent zombie task /new should clear all pending task deliveries for the session Gateway restart should not re-queue failed task result deliveries

Actual behavior

The "Background task done" message appears on every user interaction indefinitely. The agent becomes unusable on the affected channel (Telegram), while working normally on WebChat (different session, no cached task reference).

OpenClaw version

2026.04.05

Operating system

Ubuntu

Install method

npm

Model

openrouter

Provider / routing chain

openclaw

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

To fix the issue of a zombie background task in OpenClaw, clean up all references to the task in three separate locations: ACP agent sessions, task database, and default agent workspace state.

Guidance

  1. Clean ACP agent sessions: Remove the spawned ACP session with rm -f ~/.openclaw/agents/claude/sessions/*.jsonl and reset sessions.json with echo '{}' > ~/.openclaw/agents/claude/sessions/sessions.json.
  2. Clean task database: Remove the task run record with rm -f ~/.openclaw/data/runs.sqlite*.
  3. Clean default agent workspace state: Find and remove cached ACP session references with find ~/.openclaw -path "*/state/sessions/*" -name "*acp*" -exec rm -f {} \;.
  4. Restart OpenClaw gateway: After cleaning up the references, restart the gateway with openclaw gateway restart.

Example

The provided bash script in the issue body can be used as a workaround to clean up the task references:

openclaw gateway stop
rm -f ~/.openclaw/agents/claude/sessions/*.jsonl
echo '{}' > ~/.openclaw/agents/claude/sessions/sessions.json
rm -f ~/.openclaw/data/runs.sqlite*
find ~/.openclaw -path "*/state/sessions/*" -name "*acp*" -exec rm -f {} \;
openclaw gateway restart

Notes

The issue is caused by a billing/auth error when using a provider like OpenAI Codex, which creates a persistent zombie task. The task references are stored in three separate locations, making it difficult to clean up. The provided workaround and suggested fixes aim to address this issue.

Recommendation

Apply the workaround by running the provided bash script to clean up the task references and restart the OpenClaw gateway. This should resolve the issue of the zombie background task.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Failed background tasks should be marked as failed and cleaned up A billing/auth error should not create a persistent zombie task /new should clear all pending task deliveries for the session Gateway restart should not re-queue failed task result deliveries

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING