Repository navigation
perf(build): avoid unrelated gateway artifact scans - #127757
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. |
|
Codex review: blocked before merge. Reviewed September 5, 2026, 7:42 PM ET / 23:42 UTC. ClawSweeper reviewWhat this changesThe PR records gateway build-chunk locations and hashes to avoid unrelated artifact scans, while omitting help precomputation only in the existing source-performance build profile. Merge readiness⛔ Blocked before merge - 1 item remains This remains a useful, focused optimization absent from current main and the latest release. The revised head resolves the earlier worker-validation findings, and the new source-build and packaging evidence addresses the previous proof requests. No blocking defect was found. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s build guard checks compiled CLI and worker artifacts before packaging. The new bundler metadata directs gateway validation to its owned output while retaining size, import, and independent worker checks. flowchart TD
A[CLI source modules] --> B[Bundler]
B --> C[Gateway chunk and hash metadata]
C --> D[Build and package guard]
E[Frozen target source] --> D
D --> F[Size and import checks]
G[Standalone worker artifacts] --> F
F --> H[Validated output or rebuild error]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +249, Docs 0, Other +113. Total +362 across 10 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep gateway discovery at the bundler ownership boundary, preserve strict artifact validation and frozen-target compatibility, and leave worker-parser optimization as separate work. Do we have a high-confidence way to reproduce the issue? Yes: current-main source deterministically reads unrelated dist JavaScript during gateway discovery, and the supplied real-output comparison quantifies that work; this review did not execute a reproduction. Is this the best way to solve the issue? Yes: recording module ownership during emission removes heuristic discovery at its producer. Filename guesses or missing-metadata fallback would weaken that boundary; retained independent worker parsing avoids the earlier validation gap. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 07843c22c588. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (9 earlier review cycles; latest 8 shown)
|
Record the gateway command's owned chunks and verify their bytes before budget and cold-import checks. Retain independent worker validation and legacy discovery only for older frozen release targets. Keep full build profiles' precomputed help while narrowing the source-performance profile. Co-authored-by: fuller-stack-dev <[email protected]>
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Keep the three real bundler cases beside the artifact checker tests and reuse their temporary-root cleanup. This avoids an extra CI scheduling group while preserving emitted-byte, source-map and subset-build proof. Co-authored-by: fuller-stack-dev <[email protected]>
Copy the shared record helper into sparse declaration fixtures and use the canonical supported metadata version in release validation. Co-authored-by: fuller-stack-dev <[email protected]>
|
Verified the revised head On the same real build output, gateway validation changed from 8,120 read operations / 98,432,958 bytes / 271.91 ms to 7 read operations / 9,548 bytes / 0.93 ms. These are single-run observations, not a full-build speedup ratio. Source-profile build phases totalled 49.2 seconds, including the unchanged CLI/worker guard at 16.1 seconds. Real root and gateway help worked without precomputed metadata. The canonical package command completed its full build, all 152 public SDK checks, workspace AI bundling and strict tarball integrity check. The finished package retains precomputed help metadata; its 3,067-byte gateway chunk matches the locator SHA-256 The remaining ClawSweeper proof requests are covered. Its generic persistence checkbox does not apply to generated build artifacts; explicit frozen-target compatibility is covered by the release tests. Independent worker parsing remains intact and its broader optimization remains a follow-up to #127756. Thanks to @fuller-stack-dev for the original performance investigation; contributor ancestry and credit are preserved. |
|
Merged via squash.
|
* origin/main: (95 commits) perf(build): avoid unrelated gateway artifact scans (#127757) fix(update): deliver terminal progress after long updates (#139289) fix(ui): show session hover cards for local chat URLs (#139384) perf(ui): reuse unchanged transcript key snapshots (#139400) fix(ui): make subagent sessions view-only (#139381) fix: open agent state on SQLite builds without extensions (#139487) perf(skills): detach cached metadata from source strings (#139478) fix(ui): show primary user in multi-agent profile hero (#136736) perf(sessions): stop decoding the session row four times per SQLite entry patch (#136361) refactor(exec): share package-manager option scans (#139482) fix(ci): authorize frozen mobile release candidates (#139441) fix: avoid session deletion slowdown in large session stores (#139467) perf(gateway): reuse node invocation idle timers (#139354) fix(auth): preserve selected profiles across plugin scopes (#139413) fix(discord): retain voice input until transcription completes (#139484) fix(agents): name Gateway storage failures in run-failure copy (#139409) fix: keep subagent checks responsive in large session stores (#139450) fix(memory): index notes when optional embeddings cannot start (#139463) fix: refresh pending approvals when reopening chat (#139457) fix(tooling): preserve Git hook choices during install (#139461) ...
* perf(build): bound runtime artifact validation * test(build): consolidate gateway artifact build coverage Keep the three real bundler cases beside the artifact checker tests and reuse their temporary-root cleanup. This avoids an extra CI scheduling group while preserving emitted-byte, source-map and subset-build proof. Co-authored-by: fuller-stack-dev <[email protected]> * fix(build): include gateway metadata integration dependencies Copy the shared record helper into sparse declaration fixtures and use the canonical supported metadata version in release validation. Co-authored-by: fuller-stack-dev <[email protected]> --------- Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: fuller-stack-dev <[email protected]>
Related: #127756
What Problem This Solves
Gateway build validation recursively read unrelated JavaScript throughout
distjust to identify the small gateway command chunk. This added filesystem work after compilation and repeated it during package validation.Why This Change Was Made
The bundler now records the gateway command's actual output chunks from module ownership. The checker verifies their bytes against that locator, then applies the existing size budget and cold-import checks. Missing, malformed or stale metadata fails with rebuild guidance instead of triggering another broad scan. Trusted release tooling retains historical scanning only when the frozen target source predates the locator; current targets cannot select that path merely by losing an output file.
The explicit
sourcePerformanceprofile omits precomputed help metadata. Full, package, CI-artifact and CLI-startup profiles retain it. Source checkouts already support live Commander help when precomputed metadata is absent.Independent Acorn validation of all three standalone worker artifacts is retained. The original proposed worker attestations were removed because their import metadata was incomplete, and the native parser alternative failed on a large existing artifact. This PR does not claim to eliminate worker parsing or change dependency policy.
User Impact
Source builds inspect the gateway artifacts they own without reading unrelated emitted plugins. Package validation still supports older frozen source targets. The narrow performance profile avoids help precomputation while normal packaged/release builds retain it.
Thanks to @fuller-stack-dev (Jason) for identifying the build overhead and the original optimization work. Contributor ancestry and credit are preserved.
Evidence
git diff --checkpassed.config: false, literal fixture only) confirmed that the post-generation observer sees the final source-map trailer: observed and written hashes matched with maps disabled and enabled. This verifies the bundler callback contract, not the candidate postbuild or packed artifact.fa1c9df0ca6853f118c4e6d9856ef6ded6171fb2: run 33996097656. Data-only inspection of the final runtime archive confirmed the locator matches the postbuild chunk (3,067 bytes, SHA-25610f9bdeaca57f5271ddccf1ad0f48c45766d98c0bcf6d6b25376e972c923bc9f).node scripts/package-openclaw-for-docker.mjs --allow-unreleased-changelog, including its clean full build, all 152 public SDK subpaths, workspace AI bundling, inventory/lifecycle checks and strict tarball integrity validation. The finished package retained precomputed help metadata and its 3,067-byte gateway chunk matched the locator hash65113731eeb87c0857e21070b5a3a4e9033c3de14f6a963ddba74ea2913a31b7. Package SHA-256:d3ede0471f5cf49ef98c6a78fe78a53c9829c8cd717c905d47e7626d702f4b21. This full build/package check took 5m 59.70s; it is a different profile from the source build, not a before/after comparison.pnpm packand stopped at the workspace AI guard. The corrected canonical command above passed without bypassing any checks. Both isolated runners were released after completion.A bounded data-only comparison on a historical 42,315,230-byte worker artifact used Node 26.8.1, a 2 GiB JavaScript heap and a 55-second per-parser limit. Acorn completed parsing plus extraction in 16.62 seconds; Rolldown's native parser failed converting the serialized AST to a JavaScript string. The artifact was not executed. This informed retaining the existing worker validator; it is not a current-build speedup claim. The earlier 19-minute/9-second claim is not carried forward without comparable current proof.
Remaining worker-parser optimization is a separate follow-up. No dependencies, public options, SQLite schema, or worker deployment contract change.
The automated data-model compatibility checkbox does not describe runtime persistence in this patch: the JSON locator is a generated build artifact, rebuilt with its output chunks. No user data, SQLite schema, runtime cache or migration changes. The supported upgrade boundary is newer release tooling inspecting older frozen build targets; the release-check regression cases preserve that explicit path while current builds require their locator.
Tooling delta is +129/-16 (net +113); tests and test support +274/-25; docs +1/-1. The added tooling records chunk ownership at emission, verifies the selected artifact bytes and preserves the named frozen-target packaging contract. It replaces heuristic discovery on normal builds without adding a dependency or weakening worker validation.