Skip to content

perf(workers): centralize bounded worker pool sizing - #167060

Merged
steipete merged 3 commits into
mainfrom
steipete/perf-micro-worker-pool-sizing-policy-20260919
Oct 8, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/perf-micro-worker-pool-sizing-policy-20260919

Conversation

@steipete

@steipete steipete commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Independent prompt preparation and reads can wait behind unrelated worker tasks, while uncapped pools can allocate an isolate for every available CPU.

User Impact

Independent work gains bounded parallelism, with one host owner for pool sizing. Node continuations, catalog generations, usage-cost lanes, ordered side effects, and shared native heaps retain serial execution. SQLite still has exactly one writer per physical database. Current main's parallel transcript history/context and pool-wide cleanup are preserved.

No operator setting, dependency/version change, or storage migration is introduced. Memory-core changes worker capacity only: embedding/vector metadata, persisted shapes, SQL, and writer ownership are unchanged.

Why This Change Was Made

The host derives class limits from os.availableParallelism(), reserving one CPU when possible: readers cap at eight, small-file readers at two, compute at four, and writers/singletons at one. All production WorkerTaskPool sites in core and bundled plugins consume the sizing owner, either through a class or a prepared numeric budget. Shared-state readers keep their existing two-worker minimum for retained-read progress and scale to eight. Existing broker/preflight, foreground transcript, and inventory-hashing budgets move there unchanged. Foreground history/context each keep half the CPU headroom, capped at eight; background transcript owners remain serial. Hashing retains its CPU/memory admission and low-memory/Bun-Linux inline fallback.

The existing scheduler still owns FIFO admission, shared compute, cancellation, and cleanup. Independent parallel work may finish out of order. Prepared host capacity leaves caller options intact, preserving inherited preparation hooks and lazy getters. Scalable classes default to a 512 MiB V8 old-generation limit, with explicit caller resource limits preserved. Workspace computation alone uses 1 GiB to preserve the supported three-way overlay of 64 MiB manifests; measured maximum-input live worker heap was about 648 MiB. Native/Buffer/WASM memory is additional, so these are not total RSS caps.

Numeric-only SDK callers retain their behavior. Three separately published plugin sites keep numeric fallbacks for supported older hosts; current hosts prioritize class sizing. Remove these fallbacks when their minimum host version includes the policy.

Production LOC: +72 (151 added, 79 removed using the requested test/test-support/docs exclusions, including one wrapper-inventory line). Growth establishes the typed sizing contract, heap defaults, SDK/lifecycle compatibility, the existing maximum-manifest input contract, and retained shared-state read progress on small hosts. Scattered CPU formulas and capacities are removed, including the newly integrated transcript/hash owners; no second scheduler, cache, or registry is added.

Evidence

Prompt-worker performance

Production prompt workers, 20 concurrent synthetic requests, four available CPUs, three fresh-process replicates per variant, 300 measured requests each; table values are medians:

Measurement Before After
Physical prompt workers 1 3
Throughput 257.07/s 478.38/s
Mean queue wait 35.83 ms 15.84 ms
Pool-call p99 91.99 ms 53.49 ms
Mean process RSS 338.96 MiB 540.46 MiB

1.86× throughput, 56% lower mean queue wait, and 42% lower pool-call p99, at about 101 MiB incremental process RSS per added source-mode worker. These are component timings. Increasing small-file readers from two to three regressed throughput 5.2% and p99 6.8%, so their final cap stays two. Wider pools also regressed on an initially CPU-saturated rig; no improvement under CPU oversubscription is claimed.

Provider blacksmith-testbox, profile openclaw-check, lease tbx_01m4d0d7f2027xqy04jr19nkx9: node --expose-gc --import ./scripts/tsx.mjs <synthetic-pool-benchmark> <kind> <variant> <replicate>. Six baseline runs passed in 41.967 s including dependency installation; six candidate runs passed in 29.851 s. Every reply validated; lease stopped.

Actual Gateway measurement

Eight-CPU Linux rig, Node 26.8.1, matched baseline d3309e5760116877852a800c2ed21f9d15864c8e versus candidate tree 2f27804ff02865e5b694f42803871b1c106ade5e (measured head 8274df39f339f60cc083dbda39a577071a8386ca, before the narrow workspace-heap compatibility repair). The subsequent workspace-heap repair changes no pool count; the shared-state reader minimum repair only changes hosts with fewer than three available CPUs, so the measured eight-CPU pool sizing is unchanged. Each run used 20 seeded sessions, 20 WebSocket clients, two measured minutes, 50 ms RPC cadence, and exactly four serialized synthetic turns. This is not 20 simultaneous model turns or a production deployment.

These Gateway numbers are observational, not a causal speedup claim. Whole-host CPU busy fractions differed: baseline 87.1%/69.2% across the two minutes, candidate 43.5%/73.5%. The prompt pool stayed at one physical worker with seven tasks in each run, so this workload did not exercise the component gain above. Method results were mixed, including a substantially higher cron.list tail in the candidate; unequal host contention and one matched pair leave that direction unattributed, not a demonstrated improvement or an established policy-caused regression.

Measurement Baseline Candidate
sessions.list handler p99 estimate 37.65 ms [25–50] 23.46 ms [10–25]
chat.history handler mean 20.69 ms 16.64 ms
chat.history handler p99 estimate 95.80 ms [50–100] 82.27 ms [50–100]
Exact client chat.history p99 135.54 ms 138.95 ms
chat.metadata handler p99 estimate 1772.08 ms [1000–2500] 1561.29 ms [1000–2500]
models.list handler p99 estimate 370.78 ms [250–500] 401.72 ms [250–500]
cron.list handler p99 estimate 23.02 ms [10–25] 81.67 ms [50–100]
Exact client cron.list p99 55.28 ms 141.40 ms
cron.status handler p99 estimate 27.88 ms [25–50] 43.75 ms [25–50]
Mean sessionTranscript queue wait 17.249 ms / 42,552 tasks 14.255 ms / 47,250 tasks
Mean stateRead queue wait 0.04223 ms / 10,901 tasks 0.02218 ms / 12,085 tasks
Mean SQLite writer queue wait 2.636 ms 2.938 ms
State-read physical workers 2 5
Foreground transcript workers 4 4
Total tracked workers 19 22
Late-heartbeat process RSS 2134.57 MiB 2291.72 MiB

Server p99 values use official Prometheus histogram interpolation; brackets show the containing bucket, not confidence intervals. Client p99 uses exact observed RPC durations. Startup counters are excluded, all received handlers completed, and no diagnostics/series were dropped. The three added state readers corresponded to about 52 MiB additional process RSS per worker at the late heartbeat; GC-sensitive process differences are observations, not independently attributable per-thread RSS or a bound. Worker-heap delta was about 42 MiB per added worker.

The first baseline attempt stopped before measurement because WebSocket readiness preceded agent-store preparation. The fixture now waits for the documented /startupz then /readyz barriers before unchanged seeding; the recovered baseline had no seed retry or schema error. Its existing projects.list access-revision retry path ran five times during measured load (candidate: zero); no new measured-call retry logic was added. Both measured variants completed four turns and shut down with Gateway exit 0.

node --import ./scripts/tsx.mjs scripts/build-all.mts sourcePerformance passed for both matched trees (121.3 s baseline, 115.0 s candidate). A compiled SDK probe also confirmed reader/file-reader/compute caps 7/2/4, serial caps one, class precedence over numeric fallback, and 20 valid prompt requests across four physical workers. Rig commands used isolated state/TMPDIR and loopback ports under nice -n 10 ionice -c3; runtime inherited no build-only heap setting. Rig fallback followed two Testbox sync timeouts and AWS/Hetzner fleet-cap admission refusals.

Correctness and validation

The integrated sizing revision passed 87 tests across ten files in 143.69 s: policy/preparation, transcript lanes/readers/context/readiness, hashing/resource limits, copy scheduling/file transport, and Codex history. Core production types, infrastructure/session test types, targeted lint, export-collision checks, and both closure suites passed. Commands use node scripts/run-tsgo.mjs, node scripts/run-oxlint.mjs, node --import ./scripts/tsx.mjs scripts/check-export-name-collisions.mts, and node scripts/run-vitest.mjs against those owners.

The prior-base full changed gate passed all production types, all 27 core-test type groups, extension-test types, guards, dead exports, and lints after two test-only lint corrections. The first segment took 2929.94 s; its canonical continuation from lint took 776.06 s. Ten prior rebase-overlap files passed 92 tests with two filesystem-alias skips. That proof is reused only for unchanged inputs; the scoped integration checks above cover the conflict resolution. Earlier wider sibling coverage included 207 passing tests, eight Darwin-only skips, and two Bun-only skips.

New preparation regression cost: node scripts/run-vitest.mjs src/infra/worker-task-pool.preparation.test.ts --maxWorkers=1 passed 20 tests in 38.52 s wall time; cold transformation was 98% of the 35.30 s runner duration, and the twelve added cases totaled 0.126 s of test execution. Original sizing fails all ten class-admission cases; the rejected option-copying implementation fails both inherited/lazy-option cases for the intended reasons. CI run 37769955590, job 113287437575, passed the same 20 cases with 0.298 s summed test execution; the twelve added cases consumed 0.202 s. Shared import/setup and file wall time were not separately logged.

Known historical fixture failure: session-transcript-reconcile.lifecycle.test.ts:217 timed out at the original branch base, followed by deleted-fixture cleanup errors. The same selection on unchanged c531ab224174d94e78e803de46355915298ab477 reproduced that timeout and cascade (204 passed / 66 failed, 395.72 s). This PR does not claim to repair that fixture, and this is not current-main CI qualification.

Fresh independent review of the integrated candidate completed with no actionable P0–P2 findings. No full 128-CPU host comparison or live production before/after deployment is claimed.

CI run 37763793380 caught one introduced regression: the generic 512 MiB heap was too small for maximum-size workspace overlays. The original test failed on the candidate and passed on unchanged main under exact Node 24.19 with no old-space override. The final repair (bca3f0ca41ae0e998953e2542e4b9b5684af2178, tree 6ef19cbfc8ae6275d00be0944866e3167e21cb6e) gives only the workspace owner a 1 GiB ceiling. All 33 manifest/Git-worker tests passed in 84.20 s external wall with a constrained young generation. The actual repaired owner processed all 250,000 entries changed, with an effective 1036 MiB heap, sampled peak 648.02 MiB used, and process RSS peak 1343.33 MiB. Input limits and test assertions are unchanged. Targeted lint and incremental core types passed; fresh independent review found no actionable P0–P2 issue.

An inherited 8 GiB NODE_OPTIONS old-space setting overrides actual worker limits, so passes with that setting were excluded from the heap proof. The final tests use only --max-semi-space-size=4, preserving the actual 1 GiB old-generation limit. The measured process RSS includes the fixture parent and worker and is not a per-thread RSS bound.

Two other first-run failures were independently reproduced on unchanged main 4f44864c33c81ba96ade354c7f26e2a0d8617e24: context-read completion ordering (45 other cases passed) and local model-owner lookup count (eight other cases passed). Those assertions were corrected upstream in d8c8047cab63 and 839ad946cf2d; this PR does not claim their fixes. The new push contains the verified heap repair; no workflow rerun or branch update was dispatched merely to chase green.

The preceding head 304cdd3abcf5f7175936ce25a86f20af69e9ee2a was a required conflict rebase onto 9c057a3916bd584fb5eb8ff1d436533b67771575. Main inlined the Codex worker-URL helper; the resolution preserves that cleanup and the same reviewed reader class/numeric fallback. The heap repair is patch-identical, its manifest dependencies are byte-unchanged, and no new pool sites appeared. A focused Codex replay verifies the resolved owner; prior evidence is reused for unchanged inputs.

CI run 37769955590 caught a second introduced regression on its two-CPU runner: applying generic CPU headroom reduced shared-state readers from two to one. An avatar settlement read retains its worker until caller release, while a fresh catalog read must complete before that release; one slot deadlocked. The sizing owner now preserves the shared-state pool’s two-worker minimum, still capped at eight, with its existing 512 MiB heap limit. Other reader classes are unchanged. The existing avatar regression supplies a two-CPU OS input; no new test case, timeout change, or scheduler/SQLite custody change was needed.

On the Linux rig under Node 24.19 and taskset -c 0,1, with NODE_OPTIONS unset, the original candidate timed out only in that case at 120.066 s while unchanged main 977b46b22f21a1dbb98be73ba2fac779642ae817 passed all 11 cases (affected case 2.054 s). Repaired tree 9a6cfea3873d459aa6be48f91a2596a794f1b09f passed 83 tests across seven files, with two existing Bun-only skips, in 77.70 s external wall / 76.93 s wrapper time. The affected case took 2.052 s. Avatar cases consumed 15.957 s summed execution; its shared two-file shard took 29.07 s, so that is not an isolated avatar wall-time measurement. This includes shared-state reader ownership, settlement, MCP/source generations, and ordinary pool-preparation coverage.

The shared-state repair received fresh independent P0–P2 review with no actionable findings. Production retains one sizing owner and unchanged SQLite writer/retained-task ownership.

Final repair head: afb7ef6fbc37569873a143190d2b335ee3cfc790, tested tree 9a6cfea3873d459aa6be48f91a2596a794f1b09f. On the isolated Linux rig, node scripts/run-oxlint.mjs passed the three changed TypeScript files (20.27 s); node scripts/run-tsgo.mjs passed core production types (76.24 s) and the canonical state/logging test-type group (66.21 s); node --import ./scripts/tsx.mjs scripts/check-export-name-collisions.mts passed (41.65 s); node scripts/run-vitest.mjs test/scripts/eager-import-closure.test.ts test/scripts/pr-wrapper-source-closure.test.ts passed 20 cases (35.78 s wall). Changed-file formatting and git diff --check passed. The actual reader regression command used node scripts/run-vitest.mjs with the eight named avatar/read-worker/read-source/preparation files under two-CPU affinity; remote runtime proof retained no old-generation override.

Final CI run 37774099261 completed for afb7ef6fbc37569873a143190d2b335ee3cfc790. Every selected Node, type, lint, build, and guard job passed. Only UI E2E shards 3/7 and 4/7 failed, plus their aggregate gate. On unchanged main b925148b83b7ebddb32e1dd68769d6588d16f800, the repository test CLI reproduced the exact same 14 failing cases and assertions, with 15 passes, across chat-flow.active-run-follow-ups.e2e.test.ts, chat-flow.stream-reconciliation.e2e.test.ts, and session-placement.move.e2e.test.ts (Node 24.19, existing Chrome 153, isolated Linux rig, 126.26 s wall). The entire UI tree and UI test configuration are byte-identical between that main parent and tested merge c63a712a5629b92ee2b1f206e087b221bb4d42ea. These mocked-Gateway UI flows do not invoke the changed Node worker pools. Landing uses the authorized inherited-failure exception; CI is not described as green, and no workflow rerun or update-branch was requested.

@clawsweeper

clawsweeper Bot commented Oct 8, 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.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 8, 2026
@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 8, 2026, 8:09 AM ET / 12:09 UTC (Revision 7).

ClawSweeper review

What this changes

This PR centralizes CPU-based worker sizing, bounds independent parallel work, and preserves serial execution for stateful or ordered operations.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Useful centralization with shipped-entry-point evidence, explicit performance limits, and both demonstrated regressions repaired.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The complete evidence exercises the built Gateway and compiled worker/SDK path, with observed valid results and worker counts; component throughput gains are distinguished from mixed Gateway timings. Subsequent source-scoped repairs have maximum-overlay and two-CPU recovery evidence. Stored formats and migration contracts are unchanged, clearing the prior compatibility gate.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes
User problem: Independent prompt preparation and reads can wait behind unrelated work, while large hosts can create excessive worker isolates.
Reason: The existing worker-area owner proposes a single bounded sizing policy with measured component gains and explicit memory tradeoffs. It adds no operator setting or competing scheduler.

Merge readiness

✅ Ready for maintainer review

This PR remains useful and has sufficient runtime evidence. The workspace-heap finding is repaired, and the previous stored-data compatibility blocker does not apply to this diff; no actionable introduced defect remains.

Priority: P2
Reviewed head: afb7ef6fbc37569873a143190d2b335ee3cfc790

Before merge

None.

Findings

None.

Agent review details

How this fits together

OpenClaw runs expensive computation and database reads in background workers so the Gateway can keep handling requests. The changed sizing owner selects worker counts and heap defaults while the existing scheduler retains admission, cancellation, and cleanup.

flowchart TD
  A[Agent and plugin requests] --> B[Existing worker pool]
  C[Available CPU capacity] --> D[Central sizing policy]
  D --> E{Independent or serial work}
  E --> F[Bounded parallel workers]
  E --> G[Single worker]
  B --> F
  B --> G
  F --> H[Results and owned cleanup]
  G --> H
Loading

Technical review

Best possible solution:

Keep one sizing owner while retaining the existing scheduler, serial lifecycle owners, numeric SDK compatibility, and explicit resource exceptions.

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

Not applicable as an existing-behavior bug report; replicated prompt-worker measurements establish the bottleneck, and supplied before/after controls establish both repaired regressions.

Is this the best way to solve the issue?

Yes. The patch moves sizing into the existing host boundary and reuses the scheduler while preserving the intentional serial and resource-qualified paths.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point. Added test files: 4.

Security

None.

Evidence

What I checked:

  • Introduced policy and SDK compatibility: The sizing policy caps readers at eight, file readers at two, and compute workers at four. The optional workerClass parameter leaves numeric-only callers unchanged; prepared host sizing takes precedence without copying the caller's options object. (src/infra/worker-pool-sizing.ts:10, afb7ef6fbc37)
  • Previous workspace finding resolved: The workspace owner explicitly receives a 1024 MiB old-generation limit. The complete PR body records all 250,000 overlay entries processed with approximately 648 MiB peak used worker heap and 33 passing manifest/Git-worker tests, without an inherited old-space override. (src/infra/git-worker.ts:147, afb7ef6fbc37)
  • Small-host retained-read progress preserved: Shared-state readers use a separate prepared budget with a minimum of two workers. The exact-head evidence records the late-catalog avatar scenario completing in 2.052 seconds after the repair, compared with a 120.066-second timeout before it; the existing regression now supplies a two-CPU OS input. (src/state/openclaw-state-read-worker.ts:157, afb7ef6fbc37)
  • Verified no stored-data transition: Memory-core replaces only two pool-capacity options. The complete introduced diff changes no SQL, embedding/vector metadata, serialized format, schema installer, migration, or writer ownership. The prior upgrade-migration request is therefore cleared by source inspection. (extensions/memory-core/src/memory/manager-cpu-worker-runtime.ts:40, afb7ef6fbc37)
  • Complete runtime proof inspected: REST supplied the complete 15,208-unit body, matching captured SHA-256 7e4b368e33a7620c88430557302707e4a897b238eb42ce35eca852efe18c746f. It records an actual built Gateway with 20 WebSocket clients, completed RPCs and four turns, plus compiled SDK/prompt-worker execution. Gateway performance is explicitly observational; the replicated component benchmark reports 1.86× prompt throughput with increased RSS. (afb7ef6fbc37)
  • Owner-recorded resource tradeoff: The worker-area owner's PR explicitly documents increased process RSS, out-of-order completion for independent tasks, and that V8 heap limits exclude native, Buffer, and WASM memory. Numeric compatibility, serial owners, and the maximum-workspace exception are retained within that stated scope. (src/infra/worker-task-host.ts:38, afb7ef6fbc37)

Likely related people:

  • Peter Steinberger: Raw commit 63e204c adds src/infra/worker-task-capacity.ts:10 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 63e204c2e5ed; files: src/infra/worker-task-capacity.ts)
  • Hannes Rudolph: Raw commit f686ee6 adds src/infra/update-candidate-plugin-hash.ts:41 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f686ee6c076a; files: src/infra/update-candidate-plugin-hash.ts)

PR surface

Source +71, Tests +113, Docs +29, Other +1. Total +214 across 46 files.

View PR surface stats
Area Files Added Removed Net
Source 40 150 79 +71
Tests 4 118 5 +113
Docs 1 29 0 +29
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 0 +1
Total 46 298 84 +214

Review metrics

Metric Value Why it matters
Worker heap policy 512 MiB scalable default; 1,024 MiB workspace exception These explicit V8 limits preserve the measured maximum-overlay contract while excluding native and buffer memory from the claimed bound.

Stored data model

Persistent data-model change detected: vector/embedding metadata: extensions/memory-core/src/memory/manager-cpu-worker-runtime.ts. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded performance and resource-management improvement with measured component value.
  • merge-risk: 🚨 compatibility: The owner-approved optional SDK sizing contract changes selected concurrency and heap defaults while preserving numeric callers, serial owners, and the repaired workspace input contract.
  • merge-risk: 🚨 availability: Parallel isolates increase RSS as explicitly accepted in the owner's measurements; heap ceilings are not whole-process memory limits.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (6 earlier review cycles)
  • reviewed 2026-10-08T08:36:16.397Z sha b2669cd :: blocked before merge. :: none
  • reviewed 2026-10-08T08:48:42.947Z sha b2669cd :: needs changes before merge. :: none
  • reviewed 2026-10-08T09:46:59.613Z sha bd07bd0b12f087b976e15e8111b992ef4a35e338 :: needs changes before merge. :: none
  • reviewed 2026-10-08T10:08:57.481Z sha 8274df3 :: blocked before merge. :: none
  • reviewed 2026-10-08T10:46:09.431Z sha 8274df3 :: needs changes before merge. :: [P1] Preserve the workspace worker's supported memory capacity
  • reviewed 2026-10-08T11:32:54.657Z sha 304cdd3 :: blocked before merge. :: none

@steipete
steipete force-pushed the steipete/perf-micro-worker-pool-sizing-policy-20260919 branch from bd07bd0 to 8274df3 Compare October 8, 2026 10:02
@steipete
steipete marked this pull request as ready for review October 8, 2026 10:29
@steipete
steipete enabled auto-merge (squash) October 8, 2026 10:31
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 8, 2026
@steipete
steipete force-pushed the steipete/perf-micro-worker-pool-sizing-policy-20260919 branch from bca3f0c to 304cdd3 Compare October 8, 2026 11:25
@clawsweeper clawsweeper Bot added the rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. label Oct 8, 2026
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 8, 2026
Keep the retained shared-state reader pool at its existing minimum of two
workers while scaling through the central reader cap. A held settlement
read must leave room for fresh catalog reads before the caller releases it.
Exercise the existing avatar regression with a two-CPU OS input.

Node 24 two-CPU rig proof: 83 passed, two existing Bun-only skips; the
late-catalog case completes in 2.052 seconds instead of timing out at 120.
@steipete

steipete commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

The stored-data compatibility flag is a false positive for this diff. In extensions/memory-core/src/memory/manager-cpu-worker-runtime.ts, the only changes replace retrieval maxWorkers: 1 with workerClass: "reader" and indexing maxWorkers: 1 with workerClass: "compute". Input/output types, embedding/vector metadata, SQL, persisted shapes, and publication/writer ownership are unchanged. The complete PR changes no schema or migration file, so there is no stored-format transition requiring an upgrade migration.

Head afb7ef6fbc37569873a143190d2b335ee3cfc790 also repairs the two-CPU shared-state reader regression found by CI: preserve the existing minimum of two readers while scaling to eight. The original avatar late-catalog case timed out at 120.066 s on the previous candidate, passed on unchanged main in 2.054 s, and passes after repair in 2.052 s. The focused two-CPU Node 24 rig run passed 83 tests with two existing Bun-only skips; types, lint, export/closure guards, and fresh independent review passed. The PR body has the full evidence and measurement limitations.

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Oct 8, 2026
@steipete

steipete commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Final CI run 37774099261 completed for afb7ef6fbc37569873a143190d2b335ee3cfc790. Every selected Node, type, lint, build, and guard job passed. Only UI E2E shards 3/7 and 4/7 failed, plus their aggregate gate. On unchanged main b925148b83b7ebddb32e1dd68769d6588d16f800, the repository test CLI reproduced the exact same 14 failing cases and assertions, with 15 passes, across chat-flow.active-run-follow-ups.e2e.test.ts, chat-flow.stream-reconciliation.e2e.test.ts, and session-placement.move.e2e.test.ts (Node 24.19, existing Chrome 153, isolated Linux rig, 126.26 s wall). The entire UI tree and UI test configuration are byte-identical between that main parent and tested merge c63a712a5629b92ee2b1f206e087b221bb4d42ea. These mocked-Gateway UI flows do not invoke the changed Node worker pools. Landing uses the authorized inherited-failure exception; CI is not described as green, and no workflow rerun or update-branch was requested.

@steipete
steipete merged commit b3196df into main Oct 8, 2026
179 of 185 checks passed
@steipete
steipete deleted the steipete/perf-micro-worker-pool-sizing-policy-20260919 branch October 8, 2026 12:20
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 9, 2026
Derive bounded reader and compute capacities from available CPUs through one host sizing owner, preserving serial owners, SQLite writer ownership, and existing numeric SDK contracts.

Keep the shared-state reader minimum of two for retained-read progress and a workspace-specific 1 GiB heap for supported maximum manifests. Controlled prompt throughput improved 1.86x with explicit memory tradeoffs; whole-Gateway measurements remain observational.

Focused remote tests, types, lint, export/closure guards, and independent review passed. Final CI contains only inherited UI streaming failures: all 14 cases reproduced unchanged on its main parent. Landed under the authorized inherited-failure exception; see PR for evidence and limitations.
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 extensions: codex extensions: document-extract extensions: memory-core Extension: memory-core gateway Gateway runtime merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. plugin: code-mode-quickjs plugin: file-transfer plugin: team-reports proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts size: M 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