Skip to content

fix(swarm): keep collector results reliable through races and restarts - #112989

Merged
steipete merged 7 commits into
mainfrom
steipete/gifted-elion-c306a6
Jul 23, 2026
Merged

steipete merged 7 commits into
mainfrom
steipete/gifted-elion-c306a6

Conversation

@steipete

@steipete steipete commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes a cluster of Swarm reliability issues found during large-group stress testing where collector waits could lose results across cancellation, restart, or delete-mode cleanup; phase and structured-output state could disagree across projections; Codex could time out before a full agents_wait result returned; and the Control UI could miss hidden cross-agent workers, retain stale rows, or render unbounded historical dots.

Why This Change Was Made

This change makes the collector registry the durable owner of queued launch identity, terminal result capture, wait retention, and restart recovery. It normalizes structured collector success before task/session/hook projections, makes Codex server-request deadlines cancel blocked dispatch, and gives the Control UI a lazy, source-scoped roster hydrator that respects effective per-agent Swarm configuration and caps rendered history while preserving active workers.

The implementation is AI-assisted. I reviewed the complete diff, verified the pinned @openai/codex 0.144.6 app-server request contract directly in sibling Codex source, and ran repeated Codex autoreview passes until no actionable findings remained.

User Impact

Large Swarms now remain waitable and accurately represented through launch races, cancellation, Gateway restarts, delete-mode cleanup, and delayed structured completion. Codex can use the full documented wait budget without an outer timeout winning first. Dashboard users see cross-agent workers beyond the ordinary session page, fresh terminal status after hydration, per-agent enablement, bounded retry behavior, and a capped dot display instead of potentially tens of thousands of DOM nodes.

Evidence

  • Focused post-rebase proof: 398 tests passed across core agents, Gateway work admission, Control UI, and the Codex plugin.
  • Additional regression proof: collector cancellation during acceptance aborts the accepted Gateway run and releases the next FIFO worker; delete-mode collector tombstones survive missing child sessions; structured tool-only completion projects canonical success; source changes clear hydrated rows; transient hydration recovers after three failures; large phases keep active workers visible and collapse overflow behind +N; Codex timed-out requests cannot dispatch later.
  • Hosted production build: Blacksmith Testbox tbx_01ky6y6k82sxf7wb65b4b4w4nw, Actions run https://github.com/openclaw/openclaw/actions/runs/29988503135, passed. Control UI startup JavaScript measured 315.0 KiB gzip against the 317.0 KiB limit and 322547 B against the 324608 B baseline ceiling.
  • git diff --check passed.
  • Codex autoreview: final full-patch pass clean; each subsequent hosted-gate-only type/lint adjustment also reviewed clean.
  • Hosted changed gate: Blacksmith Testbox tbx_01ky73e12yx619kazdbwvxhv0n, Actions run https://github.com/openclaw/openclaw/actions/runs/29993678176, passed every format, contract, typecheck, lint, cycle, and policy lane.

Before — all 301 lifetime dots render and the active worker is buried at the end:

Swarm dashboard before: unbounded worker dots

After — the active worker stays first, history caps at 256 rendered dots, and +45 preserves the hidden count:

Swarm dashboard after: active-first capped history

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui agents Agent runtime and tooling extensions: codex size: XL maintainer Maintainer-authored PR labels Jul 23, 2026
@steipete
steipete marked this pull request as ready for review July 23, 2026 11:07
@clawsweeper

clawsweeper Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(swarm): keep collector results reliable through races and restarts This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready verification is complete on head a6d26afbb2f0f63ebd6f125ae576287b28bc4a7c.

Proof:

The latest ClawSweeper comments are still review-start placeholders and contain no rank-up moves. No proof gaps remain for the changed surfaces.

@steipete
steipete merged commit ad505a7 into main Jul 23, 2026
119 checks passed
@steipete
steipete deleted the steipete/gifted-elion-c306a6 branch July 23, 2026 13:26
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 24, 2026
openclaw#112989)

* fix(swarm): harden collector lifecycle and dashboards

* fix(swarm): initialize collector completion state

* test(swarm): satisfy cross-environment type checks

* test(codex): allow direct request handler calls

* style(ui): avoid Swarm widget shadowing

* test(swarm): keep internal helpers private

* refactor(ui): own Swarm roster helpers in runtime
steipete added a commit that referenced this pull request Sep 30, 2026
…roval admission (#161469)

The exec-approval admission catch matched a plain Error whose message was
"gateway is draining for restart". That matched the untyped refusal that
runWithGatewayIndependentRootWorkAdmission threw when the check was added in
#104172. #112989 changed that producer to GatewayDrainingError, so the
instanceof branch already covered it, and #160869 then changed the draining
copy, so the string could no longer match anything.

No path delivers a draining refusal here without class identity: the
admission call passes no AbortSignal, the wrapper and the error class come
from the same module, and the callback's spawn and authorization failures
are caught inside the admitted run.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 30, 2026
…roval admission (openclaw#161469)

The exec-approval admission catch matched a plain Error whose message was
"gateway is draining for restart". That matched the untyped refusal that
runWithGatewayIndependentRootWorkAdmission threw when the check was added in
openclaw#104172. openclaw#112989 changed that producer to GatewayDrainingError, so the
instanceof branch already covered it, and openclaw#160869 then changed the draining
copy, so the string could no longer match anything.

No path delivers a draining refusal here without class identity: the
admission call passes no AbortSignal, the wrapper and the error class come
from the same module, and the callback's spawn and authorization failures
are caught inside the admitted run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docs Improvements or additions to documentation extensions: codex maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant