Skip to content

fix: retain channel requester when child completion resumes parent - #199674

Merged
jalehman merged 4 commits into
openclaw:mainfrom
PollyBot13:openclaw/requester-fork-discord-20261115
Nov 25, 2026
Merged

jalehman merged 4 commits into
openclaw:mainfrom
PollyBot13:openclaw/requester-fork-discord-20261115

Conversation

@PollyBot13

@PollyBot13 PollyBot13 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

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:

  • Subagent completion. The child finishes and wakes its parent.
  • sessions_send followup 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 retainRequester for returned peer replies only. Completion custody and sessions_send followup custody never opted in, so the resumed turn kept the operator source but lost the human.

  • Subagent launch and recovery capture custody with retainRequester. Single-child and batch delivery re-enter the requester for dispatch, only when an origin was retained.
  • The batch rule lives in the existing completion batch authority module and reuses its source comparison: same canonical principal retains the requester; otherwise operator-owned delivery is used. Display names are ignored.
  • sessions_send followup custody captures with retainRequester and exposes runWithRequester. The private completion reply flow and the registry claim for watched/own-child sends use it.
  • readRetainedRequesterToolCaller is shared by the direct-delivery and reply-flow dispatches.
  • No owner bit is set directly; no denylist is relaxed. No schema change.

Evidence

Head db7fe515a5351818ba030a97c87e8d8481054127 (rebased onto main 4e766e6e61ba)

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, the sessions_send followup/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 in e61788e4:

    • Delivery re-entered runWithRequester even 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.
    • The requester-identity test expected a started completion to throw after source revocation. Main's refactor: drop the admitted operator authority re-check and the lifetime ratchet (R6z) #204249 removed that re-check; revocation now applies to the next start, so the assertion was dropped.
  • 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.

  • db7fe515 adds the missing runWithRequester to the scripts/perf/subagent-custody-abort-retention.ts custody probe, which check-test-types flagged on e61788e4; the focused runs above were on e61788e4, and production code is unchanged since then.

  • Exact-head PR CI 45572631399 passed; openclaw/ci-gate and 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.mode returned ok/local before and after a real announce:v1 subagent completion (live run run_6cbacb2b5d039ae9bc64d29924127505). That is prior-head evidence for the subagent path only. The sessions_send path and a Telegram end-to-end run on this head are still to do.

Rollback: revert the requester-retention commits.

@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling size: M labels Nov 15, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 15, 2026
@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

Preserves 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.

  • Before: The resumed parent loses the channel requester and can reject the same owner-only read.
  • After: The resumed parent retains the requester and config.get gateway.mode returns ok/local under current owner checks.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Relevant live proof and a focused implementation resolve the previous findings; completion-reentry direction remains an owner choice, and broad exact-head product CI has not run.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied isolated Discord/Gateway/Codex observations exercise a successful child, actual completion resumption, and a second successful owner-only config.get; local tree comparison confirms that the exercised source matches the published head, while guest, mixed-human, cancellation, and revocation controls remain deterministic evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Partial
User problem: A channel requester can delegate successfully and then find the resumed parent unable to use previously authorized owner tools.
Reason: The bounded in-process repair has demonstrated value, but extends an intentionally opt-in requester contract and does not resolve the linked crash-recovery or automation-management reports.

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
Reviewed head: 72e1afde461c17d25eea1c55efd7e6428eff7ed5
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should in-process child completions re-enter the original requester for single-child and same-principal batches, while mixed-human batches remain caller-free?
  • Recommendation: Accept the bounded in-process extension: Approve the proposed single-child and same-principal behavior with current source, owner, and tool-policy checks, coordinating overlapping capture and delivery changes with fix(subagents): preserve requester source for original singleton completions #183715.
  • Why: The merged requester-reentry feature deliberately scoped its opt-in to returned peer replies, and neither this PR nor its linked discussion records an owner decision extending it to completion-owned work.

Before merge

  • Await maintainer action - An authorized maintainer must provide the repository-required security approval for head 72e1afd.

Findings

None.

Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Paul Bohm: Raw commit d705a4b adds src/gateway/server-plugin-in-process-authority.ts:245 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d705a4bf18c6; files: src/gateway/server-plugin-in-process-authority.ts)

PR surface

Source +48, Tests +284. Total +332 across 12 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 8 91 43 +48
Tests 4 285 1 +284
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 376 44 +332

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Requester identity can disappear during delegated channel work and block previously authorized tools, with a bounded continuation path affected.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-15T16:44:58.375Z sha 237e346 :: needs real behavior proof before merge. :: [P1] Preserve delivery for mixed-requester completion waves | [P2] Compare requester principals instead of full origin metadata

Reviewed November 15, 2026, 3:30 PM ET / 20:30 UTC (Revision 2).

@clawsweeper clawsweeper Bot removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Nov 15, 2026
@PollyBot13

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 15, 2026
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

✅ Maintainer security changes approved

A maintainer approved this revision with an explicit security approval comment.

A later push requires a fresh approval comment for an external contributor's PR.

PollyBot13 and others added 2 commits November 24, 2026 22:37
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.
@jalehman
jalehman force-pushed the openclaw/requester-fork-discord-20261115 branch from 72e1afd to 2e694ec Compare November 25, 2026 06:39
@jalehman

Copy link
Copy Markdown
Contributor

/allow-security-sensitive-change

@jalehman

Copy link
Copy Markdown
Contributor

/allow-security-sensitive-change

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: L and removed size: M labels Nov 25, 2026
@jalehman

Copy link
Copy Markdown
Contributor

/allow-security-sensitive-change

@jalehman

Copy link
Copy Markdown
Contributor

/allow-security-sensitive-change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts security-sensitive-changed size: L status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants