Skip to content

fix(agents): retain collector rollback through retirement publication - #157940

Merged
vincentkoc merged 11 commits into
mainfrom
fix-collector-cancel-publication-20260925
Sep 27, 2026
Merged

vincentkoc merged 11 commits into
mainfrom
fix-collector-cancel-publication-20260925

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

A failed collector launch can reach destructive cleanup while cancellation still owns retirement publication. A temporary cleanup refusal can also be mistaken for confirmed termination, releasing FIFO capacity before the accepted run is settled.

User Impact

Failed collector work retains its FIFO ownership until publication and termination settle. Restored cleanup retries settle the original accepted attempt without dispatching another agent. No configuration or migration is required.

Why This Change Was Made

Use the existing retirement-publication owner for fresh and restored collectors. Failed registry transitions retain their accepted run ID; termination runs after publication. The existing abort-to-delete fallback and session identity guards remain intact.

The integration preserves main's async requester capture, earlier FIFO reservation, restart/forced-yield coverage and intentional fixture pruning. The stronger restored rollback regression uses main's typed restore factory; extracted preference/permission tables retain only main's surviving cases. The restored-deadline tests retain their cleanup joins. The rollback test asserts publication overlap, deletion retry, dispatch order and single abort; it does not assert a whole-test root-work join.

Candidate 3130f149097150b0d6a47bad7d4ac1ae8447eb5f integrates main 706ffe7a79c087b17add0f08b31c8ca3487052f0. The seven-file residual is 733 changed lines: production 51 additions / 17 deletions (net +34), tests 465 additions / 200 deletions. Production growth retains rollback lifetime and exact retry identity at the existing owner. Both production files and the queued-admission regression are unchanged from the previously reviewed collector repair. The catalog fix already landed through #158440 has no residual contribution.

Evidence

Landed through the native guarded squash route as d00524c29577. All seven contributed file blobs match the reviewed head.

Current exact-head hosted CI passed. Run 36297827109 completed on 3130f149097150b0d6a47bad7d4ac1ae8447eb5f: 119 successful jobs and 21 skipped jobs. All 43 compact changed Node jobs passed, alongside production types, five core test-type shards, aggregate test-types, core lint and guards. The required CI gate is green. Historical failures below retain their original scope.

  • The exact-head ClawSweeper review found no actionable findings, security issues, risks or rank-up moves and judged this the best fix. The same completed review was published on the PR, and both native completion checks admitted that exact head.
  • Hosted preflight selected 85 canonical Node-plan rows from the seven changed paths. Per-file timing/result evidence was not extracted for each intended registry, spawn, queued-admission, queued-collector, queued-recovery and claim-handoff suite; this is a successful selected CI plan, not a claim of six isolated-suite counts or a full protected-plan replay.
  • Independent integration review and the completed structured source review found no actionable findings. The actual patch pass completed; final stable-source attestation passed. Local resolved-file formatting, syntax and diff checks passed.
  • The focused integrated attempt stopped before installation or tests: native full sync omitted tracked .claude/settings.json, and the full-source guard refused the snapshot. The native command exited 1, its exact worker stopped, and the original owner joined. No suite, lint or type lane ran; integrated focused-test cost remains unmeasured. Full-sync omission remains an unresolved proof-transport follow-up, without changing the source guard or inventing a passing run.
  • Historical owner proof reproduced premature FIFO release with a negative control, then passed 524 tests across 13 files and 25 type graphs. Final fixture layout passed 278 registry/spawn tests and five affected graphs. An earlier candidate passed 191 registry/Gateway cases, its affected type graph and formatting in this native proof. These results retain their original source/dependency scope.
  • An earlier protected run failed with a session-facts error and the subsequently fixed catalog rejection. A bounded ordered diagnostic passed 23 cases; the session failure remains unexplained. Another old-head protected run exposed an unexplained shared-worker tasks-list empty result. A narrower instrumented 45-file cohort passed 365 tests, but its harness exited 3 because of reporter framing; the complete capture was recovered offline. This is nonreproduction, not a proven fix or aggregate replay.
  • The later full protected run passed build/check and Gateway (1,773 files / 28,800 tests), then ended with SSH exit 255 after roughly four hours before the remaining plan completed. Its worker closure is confirmed. Lease expiry is a source-backed inference, not a retained per-instance cause label. This PR does not establish that the complete protected plan fits its existing execution budgets.

@vincentkoc vincentkoc self-assigned this Sep 25, 2026
@clawsweeper

clawsweeper Bot commented Sep 25, 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 Sep 25, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. 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. labels Sep 25, 2026
@clawsweeper

clawsweeper Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 27, 2026, 1:45 AM ET / 05:45 UTC (Revision 9).

ClawSweeper review

What this changes

The branch delays failed collector rollback until cancellation publication finishes, preserves the accepted run during restored-launch retries, and extends agent and Gateway regression coverage.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

Keep this PR open. Current main still performs accepted-run rollback before cancellation publication, while this branch addresses that ordering gap. The related merged PRs repair separate validation issues, and no actionable defect was established in the introduced patch.

Priority: P2
Reviewed head: 3130f149097150b0d6a47bad7d4ac1ae8447eb5f

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch uses the existing lifecycle owner and adds focused coverage; historical validation is scoped accurately while current-head checks remain pending.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: This member-authored internal reliability PR is exempt from the external-contributor proof gate. The changed collector launch and restore owners are exercised by source-inspected agent and Gateway regression tests, but the integrated-head attempt stopped before runtime or type execution; no stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-authored internal reliability PR is exempt from the external-contributor proof gate. The changed collector launch and restore owners are exercised by source-inspected agent and Gateway regression tests, but the integrated-head attempt stopped before runtime or type execution; no stored-data contract changes.
Evidence reviewed 9 items Introduced rollback ordering: The pinned branch records the accepted Gateway run ID on registry-transition failure and waits for retirement publication before attempting termination.
Restored-run retry identity: The restored-launch path retains the accepted run ID and error, then waits for publication before terminating that run and settling the failed queued entry.
Current-main gap: Fetched main still terminates an accepted collector inside the registry-transition catch, before the failure-settlement publication wait added by this branch.
Findings None None.
Security None None.

How this fits together

OpenClaw's Swarm scheduler admits collector subagents through a FIFO lane, while the subagent registry tracks their launch and retirement. On launch failure, Gateway abort and session cleanup must settle before that lane admits the next collector.

flowchart LR
A[Collector request] --> B[Swarm FIFO lane]
B --> C[Gateway accepts child run]
C --> D{Registry transition succeeds?}
D -->|yes| E[Running child]
D -->|no| F[Cancellation publication]
F --> G[Abort or guarded delete]
G --> H[Release FIFO slot]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +34, Tests +265. Total +299 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 2 51 17 +34
Tests 5 465 200 +265
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 516 217 +299

Review metrics

None.

Technical review

Best possible solution:

Keep retirement publication with the registry owner, and retain the accepted run and FIFO reservation until guarded rollback and failure settlement finish.

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

Yes, as a source-level ordering case: current main can enter accepted-run cleanup before retirement publication, and the added Gateway test supplies a focused Stop overlap. This read-only review did not run that case.

Is this the best way to solve the issue?

Yes. The branch uses the registry's existing publication barrier and cleanup path while retaining the exact accepted run for retry, which is narrower than adding another scheduler hold.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against efd55b746d8e.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded collector cancellation and FIFO settlement repair with limited blast radius.
  • merge-risk: 🚨 message-delivery: Collector rollback ordering controls when queued work may dispatch and whether cancellation is reported against the accepted run.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This member-authored internal reliability PR is exempt from the external-contributor proof gate. The changed collector launch and restore owners are exercised by source-inspected agent and Gateway regression tests, but the integrated-head attempt stopped before runtime or type execution; no stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Shakker: 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 (8 earlier review cycles)
  • reviewed September 25, 2026, 2:26 AM ET / 06:26 UTC sha unknown :: blocked before merge. :: none
  • reviewed 2026-09-25T06:57:41.334Z sha 54893ee :: blocked before merge. :: none
  • reviewed 2026-09-25T07:31:51.331Z sha 54893ee :: blocked before merge. :: none
  • reviewed 2026-09-25T09:00:29.595Z sha b9ffa67 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-25T14:14:55.397Z sha 1897839 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-25T15:28:53.189Z sha 780d204 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-25T20:26:06.164Z sha 01daba2 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-26T00:32:42.490Z sha 2c8d74d :: needs maintainer review before merge. :: none

@vincentkoc vincentkoc changed the title fix(agents): preserve Stop acknowledgements during collector admission fix(agents): retain collector rollback through retirement publication Sep 25, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Please review exact head 54893ee7acd8279a776ffac8342193e65b611b56. The main overlap is resolved using the existing retirement-publication owner; the duplicate scheduler hold was removed. The PR body records the exact-base negative control, real Gateway regressions, final owning-file/type proof and remaining protected native gate.

@clawsweeper

clawsweeper Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@vincentkoc
vincentkoc marked this pull request as ready for review September 25, 2026 08:53
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Please review exact head 3130f149097150b0d6a47bad7d4ac1ae8447eb5f. The branch integrates main while preserving the collector retirement-publication repair and upstream async/FIFO coverage. The updated PR body distinguishes historical failures, the closed source-sync preflight failure, completed source review, and pending exact-head hosted runtime/type proof.

@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@vincentkoc
vincentkoc merged commit d00524c into main Sep 27, 2026
204 checks passed
@vincentkoc
vincentkoc deleted the fix-collector-cancel-publication-20260925 branch September 27, 2026 06:04
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

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

* fix(subagents): retain pending collector cleanup until Stop publishes

* fix(agents): settle accepted collector rollback after publication

* test(agents): keep collector fixtures within line caps

* fix(test): avoid unhandled catalog startup rejection (openclaw#158440)
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 merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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