Repository navigation
fix(acp): bound ACP threads fail to dispatch under explicit ownership - #146898
vixenclawsastraagent wants to merge 5 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Free ACP session keys (agent:<harness>:acp:<id>) name an external harness, not a configured agent. Runtime conversation bindings now record the configured channel route agent as ownerAgentId, channel contexts carry it as RouteOwnerAgentId, and prepared reply dispatch uses it when the session key itself is the bound harness key. Session storage and ACP execution keep the harness key's scope.
Discord thread and native slash-command routing replace the route with the bound free ACP harness key. Record the configured channel agent as ownerAgentId on the effective route and pass it into message and native-command contexts as RouteOwnerAgentId so bound threads dispatch under a published runtime instead of failing with 'prepared reply dispatch runtime owner was not published for <harness>'.
Slack, Telegram, LINE, Feishu, iMessage, and Matrix apply the same runtime conversation binding rewrite as Discord, so a bound free ACP session would lose its configured dispatch owner the same way. Forward the route's ownerAgentId into the shared inbound context builder in each channel.
Discord's effective-route rewrite needs the canonical free ACP harness key classifier from openclaw/plugin-sdk/routing, alongside the existing isAcpSessionKey and isSubagentSessionKey family. Raise the public export and callable budgets by one each.
71b9b96 to
a8145ed
Compare
|
Codex review: needs real behavior proof before merge. What this changesPreserves the configured chat agent as the reply-dispatch owner for conversations bound to an external ACP coding session across seven channels. Review scores
Merge readiness⛔ Blocked before merge - 6 items remain This PR addresses a source-supported dispatch failure that remains on current main. It retains useful slash-command and multi-channel coverage beyond the related Discord PR, but existing proof and integration blockers remain unresolved. Priority: P1 Decision needed
Before merge
FindingsNone. Agent review detailsHow this fits togetherChannel routing turns incoming messages and commands into session context. Reply dispatch needs a configured OpenClaw agent’s runtime, while ACP execution and transcripts retain the external harness’s session identity. flowchart LR
A[Channel message or command] --> B[Configured chat route]
B --> C[Conversation binding]
C --> D[Dispatch owner and ACP target]
D --> E[Configured reply runtime]
E --> F[ACP harness execution]
F --> G[Reply to originating chat]
Technical reviewBest possible solution: Use one shared binding projector to preserve the configured dispatch owner and harness session identity, with an accepted SDK contract and verified behavior for existing bindings. Do we have a high-confidence way to reproduce the issue? Yes, from source: bind a conversation to an ACP harness absent from configured agents, then dispatch a follow-up under explicit ownership; current main requests the harness’s unpublished runtime. This review did not execute that path. Is this the best way to solve the issue? The owner-versus-target separation is appropriate, but the branch needs adaptation to current main’s canonical projector and acceptance of its public SDK surface before the implementation can be endorsed for merge. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 12517a0fd2d9. Merge-risk optionsMaintainer options:
SecurityNone. EvidenceWhat I checked:
PR surfaceSource +68, Tests +335, Docs +1, Other +2. Total +406 across 30 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReviewed October 4, 2026, 9:25 AM ET / 13:25 UTC (Revision 3). |
|
Could you please rebase this onto current main? |
Related: #146365
What Problem This Solves
Fixes: messages and
/acpslash commands in a Discord thread created by/acp spawn <harness>fail withprepared reply dispatch runtime owner was not published for <harness>and are dead-lettered whenagents.ownershipisexplicitand the harness id is not a configured agent.User Impact
User impact: thread-bound ACP sessions on Discord dispatch again for both follow-up text and
/acpslash commands, and the same runtime-binding route rewrite in Slack, Telegram, LINE, Feishu, iMessage, and Matrix now carries the configured owner too. No configuration, session-key, or persistence change; existing bindings keep working as-is.Risk to note: this adds one public SDK export (
isFreeAcpSessionKeyonopenclaw/plugin-sdk/routing, the same family asisAcpSessionKey) and raises the public export budget by one.MsgContextgains one optional field,RouteOwnerAgentId.Overlap: #146651 fixes Discord text follow-ups in spawned child threads by keeping the source route for admission, and its body leaves the native slash-command path out. This PR fixes the same defect at the core route owner, so it also covers slash commands and the six other channels that apply the same rewrite. If #146651 lands first, this rebases onto it; the Discord message-path part reduces to forwarding the owner.
Why This Change Was Made
/acp spawnkeys the ACP session asagent:<harness>:acp:<id>. Runtime conversation bindings rewrite the inbound route's session key and agent id to that key, and prepared reply dispatch publishes runtimes only for configured agents. Rather than renaming sessions or synthesizing a fallback owner, the binding rewrite now records the configured channel route agent asownerAgentIdon the route (only for free ACP keys, never foracp:binding:keys), the shared inbound context builder carries it asRouteOwnerAgentId, and reply dispatch prefers it for the published-runtime lookup when the session key itself is a free ACP key. Storage, transcript, and ACP execution keep the harness key's scope, which is why the session-store path and SQLite scope checks stay consistent.Evidence
dispatch-from-config.lifecycle.test.tsfails on main withunexpected prepared reply dispatch owner opencodeand passes on this head; it asserts the published lookup usesmainwhile the store path,ensureSession, and transcript stay with the harness key. Core routing, context builder, session-key, Discord route/preflight/native-command/context tests added; 281 focused tests pass.pnpm test:extensionfor discord, slack, telegram, line, feishu, imessage, matrix: all green (272/159/1/67/103/58/35 files).pnpm test:contracts: 4 suites green (227 + 45 + 196 + 32 tests).node scripts/check-changed.mjs: passes end to end (formatting, core/extension/test typechecks, lint, dead-export scan, import cycles, plugin boundaries, SDK export sync and surface budget, doctor contract guards).pnpm build: passes (exit 0).pnpm plugin-sdk:surface:check: passes after the +1 budget line.scripts/plugin-sdk-api-diff.mts --base main --head HEAD: 1 export added (isFreeAcpSessionKey), 9 reachable declarations changed by optional fields, 0 removed.pnpm docs:check-mdxpasses.--mode branch --base main --engine claude --max-priority P1): scoped-clean, no P0/P1 findings.Critical Qualityjobs completed analysis but failed at the SARIF upload step on both runs (09:12 and 09:29 UTC) during the GitHub incident opened 2026-09-13 09:16 UTC (elevated error rates on authorization endpoints). A fork PR cannot re-run jobs; I will retrigger once the incident is resolved.--bind here, Telegram topics, and the other channels are covered by unit tests only.Source chain (main @ 17f385e; branch rebased onto 7ad2d15, no overlapping upstream changes)
src/auto-reply/reply/commands-acp/lifecycle.tsmintsagent:${spawn.agentId}:acp:${uuid}.src/channels/plugins/binding-routing.ts(resolveRuntimeConversationBindingRoute) andextensions/discord/src/monitor/route-resolution.ts(resolveDiscordEffectiveRoute) rewritesessionKey/agentIdto the bound key.src/auto-reply/reply/dispatch-from-config.gather.tsresolves the dispatch owner fromctx.SessionKey, which is already the harness key, soloadPublishedGatewayReplyDispatchRuntimethrows.Test plan
Pre-merge
node scripts/check-changed.mjspassespnpm buildpassesPost-merge
/acp spawn claudein a Discord thread on a Gateway withagents.ownership: "explicit"and confirm a follow-up message and an/acp statusslash command both dispatch (noruntime owner was not publishedline in the Gateway log). Evidence: Gateway log excerpt on issue [Bug]: Discord /acp spawn thread never dispatches: "prepared reply dispatch runtime owner was not published for claude" under agents.ownership explicit #146365.