Repository navigation
fix: subagent completions fail for session-scoped requesters - #185569
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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs real behavior proof before merge. What this changesThis PR binds public subagent completion requests to the selected existing requester session so session-scoped operators can receive results. Example: An operator with only operator.sessions.write receives a child completion in the owned selected-parent session.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 4 items remain This PR addresses a concrete completion-delivery failure that remains on main. The prior fixture finding is fixed, and no new discrete code defect was found; final-effect authorization evidence and the failing required CI gate remain unresolved. Priority: P1 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe subagent announce owner turns a completed child's result into a requester follow-up, then sends it through in-process Gateway authorization and agent execution. flowchart TD
A[Completed child] --> B[Select requester session]
B --> C[Bind existing session identity]
C --> D[Retained requester authority]
D --> E[Gateway scope and ownership checks]
E --> F[Requester execution]
F --> G[Transcript and reply]
Technical reviewBest possible solution: Reuse the existing session-run binding for the selected public requester while preserving captured private identities and current authorization checks. Do we have a high-confidence way to reproduce the issue? Source shows that public completions omit the binding required for session-scoped agent admission; the report names the matching scope error, but a failing base execution was not supplied. Is this the best way to solve the issue? The patch uses the existing authorization owner, binds the selected fallback target correctly, and removes redundant field construction without adding another state or policy owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b5135f069610. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: No concrete authorization bypass was found, but final-effect coverage for the newly admitted public completion path remains incomplete. EvidenceSecurity concerns:
What I checked:
PR surfaceSource +3, Tests +109, Docs +4. Total +116 across 3 files. Added test files: 0. View PR surface stats
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 HistoryReview history (1 earlier review cycle)
Reviewed October 27, 2026, 3:11 AM ET / 07:11 UTC (Revision 2). |
|
Addressed the fixture finding at Exact-head CI run 40463586944 passed both new cases (9410ms owned, 659ms foreign), all four runtime-file tests, 42 direct-delivery tests, and seven private-completion tests. Static checks and fresh P1 autoreview pass. The PR body now records these results. The run remains red only for the unchanged settle case Full requester execution and revocation/reassignment before transcript/provider effects remain disclosed proof gaps. An isolated Testbox allocation queued and was canceled; local runtime tests were excluded under the maintainer's host constraint. No concrete bypass was identified, and this patch adds no new authorization gate. This authorization change remains open for coordinator/maintainer review, with no merge authorized. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Bind public completion requests to the selected existing requester session while preserving private incarnation checks and nested fallback. Child results no longer require global operator.write when the retained requester has operator.sessions.write.
3c9a634 to
d2dc4ab
Compare
|
Merged via squash.
|
…lds into one helper call Upstream (openclaw#185569, openclaw#185667) grew subagent-announce-direct-delivery.ts to exactly the 700-line cap, so the fork's `continuationTrigger` and `traceparent` lines on the direct agent request put it at 702. Fold, not extract (bootstrap#1727 comment 6449160126). The new continuation-owned sibling subagent-announce-direct-delivery.continuation.ts exports withDirectAnnounceContinuationFields. It returns upstream's source-reply spread, then `continuationTrigger` and `traceparent`, each only when present. The request keeps one call in place of upstream's 3-line spread, so a later upstream edit to that spread conflicts on that one line. Field order is unchanged. Deviation from the workorder, measured (TROUBLE posted): passing upstream's 92-character expression itself as the argument cannot fit. At indent 8 with its trailing comma it needs 101 columns, so the formatter breaks it over 3+ lines, and the import costs a fourth. Counted lines with oxfmt and max-lines: verbatim argument 704; wrapping upstream's object literal with every inner byte unchanged 701; taking `completionSourceReplyDeliveryMode` 699. The helper therefore takes the operand, and upstream's expression moves verbatim into its body. Behaviour: unchanged for every consumer. The request used to carry `continuationTrigger: undefined` when there was no trigger. The key is now absent, like the sibling producers (announce delivery, restart sentinel, continuation wake). The Gateway `agent` validator treats an optional undefined as absent, and readers only read the value. Counted lines (U8 -> 3c834c7 -> this): 700 -> 702 -> 699. No cap moved. RED (3c834c7, bare and --base 7fdf69f): check:line-cap-ratchet subagent-announce-direct-delivery.ts: 700 -> 702 counted lines (cap 700). GREEN: check:line-cap-ratchet bare and --base 7fdf69f OK (806 changed files); tsgo:core exit 0. subagent-announce-direct-delivery.continuation.test.ts 2/2: upstream's fields unchanged for every mode, continuation fields only when present, order kept. subagent-announce-direct-delivery, -direct-completion-media and -delivery.completion-contract (continuation trigger and trace on the direct path) 61/61; subagent-announce-delivery{,.origin,.discord-thread, .yielded-settle,.runtime}, continuation-drain.chain-cost and media-generate-background trace-context 157/157. Refs karmaterminal/openclaw-bootstrap#1727 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…w#185569) * fix(agents): deliver subagent completions with session-scoped access Bind public completion requests to the selected existing requester session while preserving private incarnation checks and nested fallback. Child results no longer require global operator.write when the retained requester has operator.sessions.write. * test(agents): exercise completion session ownership guard
What Problem This Solves
Fixes subagent completion delivery failing with
missing scope: operator.writewhen the requester has session-scoped write access.The 2026-10-26 Team Gateway report counted 29 direct announce scope failures in 24 hours. The supplied excerpt contains 13 error lines across six ordinary run IDs, none prefixed
subagent-restart-recovery:. A separate aggregate reported 46Subagent completion requester is unavailablecleanup warnings; the supplied excerpt contains no occurrences of that warning, so this change does not attribute or alter that separate path.User Impact
A completed child can return its result to an existing requester using the requester's retained
operator.sessions.writeauthority. Private completions retain their original requester-incarnation checks, and public completion routing can still select the parent of a vanished nested requester. No configuration or persisted-data migration is required.Why This Change Was Made
Registration retains the requester's operator identity and scopes. Direct completion delivery then dispatches the in-process Gateway method
agent. Ordinary public completions omitted the host-owned session-run binding, so scope projection could not use the existing session-write alternative and Gateway rejected the call for lacking globaloperator.write.Bind a public completion to the already-selected, already-existing requester session ID and lifecycle revision. Private and settle requests continue binding their captured incarnation after the existing checks. The binding owner supplies the expected-existing fields, removing the duplicate request-field spread.
The binding records target identity in a host-held WeakMap; it does not mint authority, widen scopes, or make wire fields trustworthy. Gateway continues checking the retained source's current authority, role, and ownership of the selected session. A foreign session remains forbidden even when the request is host-bound. Public delivery uses the selected fallback target rather than transferring the vanished nested requester's captured ID to another session. A target replaced during preparation is rejected by existing admission fencing.
Evidence
Current exact-head CI 40476144840, head
d2dc4ab7eb6a2e9c45ad95d6fa3e3394b2f07368: SUCCESS, 35 jobs passed and 28 planner skips. Both the requiredopenclaw/ci-gatejob and aggregate publisher are SUCCESS. The inherited settle failure below is resolved by the included fix: preserve required child results during completion handoffs #185667.Added two cases through direct completion delivery and real Gateway admission: retained session-write authority reaches an owned selected requester, while a foreign requester fails the own-session guard. The original captured requester ID deliberately differs from the selected target. Only the downstream agent preflight consumer is replaced; the projected scopes must remain exactly
operator.sessions.write.PASS:
node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.agents-sessions.json --incremental.PASS:
node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json src/agents/subagents/announce/subagent-announce-direct-delivery.ts src/agents/subagents/announce/subagent-announce-delivery.runtime.test.ts.PASS: touched-file
oxfmt --check,node scripts/check-docs-mdx.mjs docs/tools/subagents/announce.md, andgit diff --check.P1 autoreview: scoped-clean on the final committed branch, with frozen Gateway authority and session-sharing source context. TMPDIR used the private Darwin user temporary directory; TMP and TEMP were unset.
Previous-head CI 40463586944, head
3c9a6340a8c6a1f60f009e5f23f5c7ce7168087f: both new admission regressions PASS. The runtime file passed 4/4 tests in 24.11s (new owned case 9410ms, foreign case 659ms; wrapper 25.80s). Direct-delivery tests passed 42/42 and private-completion tests 7/7. The run completed with 33 successful jobs, 28 planner skips, and two failed jobs:checks-node-changed-2and aggregateopenclaw/ci-gate. That head's requiredopenclaw/ci-gatewas FAILURE.First-head CI run 40461290445 completed with failure: the owned-requester regression passed, but the foreign fixture concealed its row before the ownership guard. The repair makes that synthetic row visible while retaining exactly
operator.sessions.write; the ownership assertion remains unchanged.Both runs failed only the unchanged requester-settle case
one undelivered, NO_REPLYin changed-2 (expected false, received true). Source attribution: landed fix(agents): settle silent subagent completions quietly #185388 (1aba44bf4281) settles successful silentsubagent_settleresults, while the unchanged test still expects retry. This patch preserves the settle call's binding and parameters. The CI table had no matching main job; the identical failure is now independently reproduced on clean main as described below. Classification and its assertion remain with that owner.Real main baseline proof: isolated Blacksmith Testbox
tbx_01m5y5b18fw4jy4njnt5v2ykht, allocation run 40469404545, source main commitb112a9ec2304954636b74f4446c8ba520a885888(after fix(agents): settle silent subagent completions quietly #185388, without this PR). The wrapper verified the source tree and three explicit classifier/delivery/test SHA-256 checks. Command:CI=1 OPENCLAW_VITEST_MAX_WORKERS=1 OPENCLAW_TESTBOX=1 OPENCLAW_TESTBOX_REMOTE_RUN=1 pnpm test src/agents/subagents/announce/subagent-announce.requester-settle-dispatch.test.ts -- -t "one undelivered, NO_REPLY". Result: the one selected test FAILED at line 316,expected true to be false; 24 tests skipped by the name filter, selected case 134ms, test process 66.36s, wrapper exit 1. This is real matching inherited-failure evidence, not a green CI claim. Testbox lifecycle status may show canceled after owned lease cleanup; the wrapper's verified source and payload result are the proof.The local Mac is oversubscribed and earlier attempts did not produce a valid scope-error red result. A Testbox was requested, but its runner was queued; the allocation was stopped without running tests, per the proof policy. Scope-regression red-on-base proof and full requester execution/revocation/reassignment proof remain unavailable. No timeout, budget, baseline, or assertion was weakened. The admission regression stops at downstream agent preflight and does not demonstrate provider or transcript effects.
Recovery and completion-classification code are unchanged. Related classification work: fix(agents): settle silent subagent completions quietly #185388.
This authorization-boundary correction grants no new scopes. The inherited settle failure was repaired by #185667, merged as
b3b0f1bb8105cf784f87f47a8f31a9564888f2e3. This branch now includes that fix at headd2dc4ab7eb6a2e9c45ad95d6fa3e3394b2f07368;git range-diffconfirms both scope commits remain patch-identical. Targeted typecheck, lint, format, and diff checks passed after integration. Fresh exact-head CI is green. The runtime proof limits above remain explicit.