Repository navigation
Description
Environment: OpenClaw 2026.9.7 (installed) / traced against 2026.9.8 sources, Linux, systemd user gateway, Telegram channel with multiple bot accounts (main, dev, ceo, …).
Error (gateway log, repeats per message, update stays pending forever):
[telegram] dispatch failed: Error: prepared reply dispatch runtime owner was not published for opencode
[telegram] spooled update 852364949 failed; keeping for retry: prepared reply dispatch runtime owner was not published for opencode
Repro:
acp.allowedAgentsincludesopencode, but there is noopencodeentry inagents.entries.- On any Telegram DM:
/acp spawn opencode --bind here(succeeds, ACP session is created). - Send any message (
Hi) → every turn fails with the error above. The spooled update never completes (retry storm). Even/acp closefails identically (failure happens before command parsing), so the chat cannot be recovered from the client. The bind had to be deleted manually fromplugin_state_entries(plugin_id='telegram',namespace='telegram.thread-bindings').
Root cause:
src/channels/plugins/binding-routing.ts:197-219— a bound conversation'sroute.agentIdbecomes the agent parsed from the bound session key (agent:opencode:acp:<uuid>→opencode).src/agents/prepared-reply-dispatch-runtime.ts:115-151—load({agentId})throwsPreparedModelRuntimeOwnerNotPublishedErrorwhen the id is absent from the publication, which only containsprovenance === "configured"agents.- Net: binding a chat to a harness id with no same-named configured agent permanently poisons the conversation.
codexbindings work only because a same-namedagents.entries.codexhappens to exist.
Why this looks like a bug: src/auto-reply/reply/dispatch-from-config.gather.ts:408-412 states the intent explicitly ("A bound ACP key names an external harness, not a configured model-runtime owner. Keep the source owner for Gateway dispatch..."), but the bound path still ends up demanding a configured owner named after the harness.
Complicating findings during triage (listed so nobody re-chases them):
- The
--bind herepin lives in the Telegram-nativetelegram.thread-bindingsplugin-state store, not incurrent_conversation_bindings(which stays empty). - Stale
agent:opencode:*conversation/session rows can linger in a deleted agent's sqlite (~/.openclaw/agents/opencode/agent/openclaw-agent.sqlite) and win ownership by recency — check per-agent DBs, not just the main state DB. - Adding a minimal
agents.entries.opencodeby hand is not a workaround: the gateway then refuses to start (Legacy workspace setup state requires migration for ~/.openclaw/workspace/opencode).
Expected: bound-harness turns fall back to the source route owner for Gateway dispatch (per the code comment above), or --bind to an owner-less harness id is rejected up front with a clear error instead of bricking the chat (and orphaning it from /acp close).
Suggested fix sketch: roster-guarded owner resolution — when the bound/ACP session key parses to an id absent from listAgentIds(cfg) (agents/agent-roster.ts), fall back to the source route session key's agent for the reply-dispatch load (dispatch-from-config.gather.ts ~:373-424 and the second load site at gateway/agent-turn/agent-run-admission-phase.ts:360). Unit-test the helper; regression-test route telegram:dev → developer + thread-binding to agent:opencode:acp:* with no opencode entry.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Oct 3, 2026
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.
This is a valid Telegram manifestation of the shared dispatch-owner defect already tracked at #146365. That open issue includes the same Matrix binding/recovery failure, and existing repair work explicitly covers Telegram; the bug remains unfixed on current main.
Root-cause cluster
Relationship:
duplicateCanonical: #146365
Summary: Telegram reproduces the same shared configured-owner versus ACP-harness mismatch already documented for Discord and Matrix.
Members:
canonical: [Bug]: Discord /acp spawn thread never dispatches: "prepared reply dispatch runtime owner was not published for claude" under agents.ownership explicit #146365 - Open report traces the same shared routing and runtime-publication failure and already includes another channel's binding/recovery evidence.fixed_by_candidate: fix(acp): bound ACP threads fail to dispatch under explicit ownership #146898 - Open repair explicitly includes Telegram and changes the shared owner propagation and dispatch lookup; it has not merged.partial_overlap: fix(channels): dispatch replies in ACP-bound conversations #149801 - Open repair targets the same dispatch-owner defect but describes Discord and Matrix coverage.adjacent_distinct: Streaming preview deleted without persistent replacement on harness turns #164610 - Reports preview deletion after successful harness execution, whereas this failure prevents dispatch before execution.Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.
Canonical path: Preserve the configured channel owner for Gateway dispatch while retaining ACP execution identity, and keep an authorized in-chat close or unbind recovery path available.
So I’m closing this here and keeping the remaining discussion on #146365.
Review details
Best possible solution:
Preserve the configured channel owner for Gateway dispatch while retaining ACP execution identity, and keep an authorized in-chat close or unbind recovery path available.
Do we have a high-confidence way to reproduce the issue?
Yes, from source: bind a configured Telegram route to an ACP harness absent from agents.entries, then send a follow-up; the rewritten harness ID reaches a configured-only runtime lookup. This review did not execute a current-main Telegram reproduction.
Is this the best way to solve the issue?
Yes—consolidating this shared failure under the existing canonical report avoids competing repairs; preserving the configured dispatch owner is narrower than adding dummy agents or renaming persisted ACP sessions.
Security review:
Security review: This report establishes a dispatch availability defect, with no demonstrated security-boundary violation.
AGENTS.md: found and applied where relevant.
What I checked:
src/channels/plugins/binding-routing.ts:209, 9b16ed050a69)src/auto-reply/reply/dispatch-from-config.gather.ts:410, 9b16ed050a69)src/agents/prepared-reply-dispatch-runtime.ts:143, 9b16ed050a69)docs/tools/acp-agents/bindings.md. (docs/tools/acp-agents/bindings.md:23, 9b16ed050a69)Likely related people:
Codex review notes: model internal, reasoning medium; reviewed against f42f774c8309.