Skip to content

fix: preserve automation management after subagent waits - #147499

Merged
steipete merged 2 commits into
mainfrom
codex/requester-automation-authority
Sep 14, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/requester-automation-authority

Conversation

@steipete

@steipete steipete commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes automation management failing with “Automation not found” after an authenticated Control UI administrator waits for subagents with sessions_yield.

User Impact

The parent can continue managing existing automations after its children finish, without asking the administrator to send another message. Cancellation, session reset/archive, a new direct user turn, and Gateway restart still revoke the handoff. No configuration or data migration is required.

Why This Change Was Made

Yield closes the original run, while child settlement starts a synthetic continuation. The registry now transfers the verified parent entitlement through the committed child batch, and Gateway admission issues fresh management-only grants for the successor. The committed batch owns the pending handoff; after admission, the fresh run scope owns the grants until it closes. Retiring a delivered batch cannot revoke a still-running parent. Retryable delivery failures retain an unconsumed handoff.

This covers explicit requester yields, including repeated yields and canonical child replacements. It preserves private completion routing and does not promote ordinary inter-session messages or restore privileges across Gateway restarts.

Evidence

The final-effect integration fixture uses synthetic authenticated connection/model inputs and real SQLite session/subagent persistence, requester handoff, Gateway admission/grants, the production cron.update handler, and CronService. It rereads the stored jobs after each operation. The scheduler is disabled and no live Gateway is involved.

Case Result Persisted automation
Previous admission implementation Administrator successor rejected with CRON_JOB_NOT_FOUND Still disabled and unchanged
Fixed administrator successor, after child-batch retirement Update succeeds Enabled and renamed; trusted policy preserved
Non-admin successor CRON_JOB_NOT_FOUND Complete stored record unchanged
New direct user during the real service-validation await Expired management grant Complete stored record unchanged
Session reset during that await Expired management grant Complete stored record unchanged

Proof command: node scripts/run-vitest.mjs src/gateway/server-methods/requester-cron-authority.integration.test.ts — 4/4 pass. An isolated replay with the exact admission module from 46aa369b315 fails the administrator case; restoring current admission in that same fixture passes all four. Scoped type checks, lint, unused-export checks, and guards pass.

  • The original requester-wake regression fails on the old code and passes with the fix: the resumed parent can manage its existing trusted-policy automation after the original run's grants close.
  • After integrating main’s ancestor-cleanup repair (fix: avoid repeated cleanup work when subagents finish #147480), all 294 tests across the six focused authority, requester-settle, lifecycle, grant, and persisted-mutation suites pass. The conflict resolution retains both committed entitlement cleanup and ancestor cleanup, with no change to the reviewed authority patch. A regression for retiring a batch while its requester is active also fails on the previous implementation and passes with the fix.
  • Local production/test type checks, lint, unused-export and ownership guards, and the full build passed before rebasing. The rebased integration passes its focused tests and production type check; exact-head CI remains the landing gate.
  • Fresh independent P2 review passes on the current-main resolution, including the pending-run lifetime repair.
  • CI found an unrelated timestamp-ordering flake in the Reef scan fixture added by improve(reef): reduce repeated delivery diagnostic reads #147505. A frozen clock reproduced the original failure, and deterministic insertion timestamps passed all 18 trust-store tests. Main independently landed the same fixture correction in fix(reef): stabilize delivery scan regression fixtures #147551, so the final rebase retains main’s fix and drops this PR’s duplicate test commit.
  • CI run 34790167652 and required openclaw/ci-gate passed before the final mechanical rebase. ClawSweeper’s completed review was ready with no findings. Both automation commits are patch-identical after rebasing onto main’s Reef fixture repair; the final exact-head CI run 34791023573 and required openclaw/ci-gate pass at a57d239280fb23f9831fa755116133a8db3a9e06.
  • No live Gateway deployment or schedule activation is included.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Sep 13, 2026
@steipete
steipete marked this pull request as ready for review September 13, 2026 22:49
@steipete
steipete requested a review from a team as a code owner September 13, 2026 22:49
@clawsweeper

clawsweeper Bot commented Sep 13, 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.

@steipete steipete self-assigned this Sep 13, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 8:02 PM ET / September 14, 2026, 00:02 UTC (Revision 4).

ClawSweeper review

What this changes

Preserves administrators’ automation management when their agent resumes after waiting for subagents, with lifecycle-bound grants, regression coverage, and documentation.

Merge readiness

✅ Ready for maintainer review

The fix remains necessary on current main. No actionable introduced defects were found, and the previously requested authority proof is satisfied by the reported persisted-mutation results and inspected production-path fixture.

Priority: P2
Reviewed head: a57d239280fb23f9831fa755116133a8db3a9e06

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent repair with strong final-effect authority proof and no actionable correctness findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The reported production-path harness exercises the changed requester handoff and Gateway admission through real cron.update/CronService writes and SQLite rereads: the administrator succeeds after batch retirement, while a non-admin and two mid-validation revocations leave records unchanged. Synthetic connection/model inputs are disclosed, and the inspected proof fixture is unchanged from the previous completed review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The reported production-path harness exercises the changed requester handoff and Gateway admission through real cron.update/CronService writes and SQLite rereads: the administrator succeeds after batch retirement, while a non-admin and two mid-validation revocations leave records unchanged. Synthetic connection/model inputs are disclosed, and the inspected proof fixture is unchanged from the previous completed review.
Evidence reviewed 7 items Current main still needs the fix: Fetched main admits direct operators but excludes synthetic clients and inter-session provenance; it has no requester-authority admission path. The proposed handoff module is absent from both fetched main and the supplied latest-release tree.
Main and release presence check: Neither tree contains the new requester handoff owner. No supplied merged related PR implements this automation-management continuation.
Authority ownership and revocation: Capture requires the original live administrator scope. Promotion requires the committed complete batch; admission checks exact requester, session, run, generation, and settlement provenance. Binding transfers ownership to the successor scope while preserving session and lifecycle revocation. The entitlement is process-local, not a persisted permission or plugin API.
Findings None None.
Security None None.

How this fits together

The subagent registry resumes a waiting parent after its children finish. Gateway admission gives that continuation fresh automation-management grants, which the automation service revalidates before changing stored jobs.

flowchart TD
  A[Authenticated administrator turn] --> B[Explicit subagent wait]
  B --> C[Committed child batch]
  C --> D[Requester continuation admission]
  D --> E[Fresh management grant]
  E --> F{Session and run still authorized?}
  F -->|Yes| G[Update stored automation]
  F -->|No| H[Reject without mutation]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +526, Tests +1120, Docs +12. Total +1658 across 20 files.

View PR surface stats
Area Files Added Removed Net
Source 11 568 42 +526
Tests 7 1217 97 +1120
Docs 2 12 0 +12
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 20 1797 139 +1658

Review metrics

Metric Value Why it matters
Production versus test growth production +526 net lines; tests and test support +1120 net lines Production growth implements the missing handoff lifecycle; the larger test portion covers persistence, revocation, retries, and retirement.
Final-effect cases 1 allowed mutation; 3 denied mutations The reported production-path run checks persisted outcomes for administrator, non-admin, direct-user replacement, and session-reset cases.

Technical review

Best possible solution:

Keep management authority attached to the verified task handoff, issue fresh successor grants, and enforce revocation at the existing automation mutation boundary.

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

Yes, at source level: current main rejects the synthetic continuation's management authority after the original run closes, and the contributor reports a failing old-admission replay through the persisted-update fixture. No tests were executed in this read-only review.

Is this the best way to solve the issue?

Yes. The patch extends the existing requester settlement and grant owners, preserves management-only scope, and avoids reviving expired grants or adding a competing permission mechanism.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: Repairs automation management after an explicit subagent wait, with an existing workaround through a fresh administrator turn or the Automations page.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The reported production-path harness exercises the changed requester handoff and Gateway admission through real cron.update/CronService writes and SQLite rereads: the administrator succeeds after batch retirement, while a non-admin and two mid-validation revocations leave records unchanged. Synthetic connection/model inputs are disclosed, and the inspected proof fixture is unchanged from the previous completed review.
  • proof: sufficient: Contributor real behavior proof is sufficient. The reported production-path harness exercises the changed requester handoff and Gateway admission through real cron.update/CronService writes and SQLite rereads: the administrator succeeds after batch retirement, while a non-admin and two mid-validation revocations leave records unchanged. Synthetic connection/model inputs are disclosed, and the inspected proof fixture is unchanged from the previous completed review.

Evidence

What I checked:

  • Current main still needs the fix: Fetched main admits direct operators but excludes synthetic clients and inter-session provenance; it has no requester-authority admission path. The proposed handoff module is absent from both fetched main and the supplied latest-release tree. (src/gateway/server-methods/cron-creator-authority-admission.ts:26, 0176c61961da)
  • Main and release presence check: Neither tree contains the new requester handoff owner. No supplied merged related PR implements this automation-management continuation. (src/agents/subagents/requester-cron-authority.ts, 0176c61961da)
  • Authority ownership and revocation: Capture requires the original live administrator scope. Promotion requires the committed complete batch; admission checks exact requester, session, run, generation, and settlement provenance. Binding transfers ownership to the successor scope while preserving session and lifecycle revocation. The entitlement is process-local, not a persisted permission or plugin API. (src/agents/subagents/requester-cron-authority.ts:286, a57d239280fb)
  • Final-effect proof: The complete supplied body and contributor comment fix: preserve automation management after subagent waits #147499 (comment) report four passing cases through real SQLite persistence, Gateway admission, cron.update, and CronService. The inspected fixture verifies an administrator's persisted enable/rename after batch retirement, non-admin rejection, and unchanged complete records after direct-user admission or session reset during service validation. Authentication/model inputs are synthetic; no live Gateway was used. This reviewer did not execute tests. (src/gateway/server-methods/requester-cron-authority.integration.test.ts:280, a57d239280fb)
  • Revocation reaches the mutation guard: Management-grant validation now checks continuation currency. The existing Gateway mutation guard invokes that validation, and CronService invokes the commit guard after asynchronous delivery validation before applying the stored update. (src/gateway/cron-creator-authority-grant.ts:214, a57d239280fb)
  • Re-review continuity: GitHub contents reads confirmed that the requester authority owner, persisted-mutation fixture, admission module, and lifecycle-wake module are byte-identical to the previous completed review at dcabc6c9334cc69feeb7a2d9111070873b3eb45d. That review retained no findings. Local historical comparison failed because required objects could not be retrieved; GitHub reads supplied the comparison instead. (src/agents/subagents/requester-cron-authority.ts, a57d239280fb)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-09-13T22:57:05.683Z sha 0eddb57 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-13T23:30:02.360Z sha 2f1a88fd469ab5cbaff23a52e408e1a0d5807fe3 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-13T23:41:55.820Z sha dcabc6c9334cc69feeb7a2d9111070873b3eb45d :: needs maintainer review before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Added the requested final-effect proof in requester-cron-authority.integration.test.ts. It runs the actual Gateway cron.update handler and CronService against isolated SQLite-backed session, subagent, and automation state. The resumed administrator enables and renames the stored job after child-batch retirement; the non-admin case and two revocations during the real service-validation await leave the complete stored job unchanged. The previous admission implementation fails the positive case, and the current implementation passes all four cases. The PR body now records the results and the synthetic connection/model boundary. No live Gateway was modified.

@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete force-pushed the codex/requester-automation-authority branch from 80f0dc3 to 2f1a88f Compare September 13, 2026 23:23
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Rebased the final-effect proof onto current main to resolve the adjacent cleanup/import conflict with #147480. Head: 2f1a88fd469ab5cbaff23a52e408e1a0d5807fe3. The range comparison preserves the reviewed authority patch and the persisted-mutation test unchanged; both batch entitlement cleanup and main’s ancestor cleanup remain. All 294 tests in the six focused suites pass, including the real Gateway/CronService write and revocation cases described above. The PR body now includes this integration evidence.

@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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 Sep 13, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The reviewed automation implementation and persisted-mutation proof are unchanged. The only additional change fixes the unrelated Reef test flake found by CI: Date-only fake time plus one millisecond per fixture insertion makes the existing exact-order assertions deterministic. A frozen-clock replay failed before the repair; all 18 trust-store tests pass afterward, and an independent P2 review is clean. Production and test typechecking pass. The previous review’s authority-proof blocker remains resolved.

@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

Continue authenticated Control UI automation management after an explicit
subagent yield by binding its entitlement to the committed requester batch.
Admit fresh management-only grants for the successor and revalidate the live
session, batch, and run owner at use time.

Preserve retryable handoffs and canonical child replacements. Revoke pending
authority on cancellation, reset, new direct user admission, and committed
settlement without reviving the original run's grants.

Cover the original trusted-automation visibility regression, repeated yields,
callback binding, retry, revocation, and cleanup. Validation: focused tests,
changed-file checks, full build, and independent P2 review.
@steipete
steipete force-pushed the codex/requester-automation-authority branch from dcabc6c to a57d239 Compare September 13, 2026 23:54
@steipete
steipete merged commit 3ae3e4d into main Sep 14, 2026
197 checks passed
@steipete
steipete deleted the codex/requester-automation-authority branch September 14, 2026 00:10
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
…7499)

* fix(agents): retain automation authority across requester yield

Continue authenticated Control UI automation management after an explicit
subagent yield by binding its entitlement to the committed requester batch.
Admit fresh management-only grants for the successor and revalidate the live
session, batch, and run owner at use time.

Preserve retryable handoffs and canonical child replacements. Revoke pending
authority on cancellation, reset, new direct user admission, and committed
settlement without reviving the original run's grants.

Cover the original trusted-automation visibility regression, repeated yields,
callback binding, retry, revocation, and cleanup. Validation: focused tests,
changed-file checks, full build, and independent P2 review.

* test(agents): prove resumed automation writes at the service boundary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant