Skip to content

fix(subagents): avoid Gateway blocking while Stop saves state - #160203

Merged
steipete merged 25 commits into
mainfrom
codex/native-run-cancellation-20260927
Sep 29, 2026
Merged

steipete merged 25 commits into
mainfrom
codex/native-run-cancellation-20260927

Conversation

@steipete

@steipete steipete commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Moves file-backed native subagent Stop persistence off the Gateway thread while preserving cancellation through storage failures and session changes.

User Impact

Active and queued children keep their original queue holds until cancellation settles. A collector cancelled during launch cannot be revived by a late launch response. Child completion retains its existing admission while required worker reads finish. Replacement sessions or runs cannot inherit an older Stop. Follow-up turns join pending completion bookkeeping before adopting the child. If child storage becomes unavailable after the kill claim commits, the durable intent remains fenced. Deleting the parent while Stop finishes no longer invalidates the unchanged child's committed cancellation.

Why This Change Was Made

Cancellation consumes the existing registry and session worker owners, staged publication, uncertain-outcome tracking, and terminal-state lock. A lost acknowledgement keeps the affected row fenced until canonical recovery instead of replaying a possibly committed write.

The storage contract is unchanged: workers persist the same run and session fields through the existing codecs, and existing databases require no migration. The change adds no configuration option or default and preserves public Gateway and tool response shapes.

Single-session deletion already publishes its exact physical/key removal. Its final list refresh now preserves that publication rather than invalidating every session's facts. Group sweeps and unknown changes retain normal invalidation; access revisions and keyless notification coalescing remain intact.

This is an incremental conversion. Process-held incognito, prepared native deletion/reset transport, ordinary announcement cleanup, and reactivation’s existing synchronous atomic replacement remain separately owned follow-ups. The earlier-success test still observes host SQL from ordinary cleanup; the zero-SQL claim covers the asserted active/queued file-backed Stop windows.

Evidence

Current head 46b6f52f0e40 takes only the canonical private result-type cleanup from #159588 to resolve the next verified conflict. The native selector, request fields, and distributive prepared-input union remain unchanged, and the runtime code is unchanged. Core and worker-owner test types, scoped typed lint, formatting, and fresh independent review pass; the exact merge with pinned main e02f5358afbe is clean. The 181-case runtime proof is reused. Current-head CI completed successfully: 137 jobs passed, 21 were skipped, and none failed, including build, security-fast, and the aggregate CI gate. Native merge admission remains required.

After the green 134751ce7cb8 run, canonical main 447fb86fb9f3 consolidated registry tests that overlapped the awaited Stop fixtures. Integration d3e978f563be merges that fixed main, preserves the consolidated assertions and finite root-work settlement, and removes the redundant helper. The exact combined tree passed 181 receiving cases across the registry, steer restart, query topology, registered native Stop, and follow-up replacement; core types, the owning test graph, selected guards, three dead-export scans, and typed lint also passed. Independent review completed; its one mock-reset finding was disproved by pinned Vitest 5.0.1 behavior and the executed held-write case. Those scoped results remain retained for the following type-only successor.

The prior receiving run passed the repaired source-contract check, then exposed a follow-up admission race: the ended-hook fact was present in memory while its SQLite stamp was still pending. Follow-up replacement now joins those existing writes and rechecks the original source, row, and caller before the unchanged strict comparison. The original 26-file parallel group passes with its original deadline. Hosted receiving CI also passed all 15 fallback proof cases, including both formerly failing direct follow-ups.

An earlier hosted run stopped on nine existing daemon lazy-forwarder false positives in the export-collision checker and cancelled the remaining jobs. This branch includes the exact already-landed fix from #160558 by @vincentkoc, with unchanged runtime code; the subsequent receiving run passed that check.

The current repair stack has component-level Linux regression, sibling, type/lint, and independent review evidence. Receiving CI on 6a7b34a59bdb passed the six native-plugin UI cases, the original Skills refresh case, and all 15 fallback proof cases. The run ended with 135 successful jobs, 20 skipped jobs, and four Codex fixture failures in one plugin row plus its aggregate gate. Those failures remain recorded. The two-file fixture correction separates protocol progress from setup wall time and measures unattended denial from the actual review-required hook to the decline; production budgets and executable integrity checks are unchanged. Identical controlled latency gives four failures before and four passes after, and the original six-file envelope passes 34 tests. The original Unix 120-second timeout was not independently reproduced; receiving CI at 134751ce7cb8 passed that row. Final companion qualification passed the 34-test envelope, eight deadline cases, three no-Gateway-request approval cases, extension-test types, all selected guards and dead-export scans, typed lint, and independent review. Prior-head CI completed successfully at 134751ce7cb8: 135 successful jobs, 21 skipped, and no failures, including build, security, and the aggregate CI gate.

A later real conflict arose when #160266 independently repaired the same UI readiness boundary. This branch takes that exact canonical helper, credited to Kimi Yu, and removes its superseded quiet-window variation. Geometry assertions and viewport order are unchanged. The canonical helper has six observed Linux E2E passes, successful exact-head upstream CI, and a fresh scoped review; native production is unchanged. Receiving CI at 134751ce7cb8 was successful.

  • Follow-up admission preserves the already-emitted hook stamp on failure and reuses the registry’s pending-write settlement owner. The exact original 26-file group passes 109 tests at its effective two-worker setting; 173 owning/sibling tests and 24 final send-authority cases pass, including unknown outcomes, caller retirement, and source replacement. Fresh P0–P2 review found no actionable issue. Counts overlap and are not summed.
  • A later real conflict required integration with exact main 94cbd1335dfb. The resolution keeps canonical queued-test helpers together with native awaited claims, and preserves current session-owner publication and requester authority. All 123 receiving cases pass, including stale-owner refusal/current-owner acceptance and the 12 native worker controls; core and four owning test graphs, selected conflict checks, sharing lint/format, and fresh P0–P2 integration review pass. The hosted run at 134751ce7cb8 was successful.
  • Follow-up CI diagnosis found missing lifetime retention during asynchronous completion and a preaccept collector adoption race. Repairs reuse the existing admission continuation and pending-claim owners. The original timing, restart, spawn, and Gateway cancellation assertions remain intact; fixtures now use canonical registration, the broker-backed test runner, and exact publication barriers where required.
  • Actual registered run-ID Stop uses real SQLite, asserts zero host data SQL on accepted active/queued paths, and independently reads persisted native/session results after the counted window. Controls cover cold selection, caller/session replacement, held acknowledgements, and earlier-success precedence.
  • Real Gateway composition creates a non-main session through the public API, admits a turn, stops its native child, then describes the published result. Separate fanout-failure and parent-replacement controls preserve their original assertions.
  • The qualified repair at c79e8576df42, integrated with main 69a2b5094bad, passed 128 runtime cases: 24 cancellation/reset/delete regressions, 28 native/public-composition controls, 74 deletion/publication siblings, and two keyless-coalescing controls. The original failing Gateway pair changed from 19 passed / 5 failed to 24 passed; no timeout or expected outcome was weakened.
  • On that c79 repair, full changed checks passed core types, all 25 test type graphs, all three dead-export scans, typed lint across 87 files, and storage/import guards. Fresh independent review found no actionable P0–P2 issue. Full build passed, including plugin and SDK declarations; it retained a UI startup-JS bundle-size advisory while exiting successfully.
  • The subsequent conflict resolution with exact main 526f67dc6382 preserves native spawn depth together with canonical ACP parent/session-start facts. All 80 receiving sharing, generation, native Stop, and public Gateway cases pass; core compilation, scoped typed lint, and fresh integration review also pass. Its changed check first stopped on an independently reproduced main issue: the unchanged ui-other type shard contained 721 test roots against its 720 limit. Clean main and the candidate produced the same ordered root list. The exact already-landed four-file repair 52ae7e314dc2 is included with provenance; 35 routing cases, both resulting UI type graphs, and its selected changed checks pass. The cap and test coverage remain unchanged.
  • Hosted CI exposed a legacy authorization fixture that inserted incomplete in-memory runs while mocking away synchronous persistence. The fixture now awaits canonical registration and uses its published generation. The complete original owner/foreign/replacement/real-ACP E2E passes on the actual CI merge source, as do all 12 native worker controls; no production guard, expected outcome, or timeout changed.
  • Earlier qualified integration 1dacfd7 passed 98 runtime cases and the unchanged 199-case lifecycle suite. Earlier fixed-base proof passed 216 native siblings and 25 archive cases. A separate receiving E2E correction passed its original 32-case pair while preserving the 15-second grace, output cap, and no-RPC assertions. These are earlier scoped receipts, not a claim that every hosted test ran on the new head.

Measured Linux registered-command wall time for the c79 repair: Gateway regressions 54.2s, native/public controls 100.9s, deletion/publication siblings 119.4s. These include runner/bootstrap work and do not measure Stop latency. Full changed checks took 29m21s; full build took 10m23s. Source hashes were verified after each phase and after commit, and the owned Testbox was stopped after verified evidence export.

Move native cancellation reads and writes through the existing worker owners while retaining exact run, session, queue and source authority. Join claim publication, terminal settlement and cleanup, preserve earlier completion, and fence uncertain writes without replay.

Validated registered Stop with real SQLite, public Gateway create/turn/Stop/describe, native lifecycle and scheduler controls, all changed checks, archive E2E and the full build.
Preserve current main recovery and pre-read sharing acquisition alongside native cancellation. Keep the existing generation reducer with its canonical type owner and retain public Gateway creation proof with nondestructive fixture seeding.
@clawsweeper

clawsweeper Bot commented Sep 28, 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: XL labels Sep 28, 2026
@steipete
steipete marked this pull request as ready for review September 28, 2026 06:31
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. 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 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 28, 2026, 10:15 PM ET / September 29, 2026, 02:15 UTC (Revision 18).

ClawSweeper review

What this changes

Moves file-backed subagent Stop persistence to existing SQLite workers and holds cancellation authority and queue reservations until the writes settle.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep open. Current main still performs synchronous persistence during subagent Stop, while this PR has a distinct, tested repair. The prior config/default upgrade concern is unsupported by the pinned diff.

Priority: P1
Reviewed head: 46b6f52f0e40e3f53d6785892ec74aed1f4d86f3

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Production-path SQLite and Gateway proof is strong, and the reviewed patch has no established correctness or security finding despite its substantial scope.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The changed Stop owner is exercised through the registered subagents tool with real SQLite worker writes and through Gateway create/Stop/describe tests. The recorded after-fix results include zero observed host SQLite calls in the covered Stop windows, persisted cancellation state, and refusal before foreign or replacement effects. The schema and row codec are unchanged, so no stored-data migration contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The changed Stop owner is exercised through the registered subagents tool with real SQLite worker writes and through Gateway create/Stop/describe tests. The recorded after-fix results include zero observed host SQLite calls in the covered Stop windows, persisted cancellation state, and refusal before foreign or replacement effects. The schema and row codec are unchanged, so no stored-data migration contract changes.
Evidence reviewed 9 items Current main still has the synchronous Stop path: The current-main kill runtime reads the session entry directly and calls the existing session patch path during Stop; the worker-backed change remains absent from main.
Worker write and final commit authority: The branch sends the existing subagent row format to the state worker and checks the selected source at transaction and commit admission.
Cancellation selection and session custody: The branch captures run retirement and prepares a session generation before awaited discovery, then retains queue holds through publication and release.
Findings None None.
Security None None.

How this fits together

The Gateway receives Stop requests for child agents and passes them to subagent control. That control updates the child run and session records, then publishes the result to the requester.

flowchart LR
A[Stop request] --> B[Subagent control]
B --> C{Current run and session?}
C -->|Yes| D[SQLite worker writes]
C -->|No| E[Refused result]
D --> F[Published run and session state]
F --> G[Stop result]
Loading

Before merge

  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

Metric Value Why it matters
Production versus test code production +3,129/−1,385; tests and support +2,836/−1,001 The production growth is attributed to worker write custody and run/session authority fencing; the separate test growth covers those boundaries.
Upgrade contract changes 0 config defaults, 0 schema edits, 0 run-codec edits These pinned-diff facts resolve the prior config/default upgrade question without treating ordinary worker-request types as persisted state.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/config/sessions/session-transcript-worker.types.ts, unknown-truncated-pull-files. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep Stop writes with the existing worker owners while preserving exact run, session, and caller checks through commit and publication.

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

Yes, from current-main source: Stop still uses synchronous session persistence, and the branch documents a registered-tool before/after observation. I did not execute code in this read-only review.

Is this the best way to solve the issue?

Yes. Reusing the existing SQLite worker and retaining source, session, and caller authority is a focused repair for the blocking Stop path.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P1: Gateway-thread persistence during Stop affects an active agent workflow, and the repair has direct registered-tool and Gateway-path evidence.
  • merge-risk: 🚨 session-state: Stop now awaits run and session writes, where a stale publication could otherwise associate cancellation with replacement work; the reviewed controls cover those cases.
  • 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 changed Stop owner is exercised through the registered subagents tool with real SQLite worker writes and through Gateway create/Stop/describe tests. The recorded after-fix results include zero observed host SQLite calls in the covered Stop windows, persisted cancellation state, and refusal before foreign or replacement effects. The schema and row codec are unchanged, so no stored-data migration contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed Stop owner is exercised through the registered subagents tool with real SQLite worker writes and through Gateway create/Stop/describe tests. The recorded after-fix results include zero observed host SQLite calls in the covered Stop windows, persisted cancellation state, and refusal before foreign or replacement effects. The schema and row codec are unchanged, so no stored-data migration contract changes.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • shakkernerd: 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 (17 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-28T17:18:43.611Z sha a51a47e :: blocked before merge. :: none
  • reviewed 2026-09-28T17:54:17.023Z sha a51a47e :: blocked before merge. :: none
  • reviewed 2026-09-28T19:32:21.151Z sha 6a7b34a :: blocked before merge. :: none
  • reviewed 2026-09-28T20:49:29.283Z sha 6a7b34a :: blocked before merge. :: none
  • reviewed 2026-09-28T22:39:05.289Z sha 134751c :: blocked before merge. :: none
  • reviewed 2026-09-28T23:12:09.230Z sha 134751c :: blocked before merge. :: none
  • reviewed 2026-09-29T00:56:30.923Z sha d3e978f :: blocked before merge. :: none
  • reviewed 2026-09-29T01:43:34.302Z sha 46b6f52 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 28, 2026
Keep an acknowledged kill intent when session storage is unavailable, and publish the final deletion refresh without revoking unrelated session generations. Preserve keyless coalescing and join the existing lifecycle publication owners in cancellation fixtures.
@openclaw-barnacle openclaw-barnacle Bot reopened this Sep 28, 2026
Merge the fixed main snapshot while retaining native spawn depth and ACP parent/session-start facts in the same sharing projector.

Receiving proof: 80 sharing, generation, registered Stop and public Gateway cases; core types and scoped typed lint pass. Independent integration review found no actionable issues. Full changed checks remain blocked by the independently reproduced main UI shard budget (721 roots, cap 720); no guard or coverage exception is added.
Take the exact landed shard repair so the native Stop branch retains all compiler roots under the unchanged budget. No native cancellation source changes.

Receiving proof passes 35 routing cases, both UI type graphs, selected changed checks, and independent review. The original 721-root baseline failure remains attributed to main.

(cherry picked from commit 52ae7e3)
Replace resident-only run seeding and no-op persistence with awaited canonical registration. Preserve owner, foreign-run, generation-replacement, and real ACP interrupt assertions.
Keep real controller resolution in tool tests and register the orphaned child through real session and registry persistence. Preserve all original cancellation assertions and isolate the running-child wait transport.
Update the held model fixture to recognize the batch-scoped completion prompt introduced by #158642. Preserve the two-active, third-queued, ordinary-probe, runtime-budget, and cleanup assertions.

Verified on the exact native cancellation CI merge: the original four-case order reproduced three passes and the stale-marker failure, then all four passed with this single-line correction. Owning changed checks and independent review passed.
steipete and others added 2 commits September 28, 2026 13:27
Use the exact helper postimage from d64568e (#160266). The canonical committed-size wait supersedes this branch's layout quiet-window variation while preserving every geometry assertion and viewport order.

Validation: canonical Linux native-plugin E2E six cases and exact-head CI pass; helper and layout-owner source bindings verified; formatting, diff checks, and independent P0-P2 review pass. Native cancellation production is unchanged.

Co-authored-by: Kimi Yu <[email protected]>
Keep protocol fixtures on their existing controlled deadline clock and measure unattended denial from the review-required hook to the actual decline. Preserve model, transport, history and approval assertions, the existing bounds, and all production clock and executable-integrity behavior.

Validation: identical latency controls change four failures to four passes; the original six-file envelope passes 34 tests, with eight deadline and three no-approval-request siblings. Selected changed checks and independent P0-P2 review pass. The original Unix 120-second stall was not independently reproduced; current-head CI remains required.
Merge main at 447fb86 while preserving
awaited native termination and finite root-work settlement. Keep the
canonical lifecycle and collector test consolidation, carry its held and
settled root assertions into the surviving native helper, and remove the
redundant timing helper.

The exact combined tree passes 181 receiving tests, core types, the owning
agents test graph, selected guards, all dead-export scans, and typed lint.
Independent review has no accepted findings after checking the pinned
Vitest reset contract against source and the passing held-write case.
@openclaw-barnacle openclaw-barnacle Bot removed app: web-ui App: web-ui scripts Repository scripts labels Sep 29, 2026
Take the private result-alias cleanup from b4d93d2
(#159588) without importing unrelated main changes. Keep the canonical
input declaration position while preserving the native selector, request
fields, and distributive prepared-input union.

The emitted runtime is unchanged. Core and worker-owner test types,
scoped lint, formatting, and independent review pass; the qualified native
runtime proof remains applicable.
@steipete
steipete merged commit fd1467d into main Sep 29, 2026
230 checks passed
@steipete
steipete deleted the codex/native-run-cancellation-20260927 branch September 29, 2026 02:25
@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 29, 2026
…aw#160203)

* fix(subagents): await native Stop persistence

Move native cancellation reads and writes through the existing worker owners while retaining exact run, session, queue and source authority. Join claim publication, terminal settlement and cleanup, preserve earlier completion, and fence uncertain writes without replay.

Validated registered Stop with real SQLite, public Gateway create/turn/Stop/describe, native lifecycle and scheduler controls, all changed checks, archive E2E and the full build.

* fix(subagents): preserve optional snapshot owner shape

* test(subagents): await finite lifecycle settlement

* ci: consume canonical UI component type shard

Take the exact landed shard repair so the native Stop branch retains all compiler roots under the unchanged budget. No native cancellation source changes.

Receiving proof passes 35 routing cases, both UI type graphs, selected changed checks, and independent review. The original 721-root baseline failure remains attributed to main.

(cherry picked from commit e7f5a85)

* test(agents): register native cancellation fixtures through real owner

Replace resident-only run seeding and no-op persistence with awaited canonical registration. Preserve owner, foreign-run, generation-replacement, and real ACP interrupt assertions.

* test(subagents): preserve canonical controller and abort fixtures

Keep real controller resolution in tool tests and register the orphaned child through real session and registry persistence. Preserve all original cancellation assertions and isolate the running-child wait transport.

* test(agents): match restored requester batch wake messages

Update the held model fixture to recognize the batch-scoped completion prompt introduced by openclaw#158642. Preserve the two-active, third-queued, ordinary-probe, runtime-budget, and cleanup assertions.

Verified on the exact native cancellation CI merge: the original four-case order reproduced three passes and the stale-marker failure, then all four passed with this single-line correction. Owning changed checks and independent review passed.

* test(gateway): keep abort append faults connection-local

* fix(subagents): retire superseded timing reads without false warnings

* fix(subagents): retain finite completion reconciliation work

* test(gateway): preserve real descendant abort fixture custody

* test(ui): await settled native composer layout

Wait for the existing layout-settled contract after viewport changes before measuring native composer footer clearance. ResizeObserver updates transcript width asynchronously while the footer follows its container immediately. Preserve every geometry formula, threshold, and variant order.

Validation: six native-plugin UI cases, UI E2E types, scoped lint, formatting, and isolated review passed. Linux baseline passed; candidate remote attempts stopped during source synchronization before test execution.

* test(subagents): use real abort persistence and publication barriers

* fix(agents): fence collector adoption during cancellation

Pending Swarm collectors can receive an aborted Gateway response while Stop is
still persisting cancellation. Begin the existing kill claim immediately after
native admission drains, then refuse launch adoption while its write is pending.
This preserves cancellation publication before provisional-session cleanup and
retains the current caller, session, generation, and database authority checks.

Cover queued and already-started collectors whose acknowledgment races a pending
kill write. Preserve the original three Gateway preaccept Stop cases and their
publication, rollback, and timeout assertions.

Validation: causal regression RED/GREEN; 273 focused and sibling tests; original
18-file shard with 264 tests; full check-changed including all 26 core test type
graphs; independent P2 review with no actionable findings.

* test(subagents): join canonical registry completion before assertions

Reuse existing finite lifecycle/root-work settlement in collector-yield and completion-before-kill fixtures. Preserve their original assertions, order, and timeouts.

Validation: original-order regression diagnosis; twenty standalone and two original 33-file replays passed; unchanged completion siblings reuse the qualified timing shard receipt; owning changed checks and independent component/combined P2 reviews passed. A third stress replay was interrupted by provider shutdown and is not counted as a test result. Current-head hosted CI remains required.

* fix(tooling): stop reporting lazy imports as duplicate exports (openclaw#160558)

Recognize transparent literal dynamic-import forwarders in the shared export-collision guard while preserving member, argument and body restrictions. Both variable and inline forwarding paths use the same predicate; runtime behavior is unchanged.

Validation: original guard reproduces nine repository false positives and fails all three new positive fixtures. Candidate passes the repository guard and all 54 fixtures, including six new rejection cases, under a 7 GiB process-tree limit with swap disabled. Script types and formatting pass. Independent and exact-head ClawSweeper reviews identify no actionable findings.
(cherry picked from commit 34f3dab)

* fix(agents): join registry writes before follow-up adoption

A child follow-up can reach source replacement while its ended-hook stamp
is still in the registry worker. Join the existing write owner before the
exact durable comparison, retaining uncertain-write errors and rechecking
the selected source and admitted caller after every await.

Carry sessions.send session authorization through the same boundary. Cover
held real writes, caller retirement, and source replacement.

* test(ui): consume canonical composer readiness check

Use the exact helper postimage from 47c33fe (openclaw#160266). The canonical committed-size wait supersedes this branch's layout quiet-window variation while preserving every geometry assertion and viewport order.

Validation: canonical Linux native-plugin E2E six cases and exact-head CI pass; helper and layout-owner source bindings verified; formatting, diff checks, and independent P0-P2 review pass. Native cancellation production is unchanged.

Co-authored-by: Kimi Yu <[email protected]>

* test(codex): separate protocol timing from startup cost

Keep protocol fixtures on their existing controlled deadline clock and measure unattended denial from the review-required hook to the actual decline. Preserve model, transport, history and approval assertions, the existing bounds, and all production clock and executable-integrity behavior.

Validation: identical latency controls change four failures to four passes; the original six-file envelope passes 34 tests, with eight deadline and three no-approval-request siblings. Selected changed checks and independent P0-P2 review pass. The original Unix 120-second stall was not independently reproduced; current-head CI remains required.

* refactor(config): align canonical worker result types

Take the private result-alias cleanup from 886db07
(openclaw#159588) without importing unrelated main changes. Keep the canonical
input declaration position while preserving the native selector, request
fields, and distributive prepared-input union.

The emitted runtime is unchanged. Core and worker-owner test types,
scoped lint, formatting, and independent review pass; the qualified native
runtime proof remains applicable.

---------

Co-authored-by: Vincent Koc <[email protected]>
Co-authored-by: Kimi Yu <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 1, 2026
Regression from the L5 absorb (a8e96ea), found only by locally filling a
Mode-B batch that is cancelled at the 90-minute job timeout every run.
Upstream's session-utils.queued-collector-admission.test.ts ("cancels real
preaccept admission and joins cleanup") recorded "failed" instead of
"killed"; it passes at upstream 6d06be1 and at the deployed fleet build.

Mechanism: upstream fd1467d (openclaw#160203) made Stop's kill-intent publish
asynchronous behind a row-unchanged check (subagent-registry-persistence
publishSubagentRunPostimages). Our accepted-spawn rollback (69dc864) is
recorded synchronously in the collector's start-failure catch and rewrites
the live row (acceptedSpawnRollback, suppressCompletionDelivery, execution).
Recorded while Stop's publish is pending, it makes Stop fail with "Subagent
mutation lost its original registry row"; with no kill on the row,
settleFailedLaunch takes the generic failure path and the collector settles
"failed".

Fix: when Stop's kill scope is publishing for this row
(registrationScope.waitForRetirementPublication() !== undefined), the catch
holds the failure reason and settleLaunchFailure records the rollback after
the existing claim/publication waits, still before
terminateAcceptedCollectorRun. With no Stop in flight the record happens in
the catch exactly as before. Record and error handling moved unchanged into
a shared recordRollbackOwner helper.

New fork test subagent-spawn-collector.stop-rollback.test.ts pins record ->
abort -> release -> settle for both orders; upstream's test alone passes even
if the rollback record is dropped. Pre-fix control: admission test 3 failed
("expected 'failed' to be 'killed'"); deferral case fails.

Verified: admission 3/3; registry + session-cleanup 71 files / 1288 tests;
spawn + sessions-spawn 46 files / 549 tests; tsgo core 0; oxlint/oxfmt clean;
line-cap and assertion-safety ratchets OK against 6b229ad.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Fq5EX9ESA3CG9cuZxVoKAK
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 1, 2026
Regression from the L5 absorb (a8e96ea), found only by locally filling a
Mode-B batch that is cancelled at the 90-minute job timeout every run.
Upstream's session-utils.queued-collector-admission.test.ts ("cancels real
preaccept admission and joins cleanup") recorded "failed" instead of
"killed"; it passes at upstream 6d06be1 and at the deployed fleet build.

Mechanism: upstream fd1467d (openclaw#160203) made Stop's kill-intent publish
asynchronous behind a row-unchanged check (subagent-registry-persistence
publishSubagentRunPostimages). Our accepted-spawn rollback (69dc864) is
recorded synchronously in the collector's start-failure catch and rewrites
the live row (acceptedSpawnRollback, suppressCompletionDelivery, execution).
Recorded while Stop's publish is pending, it makes Stop fail with "Subagent
mutation lost its original registry row"; with no kill on the row,
settleFailedLaunch takes the generic failure path and the collector settles
"failed".

Fix: when Stop's kill scope is publishing for this row
(registrationScope.waitForRetirementPublication() !== undefined), the catch
holds the failure reason and settleLaunchFailure records the rollback after
the existing claim/publication waits, still before
terminateAcceptedCollectorRun. With no Stop in flight the record happens in
the catch exactly as before. Record and error handling moved unchanged into
a shared recordRollbackOwner helper.

New fork test subagent-spawn-collector.stop-rollback.test.ts pins record ->
abort -> release -> settle for both orders; upstream's test alone passes even
if the rollback record is dropped. Pre-fix control: admission test 3 failed
("expected 'failed' to be 'killed'"); deferral case fails.

Verified: admission 3/3; registry + session-cleanup 71 files / 1288 tests;
spawn + sessions-spawn 46 files / 549 tests; tsgo core 0; oxlint/oxfmt clean;
line-cap and assertion-safety ratchets OK against 6b229ad.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Fq5EX9ESA3CG9cuZxVoKAK
(cherry picked from commit 7893b1e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling extensions: codex gateway Gateway runtime merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. 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.

2 participants