Repository navigation
fix: retain channel requester when child completion resumes parent - #199674
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 changesPreserves the original channel requester when child completion starts a parent continuation. Example: A Discord owner reads gateway.mode, delegates to a child, and resumes after that child finishes.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Partial Merge readiness⛔ Blocked before merge - 1 item remains Keep this PR open: it addresses a source-confirmed requester-identity gap, resolves both earlier findings, and supplies relevant live proof; extending requester re-entry to completion-owned work still needs an owner decision. Priority: P2 Decision needed
Before merge
FindingsNone. Agent review detailsHow this fits togetherThe subagent registry retains completion custody, announcement delivery starts the parent continuation, and Gateway admission resolves its requester identity and tool permissions. flowchart LR
A[Channel requester] --> B[Parent agent]
B --> C[Child registration]
C --> D[Retained completion custody]
D --> E[Completion delivery]
E --> F[Gateway requester admission]
F --> G[Parent continuation]
Technical reviewBest possible solution: Retain the selected requester through existing completion custody and normal admission under an explicitly approved completion-reentry contract. Do we have a high-confidence way to reproduce the issue? Current-main registration omits retainRequester and completion dispatch omits agentToolCaller; the author also reports a failing original regression and a successful live continuation on the repaired tree. Is this the best way to solve the issue? The patch uses the existing capture, custody, principal-comparison, and admission owners without introducing another authority store; its completion-reentry scope needs owner acceptance. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 113d6243f360. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +48, Tests +284. Total +332 across 12 files. Added test files: 1. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. 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 HistoryReview history (1 earlier review cycle)
Reviewed November 15, 2026, 3:30 PM ET / 20:30 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 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. |
Rebased onto main. The batch requester rule now lives in the extracted completion batch authority module, reusing its source comparison.
A one-way or own-child sessions_send result resumes the sending turn's requester through the same retained-requester continuation as subagent completion, instead of only the operator source.
72e1afd to
2e694ec
Compare
|
/allow-security-sensitive-change |
|
/allow-security-sensitive-change |
|
/allow-security-sensitive-change |
|
/allow-security-sensitive-change |
Related: #182043, #168823. Adjacent cohort work: #164366 (completion-wave selection is unchanged).
What Problem This Solves
A parent resumed by work it started loses the original channel requester's identity and can reject already-authorized owner tools. That happens in two places:
sessions_sendfollowup results. These are one-way or own-child sends whose result returns to the sending session.Users see the agent stop midway ("I no longer have authority, say go on a new turn") right after a delegated step finishes.
User Impact
The resumed turn acts for the person who asked, subject to current owner checks and the existing completion tool-policy ceiling. Guests are not promoted. Mixed-human batches keep operator-owned delivery without choosing a member. No configuration or state migration.
Out of scope: crash/restart recovery (see #203479 for restored scopes) and automation-management grants (#168823).
Why This Change Was Made
The continuation that holds a parent's operator source deliberately drops the ambient tool caller. #178750 added an opt-in
retainRequesterfor returned peer replies only. Completion custody andsessions_sendfollowup custody never opted in, so the resumed turn kept the operator source but lost the human.retainRequester. Single-child and batch delivery re-enter the requester for dispatch, only when an origin was retained.sessions_sendfollowup custody captures withretainRequesterand exposesrunWithRequester. The private completion reply flow and the registry claim for watched/own-child sends use it.readRetainedRequesterToolCalleris shared by the direct-delivery and reply-flow dispatches.Evidence
Head
db7fe515a5351818ba030a97c87e8d8481054127(rebased onto main4e766e6e61ba)Untrusted-source route: secretless AWS Crabbox,
--fresh-pr,--no-hydrate, trusted bootstrap from main with IAM-404 and exact-SHA checks. Leases released afterward.Focused suites, 13 files:
run_9b29587cf9b61b6ad3c3776f818fce4b, all passed. Covers requester-policy, completion-authority registry (including the requester-identity cases), direct delivery, requester-settle dispatch/followup, result-owed, followup completion, thesessions_sendfollowup/revalidation/owner-continuation tests, and the Gateway followup-owner/dispatch-owner tests.New regression
sessions-send-owner-continuation.test.ts› returns a one-way result to the channel requester who sent it:run_32bb28f71c513d4fb75ae94ab6b88232. With the followup custody and reply-flow changes reverted it fails (expected undefined to match object { agentId: 'main', … }); restored, it passes.An earlier run on head
2e694ec0(run_4ebe5adc39ffaac831d42627012ddbd6) failed 3 tests. Both causes were fixed ine61788e4:runWithRequestereven when no origin was retained, which re-admitted under a new invocation and broke delivers overlapping completions under their own invocations. It now re-enters only a retained requester.Independent local review of the rebase found two missed fixtures (now fixed) and no authorization leak. Main's
participationCeiling, required-custody and aborted-signal checks are preserved.db7fe515adds the missingrunWithRequesterto thescripts/perf/subagent-custody-abort-retention.tscustody probe, whichcheck-test-typesflagged one61788e4; the focused runs above were one61788e4, and production code is unchanged since then.Exact-head PR CI 45572631399 passed;
openclaw/ci-gateand the security-sensitive review passed after maintainer approval.Prior-head live proof (November 15, head
72e1afde461c)An isolated Discord canary with OAuth-backed Codex: the parent's owner-only
config.get gateway.modereturnedok/localbefore and after a realannounce:v1subagent completion (live runrun_6cbacb2b5d039ae9bc64d29924127505). That is prior-head evidence for the subagent path only. Thesessions_sendpath and a Telegram end-to-end run on this head are still to do.Rollback: revert the requester-retention commits.