Skip to content

fix(subagents): owner subagent results dropped after the owner sends a followup message - #167047

Open
Oldrich333 wants to merge 1 commit into
openclaw:mainfrom
Oldrich333:fix/owner-completion-after-followup
Open

Oldrich333 wants to merge 1 commit into
openclaw:mainfrom
Oldrich333:fix/owner-completion-after-followup

Conversation

@Oldrich333

Copy link
Copy Markdown
Contributor

Agent-written on behalf of @Oldrich333 · agent: hive-admin/executor · model: anthropic/claude-opus-5-5 · origin: agent-initiated

Related: #162761

What Problem This Solves

Fixes: the gateway owner's finished subagent results are dropped with Requester operator authority is no longer current when the owner sends another message in the same conversation while the subagents still run.

User Impact

User impact: an owner who keeps chatting while helpers work gets their results delivered instead of a silently stalled conversation. Operators with a role policy, a model policy, narrower scopes or a non-owner profile keep today's fail-closed refusal.

Why This Change Was Made

  • A direct user turn revokes pending yield authority (revokeRequesterCronAuthority); an operator-captured batch then throws in withRequesterCronAuthority (!current() branch), while a batch without a captured operator takes run() in the same branch and is delivered.
  • gateway-owner with operator.admin and no role or model policy is captured, but that authority restricts nothing the no-operator dispatch allows. Taking the existing no-operator run() for exactly that authority grants nothing new.
  • Scope: owner only. It does not answer the general same-principal question in [Bug]: Same-owner followups revoke native subagent completion authority and stall authorized work #162761 (non-owner operators stay fail-closed). Outer fences in the settle wake are unchanged: private rows of a reset/replaced requester session are still refused (private completion requester session was replaced), cohort and incarnation checks still apply.

Evidence

  • New it.each in src/agents/subagents/requester-cron-authority.test.ts: yield captured from an operator turn → revokeRequesterCronAuthority(SESSION) (the later direct turn) → dispatch. Unrestricted owner delivers; owner without admin, owner with a role policy, owner with a model policy, and a named profile with admin all still throw.
  • Revert proof: with the source change reverted, the unrestricted gateway owner case fails (1 failed | 36 passed); with it, 37 passed.
  • Family: every non-e2e test importing requester-cron-authority (14 files) → passed 5 Vitest shards, 344 tests.
  • pnpm test src/agents/subagents/requester-cron-authority.test.ts --maxWorkers=1: cold 34.4 s, warm 11.1 s. CI duration: unavailable (no CI log found for the file on recent main commits).
  • run-tsgo tsconfig.core.json, test/tsconfig/tsconfig.core.test.agents-other.json, …agents-sessions.json: 0 errors. oxfmt --check, oxlint on both files: clean.
  • Production (2026.9.8, Linux host, npm global install): 36 owner-conversation results dropped this way on 3 gateways 2026-10-04..10-08; one sequence: 6 children spawned, owner messages at +4:42 and +6:22, all 6 dropped after the 30 s / 120 s replays; a batch spawned after the last owner message delivered.
  • Real behavior proof scope: a Control UI client authenticated only by the shared gateway token captures no owner operator authority, so it takes the no-operator path and does not reproduce; a disposable-gateway proof needs an authenticated-owner client. We run the same change as a local patch on 2026.9.8 and will add the first production log line of the patched path here.

…p message

A later direct turn revokes pending yield authority. For the gateway owner with admin scope and no
role or model policy, the captured operator authority restricts nothing the no-operator dispatch
allows, so the revoked batch takes the existing no-operator path instead of throwing
'Requester operator authority is no longer current'. Narrower operators stay fail-closed.

Related: openclaw#162761
@clawsweeper

clawsweeper Bot commented Oct 8, 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.

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Maintainer security review required

This external contributor PR changes sensitive security components. A maintainer must review these changes before merging.

Current SHA: ae905e503665d2635ec891207b2aabe118f89d26

These sensitive security changes were made:

  • src/agents/subagents/requester-cron-authority.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

After reviewing the changes, post a new PR comment containing only approval commands, each on its own line:

/allow-security-sensitive-change

A later push requires a fresh approval comment.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Oct 8, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. 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. labels Oct 8, 2026
@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

The branch allows subagent completion dispatch to continue without captured operator authority when the original requester was an administrator Gateway owner without role or model restrictions.

Example: An authenticated Gateway owner sends a followup while yielded subagents are running.

  • Before: Completion dispatch rejects the finished batch with “Requester operator authority is no longer current.”
  • After: The owner batch takes the uncaptured-operator dispatch path instead of rejecting.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The production problem is well supported, but the proposed exception bypasses genuine revocation and has no after-fix runtime proof.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🧂 unranked krab (1/6) Security review found an item that needs attention.

Product

Kind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Partial
User problem: Helpers finish successfully, but an owner who keeps chatting receives no automatic continuation and must recover their results manually.
Reason: Reliable completion is valuable and covered by the existing announcement contract, but this owner-only exception changes an intentionally retained authority boundary and leaves the broader linked report unresolved.

Merge readiness

⛔ Blocked before merge - 10 items remain

This PR addresses a corroborated problem still present on current main, but needs real behavior proof before merge and introduces a bypass of genuine owner-authority revocation.

Priority: P1
Reviewed head: ae905e503665d2635ec891207b2aabe118f89d26
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should verified same-owner followups preserve pending batches' original live authority, or should direct turns continue revoking those batches with explicit result recovery?
  • Recommendation: Preserve verified continuity: Retain the original live source only for verified same-principal followups, with genuine revocation remaining terminal.
  • Why: Earlier merged work deliberately revoked pending handoffs on new direct turns, while the documented completion contract and production reports support continuity; no area-owner decision resolves that tension for this proposal.

Before merge

  • Add real behavior proof - Authority-chain proof required: demonstrate an authenticated owner's multi-child completion after a same-owner followup, and show genuine device/access revocation prevents parent input persistence, execution, and delivery through the production completion path. The supplied after-fix evidence is unit coverage; production logs describe pre-fix failures and patched runtime output is still promised. No stored-data format or migration changes are introduced. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Keep genuinely revoked owner authority fail-closed (P1) - An owner batch whose original device or access source is revoked now reaches run() without its captured operator authority. current() returns false when operatorAuthority.assertCurrent() throws, not only when a followup discards the yield; a pairing/access revocation can leave the frozen gateway-owner, admin scope, and absent policies unchanged. This condition therefore permits completion dispatch after genuine authorization loss. The settle-wake's batch/session fences do not revalidate that original source. Preserve live original authority for verified same-principal continuity rather than bypassing every failed currentness check.
  • Resolve security concern: Revoked owner work becomes uncaptured dispatch - The fallback checks historical profile/scope fields after current authority has failed, allowing an originally owner-bound completion to proceed without the source revocation checks carried by the normal dispatch scope.
  • Resolve merge risk - The proposed owner exception changes deliberate direct-turn revocation behavior without recorded area-owner acceptance of the new authority lifecycle.
  • Complete next step - Resolve the owner-continuity contract, repair the revoked-source bypass, provide after-fix allowed/revoked runtime evidence, and obtain the enforced security review for the resulting revision.
  • Improve patch quality - Replace the broad fallback with original live-authority continuity that distinguishes same-principal followups from genuine revocation.
  • Improve patch quality - Add redacted after-fix runtime logs or terminal evidence for delivery and revoked-source rejection; remove private addresses, credentials, and endpoints.
  • Improve patch quality - Update the PR body with the evidence to trigger fresh review, or have a maintainer comment @clawsweeper re-review.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
  • Explain or restore the original intent of src/agents/subagents/requester-cron-authority.ts: invalid captured-operator dispatch - bdd47f2: feat: edit personal instructions on multi-user gateways #155256 retained original requester restrictions and fenced revoked retries rather than permitting unrestricted fallback.

Findings

  • [P1] Keep genuinely revoked owner authority fail-closed — src/agents/subagents/requester-cron-authority.ts:526-529
  • [high] Revoked owner work becomes uncaptured dispatch — src/agents/subagents/requester-cron-authority.ts:526

Provenance

Tests

  • Missing end-to-end proof: No authenticated-owner Gateway run demonstrates after-fix delivery for a multi-child yielded batch across a followup, or rejection before effects after genuine device/access revocation. The body reports base-failing/head-passing unit coverage, which was not independently executed here.
Agent review details

How this fits together

Native subagents return completed work to the parent conversation through a completion wake. The authority handoff carries the original requester's permissions into that resumed parent turn.

flowchart TD
  A[Authenticated requester] --> B[Parent starts subagents and yields]
  B --> C[Captured requester authority]
  D[Followup or access revocation] --> C
  E[Finished child batch] --> F[Completion authority check]
  C --> F
  F --> G[Reject invalid authority]
  F --> H[Resume parent conversation]
Loading

Technical review

Best possible solution:

Preserve the original live requester authority across verified same-principal followups at admission, while keeping genuine source revocation and session, cohort, cancellation, and final-effect fences intact.

Do we have a high-confidence way to reproduce the issue?

Yes, source establishes that direct user admission discards pending authority and current main rejects its later completion dispatch; official-release reports corroborate that sequence. No runtime reproduction was executed during this read-only review.

Is this the best way to solve the issue?

No. Falling back after any currentness failure conflates ordinary followups with actual access loss; retaining verified original authority at the admission boundary is safer.

Full review comments:

  • [P1] Keep genuinely revoked owner authority fail-closed — src/agents/subagents/requester-cron-authority.ts:526-529
    An owner batch whose original device or access source is revoked now reaches run() without its captured operator authority. current() returns false when operatorAuthority.assertCurrent() throws, not only when a followup discards the yield; a pairing/access revocation can leave the frozen gateway-owner, admin scope, and absent policies unchanged. This condition therefore permits completion dispatch after genuine authorization loss. The settle-wake's batch/session fences do not revalidate that original source. Preserve live original authority for verified same-principal continuity rather than bypassing every failed currentness check.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.99

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against a9d68fff897f.

Merge-risk options

Maintainer options:

  1. Repair the live-authority handoff (recommended)
    Replace the invalid-authority fallback with verified same-principal continuity and prove actual source revocation prevents completion effects.
  2. Retain revocation and expose recovery
    If turn-scoped revocation remains intentional, pause this exception and provide a visible recovery path for retained child results.

Testing

Proof path: unit tests only.

Security

Needs attention: The owner fallback removes a live authorization fence after genuine source revocation; no dependency or supply-chain changes are introduced.

Evidence

Security concerns:

  • [high] Revoked owner work becomes uncaptured dispatch — src/agents/subagents/requester-cron-authority.ts:526
    The fallback checks historical profile/scope fields after current authority has failed, allowing an originally owner-bound completion to proceed without the source revocation checks carried by the normal dispatch scope.
    Confidence: 0.99

What I checked:

PR surface

Source +17, Tests +70. Total +87 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 18 1 +17
Tests 1 70 0 +70
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 88 1 +87

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #162761
Summary: This PR proposes an owner-only partial fix for the canonical same-principal completion-authority report.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: Multiple official-release reports show successful subagent work failing to resume its parent during ordinary ongoing conversations.
  • merge-risk: 🚨 security-boundary: The new fallback drops the captured operator boundary after genuine source-authority revocation as well as after direct-turn invalidation.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🦪 silver shellfish and patch quality is 🧂 unranked krab.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

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.

Reviewed October 8, 2026, 3:58 AM ET / 07:58 UTC.

This branch has not been deployed

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

Labels

agents Agent runtime and tooling merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. security-review-required security-sensitive-changed size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant