Repository navigation
fix(channels): keep ACP configured bindings authoritative over stale non-ACP runtime bindings - #140073
fix(channels): keep ACP configured bindings authoritative over stale non-ACP runtime bindings#140073LiuwqGit wants to merge 1 commit 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. |
|
Codex review: needs real behavior proof before merge. Reviewed September 6, 2026, 10:29 AM ET / 14:29 UTC. ClawSweeper reviewWhat this changesThe PR changes conversation routing to favor configured ACP coding-agent bindings over unmarked session bindings, adds provenance to generic binding writes, and aligns LINE ingress with Gateway ownership checks. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 8 items remain The fix remains necessary on current main. LINE routing consistency is repaired, but the earlier SDK compatibility concern remains partly unresolved for adapter-backed and pre-upgrade bindings. Priority: P2 Review scores
Verification
How this fits togetherChannel routing combines configured agent assignments with runtime conversation bindings to select a session. The Gateway reuses that selection to authorize conversation discovery, sends, and queued delivery recovery. flowchart TD
A[Incoming channel message] --> C[Binding precedence]
B[Configured agent assignment] --> C
D[Runtime conversation binding] --> C
C --> E[Selected agent and session]
E --> F[Gateway ownership check]
F --> G[Allow or reject delivery]
Decision needed
Why: The same persisted shape represents both legitimate released bindings and unwanted legacy rows; absence of the new marker cannot establish which interpretation is correct. Before merge
Findings
Agent review detailsSecurityNeeds attention: The new stale-row classification can replace an intentional runtime owner with the configured agent at the Gateway authorization boundary. PR surfaceSource +93, Tests +776, Docs +9. Total +878 across 16 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. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Preserve intentional runtime ownership across all binding producers and upgrades, with an owner-approved distinction for obsolete rows and consistent ingress and delivery enforcement. Do we have a high-confidence way to reproduce the issue? Yes, from source: create a non-ACP session binding through a registered channel adapter alongside a conflicting configured ACP binding; the adapter omits the marker and the new resolver ignores the intentional assignment. This read-only review did not execute tests. Is this the best way to solve the issue? No, not yet: sharing precedence across ingress and delivery is appropriate, but stamping only the fallback writer and treating every unmarked retained row as obsolete does not preserve the SDK contract. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9ed5275a5956. LabelsLabel justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
|
Note on the failing |
953eef2 to
513d78f
Compare
|
Follow-up addressing both P1 findings from the ClawSweeper review of 953eef2b (now at 513d78f1d9c, rebased on latest main): [P1] Preserve intentional live non-ACP bindings — The guard in [P1] Keep LINE ingress and Gateway ownership precedence consistent — LINE ingress now resolves its route through Authority-chain evidence (still deterministic, L2 — no live channel credentials available): the new gateway tests exercise the real evaluator that gates delivery before any transport I/O (approved owner succeeds, competing agent rejected), and LINE ingress agreement is asserted against the same precedence inputs. Real Telegram Test Server proof remains outstanding (no credentials locally); noted in the PR body as a pending limitation. Regarding the failing |
513d78f to
9a06ed9
Compare
…non-ACP runtime bindings Conversations that match a configured ACP binding could still be routed through a persisted non-ACP runtime binding record (e.g. stale rows written by legacy catch-all bindings), sending messages to the wrong agent. The configured-binding guard in resolveRuntimeConversationBindingRoute now suppresses only generic session-kind records that lack bind-API provenance: bindGenericCurrentConversation stamps bindingOrigin metadata on every record it writes (including refreshes of legacy rows), so intentional SDK bindings keep their runtime precedence while provenance-less rows can no longer nullify a configured binding. Records targeting an ACP session (explicit /acp spawn binds), active subagent thread bindings, and plugin-owned records keep their existing precedence. LINE ingress resolved runtime bindings without the configured-binding result, so inbound messages still followed a stale runtime record while Gateway conversation-send and queued-recovery authorization followed the configured ACP owner. LINE now passes the configured route into the shared resolver, keeping ingress and delivery authorization on the same precedence. Fixes openclaw#115354
9a06ed9 to
7b3178d
Compare
|
Follow-up for the ClawSweeper review of 9a06ed9 — addressed the P1 SDK-compatibility finding, the security concern, and the delivery-boundary proof gap in 7b3178d (rebased onto latest [P1] Distinguish obsolete rows from fresh SDK session bindings — fixed via bind-API provenance. Security concern / delivery-boundary proof — added
Regression coverage added: the new provenance case was RED on the previous head (fresh bind suppressed — reproducing the finding) and is GREEN now; Telegram Test Server proof ( CI lanes are pending on GitHub Actions for the new head. |
|
Closing for now: the remaining CI failure ( |
Closes #115354
What Problem This Solves
{type: "acp", agentId: "claude", match: {channel: "feishu", peer: {kind: "direct", id: "ou_user_a"}}}) would have their messages routed to the wrong agent whenever a persisted non-ACP runtime binding record (staleagent:{agentId}:{channel}:{accountId}:direct:{peerId}rows previously written by catch-all bindings) also exists for that conversation — the stale runtime record silently nullified the configured ACP binding.Why This Change Was Made
resolveRuntimeConversationBindingRoutenow refuses to rewrite a route that a configured binding already claimed only for generictargetKind: "session"records that lack bind-API provenance.bindGenericCurrentConversationstampsmetadata.bindingOrigin: "generic-bind-api"on every record it writes (including refreshes of legacy rows onto the same target — an explicit rebind is itself evidence of intent), so records created through the public SDK bind API keep their runtime precedence over configured bindings, while provenance-less generic session rows can only originate from the removed legacy catch-all writer (fix(gateway): keep conversation delivery within agent bindings #126424) and are treated as stale. Live runtime overrides keep their existing precedence: fresh generic SDK bindings, records targeting an ACP session (explicit/acp spawn --bind here), active subagent thread bindings (targetKind: "subagent"created bybindThreadForSubagentSpawn), and plugin-owned records. The guard sits next to the existing cron-run and plugin-owned checks. Callers that run configured-first (generic gateway ingress, Feishu, Telegram, iMessage, and now LINE) pass the configured-binding result through so the resolver can enforce this precedence.getSessionBindingService().bind()/bindGenericCurrentConversation()remain authoritative for intentional runtime binds); runtime records targeting an ACP session still take precedence; active subagent thread bindings still override a configured ACP binding (an intentionally spawned subagent keeps receiving follow-ups); plugin-owned records are still observed without rewriting; records whose target equals the configured target are still applied and touched; with no configured binding context the resolver behaves exactly as before.resolveLineConversationRoute), keeping ingress and delivery authorization on the same precedence at both boundaries.User Impact
src/channels/plugins/binding-routing.ts(guard next to the cron/plugin-owned checks, scoped to provenance-less generictargetKind: "session"records),src/plugins/conversation-binding-metadata.ts(bindingOriginprovenance constant and predicate),src/infra/outbound/current-conversation-bindings.ts(bindGenericCurrentConversationstamping provenance),extensions/line/src/bot-message-context.ts(resolveLineConversationRoutepassingconfiguredBindingRoute), and the tests insrc/channels/plugins/binding-routing.test.ts("still lets a fresh generic bind-API runtime binding override the configured route"),src/infra/outbound/current-conversation-bindings.test.ts("stamps bind-API provenance on every record it writes"),src/gateway/conversation-send-binding-precedence.test.ts(allowed delivery, competing agent rejected before transport, queued recovery after reassignment), andsrc/gateway/conversation-route-ownership.test.ts(configured owner eligible / competing agent denied; reassignment to a live subagent binding followed by the evaluator).Evidence
lineBindingsAdapter), a real per-agent conversation registry and delivery store for the send/queued-recovery boundary tests, and the real resolver/ownership chain (no mocks of the code under test; only the transport action is replaced) in an isolated worktree at commit 7b3178d (rebased onto the latestmain).touchnever called; the configured route won) — reproducing the review's SDK-compatibility finding. On the head before that (953eef2b) the subagent/LINE/ownership regression tests failed as previously documented. On unpatched origin/main the original end-to-end test failed withexpected 'main' to be 'codex'— the stale row routed the conversation to agentmainand the configured ACP binding was never honored.proof: telegram-e2e) requires maintainer/CI Convex credentials that are not available to contributors, so real Telegram routing proof cannot be produced here. Discord/Slack channel-owned resolvers (unchanged by design), and the generation-aware stale-record cleanup direction discussed in fix(plugin-sdk): unbind conversation bindings on session deletion #133694 are also not covered. CI lanes (changed-project tests, full test-type check) pending on GitHub Actions.