Repository navigation
fix(agents): retain requester selection for returned peer replies - #178750
roboclaw-bot merged 3 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. |
|
Codex review: blocked before merge. What this changesThis PR preserves the selected requester when a delayed legacy peer reply starts a separate execution after the originating invocation ends. Example: Alice selects Bob for a nonblocking sessions_send, and the peer replies after Alice’s invocation ends.
Review scores
ProductKind: Feature · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep this PR open for the security/session-owner decision on retained requester selection; source review found no actionable introduced defect. Priority: P2 Decision needed
Before merge
FindingsNone. Agent review detailsHow this fits togetherSession tools hand accepted peer work to the Gateway continuation owner, which retains live operator authority and later admits the returned result into the requesting session. flowchart TD
A[Requester selects Bob] --> B[Session send tool]
B --> C[Existing continuation owner]
B --> D[Peer execution]
D --> E[Returned peer result]
C --> E
E --> F[Separate requester execution]
F --> G[Personal tool authorization]
Technical reviewBest possible solution: If approved, retain only the original selection through the existing continuation owner, preserving current source checks, scope intersection and separate-turn delivery. Do we have a high-confidence way to reproduce the issue? Current main visibly clears the caller during continuation and copies the unselected caller origin; the submitted composition records a selected-Bob failure before the producer repair, but this read-only review executed no target code. Is this the best way to solve the issue? The patch uses the canonical selection resolver and existing continuation owner, giving the smallest coherent implementation of the proposed policy without a second authority store. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7ba05b683647. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +61, Tests +638. Total +699 across 6 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
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 21, 2026, 11:59 PM ET / October 22, 2026, 03:59 UTC (Revision 3). |
|
@clawsweeper re-review Current head: The positive first collector's incorrect history-role assertion, earlier setup failures, stale initializer fields and each capture's runtime/effect limits are explicitly preserved. No native Codex effect, profile reassignment, all-recipient-permissions claim or security/session-owner approval is inferred. This remains a separate draft policy proposal; #177698 excludes it. |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Current head |
|
🦞👀 Re-review progress:
|
✅ Maintainer security changes approvedA maintainer approved this revision with an explicit security approval comment.
A later push requires a fresh approval comment for an external contributor's PR. |
|
/allow-security-sensitive-change |
|
Merged via squash.
|
…enclaw#178750) * fix(agents): retain requester selection for returned peer replies * fix(agents): capture selected requester for returned peer replies
What Problem This Solves
A returned legacy peer result may need the original requester's personal-tool selection after the originating tool invocation has ended. The existing continuation retains operator source authority but deliberately removes its ambient tool caller. Reconstructing a fresh caller later can select the wrong requester or reject valid return work.
This is the personal-requester proposal extracted from #177698, presented separately so its authority decision does not hold up the lifecycle consolidation.
Proposed Behavior
Capture the requester selection while the originating caller is live. Only the legacy
replyMode: peerreturn flow opts into re-entering that selection under its existing retained operator source. Completion custody follows its existing path; peer messages retain separate turns. The ended invocation's receipt and operational-run instance are not restored.The retained source's device/Gateway lifetime, release and operator-policy checks remain. The selected person's authority is intersected with the existing caller's scopes. No schema, configuration option, dependency, storage migration or native Codex change is introduced.
Current upstream conflict repair (2026-10-22)
Current head
615876add6b9448d661e73d9f3ae597f5f9d349fintegrates pinned upstream52df852cd5be3b3691ef27d0942a4db7b2258eb1into this standalone requester-selection proposal. Upstream’s accepted-steering custody suite and regular continuation behavior are preserved. Only legacy returned-peer work without a completion owner opts into the captured selected-requester path; completion-owned work retains its existing custody. The requester remains Bob when Alice selected Bob, while upstream’s initiating-creator provenance remains Alice. The ended invocation’s receipt, operational run and full-permission flags are not restored.The conflict repair also adopts the upstream
AgentStepSessiontype owner. One stale test expectation exposed upstream’s new delegated-creator field; the tests now assert both Bob’s selected identity and Alice’s original creator field, including the actual reply-flow composition. This requires no production permission change or new fallback.The final affected suites pass 20 checks: four real reply-flow compositions, eight retained-source/accepted-steering custody cases, and eight AgentStep siblings (25.74 seconds through the canonical wrapper). The production-identical regular continuation suite separately passes 13 cases (12.05 seconds file duration). Core production types, the bounded four-file owning test type graph, scoped production/test typed lint, six-file formatting, and whitespace checks pass. The earlier integrated run correctly exposed the stale creator expectation; its failure is retained as the reason for this test-only repair. Broad exact-head CI remains pending publication.
Fresh independent P0–P2 review of the final candidate against the pinned base returns
scoped-clean, with no actionable findings. Both passes complete: one metadata/context pass explicitly records its limited implementation coverage, and the second reviews the actual patch with frozen authority context. This is a source assessment; the reviewer did not execute project code and does not supply owner approval or a new runtime capture.The simplify pass keeps selection capture and source re-entry in the existing continuation owner; no second authority store or recipient-permission owner is introduced. The two test groups protect different boundaries: accepted queue custody and retained selected-human identity. Existing compositions additionally protect return delivery, source revocation and requester-session replacement. Net changes against pinned upstream are production +81/−20 lines, tests +640/−3, and one test-planner line. The test growth is retained focused proof from this standalone proposal; this repair adds only explicit initiating-creator expectations and preserves upstream cases.
The security/session-owner decision below remains explicitly open; this PR is ready for that review. Historical authenticated returned-peer, canonical revocation, and personal-tool final-effect captures remain qualified to their recorded
9600c93source. Their satisfied proof requests are not reopened by this integration; they are also not new runtime executions of the repaired head. Source reassignment, native Codex personal-tool effects, and owner approval remain unclaimed. No operator Gateway was changed or restarted.Local deployment checkpoint (2026-10-20)
The operator explicitly opted into a combined local deployment containing main consolidation
7605b4fc8c28a628cd4d6b9a3e63bc9f1304ce10, reply-obligation candidate66eea4b4ef10f196ba1640398d186884d5557cdd, reconnect candidatede1dfafe07c8f0762b9e5fc16d4dfc6b36a3fbeb, and selected-requester candidate9600c93d45bbdb867ff738d258f25ea94a7f2f45, alongside existing local integrations and the separately restored saved-attempt UI work. The resulting local build is764886a56987d82f3a3934e2dd7d6a2416ef98da.Operational readback confirms the exact loaded build, readiness, health, Node 24, unchanged service environment, and all 25 previously active plugins. This is a combined integration deployment, not standalone validation of each PR or security/session-owner acceptance of any extracted policy. No new business-message, native-effect, revocation or reassignment proof is inferred from operational health. The earlier isolated traces below retain their recorded revisions, scenarios and failed-collector qualifications.
Maintainer Decision
Should accepted returned peer work be allowed to re-enter the originally selected personal-tool requester under its retained, live-checked source authority? This is a policy proposal, not inferred approval from matching profiles or session identifiers. It does not authorize reviving the ended invocation or replacing recipient execution permissions.
Recommendation: permit this bounded return path only with the original selection, live checks and the full-flow/final-effect proof below. Review it independently of #177698; that consolidation excludes this machinery.
Evidence
Actual returned-peer personal-tool effects
An isolated Gateway built at
9600c93d45bbdb867ff738d258f25ea94a7f2f45completed the genuine publicsessions_sendreturn using the built-in OpenClaw runtime and scripted inference. Configured trusted-proxy authentication established distinct synthetic Alice and Bob profiles. Bob's explicit human steering was actually accepted into Alice's original execution before the provider selected Bob through the advertised tool. The original invocation and peer ended normally. The returned result then started a distinct execution in the original Gateway session, retaining Bob and the original read/write ceiling without the ended invocation's receipt, operational run or full-permission flag.The returned execution made three actual advertised
personal_instructionscalls: get and set on Bob's permitted agent succeeded and matched Bob's authenticated canonical readback; set on an agent permitted to Alice but forbidden to Bob returned the exact current-role error. Canonical history attributes all three tool results to that returned execution, with two successes and one error. Alice's own-file readbacks on both agents and five confined filesystem observations remained unchanged; no Bob file appeared on the forbidden agent. The returned execution ended normally with one visible final, one attributed forwarded peer row and an empty pending-input queue. Four main provider requests covered this returned tool/final cycle; background utility requests are counted separately.The collector exited 0, qualified=true without timeout or forced containment. Raw facts retain stale initializer fields (
status=UNRUN-unqualified,pass=false); the finalbodyQualified=trueandpassed=true, exercised assertions and joined exit0 determine qualification. Raw records were not rewritten. The Gateway exited0, all eight observed task processes exited0 and were absent afterward, clients/proxy/provider joined, and task/bootstrap state was removed. The allowlisted trace below uses fixed aliases and relative timing; raw identifiers and state remain private.Scope and retained failures: the API is self-only. This proves a personal effect on an Alice-permitted/Bob-forbidden agent, not a foreign-profile file target API or every recipient permission. This is built-in runtime/scripted-provider evidence, not native Codex or real-model inference. Profile reassignment and source revocation are not exercised by this effect case; the separate revoked-source trace retains its own scope. No owner/security approval is inferred. Three prior effect captures remain unqualified setup failures (multi-agent ownership marker, missing private workspace, then the implicit QA workspace suffix); none reached a provider or personal-effect call. Each was preserved and corrected through the supported fixture contract, without changing production guards or permissions.
Redacted final-effect trace
{ "kind": "derived allowlisted trace; fixed aliases, not a verbatim raw dump", "sourceRevision": "9600c93d45bbdb867ff738d258f25ea94a7f2f45", "runtime": "built-in OpenClaw", "syntheticState": true, "scriptedInference": true, "authentication": "configured trusted proxy; distinct non-owner profiles", "collectorExitCode": 0, "qualified": true, "trace": [ { "tMs": 0, "event": "original runtime accepted Bob human input into Alice execution", "participantRecorded": true }, { "tMs": 291, "event": "original Alice execution ended normally" }, { "tMs": 624, "event": "peer ended normally" }, { "tMs": 656, "event": "returned requester is Bob", "scopes": [ "operator.read", "operator.write" ], "oldInvocationReceipt": false, "oldOperationalRun": false, "fullPermission": false }, { "tMs": 767, "event": "distinct returned execution started", "sameGatewaySessionAsOriginal": true }, { "tMs": 921, "tool": "personal_instructions", "action": "get", "agent": "shared-agent", "resolvedPerson": "Bob", "isError": false }, { "tMs": 976, "tool": "personal_instructions", "action": "set", "agent": "shared-agent", "resolvedPerson": "Bob", "isError": false, "canonicalAuthenticatedReadbackMatches": true }, { "tMs": 1012, "tool": "personal_instructions", "action": "set", "agent": "Alice-permitted-agent", "isError": true, "error": "Your operator role cannot edit personal instructions for this agent." }, { "tMs": 1070, "event": "returned execution ended normally", "visibleFinalRows": 1 } ], "verification": { "returnedMainProviderRequests": 4, "personalToolCalls": 3, "successfulPersonalToolCalls": 2, "forbiddenPersonalToolCalls": 1, "canonicalAttributedPeerResultRows": 1, "pendingInputs": 0, "aliceSharedAgentPersonalFileUnchanged": true, "alicePrivateAgentPersonalFileUnchanged": true, "sharedUserFileObservationsUnchanged": 2, "bobPrivateAgentFileAbsent": true }, "cleanup": { "gatewayExitCode": 0, "observedTaskProcessExitCodes": [ 0, 0, 0, 0, 0, 0, 0, 0 ], "observedPidsAbsent": true, "gatewayProxyProviderClientsJoined": true, "taskStateRemoved": true, "launcherBootstrapRemoved": true, "forcedContainment": false }, "limits": [ "Self-only personal-file API: agent-scoped Alice-permitted/Bob-forbidden effect, not a foreign-profile target API.", "Built-in runtime with scripted inference; no native Codex execution or real-model claim.", "This effect case does not exercise profile reassignment or source revocation; the separate revoked-source capture retains its own scope.", "No security/session-owner or product approval is inferred.", "Three earlier effects attempts remain unqualified setup failures; none reached a provider/effect call." ], "qualification": { "finalBodyQualified": true, "finalPassed": true, "joinedCollectorExitCode": 0, "staleInitializerFieldsRetained": [ "status=UNRUN-unqualified", "pass=false" ], "rawFactsRewritten": false } }Actual authenticated returned-peer and revocation boundaries
At source
9600c93d45bbdb867ff738d258f25ea94a7f2f45, an isolated authenticated Gateway and the built-in OpenClaw runtime exercised genuine public selection: Alice and Bob became real participants; Alice selected Bob insessions_send; the original and peer runs completed normally before the separate returned execution. The observed requester remained Bob with the original read/write intersection, without borrowing the ended receipt, run, or full permission. One returned main-execution request and one attributed peer history entry produced a normal final. The original positive collector exited 1 because it incorrectly required a user-role history row; the canonical display projection returns that forwarded entry as assistant. The saved raw observations were audited after the run; this is not a whole-collector pass.A separate revoked-source capture exited 0. A metadata-only pause held the actual prepared result before its unchanged consumer; the revocation record timestamp was 49 ms after the hold; the successful RPC confirmed persistence by 52 ms, before resumption/source refusal at 54 ms. There were zero returned main-execution requests and zero attributed peer entries. Auxiliary label inference is distinct: two positive and one revoked-case label requests also contained peer text, so this evidence makes no global zero-model-I/O claim. Gateway, provider, proxy, task state and bootstrap cleanup joined without forced containment in both captures.
This uses a scripted local provider with actual loopback provider I/O and disclosed in-memory observation of original owner code, not native Codex. Personal-tool effects, recipient execution permissions and reassignment remain unproved by these captures. Earlier failed collectors remain preserved.
The original positive collector's final history-role assertion remains a failed collector result. Its successful target observations were independently correlated against the real controller, provider, attributed history and normal terminal receipts; the negative capture passes its complete collector. No failed attempt is relabeled. The earlier authentication/omitted-explicit-steer fixture failures remain preserved as setup/admission evidence. Both cases use the actual public
chat.sendwith explicit steer and advertisedsessions_senduser selection; the observation records the original successful acceptance after participant registration, and pauses the original returned preparation without replacing authorization, return values or errors.Redacted allowed-return and canonical-revocation receipts
{ "scope": "Actual authenticated Gateway and built-in runtime with scripted local provider (actual loopback provider I/O); instrumented original preparation await, no authority/result replacement.", "positive": { "sourceCommit": "9600c93d45bbdb867ff738d258f25ea94a7f2f45", "runtime": "built-in OpenClaw", "provider": "scripted local provider", "selectedRequester": "Bob", "originatingParticipant": "Alice", "scopeCeiling": [ "operator.read", "operator.write" ], "endedReceiptOrRunOrFullPermissionBorrowed": false, "actualHumanEnqueueAcceptedAndParticipantRecorded": true, "originalRunNormalTerminal": true, "peerRunNormalTerminal": true, "preparedReturnOrderingMs": { "held": 0, "resumed": 47, "returnedReceipt": 84 }, "returnedMainExecutionProviderInputs": 1, "auxiliaryLabelRequestsContainingPeerText": 2, "attributedPeerHistoryEntries": 1, "separateReturnedRunNormalTerminal": true, "collectorExit": 1, "wholeCollectorPass": false, "collectorQualification": "Incorrect user-role assertion failed after successful returned delivery; expected attributed assistant projection independently verified.", "cleanup": { "gatewayExitZero": true, "gatewayProviderProxyJoined": true, "taskStateRemoved": true, "bootstrapRemoved": true, "forcedContainment": false } }, "revoked": { "sourceCommit": "9600c93d45bbdb867ff738d258f25ea94a7f2f45", "runtime": "built-in OpenClaw", "provider": "scripted local provider", "selectedRequester": "Bob", "originatingParticipant": "Alice", "scopeCeiling": [ "operator.read", "operator.write" ], "endedReceiptOrRunOrFullPermissionBorrowed": false, "actualHumanEnqueueAcceptedAndParticipantRecorded": true, "originalRunNormalTerminal": true, "peerRunNormalTerminal": true, "preparedReturnOrderingMs": { "held": 0, "revocationRecordTimestamp": 49, "revocationRpcReturnedCommitConfirmedBy": 52, "resumed": 54, "sourceDenied": 54 }, "returnedMainExecutionProviderInputs": 0, "auxiliaryLabelRequestsContainingPeerText": 1, "attributedPeerHistoryEntries": 0, "separateReturnedRunNormalTerminal": false, "collectorExit": 0, "wholeCollectorPass": true, "collectorQualification": "Qualified revoked-source refusal before returned provider input.", "cleanup": { "gatewayExitZero": true, "gatewayProviderProxyJoined": true, "taskStateRemoved": true, "bootstrapRemoved": true, "forcedContainment": false } }, "unproved": [ "Personal-tool effects and recipient execution permissions", "Source reassignment", "Native Codex adapter" ] }Selected-requester producer repair at
9600c93d45bbdb867ff738d258f25ea94a7f2f45The new actual reply-flow composition exposed a real producer mismatch: after Alice selects Bob, the retained continuation correctly holds Bob's authority, but
prepareSessionsSendReplyContextcopied Alice's plain caller origin into the outgoingagentToolCaller. The factory now takes requester origin from the existing canonical selected-operator resolver, with its required-origin check, while retaining the original caller's agent/session bindings. No authority fallback or new policy owner is introduced.The composition exercises the real requester factory, canonical session readers and communication receipts, detached reply custody, A2A flow and AgentStep. A held peer returns only after the originating invocation/receipt ends. On the preceding candidate, three controls pass and the selected-Bob row fails specifically because outgoing origin says Alice. With the repair, all four cases pass: normal return, selected Bob with original read/write scope ceiling, canonical source revocation, and requester session replacement. No ended invocation, receipt or full-permission flag is restored. A separate determining-owner rollback to original upstream also reproduces the missing-requester failure; this is not a whole historical-tree execution.
The 4 composition cases, 4 retained-source cases and 7 AgentStep siblings pass (15 total, 62.48s canonical wrapper). Core production and owning agent-tools test types, scoped typed lint, formatting and fresh independent P0–P2 review pass. The exact committed runtime build also passes (120.3s). These compositions intercept transport; the separate Gateway captures above establish their own stated runtime boundaries. No claim of Alice-only personal-tool denial, reassignment rejection or recipient execution permissions follows from these tests.
The original extracted candidate
9ec7457c42d80015ef85ca36d77bee3cafc38bddwas based on upstream1429fd5487b508d59b0466fb83a9618c8022f162. Its retained-owner suite separately covers release, device revocation, Gateway replacement and selected-person scope intersection. These owner tests do not stand in for Gateway/final-effect evidence.The proof fixtures above are synthetic. No operator Gateway or business session was changed, restarted or deployed to collect them.
Related Work
#162299 already separates accepted reply custody from the original invocation's lifetime. #177296 clears stale ambient caller context when starting a recipient; it does not restore the originally selected requester for this returned personal-tool path. #177618 fixes pre-ACK run-scope binding, which stays in #177698.
Remaining Merge Gates
This PR is ready for security/session-owner review of its extracted authority-policy proposal, independently of the lifecycle consolidation.