Repository navigation
test(runner): resolve native fixture source dependencies - #170263
Conversation
Prime the real cron source with a temporary native resolution hook before the Vite external import. Preserve native cache identity, reset behavior, partial mock metadata, and all aggregate assertions after the cron module gained runtime dependencies. The hook applies only during synchronous fixture loading and always deregisters. Focused formatting and lint plus independent Codex review pass. Runtime regression remains pending with the qualification owner.
|
🦞👀 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 maintainer review before merge. What this changesThis PR fixes native source resolution and asynchronous database preparation in generated test-runner fixtures. Example: The generated Gateway producer fixture prepares Claw schema-version facts.
Review scores
ProductKind: Test only · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it repairs broken lifecycle fixtures while preserving their assertions, and the reviewed diff contains no actionable correctness or security finding. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe runner regression suite generates child Vitest projects that load repository modules and report native module identity, cross-file cleanup, database closure, and listener retirement. flowchart TD
A[Runner regression suite] --> B[Generated child projects]
B --> C[Native cron source loader]
B --> D[Gateway lifecycle fixtures]
C --> E[Native identity assertions]
D --> F[Managed SQLite workers]
F --> G[Readiness and cleanup assertions]
Technical reviewBest possible solution: Land the focused fixture repair through the existing CI and landing workflow while retaining every lifecycle assertion. Do we have a high-confidence way to reproduce the issue? Source inspection confirms the obsolete initializer call and native dependency-resolution mismatch; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch adapts the fixtures to existing source-loading and worker owners, preserves native identity checks, and fixes the previously reported transformation and preparation defects without weakening production boundaries. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ec71e926c1a2. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceTests +42. Total +42 across 3 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label 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 HistoryReview history (3 earlier review cycles)
Reviewed October 12, 2026, 6:21 PM ET / 22:21 UTC (Revision 4). |
Enable native TypeScript transformation only in the generated runner child so source aliases can load retry parameter properties without changing module identity. Migrate both generated Gateway lifetime probes to the existing async provenance preparation API after the synchronous initializer was removed. Keep every test count, native identity, notification, afterAll, resource-drain, and retired-generation assertion. Formatting and targeted lint pass; runtime qualification remains with the red-main coordinator.
Carry the Gateway plugins and managed compiled-worker owner into the generated lifecycle child now that provenance preparation invokes a state worker. Reuse the cleanup fixture ownership pattern and join disposal after the child completes. Preserve every readiness, closure, ordering, and aggregate assertion, with the captured provenance error included in readiness diagnostics. Source inspection identified the missing prerequisites after CI reported only A/B state-error snapshots. That run did not capture the underlying exception. Targeted lint, formatting, and diff checks pass; runtime confirmation remains pending with the red-main coordinator.
…0263) ## What Problem This Solves Two generated fixtures in `test/non-isolated-runner.test.ts` fail before completing their intended lifecycle proof. After openclaw#170162 (`271e435a9bbe`), the native cron module gained runtime dependencies that Node could not resolve from TypeScript source. Fixing relative imports exposed a workspace alias, then a parameter property in the existing retry package that Node's strip-only mode cannot load. Separately, openclaw#169880 (`c8a40c7a9dab`) removed the synchronous provenance initializer still called by both generated Gateway lifetime tests. ## Why This Change Was Made Prime the real cron module through the fixture's native CommonJS entry point with a temporary synchronous resolution hook for relative source imports and exact aliases from `tsconfig.json`. Always deregister the hook in `finally`, and enable Node's native TypeScript transformation only in this generated child project's `execArgv`. Vite still imports the same native generation. Migrate both Gateway fixtures to await the existing `prepareClawInstallSchemaVersions(options)` owner and publish its result. Carry the Gateway project's plugins into the child and give its newly asynchronous worker calls the same managed compiled-worker setup and joined disposal used by the cleanup child. Run this generated host fixture in a fork: shared-state admission requires a process main thread, as the existing live and agents-support test configurations already document. Keep the Gateway isolation and custom cleanup runner. ## User Impact The combined change touches three test files (+59/−17). It preserves native cache identity, reset behavior, partial-mock metadata, readiness and close notifications, `afterAll` ordering, awaited resource drains, retired-generation isolation, and every lifecycle assertion and aggregate count. The pool metadata assertion now expects `forks`. Readiness failures include the captured provenance error before the intentional close replaces that snapshot. Production code, timeouts, and test counts are unchanged. ## Evidence At final head `b59341be18c2`, [CI run 38314652902](https://github.com/openclaw/openclaw/actions/runs/38314652902) passes both tests in `test/non-isolated-runner.test.ts`: shared runner cleanup in 60.697 seconds and Gateway worker lifetimes in 38.036 seconds. Vitest duration is 100.66 seconds; the CI test step takes 104 seconds and its job takes 172 seconds including setup. This is exact-head runtime proof for the complete patch; the earlier failed runs below only establish the causes. The focused reproduction command is `pnpm test test/non-isolated-runner.test.ts --maxWorkers=1`; no separate local runtime run is claimed. The two earlier resolver changes each passed targeted formatting/lint, diff checks, normal commit hooks, and an independent Codex P0–P2 review. The fixture follow-ups passed targeted lint, formatting, diff checks, and normal hooks; the transform/provenance follow-up also received a separate maintainer diff inspection. The two completed review rounds are retained without a third round. CI run [38302535736](https://github.com/openclaw/openclaw/actions/runs/38302535736) showed the original relative-import failure; [38306200884](https://github.com/openclaw/openclaw/actions/runs/38306200884) reached the workspace-alias failure. At the prior PR head `2fe45983c46b`, run [38310484484](https://github.com/openclaw/openclaw/actions/runs/38310484484) passed the selected type, lint, baseline, source-contract, and architecture checks, but both parent tests failed: cleanup encountered the unsupported retry parameter property, and Gateway lifetime encountered the removed initializer. The cleanup report expected six failed modules/suite errors from intentional fixtures and observed ten/nine because of the unexpected import failures. Those intentional MCP, watcher, and cancellation failures are not product regressions. At head `3703bbbc703d`, run [38312339272](https://github.com/openclaw/openclaw/actions/runs/38312339272) passed cleanup in 63.515 seconds, confirming the native import and transformation fixes. Gateway lifetime still failed with `A:state-error` and `B:state-error`. That log did not emit the underlying exception, and no retained fixture artifact was uploaded. The following patch restored omitted Gateway plugins and managed compiled-worker ownership and added error diagnostics. At head `aefd7bcd3712`, run [38313572251](https://github.com/openclaw/openclaw/actions/runs/38313572251) again passed cleanup and exposed the exact Gateway error: `Shared-state admission requires the host broker`. The native `isMainThread` guard in `openSharedStateSqliteWorkerStore` rejects the inherited thread pool before broker admission. The final fixture-only change selects `forks` and updates the pool metadata expectation; it does not mock or weaken that owner boundary. All selected static leaf checks pass at the final head: changed-test, source-contract, boundary, lint, production-type, all five core test-type stripes, root test-type, and baseline-ratchet checks. The architecture job executes both cycle checks with zero cycles and passes Kysely guardrails. The PR does not select Knip. Scoped Knip evidence comes from the actual V28 scan at `0c4b38b77adf`: its only findings were three unrelated Team-scale fixture exports, fixed on main by `2531250f6525`. Comparing the three fixture files and their configs shows no new static module edges, exports, dependencies, or test entry selection after that scan. The generated provenance import switches symbols within the same owner module; runtime changes are proven by this PR's passing tests. The only Knip-config difference is the unrelated PostgreSQL generator entry already landed as `19581446c556`. This qualifies the fixture scope; it does not claim that the full V28 Knip scan passed. The diff is test-only: no SQL statements, requests, T1 calls, SDK APIs, schema, updater, or service lifecycle behavior changes are claimed. Build and published-driver jobs are skipped by PR selection. The final exact-head CI run is green, including `openclaw/ci-gate`: 28 jobs succeeded and 28 were skipped by selection.
#170162 backport The #170162 backport (cf6f760) added a runtime import of agents/run-termination.js to cron/service/active-run-cancellation.ts. The non-isolated runner fixture loads that source through native CommonJS require, which cannot resolve .js specifiers to TypeScript sources, so 09-d and 09-i failed with 'Cannot find module .../run-termination.js' (FRV run 38333371459, job 115088198455). Port the cron fixture portion of main's companion fix #170263 (aeaae03): prime the native generation through a temporary synchronous resolve hook for relative .js and tsconfig alias imports, and enable --experimental-transform-types in the generated child project. The Gateway lifetime hunks of #170263 are not ported: they follow #169880, which is not on this branch, and that test passes here.
What Problem This Solves
Two generated fixtures in
test/non-isolated-runner.test.tsfail before completing their intended lifecycle proof. After #170162 (17c9b482ee5d), the native cron module gained runtime dependencies that Node could not resolve from TypeScript source. Fixing relative imports exposed a workspace alias, then a parameter property in the existing retry package that Node's strip-only mode cannot load. Separately, #169880 (04d4e9cd3fbf) removed the synchronous provenance initializer still called by both generated Gateway lifetime tests.Why This Change Was Made
Prime the real cron module through the fixture's native CommonJS entry point with a temporary synchronous resolution hook for relative source imports and exact aliases from
tsconfig.json. Always deregister the hook infinally, and enable Node's native TypeScript transformation only in this generated child project'sexecArgv. Vite still imports the same native generation. Migrate both Gateway fixtures to await the existingprepareClawInstallSchemaVersions(options)owner and publish its result. Carry the Gateway project's plugins into the child and give its newly asynchronous worker calls the same managed compiled-worker setup and joined disposal used by the cleanup child. Run this generated host fixture in a fork: shared-state admission requires a process main thread, as the existing live and agents-support test configurations already document. Keep the Gateway isolation and custom cleanup runner.User Impact
The combined change touches three test files (+59/−17). It preserves native cache identity, reset behavior, partial-mock metadata, readiness and close notifications,
afterAllordering, awaited resource drains, retired-generation isolation, and every lifecycle assertion and aggregate count. The pool metadata assertion now expectsforks. Readiness failures include the captured provenance error before the intentional close replaces that snapshot. Production code, timeouts, and test counts are unchanged.Evidence
At final head
b59341be18c2, CI run 38314652902 passes both tests intest/non-isolated-runner.test.ts: shared runner cleanup in 60.697 seconds and Gateway worker lifetimes in 38.036 seconds. Vitest duration is 100.66 seconds; the CI test step takes 104 seconds and its job takes 172 seconds including setup. This is exact-head runtime proof for the complete patch; the earlier failed runs below only establish the causes. The focused reproduction command ispnpm test test/non-isolated-runner.test.ts --maxWorkers=1; no separate local runtime run is claimed.The two earlier resolver changes each passed targeted formatting/lint, diff checks, normal commit hooks, and an independent Codex P0–P2 review. The fixture follow-ups passed targeted lint, formatting, diff checks, and normal hooks; the transform/provenance follow-up also received a separate maintainer diff inspection. The two completed review rounds are retained without a third round.
CI run 38302535736 showed the original relative-import failure; 38306200884 reached the workspace-alias failure. At the prior PR head
2fe45983c46b, run 38310484484 passed the selected type, lint, baseline, source-contract, and architecture checks, but both parent tests failed: cleanup encountered the unsupported retry parameter property, and Gateway lifetime encountered the removed initializer. The cleanup report expected six failed modules/suite errors from intentional fixtures and observed ten/nine because of the unexpected import failures. Those intentional MCP, watcher, and cancellation failures are not product regressions.At head
3703bbbc703d, run 38312339272 passed cleanup in 63.515 seconds, confirming the native import and transformation fixes. Gateway lifetime still failed withA:state-errorandB:state-error. That log did not emit the underlying exception, and no retained fixture artifact was uploaded. The following patch restored omitted Gateway plugins and managed compiled-worker ownership and added error diagnostics.At head
aefd7bcd3712, run 38313572251 again passed cleanup and exposed the exact Gateway error:Shared-state admission requires the host broker. The nativeisMainThreadguard inopenSharedStateSqliteWorkerStorerejects the inherited thread pool before broker admission. The final fixture-only change selectsforksand updates the pool metadata expectation; it does not mock or weaken that owner boundary.All selected static leaf checks pass at the final head: changed-test, source-contract, boundary, lint, production-type, all five core test-type stripes, root test-type, and baseline-ratchet checks. The architecture job executes both cycle checks with zero cycles and passes Kysely guardrails.
The PR does not select Knip. Scoped Knip evidence comes from the actual V28 scan at
0c4b38b77adf: its only findings were three unrelated Team-scale fixture exports, fixed on main by36e78f215f1f. Comparing the three fixture files and their configs shows no new static module edges, exports, dependencies, or test entry selection after that scan. The generated provenance import switches symbols within the same owner module; runtime changes are proven by this PR's passing tests. The only Knip-config difference is the unrelated PostgreSQL generator entry already landed ase2f58e771393. This qualifies the fixture scope; it does not claim that the full V28 Knip scan passed.The diff is test-only: no SQL statements, requests, T1 calls, SDK APIs, schema, updater, or service lifecycle behavior changes are claimed. Build and published-driver jobs are skipped by PR selection. The final exact-head CI run is green, including
openclaw/ci-gate: 28 jobs succeeded and 28 were skipped by selection.