Repository navigation
perf(swarm): give collector groups independent execution lanes - #158616
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
bca893d to
b4701f7
Compare
b4701f7 to
1049c6f
Compare
|
Codex review: blocked before merge. Reviewed September 25, 2026, 11:52 PM ET / September 26, 2026, 03:52 UTC. ClawSweeper reviewWhat this changesRoutes Swarm collector children through separate group execution lanes, raises the default group concurrency from 8 to 32, and updates diagnostics and documentation. Merge readiness⛔ Blocked before merge - 5 items remain Keep open. Current main still has the collector execution bottleneck, so the change is useful, but its new diagnostics expose session identities across configured visibility boundaries. Priority: P2 Review scores
Verification
How this fits togetherSwarm schedules collector children requested by an agent. Gateway preflight passes each admitted group's lane and capacity to the agent execution queue, which starts child runs and reports queue diagnostics. flowchart LR
A[Collector request] --> B[Swarm scheduler]
B --> C[Gateway preflight]
C --> D[Group execution queue]
D --> E[Child agent runs]
D --> F[Lane diagnostics]
F --> G[Read-only operator]
Before merge
Findings
Agent review detailsSecurityNeeds attention: The auth-helper move preserves its logic, but new lane diagnostics disclose requester session identities across configured session-visibility boundaries. PR surfaceSource +88, Tests +130, Docs +46, Generated 0. Total +264 across 26 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the separate group lanes, but publish bounded opaque group identifiers in diagnostics and verify the final RPC response for a reader barred from the requester's session. Do we have a high-confidence way to reproduce the issue? Yes. Current-main source shows collector execution entering the parent's subagent lane, and the PR records a before/after queue fixture; this reviewer did not execute the fixture. Is this the best way to solve the issue? No, not yet. Group-owned execution lanes address the bottleneck at the existing scheduler and queue owners, but the diagnostic response must stop disclosing raw session identities. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5dc4df504e6c. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
22 upstream commits, none in extensions/feishu. One conflict, docs/.generated/config-baseline.sha256, which is generated: upstream's core schema moved (openclaw#158616) while this branch moves the channel one. It came from upstream and was regenerated. build:docker ran in a separate detached checkout of this commit outside the nested node_modules install. Regenerating there gave upstream's core line, this branch's channel line, the unchanged plugin line and a new total, as predicted from the two sides, and the three generated-file checks pass there. The counts stay at core 2463, channel 3742, plugin 4349. The lockfile did not move. Feishu: 105 files and 2161 tests in the extension project, 15 files and 347 tests in the database-workers project. The forwarder test and the routing guards pass, 2033 tests (one --help probe first hit its 5 second spawn timeout while the separate build was running, and test-projects then passed 1738 of 1738 twice on its own). oxlint on the 43 changed code files, oxfmt, tsgo:core, tsgo:extensions, tsgo:extensions:test, tsgo:test:root, and the line-cap, max-lines and assertion-safety ratchets against upstream/main all pass.
What Problem This Solves
Collector children could receive a swarm scheduler slot and then stall in their parent's ordinary eight-slot subagent execution lane. Raising
tools.swarm.maxConcurrentdid not raise execution concurrency, and the backlog also delayed ordinary children from the same parent.User Impact
Each admitted swarm group now executes in
subagent:swarm:<schedulerGroupKey>with its scheduler-owned capacity. Ordinary children retain the immediate parent's session lane and its default cap of 8, including ordinary descendants of collectors.The default
tools.swarm.maxConcurrentincreases from 8 to 32, explicitly approved by Peter on 2026-09-26. An explicit value of 8 still caps the group at 8. Each running child costs one model stream and one Code Mode worker isolate.maxChildrenPerGroupandmaxTotalPerGroupare unchanged; there is no new configuration or storage format.Why This Change Was Made
After the existing collector authorization, preflight carries the live scheduler group's lane descriptor through command execution. Its cap getter follows the scheduler owner across delayed preparation and retries, including restored launches. The command queue installs that capacity atomically with enqueue, keeps ordinary concurrency publications separate, and retires idle group queues. Diagnostics expose the group key and swarm scope, with at most 32 detailed group rows and overflow aggregated.
Docs, schema help, labels, and the generated config-doc hash describe the new default. The existing auth-selection helper moves unchanged into a sibling module to satisfy the attempt module's line-growth ratchet. Net production growth is 88 lines.
Evidence
The 60-task execution-queue fixture measured these admissions:
Both regression cases fail on the original implementation. The fixture deliberately isolates execution capacity from child-creation admission; a 60-live-child application must separately allow that admission count. In the full flow, the swarm scheduler normally holds excess children before execution enqueue. This proves capacity and isolation, not live model throughput or production memory savings.
On Blacksmith Testbox (
blacksmith-testbox, profileopenclaw-check), the lane file took 2.48 s / 619 MiB peak RSS before and 1.68 s / 457 MiB after. These include cold/warm test loading and are not claimed as runtime CPU/RSS improvements.tbx_01m3dqtfw975dkxc8d5m0wq0zj(run)./usr/bin/time -v node scripts/run-vitest.mjs src/agents/embedded-agent-runner/lanes.test.ts --maxWorkers=1: two expected regression failures before, 14/14 passing after. Dependencies were installed once after the initial missing-dependencies refusal. Two later source-sync attempts timed out before tests; the lease was stopped.tbx_01m3drh11h0yq8aazhbvw9vqwf(run). Changed tests plus command-queue, scheduler, swarm-tool, and diagnostics siblings: 355 tests passed. Each remote command used native sync, with one command active at a time.tbx_01m3dsfap25waznmyyk3xgsxn2.pnpm openclaw config validate --jsonaccepted an isolated config withtools.swarm.maxConcurrent: 64(valid: true, no warnings); its normal runtime build completed in 30.5 s. The final attempt/lifecycle rerun passed 180 tests, and the final lane rerun passed 14. All leases are stopped.Single-worker measured file costs (
pnpm test <file> --maxWorkers=1):embedded-agent-runner/lanes.test.tsembedded-agent-runner/run/lane-controller.lifecycle.test.tssubagents/swarm/swarm-config.test.tsgateway/agent-turn/agent-request-preflight.test.tscommand/attempt-execution.cli.test.ts(existing coverage)The lifecycle file spends 91% of its Vitest duration transforming existing dependencies; its new case uses the existing fixture with no timers or process boots. The unchanged attempt suite covers the behavior-preserving extraction. Queue tests cover nested ordinary admission, config-publication independence, diagnostics, and idle retirement. Preflight coverage uses the real scheduler and checks live cap changes without trusting saved launch settings.
node scripts/check-changed.mjs --base b03cf209ea6b2eb93be6f3c486317fc05422fdf5passed core typechecking and all 25 selected test typecheck groups (1,254.61 s), formatting, generated config-doc validation, boundary/ratchet/dependency guards, and dead-export scans. Its final lint failure was a test-only string/enum comparison; after replacing that comparison with the literal lane name, the owningnode scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json <21 changed TS files>passed with zero warnings/errors. The remaining native-schema, database, media-download, runtime-loader, import-cycle, webhook, and pairing guards passed separately. The completed typecheck proof was reused.pnpm docs:check-config-examplesvalidated 1,284 config fences;pnpm docs:check-linkschecked 14,621 links with zero broken links. Earlier check attempts identified the required config-doc hash refresh and a narrow test-fixture type omission; both were corrected. One attempted lint-only checker option was unsupported, so the checker's actual lint command was used. Source-sync timeouts were infrastructure failures before execution, recovered with stopped/replacement leases and native sync.Rebased after concurrent queue-diagnostics and documentation changes.
git range-diffconfirmed only conflict-context changes to the feature patch. Fresh leasetbx_01m3dw8phwfbzp67z0qnwhd0nypassed 131 overlapping queue/controller/preflight/config/diagnostics tests, core typechecking, lint across the 21 changed TypeScript files, and the config-doc check. After a subsequent plugin retirement changed the generated hash, leasetbx_01m3dwnryyvyb6y5tn05ejw9npregenerated and verified the combined config-doc artifact. Both leases are stopped.Exact-head CI for
1049c6f0c9f6: CI run, passed, includingopenclaw/ci-gate: 129 successful CI jobs. Across the 55 selected compact test jobs, CI wall times were 86–520 s. Per-file CI timings could not be extracted because the completed-job log request failed with a stream error; the measured per-file Testbox costs are recorded above. No live Gateway was modified or restarted. Live model throughput, resource pressure at 32 running children, and production rollout remain unmeasured.