Repository navigation
perf(ci): keep prompt snapshot generation off the jiti loader - #109757
Conversation
… lane -> ~1.5min)
Measured breakdown of check-prompt-snapshots in run 29557851276 (5m03s):
- 37s checkout + Node env setup
- 4m25s inside one `pnpm prompt:snapshots:check` process:
- ~35s tsx import of the generator graph
- ~3min first createOpenClawCodingTools call: the message-tool schema
build resolves the scenario channel plugin, the empty loaded registry
falls back to the bundled-channel jiti loader
(extensions/telegram/index.ts), and jiti re-transpiles the core source
graph (136.6s jiti self time in --cpu-prof; second generation call in
the same process takes 0.3s)
- ~1min more for the cold provider-plugin lookup in
normalizeAgentRuntimeTools; no provider plugin owns tool-schema hooks
for the `codex` harness provider, so the jiti load only rediscovers a
no-op
- <2s actual rendering + oxfmt + drift compare
Split axis decision: the planned 2-3 way scenario shard matrix cannot
lower the pole because the cost is a one-time per-process transpile;
every shard would pay the full ~4min again (jiti fsCache does not help:
a warm-cache rerun still took 200s). Fix the generator instead:
- Preload each scenario's channel plugin surface (channel-plugin-api.js,
resolved via the bundled-plugin public-surface resolver) through the
ambient tsx/vitest ESM graph, and pin exactly that channel in a scoped
loaded registry while the scenario's tools are built. Snapshot bytes
are unchanged: the loaded plugin object is the same export the bundled
jiti fallback materializes, and cross-channel action discovery still
sees no other loaded channels.
- Pass allowProviderRuntimePluginLoad=false to normalizeAgentRuntimeTools;
registry-only resolution returns the same undefined plugin instantly.
Coverage guard: test/scripts/prompt-snapshots.test.ts now generates the
snapshot files and asserts zero jiti plugin-loader calls (with the
offending transform targets in the failure message), so a future scenario
or channel that misses the preload fails the suite instead of silently
restoring the 4-minute lane.
Proof: `pnpm prompt:snapshots:check` passes byte-identical against the
committed fixtures in 54s wall / 35s CPU locally (was 354s wall / 306s
CPU); focused vitest suites (32 tests incl. new guard), tsgo core-test +
extensions-test lanes, scoped oxlint/oxfmt, and `git diff --check` are
green. Expected CI pole when the lane fires: ~5.1min -> ~1.5-2min.
|
Codex review: needs maintainer review before merge. Reviewed July 17, 2026, 3:23 AM ET / 07:23 UTC. Summary PR surface: Tests +124, Config +1. Total +125 across 4 files. Reproducibility: yes. at source and CI-command level: current main’s helper reaches channel and provider fallback resolution, and the PR supplies measured before/after runs for Review metrics: 2 noteworthy metrics.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the scoped public-surface preload and zero-jiti guard once exact-head CI confirms unchanged snapshots and the expected lane timing, without changing production plugin loading behavior. Do we have a high-confidence way to reproduce the issue? Yes at source and CI-command level: current main’s helper reaches channel and provider fallback resolution, and the PR supplies measured before/after runs for Is this the best way to solve the issue? Yes. Preloading the exact bundled public channel surface and disabling an irrelevant provider lookup inside this fixture removes the root cost without changing production loaders, while the zero-call test protects the performance contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 473dfc2e51b8. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Tests +124, Config +1. Total +125 across 4 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Merged via squash.
|
… lane -> ~1.5min) (openclaw#109757) Measured breakdown of check-prompt-snapshots in run 29557851276 (5m03s): - 37s checkout + Node env setup - 4m25s inside one `pnpm prompt:snapshots:check` process: - ~35s tsx import of the generator graph - ~3min first createOpenClawCodingTools call: the message-tool schema build resolves the scenario channel plugin, the empty loaded registry falls back to the bundled-channel jiti loader (extensions/telegram/index.ts), and jiti re-transpiles the core source graph (136.6s jiti self time in --cpu-prof; second generation call in the same process takes 0.3s) - ~1min more for the cold provider-plugin lookup in normalizeAgentRuntimeTools; no provider plugin owns tool-schema hooks for the `codex` harness provider, so the jiti load only rediscovers a no-op - <2s actual rendering + oxfmt + drift compare Split axis decision: the planned 2-3 way scenario shard matrix cannot lower the pole because the cost is a one-time per-process transpile; every shard would pay the full ~4min again (jiti fsCache does not help: a warm-cache rerun still took 200s). Fix the generator instead: - Preload each scenario's channel plugin surface (channel-plugin-api.js, resolved via the bundled-plugin public-surface resolver) through the ambient tsx/vitest ESM graph, and pin exactly that channel in a scoped loaded registry while the scenario's tools are built. Snapshot bytes are unchanged: the loaded plugin object is the same export the bundled jiti fallback materializes, and cross-channel action discovery still sees no other loaded channels. - Pass allowProviderRuntimePluginLoad=false to normalizeAgentRuntimeTools; registry-only resolution returns the same undefined plugin instantly. Coverage guard: test/scripts/prompt-snapshots.test.ts now generates the snapshot files and asserts zero jiti plugin-loader calls (with the offending transform targets in the failure message), so a future scenario or channel that misses the preload fails the suite instead of silently restoring the 4-minute lane. Proof: `pnpm prompt:snapshots:check` passes byte-identical against the committed fixtures in 54s wall / 35s CPU locally (was 354s wall / 306s CPU); focused vitest suites (32 tests incl. new guard), tsgo core-test + extensions-test lanes, scoped oxlint/oxfmt, and `git diff --check` are green. Expected CI pole when the lane fires: ~5.1min -> ~1.5-2min.
… lane -> ~1.5min) (openclaw#109757) Measured breakdown of check-prompt-snapshots in run 29557851276 (5m03s): - 37s checkout + Node env setup - 4m25s inside one `pnpm prompt:snapshots:check` process: - ~35s tsx import of the generator graph - ~3min first createOpenClawCodingTools call: the message-tool schema build resolves the scenario channel plugin, the empty loaded registry falls back to the bundled-channel jiti loader (extensions/telegram/index.ts), and jiti re-transpiles the core source graph (136.6s jiti self time in --cpu-prof; second generation call in the same process takes 0.3s) - ~1min more for the cold provider-plugin lookup in normalizeAgentRuntimeTools; no provider plugin owns tool-schema hooks for the `codex` harness provider, so the jiti load only rediscovers a no-op - <2s actual rendering + oxfmt + drift compare Split axis decision: the planned 2-3 way scenario shard matrix cannot lower the pole because the cost is a one-time per-process transpile; every shard would pay the full ~4min again (jiti fsCache does not help: a warm-cache rerun still took 200s). Fix the generator instead: - Preload each scenario's channel plugin surface (channel-plugin-api.js, resolved via the bundled-plugin public-surface resolver) through the ambient tsx/vitest ESM graph, and pin exactly that channel in a scoped loaded registry while the scenario's tools are built. Snapshot bytes are unchanged: the loaded plugin object is the same export the bundled jiti fallback materializes, and cross-channel action discovery still sees no other loaded channels. - Pass allowProviderRuntimePluginLoad=false to normalizeAgentRuntimeTools; registry-only resolution returns the same undefined plugin instantly. Coverage guard: test/scripts/prompt-snapshots.test.ts now generates the snapshot files and asserts zero jiti plugin-loader calls (with the offending transform targets in the failure message), so a future scenario or channel that misses the preload fails the suite instead of silently restoring the 4-minute lane. Proof: `pnpm prompt:snapshots:check` passes byte-identical against the committed fixtures in 54s wall / 35s CPU locally (was 354s wall / 306s CPU); focused vitest suites (32 tests incl. new guard), tsgo core-test + extensions-test lanes, scoped oxlint/oxfmt, and `git diff --check` are green. Expected CI pole when the lane fires: ~5.1min -> ~1.5-2min.
What Problem This Solves
check-prompt-snapshots is a 5.1min job when it fires (~40-60% of PR runs) — the longest pole of those runs. Measured breakdown (run 29557851276): <2s of actual rendering/compare; ~4min is one-time jiti re-transpilation of the core source graph, triggered because tool construction resolves the scenario channel plugin against an empty loaded registry and falls back to the bundled-channel jiti loader (136.6s jiti self time in --cpu-prof), plus a cold provider-plugin lookup that only rediscovers a no-op.
Why This Change Was Made
The planned shard split cannot help — the cost is per-process transpile, so every shard repays the full ~4min (warm jiti fsCache rerun still took 200s). Fix the generator instead:
allowProviderRuntimePluginLoad=falseto normalizeAgentRuntimeTools — no provider plugin owns tool-schema hooks for thecodexharness provider, so registry-only resolution returns the same undefined instantly.User Impact
None at runtime — test-helper and CI-comment changes only. The lane drops ~5.1min → ~1.5-2min when it fires.
Evidence
pnpm prompt:snapshots:checkbyte-identical against committed fixtures: 54s wall / 35s CPU (was 354s/306s); independently re-verified on a second machine after cherry-pick onto current main ("Prompt snapshots are current (7 files)").node scripts/run-vitest.mjs test/scripts/prompt-snapshots.test.ts— 13 passed incl. the new zero-jiti guard.git diff --check— green (worker run).