Repository navigation
build: emit the shared worker host graph once - #204087
Conversation
- Build the shared host, state reader and transcript worker as one group; their common modules ship once (~758 fewer installed files). Co-authored-by: obviyus <[email protected]>
|
🦞👀 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. |
|
Codex review: needs changes before merge. What this changesBuild the shared host, state reader, and transcript worker together so their common modules are emitted once. Example: Packaging the three hosted worker entrypoints.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep this PR open: the build deduplication is useful and remains absent from main, but the chunk-name cutover leaves updater fixtures failing in two CI shards. Priority: P2 Before merge
Findings
Agent review detailsHow this fits togetherThe runtime-process registry supplies entrypoints and chunk settings to production packaging and the Vitest worker compiler; their outputs are executable worker files and private shared chunks. flowchart TD
A[Runtime process registry] --> B[Standalone build groups]
B --> C[Production package builder]
B --> D[Vitest worker compiler]
C --> E[Three stable worker entries]
D --> F[Compiled test workers]
E --> G[Shared private chunks]
F --> G
Technical reviewBest possible solution: Keep the shared registry grouping and complete the cutover by updating updater fixtures to the new private chunk namespace without weakening their assertions. Do we have a high-confidence way to reproduce the issue? Current-main source independently builds the overlapping graphs, and exact-head CI annotations confirm the fixture failures caused by their renamed output namespace; this read-only review ran no builds or tests. Is this the best way to solve the issue? Grouping the entries at their existing registry owner is a small, coherent solution that preserves stable entrypoints and main-graph isolation, but its updater fixture consumers must migrate with it. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 24167fa16673. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceOther +20. Total +20 across 3 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 23, 2026, 9:09 AM ET / 14:09 UTC. |
Co-authored-by: obviyus <[email protected]>
The installed package tree shrinks by about 758 files. That brings it back under the 47,500-entry installed package budget. The shared worker host, the state reader and the transcript worker now build as one graph, so their common modules ship once. Part of openclaw#204008. ## Problem openclaw#202495 ("run lean core workers in one shared host") added `infra/shared-worker-host.worker` as a standalone runtime process with its own private chunk graph. The host imports the state reader and the session transcript worker, and those two workers also keep their own private graphs. So the package ships the same modules up to three times: | Chunk directory | Files on `main` | |---|---| | `infra/shared-worker-host-*` | 589 | | `state/openclaw-state-read-*` | 338 | | `config/sessions/transcript-*` | 404 | Scheduled `main` CI measured 48,070 installed entries against the 47,500 budget (`scripts/check-openclaw-installed-package-budget.mts`). ## Solution - `standaloneRuntimeProcessBuildGroups` (`scripts/lib/runtime-process-core-build-entries.mts`) returns one build per standalone entry, but puts the three hosted entries in one build. `getStandaloneRuntimeProcessOutputOptions` gives the three entries the host's chunk directory. - `tsdown.config.ts` and `scripts/lib/vitest-worker-compiler.mts` both build from those groups, so the package and the test worker generations use the same layout. - Each worker keeps its own entry file and loads only the chunks that its own graph reaches. Rolldown puts a module in a chunk only with modules that the same entries reach. - The session transcript worker now bundles `@openclaw/fs-safe`, as the state reader and the host already do. Inside the lean host it already ran with the bundled copy. ## Evidence - A build of only the grouped config emits 573 files in `infra/shared-worker-host-*` and none in the state-read or transcript directories (main: 1,331 across the three). - `test/scripts/runtime-process-build-graph.test.ts` passes, including the private-chunk limit and the "out of the Gateway server graph" checks for all three workers. - `src/infra/shared-worker-host.test.ts` and `shared-worker-host.unqualified-close.test.ts` pass on a freshly compiled worker generation (the host loads the state reader and transcript modules from the shared directory). - Gap: the full installed-tree count is not re-measured locally. 48,070 − 758 ≈ 47,312 is an estimate; the package acceptance budget check measures it. Co-authored-by: Ayaan Zaidi <[email protected]>
The installed package tree shrinks by about 758 files. That brings it back under the 47,500-entry installed package budget. The shared worker host, the state reader and the transcript worker now build as one graph, so their common modules ship once.
Part of #204008.
Problem
#202495 ("run lean core workers in one shared host") added
infra/shared-worker-host.workeras a standalone runtime process with its own private chunk graph. The host imports the state reader and the session transcript worker, and those two workers also keep their own private graphs. So the package ships the same modules up to three times:maininfra/shared-worker-host-*state/openclaw-state-read-*config/sessions/transcript-*Scheduled
mainCI measured 48,070 installed entries against the 47,500 budget (scripts/check-openclaw-installed-package-budget.mts).Solution
standaloneRuntimeProcessBuildGroups(scripts/lib/runtime-process-core-build-entries.mts) returns one build per standalone entry, but puts the three hosted entries in one build.getStandaloneRuntimeProcessOutputOptionsgives the three entries the host's chunk directory.tsdown.config.tsandscripts/lib/vitest-worker-compiler.mtsboth build from those groups, so the package and the test worker generations use the same layout.@openclaw/fs-safe, as the state reader and the host already do. Inside the lean host it already ran with the bundled copy.Evidence
infra/shared-worker-host-*and none in the state-read or transcript directories (main: 1,331 across the three).test/scripts/runtime-process-build-graph.test.tspasses, including the private-chunk limit and the "out of the Gateway server graph" checks for all three workers.src/infra/shared-worker-host.test.tsandshared-worker-host.unqualified-close.test.tspass on a freshly compiled worker generation (the host loads the state reader and transcript modules from the shared directory).