Reject split outbound agent session ownership#96078
Conversation
|
Hi maintainers, this PR is ready for review when you have bandwidth. Summary:
I intentionally left |
01f18f2 to
0b58b05
Compare
|
Codex review: needs real behavior proof before merge. Reviewed July 20, 2026, 2:43 PM ET / 18:43 UTC. Summary PR surface: Source +311, Tests +694, Docs +4. Total +1009 across 17 files. Reproducibility: no. high-confidence current-main runtime reproduction was established in this review. The linked report and proposed tests identify a concrete source-level path, but the supplied real-run evidence is for an earlier PR head rather than the current one. Review metrics: none identified. Stored data model 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:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Adopt one explicitly documented ownership contract for control and transcript keys, then land a consistent guard only with fresh exact-head proof that demonstrates rejection before dispatch and acceptance of supported routed-policy cases. Do we have a high-confidence way to reproduce the issue? No high-confidence current-main runtime reproduction was established in this review. The linked report and proposed tests identify a concrete source-level path, but the supplied real-run evidence is for an earlier PR head rather than the current one. Is this the best way to solve the issue? Unclear. A shared guard is the maintainable shape if the canonical-owner invariant is accepted, but maintainers must first decide whether fail-closed rejection and queue dead-lettering are the correct compatibility contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4aaea7b07291. Label changesLabel justifications:
Evidence reviewedPR surface: Source +311, Tests +694, Docs +4. Total +1009 across 17 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
Review history (4 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Quick clarification for whoever picks this up for human review: I believe the ClawSweeper “Stored data model” note is a false positive. The only intentional compatibility change is the fail-closed rejection of contradictory split-owner requests: an explicit Same-agent keys, omitted/blank agent ids, legacy/non-agent keys, and cross-agent I’m happy to adjust if maintainers prefer a different compatibility posture here. cc @vincentkoc if you have bandwidth to sanity-check the outbound/gateway boundary. Thanks! |
|
This pull request has been automatically marked as stale due to inactivity. |
0b58b05 to
af7feb2
Compare
af7feb2 to
473ea2e
Compare
473ea2e to
b5599c1
Compare
b5599c1 to
67dece7
Compare
67dece7 to
cab9644
Compare
cab9644 to
6e1fa96
Compare
|
@vincentkoc could you confirm the outbound/Gateway compatibility contract on the current exact head The requested decision is specifically whether these three rules are acceptable together:
There is no queue schema/version or migration change. Exact-head CI is green, and the PR body now contains the current-SHA terminal evidence and recovery behavior details. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: Reject split outbound agent session ownership This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
What Problem This Solves
Fixes #96075.
Outbound send/action paths could accept an explicit
agentIdwhile also carrying an agent-scoped session key owned by another agent. That could split ownership across media policy, plugin dispatch, transcript mirroring, queueing, and internal hook correlation.Why This Change Was Made
This adds a shared outbound ownership guard that parses
agent:<owner>:...session keys and compares only the normalized owner segment against explicit agent owners. The guard is applied at both Gateway boundaries and lower outbound helpers so internal callers cannot bypass the Gateway check.policyKeyremains intentionally excluded from equality checks because routed ACP-style delivery can use a separate policy/origin session while the canonical session/mirror keys still describe the owning agent.User Impact
Contradictory outbound requests such as
agentId: "work"withsessionKey: "agent:main:..."now fail before dispatch, media resolution, durable queueing, mirroring, or hook correlation. Omitted/blank agent ids, legacy session keys, same-agent different conversation keys, and cross-agent delivery policy keys remain supported.Compatibility and Stored Queue Behavior
This intentionally changes contradictory split-owner outbound requests from accepted dispatch to fail-closed validation. The rejected shape is an explicit agent owner paired with an agent-scoped session key owned by a different agent, for example
agentId: "work"withsessionKey: "agent:main:slack:channel:c1".I am not preserving explicit-agent precedence for that contradictory shape because it can route media policy, plugin dispatch, transcript mirroring, queueing, and hook correlation under different owners. Same-agent session keys, omitted or blank agent ids, legacy/non-agent session keys, and cross-agent
policyKeyrouting remain allowed.There is no serialized queue-shape, schema-version, or migration change. Recovery validates the existing
sessionandmirrorfields. A previously stored entry whose canonical owners disagree is permanently markedfailedthrough the existing queue failure path instead of being replayed across agent boundaries. This is the intended compatibility behavior;policyKeyremains excluded from the recovery equality check.Evidence
Exact-head behavior proof
Exact reviewed head:
The canonical PR CI completed successfully on that exact SHA: https://github.com/openclaw/openclaw/actions/runs/29933742723
Selected terminal output from the exact-head Node shards:
Those exact-head suites exercise the final side-effect boundaries:
deliver.test.tsrejects mismatched canonical ownership before queue or platform I/O and asserts zero enqueue/platform calls.deliver.test.tsallows same-owner control and mirror keys with a cross-agentpolicyKeyand reaches the adapter once.delivery-queue.recovery.test.tspermanently fails mismatched or malformed stored entries before admission, backoff, adapter lookup, or replay.delivery-queue.recovery.test.tsreplays a valid stored entry whose canonical owner ismainwhile itspolicyKeybelongs topolicy-owner.Additional checks
git diff --check.agents/skills/autoreview/scripts/autoreview --mode uncommittedfor the recovery contract follow-up: clean, no accepted/actionable findings