Repository navigation
fix(build): stabilize declaration cache reuse - #138385
vincentkoc wants to merge 21 commits into
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. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: stale review; fresh review needed. Summary Next step Review history (6 earlier review cycles)
|
* commit 'c0e6951d6f02d3eabd4bc13cf8e9fa9e77d290ac': (21 commits) fix(cron): align regression fixtures with Gateway scheduler fix(cron): supply scheduler in startup recovery fixture fix(whatsapp): make shutdown drain coverage deterministic (#159115) refactor: clear repository lint warnings (#159133) test: accelerate provider shutdown recovery coverage (#159098) chore(ui): refresh control ui locales (#159122) refactor(ui): deslop pages third pass (#158846) perf(team-reports): keep collection off the Gateway event loop (#159101) perf(agents): avoid repeated retained subagent recovery reads (#159082) test(core,plugins,ui): remove low-value tests (batch d041) (#159097) refactor(cron): schedule foreign receipt reconciliation (#159114) test(android): avoid idle waits for settled gateway actions (#159077) refactor(gateway): share periodic maintenance scheduling (#159111) fix(cron): keep future jobs running after startup catch-up fails (#159086) refactor(cron): own retained run transcript access (#158776) fix(memory): Chinese queries lose English terms written without spaces (#159076) test(plugins, model-picker, terminal): remove low-value tests (batch d043) (#159108) improve(channels): prune ingress overflow inside SQLite (#159050) fix(tasks): preserve changed cron history and finish deferred cancellation (#159064) test(build): preserve SDK artifacts after declaration errors ...
Baseline-Refresh: 9729081a45ccb46bfd241da2b794ee2abb34a30a
Baseline-Refresh: afde626ff509cfa293bdc82121fca4c950ddacbc
What Problem This Solves
Fixes package builds whose runtime chunk layout changes when declaration emission is toggled. Stable outputs avoid invalidating restored declaration caches. Current main's final runtime-only build pass remains unchanged; this repair addresses the package graph producer rather than removing that existing mitigation.
Why This Change Was Made
Runtime JavaScript and declaration emission now use separate, stable tsdown config partitions for AI and all workspace packages, including agent-core, while preserving main's consolidated full declaration program and SDK-only selection. The build wrapper owns DTS mode for the default, main, and AI configs, including CAC's
--dts=trueand--dts=falseforms; arbitrary custom configs and--no-configretain their original arguments.The compiler-input snapshot, cache namespace algorithm, cache format, dependencies, and environment surface are unchanged. The shared config-splitting helper is reached through the canonical generator import closure, so edits invalidate the producer stamps without a new hard-coded input list. Current package compiler options, runtime-cache ownership and runtime-only plugins remain intact. Cleanup now receives the same effective DTS mode as compilation.
User Impact
Warm full builds can reuse restored declaration artifacts after runtime-only rebuilds instead of recompiling all declaration groups. Explicit DTS CLI overrides continue to work without recombining the runtime and declaration graphs.
Evidence
Published Current-Main Correction
Current published head:
75e3a6a385cad7110fb3dfe6dccfca9d09a70615, tree2539d949e3dac0841a5bdc9755d2d26d98bdb5f8. Native signed integration828968d45df5preserves the formatting correctionaec7099c3276as first parent and captured main5c0201b1e7d8as second parent. The final product diff is 19 build/config/tooling/test paths, +729/-96; no dependency, schema, protocol or excluded product-surface change.The four independently reviewed conflict resolutions retain main's new AI entrypoints, dynamic/updater consumers and current fixtures. Standalone source-module metadata stays on runtime partitions only. The signed follow-up migrates main's new standalone source loader to the split AI config array and extends its existing real-loader fixture to both declaration modes, asserting one runtime entry while preserving original JavaScript worker mapping. Fresh full-branch AutoReview against the captured baseline found no actionable P0-P2 findings; source whitespace is clean.
Predecessor CI40481742185 exposed two concrete integration defects: main had removed imports still used by this PR's watch/precedence fixtures, and the expanded standalone-loader destructuring needed formatting. The declaration file actually ran 23 cases: 18 passed, three failed with the missing group import, and two skipped; tooling types separately reported four missing-symbol errors. Changed formatting identified only the loader file, while all lint substeps passed. Signed successor
75e3a6a385carestores both imports from their maintained owners and reformats the loader, with no assertion, literal or behavior changes. Independent bounded integration review found no additional defects; fresh scoped AutoReview with full fixture/helper context is clean through P2. Predecessor failures remain recorded, not waived.Exact-head CI40483818685 binds
75e3a6a385cathrough merge671a39bainto main4c3fd8a08b56. Retained Linux logs verify 321 passed and three explicit skips across 11 relevant suites: declaration-resolution21/2skips, config62, build-wrapper110, runtime-config13, build-all55, runtime-cache2, standalone-loader9, Knip-export28, AI-package1, SDK-declarations11/1skip and unified-writer9. Both formerly failing watch modes and DTS precedence pass. Both split-AI loader modes pass, as do the actual declaration-cache reuse/input-edit cases. Hosted tooling types and changed formatting/Bun parity pass; the build-artifacts job also succeeds. Skips are not counted as passes.CI completed successfully at10:07UTC; landing still requires causal proof and final native admission. The baseline-ratchet job and complete current-head CI succeeded. The two-case loader regression still needs an executed pre-fix comparison using the unchanged current test and the loader blob from signed integration
828968d45df5, followed by exact production restoration and focused green confirmation. Expected failure is the existing named-entry-map guard, not an infrastructure or timeout failure. This proof must use the existing executor and an admitted remote route; no new lease was allocated in this continuation. No application tests, builds, formatter, lint or typecheck ran on the local Mac. Nativegithub_pendingwas publication admission, not a completed final-gate stamp. Substantive review and completed-hosted native squash gates remain; no merge or auto-merge was requested.Historical b41 CI39347889372 completed with 39 successful jobs, 27 skipped and two failed jobs: changed-test formatting and the aggregate gate. All formerly queued jobs executed; there is no remaining queue blocker from that run. The exact two-file formatting correction is preserved. Its 14 passing Knip cases and all earlier passes/failures below remain predecessor evidence, not qualification of the new head.
Historical Qualification and Review Disposition
The following checkpoints retain their original source and execution identities. References to then-current heads and pending work describe those historical checkpoints.
Predecessor native integration:
097b5b637185ff7f085ae23c093146f2a289b08a, treebee60f2ffb07e34dac4563c56a655b62dbe1ab7c. The signed native baseline integration preservesb98fd8a322c54f2f2dbafa3a648bfc92f8ce6a33as first parent and pins main6deac372 as second parent. This consumes the canonical main UI typecheck repair without adding a UI change to the PR's 15-file build/cache product diff. The emitted-asset and explicit-build-cwd repairs, all original ancestry and current compiler/cache/worker/fixture owners remain intact.Independent source review verified the exact materialized resolution: unconditional real lockfile copy, physical fixture boundary, installed-dependency protection and opt-in Mistral license. Current client-credential worker and Darwin native-asset contracts remain intact. Fresh full-diff AutoReview raised one standalone-build finding. Parent and independent review rejected it as an introduced regression: that owner deliberately retains its unchanged full-DTS, clean-output, uncached build contract; build-all's repaired cache route calls a different owner. The existing real standalone test remains mandatory hosted coverage. Source review is not runtime qualification.
Both substantive historical ClawSweeper findings are addressed in source: spaced boolean DTS values are consumed with their option, and the native declaration emitter removes maps owned by excluded runtime stub chunks. Effective DTS mode also reaches cleanup, and sequential CLI tests check retained declaration bytes rather than incorrectly expecting removal. Cache tests retain cold/warm/mixed-hit/disabled cases, actual runtime imports, declaration restoration and byte/hash comparisons; watch tests require two completed generations.
Predecessor proof has two retained failures; successor proof is pending. CI39336508914 binds
0b512449, not this successor. Actual Linux logs showtsdown-config62 passes, declaration-resolution 24 passes/four platform-capability skips, build-all 59 passes, and plugin-SDK declarations 11 passes/one skip. The unified writer suite has 11 passes/one failure: its first warm-build assertion incorrectly requires invocation-specificbuild-cache-inputs.jsonto retain cold-build bytes; all other 160 artifact hashes match. The AI package streaming test also fails because its direct caller spreads the now-array config export as one object, losing license-copy settings. Both failures remain recorded, not waived.The two test corrections at
be0a5f4e8e2derive each phase's expected receipt from explicit cache owners and authoritative stamps while retaining every other artifact hash, and select the unique AI runtime config while retaining license and streaming assertions. CI39339178297 advanced beyond the repaired first warm-build assertion, then failed the mixed-cache phase because onlypackages/ai/dist/mistral.LICENSEwas missing. The unified writer retained 11 passes/one failure. Actual passing suites included config62, declaration-resolution24/four platform-capability skips, build wrapper106, build-all59 and SDK declarations11/one skip. These remain predecessor results, not qualification of the new head.The current three-file correction emits the license through the bundler's asset owner instead of an out-of-band copy, and includes physical asset provenance in runtime-cache signatures. This preserves both license restoration and invalidation when its source changes. The existing cache test now exercises a non-module asset, unchanged restoration and isolated source invalidation; the real mixed-cache fixture, complete artifact hashes, declaration signatures, cache reuse and license/streaming assertions are unchanged. Installed tsdown/Rolldown contracts were inspected directly; independent source audit and fresh scoped autoreview found no actionable P0-P2 findings. No cache format, dependency, schema or protocol change is introduced.
Predecessor CI39341268365, at
4d165d35, passed all 12 unified-writer cases, including the formerly failing strict mixed-cache packaged-hash comparison. The actual AI streaming/license case passed, as did build-all59, SDK declarations11/one intentional skip and config62. Declaration-resolution had21 passes, three failures and four platform/capability skips: both explicit AI DTS override cases read the license under the ambient process cwd instead of the build cwd; the overlapping-build fixture then timed out after the same AI build-start failure. These are actual failures, not flaky-check exemptions.The signed two-line correction at
b98fd8a3uses the normalizedbuildStart(options).cwdsupplied by Rolldown. Strict license reads, emitted provenance, runtime-cache signatures and every test remain unchanged. Dependency source/types and the existing nested-root/concurrent-build fixtures were inspected; fresh scoped autoreview found no actionable P0-P2 findings. No timeout increase, process-cwd mutation, fallback or assertion weakening is used. Its hosted CI39342546256 actually passed declaration-resolution24/four explicit skips and config62, including both formerly failing AI overrides, overlapping workspace/AI builds, two-generation watch and canonical DTS precedence. Separate actual Linux output confirms unified-writer12, build wrapper106, AI streaming/license1 and build-all59 passes. These results bindb98fd8a3, not the integrated successor.That CI's merge into
db91ecf9failed the unrelated UI typecheck:resumeStoredChatOutboxeswas referenced without its import. The PR does not change that UI file. Canonical main6deac372 adds exactly the missing import. The new signed integration consumes that fix through main ancestry; it does not copy a UI patch into this PR or replace a failed scheduled run with manual green. Prior passes and failures retain their exact source bindings. Current-head CI39344635400 has started for097b5b63; its completed proof remains required.Actual predecessor
097b5b63Linux output confirms 277 passed and five explicit skips across eight relevant suites: declaration-resolution24/4skips, config62, unified-writer12, build wrapper106, AI streaming/license1, build-all59, runtime-cache2, and SDK declarations11/1skip. This includes strict mixed-cache artifact/hash equality, emitted-asset source invalidation/corruption, both watch modes, overlapping workspace/AI builds, and canonical SDK publication. The previously failing production typecheck also passed. Its completed CI failed three jobs: Knip's single-object AI config consumer (TS2339), formatting in the two touched declaration tests, and an inherited xAI test status-argument mismatch (TS2345). The first two are repaired in the current correction and await exact-head hosted verification. Independent source attribution proves the xAI caller/helper unchanged across baseline and candidate; canonical 177830, commit0449ef26b26630eba2c75cb53262bee23343e31c, fixes that call on main. This PR adds no xAI patch. Failed predecessor gates remain failed, and these277 passes do not qualify the new regression. Skipped cases are not claimed as passes.The completed ClawSweeper review binds
be0a5f4: it resolves the earlier DTS-boolean/orphan-map findings and identifies the accepted license-loss P2. Emitted-asset ownership plus predecessor097 strict mixed-cache and runtime-cache asset-invalidation proof address that finding; the cwd repair also passes its previously failing declaration cases. Independent composition review verified an identical 15-file product patch across the native baseline integration, unchanged product blobs and no conflicts. Automatic dispatch did not produce a newer review. Nativegithub_pendingpublication is not a successful gate stamp. No application tests or checks ran on the local Mac; no new Testbox was allocated. Required full new-head CI, substantive review and native squash gates remain.Retained Historical Correction Evidence
The following results bind private
3ffbf06672cca9161da426ef54c603893792b383/ tree0e7c3c238a9c94cd5aa5b3d710ada10f89e08531, not the newly published correction.Composition proof passed 314 tests, zero failures and four Windows-only skips across eight suites; scoped formatting/diff checks passed and source pins stayed exact. Earlier scoped proof retains270 passes and complete scoped checks under its original binding. The causal baseline retains two intended failures, independently reconciled from its verifier-text mismatch. These are separate results, not cumulative current-head qualification.
Full native gate remains failed/incomplete. Run37099949204 completed build/full checks and five groups with 30,961 passed /57 skipped, but tooling did not complete. Wrapper255/native1 and the absence of a successful gate stamp remain recorded. GitHub names Blacksmith's bot as cancellation actor; the exact termination cause is unknown. Provider completion, joined children and native lock recovery were verified. The unavailable failed-job log was not fetched again; the portal warning is separate reporting.
That unknown cancellation cause still prevents an unchanged Testbox retry. It does not block the independently reviewed native hosted-publication route now used. No provider switch, deadline extension, inherited-failure exception or partial-group success stamp is used.
Remaining: inspect actual current-head Linux coverage for the changed suites and fixture consumers, fix concrete failures, complete fresh head-bound review and native completed-hosted gates, then squash only when all required checks pass.
Historical Evidence for Public Head
c0403dbf4945The following evidence predates the current-main reconstruction and does not qualify the current correction.
node scripts/run-vitest.mjs test/scripts/tsdown-build.test.ts: 174 passed at the exact head.node scripts/run-vitest.mjs test/scripts/tsdown-build.test.ts -t 'assigned|preserves repeated DTS switches': 4 expected failures before the repair; 16 passed after. Covers default, explicit main, AI, last-switch precedence, custom config preservation, and--no-configpreservation.node scripts/run-vitest.mjs test/scripts/tsdown-build.test.ts -t 'keeps one owned watcher through its initial build and one edit': 1 passed. Covers initial build plus edit, JavaScript, declarations, source maps, and child cleanup.node scripts/run-vitest.mjs test/scripts/tsdown-config.test.ts test/scripts/write-unified-entry-dts.test.ts -t 'isolates runtime output from bounded declaration-only graphs|keeps source maps aligned across package runtime and declaration graphs|reuses declarations after AI and workspace runtime graphs rebuild': 3 passed. The real-emitter case covers a cold build, retained declaration cache, runtime-only AI/package rebuilds, mixed upstream cache hits/misses, cache-disabled rebuilds, and downstream declaration reuse.node scripts/run-vitest.mjs test/scripts/tsdown-build.test.ts test/scripts/build-all.test.ts test/scripts/tsdown-config.test.ts -t 'isolates runtime output|keeps source maps aligned|keeps node package artifacts|keeps.*runtime imports|resolveTsdownBuildInvocation|invalidates both workspace declaration caches|rebuilds runtime JS': 167 passed, 122 skipped in one earlier candidate-wide run. This is a separate run, not a cumulative count with the exact-head checks above.c0403dbf4945955156de5ea0069062cc939a6502: scoped clean for P0-P2 findings.openclaw/ci-gate; 16 non-applicable jobs were skipped.A broader local build/config invocation completed 196 tests and failed 2 unrelated
memory-lancedbfixture cases because this candidate worktree lacked the per-pluginextensions/memory-lancedb/node_moduleslinks used by the untouched fixture. The canonical baseline has the declared Darwin native-binding link. After wiring that missing worktree link without installing or changing dependencies, both untouched fixture cases passed (2 passed, 22 skipped). This PR does not change dependency manifests, the lockfile, or that test; the original incomplete-worktree run is not counted as green evidence.