fix(agents): keep merged delivery routes account-bound - #98240
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 30, 2026, 9:27 PM ET / 01:27 UTC. Summary PR surface: Source -15, Tests +46. Total +31 across 4 files. Reproducibility: yes. at source level: current main and the latest release merge fallback route fields across same-channel contexts because Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the shared account-bound route guard with the restored regression coverage after maintainers accept the fail-closed account-conflict behavior and exact-head validation is satisfactory. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main and the latest release merge fallback route fields across same-channel contexts because Is this the best way to solve the issue? Yes. The shared merge helper is the best fix boundary because subagent, media, harness, session, sentinel, and outbound paths already centralize route-field crossing there; keeping per-caller account guards would leave drift. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1241885db6ad. Label changesLabel justifications:
Evidence reviewedPR surface: Source -15, Tests +46. Total +31 across 4 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
mergeDeliveryContext gated route-field crossing on channel only, so a completion origin that knew its account but not a concrete target inherited a different account's to/threadId on the same channel. A subagent, cron, or media completion for bot-a could be addressed to bot-b's chat but sent through bot-a (cross-account misroute) or dropped. This restores the account-bound guard added in 1ed8592 and removed as collateral by 025db6c (PR openclaw#89949); same-account and missing-account merges still backfill so the media route-pin path is preserved. Restores the deleted regression test.
41b734d to
06942bc
Compare
|
Land-ready verification for
No review threads, linked issue, or open duplicate was found. Changelog is not required for this internal routing correction. |
|
Merged via squash.
|
* fix(agents): keep merged delivery routes account-bound mergeDeliveryContext gated route-field crossing on channel only, so a completion origin that knew its account but not a concrete target inherited a different account's to/threadId on the same channel. A subagent, cron, or media completion for bot-a could be addressed to bot-b's chat but sent through bot-a (cross-account misroute) or dropped. This restores the account-bound guard added in 35e8b60 and removed as collateral by 523bae1 (PR openclaw#89949); same-account and missing-account merges still backfill so the media route-pin path is preserved. Restores the deleted regression test. * fix(agents): centralize account-bound completion routes --------- Co-authored-by: Peter Steinberger <steipete@golden-gate.local>
* fix(agents): keep merged delivery routes account-bound mergeDeliveryContext gated route-field crossing on channel only, so a completion origin that knew its account but not a concrete target inherited a different account's to/threadId on the same channel. A subagent, cron, or media completion for bot-a could be addressed to bot-b's chat but sent through bot-a (cross-account misroute) or dropped. This restores the account-bound guard added in 1ed8592 and removed as collateral by 025db6c (PR openclaw#89949); same-account and missing-account merges still backfill so the media route-pin path is preserved. Restores the deleted regression test. * fix(agents): centralize account-bound completion routes --------- Co-authored-by: Peter Steinberger <steipete@golden-gate.local>
What Problem This Solves
Multi-account deployments can merge a completion origin for one account with the saved target and thread of another account on the same channel. That can misroute or drop subagent, cron, media, and agent-harness completions.
The account guard was added in
1ed8592467, then removed while the media route-pin path was introduced in025db6cf9e/ #89949. Currentmaintherefore allows a Telegrambot-aorigin with no target to inheritbot-b'stoandthreadId.Why This Change Was Made
mergeDeliveryContextis the canonical owner of route-field crossing. It now treats two explicit, differing account IDs as a route conflict and keeps the primary route isolated: fallback channel, target, thread, and account do not cross the account boundary. Same-account and missing-account merges retain the existing backfill behavior.The patch also removes the media-only duplicate account guard and sends media route pinning through the same
resolveAnnounceOriginpath used by subagent, cron, and harness completions. This is the best fix because all callers share one invariant instead of carrying caller-specific defenses.User Impact
Completions from one configured account can no longer inherit another same-channel account's destination or thread. Single-account, same-account, and channel-conflict behavior is unchanged.
Evidence
delivery-context, subagent announcement delivery, media completion routing, and the plugin SDK harness runtime.tbx_01kwdkbva1c8zh4f73zv22rkjs(jade-shrimp):pnpm check:changedpassed, including core/core-test type checks, lint, dependency guards, database-first/media/runtime guards, and import-cycle checks.resolveAnnounceOriginandresolveExternalBestEffortDeliveryTargetfor same-channel and account-only primary origins. Currentmainproduced{channel:"telegram",to:"peer-b",accountId:"bot-a",threadId:99}and a deliverable bot-a/peer-b target; this head produces{channel:"telegram",accountId:"bot-a"}(or{accountId:"bot-a"}) and{deliver:false}.oxfmt --checkandgit diff --check: clean.The credentialed Telegram Desktop proof lane was attempted, but its harness provisions only one bot account and cannot express this two-account condition. The strongest feasible live-like proof is therefore the real production resolver/target path on retained Testbox with two distinct account IDs; no Bot API message was sent with two real bot tokens.
No linked issue was found. No docs or changelog change is needed for this internal routing correction.