Skip to content

fix: reuse prepared test runtimes after source refreshes - #162744

Merged
shakkernerd merged 2 commits into
mainfrom
fix/test-runtime-reuse
Oct 1, 2026
Merged

shakkernerd merged 2 commits into
mainfrom
fix/test-runtime-reuse

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Related: #57204

What Problem This Solves

Native test preparation repeats a full runtime build when a retained remote checkout receives a new transport commit, even when its production inputs have not changed.

User Impact

After a successful build, ordinary and private-QA tests can reuse that runtime across equivalent source refreshes and test-only corrections. Production, dependency, compiler and configuration changes still require preparation. Ordinary CLI, immutable deployment and UI E2E checks retain their stricter current-head requirements.

Why This Change Was Made

The existing build stamps now identify the effective production inputs, and only test preparation can admit an equivalent source snapshot. Reuse keeps the original build, runtime and CLI metadata together instead of relabeling old artifacts with a newer commit.

The native build owner invalidates stamps before output writes or cache restoration and verifies that inputs remained stable. Asset generation can replace its declared Control UI fields; authored manifest metadata and stylesheet inputs remain checked. Partial runtime preparation cannot satisfy a reader that requires complete static assets.

Evidence

A retained 8-CPU Crabbox received separate source synchronizations, including a real correction to test fixtures. On the final target, ordinary preparation took 1.09s and private-QA preparation took 1.02s. Neither rebuilt artifacts or changed their generation; the native cold E2E runtime prerequisite had taken 13m30s. Synchronization and dependency setup are excluded from those preparation measurements.

Production source, package source, stylesheet and authored-manifest edits each invalidated reuse. Regression coverage also checks reverted edits during a build, failed cache restoration, incomplete static assets, legacy stamps, strict CLI behavior and immutable deployments.

Remote validation passed: the applicable formatting/lint/structural, production/test type, package-boundary, security and asset checks, plus the 36-file affected batch (1,959 cases; six corrected fixture cases rerun independently). Independent source review is clean. Hosted CI passed on 146d3b694396; ClawSweeper rated that head Platinum with no code findings.

Changed-test command costs on the retained Linux box (pnpm test <file> --maxWorkers=1, including tooling preparation and runner startup):

File Wall seconds
src/infra/build-stamp.test.ts 26.21
test/scripts/build-all.test.ts 18.60
test/scripts/prepare-vitest-runtime.test.ts 17.25
test/scripts/runtime-postbuild-stamp.test.ts 18.55
test/scripts/test-projects-build-admission.test.ts 12.47

The initial CI run measured src/infra/build-stamp.test.ts at 6.40s from shard start to successful exit. Other changed files ran in grouped CI tasks without isolated file clocks. The declaration-fixture correction passed its affected canonical-group reuse case in 12.26s of native runner wall time (11.38s Vitest); Hosted Windows confirmation passed on the appended head 146d3b694396.

@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts size: XL labels Oct 1, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 1, 2026
@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 1, 2026, 10:53 AM ET / 14:53 UTC (Revision 4).

ClawSweeper review

What this changes

The branch fingerprints build inputs so test preparation can reuse unchanged compiled runtimes after source refreshes, while preserving stricter CLI, deployment, and UI E2E checks.

Merge readiness

✅ Ready for maintainer review

This PR remains useful: current main and the latest release lack equivalent-input runtime reuse for test preparation. No blocking introduced defect was found, and the recorded remote preparation results support the change.

Priority: P2
Reviewed head: 146d3b694396f5d060ddc91af207df69af7eb488

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch has relevant real preparation evidence, meaningful freshness regressions, and no blocking finding.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): Recorded Crabbox runs exercise native test preparation after source synchronization and fixture correction, observing unchanged artifact generation and approximately one-second reuse. Input-edit checks support invalidation; additive stamp fields retain legacy admission without a user-state migration.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Recorded Crabbox runs exercise native test preparation after source synchronization and fixture correction, observing unchanged artifact generation and approximately one-second reuse. Input-edit checks support invalidation; additive stamp fields retain legacy admission without a user-state migration.
Evidence reviewed 9 items Pinned introduced change: Reviewed the merge-base-to-head introduced hunks. The subsequent head commit only adds the watched-path module to declaration fixtures. The supplied test merge is stale and was not used to infer removal of current-main behavior.
Current main still needs this preparation improvement: Current main calls resolveRunNodePreparation without equivalent-input admission; the branch adds that admission specifically to test preparation.
Latest release retains strict preparation: The supplied v2026.9.7 release commit likewise lacks equivalent-input admission in test preparation; no shipped implementation was established.
Findings None None.
Security None None.

How this fits together

OpenClaw's test preparation selects and prepares compiled runtime artifacts before test workers start. Build stamps connect those artifacts to source inputs and determine whether compilation or runtime synchronization is needed.

flowchart TD
  A[Source and compiler inputs] --> B[Build owner]
  B --> C[Artifacts and verified stamps]
  D[Test preparation request] --> E[Freshness admission]
  C --> E
  A --> E
  E --> F[Reuse unchanged runtime]
  E --> B
  F --> G[Test workers]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +395, Other +500. Total +895 across 16 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 7 422 27 +395
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 9 553 53 +500
Total 16 975 80 +895

Review metrics

Metric Value Why it matters
Production versus test growth production +500 net lines; tests and test support +386 net lines The stated production growth supplies input fingerprinting and producer validation through existing build owners, with regression coverage for reuse and invalidation.

Stored data model

Persistent data-model change detected: serialized state: scripts/run-node.mts, unknown-data-model-change: scripts/run-node.mts. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Technical review

Best possible solution:

Keep verified artifact reuse within the existing test-preparation owner, preserving original generation metadata and strict admission for deployment and UI consumers.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: current-main test preparation retains HEAD-based admission, so an equivalent source snapshot with a different transport commit requests rebuilding. This review did not execute that path.

Is this the best way to solve the issue?

Yes. Extending the existing stamps and preparation owner avoids timestamp-only freshness shortcuts and preserves stricter consumers without creating a competing cache owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 85f09d7ea34b.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This improves repeated developer test preparation with bounded build-tooling impact.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Recorded Crabbox runs exercise native test preparation after source synchronization and fixture correction, observing unchanged artifact generation and approximately one-second reuse. Input-edit checks support invalidation; additive stamp fields retain legacy admission without a user-state migration.
  • proof: sufficient: Contributor real behavior proof is sufficient. Recorded Crabbox runs exercise native test preparation after source synchronization and fixture correction, observing unchanged artifact generation and approximately one-second reuse. Input-edit checks support invalidation; additive stamp fields retain legacy admission without a user-state migration.

Evidence

What I checked:

  • Pinned introduced change: Reviewed the merge-base-to-head introduced hunks. The subsequent head commit only adds the watched-path module to declaration fixtures. The supplied test merge is stale and was not used to infer removal of current-main behavior. (146d3b694396)
  • Current main still needs this preparation improvement: Current main calls resolveRunNodePreparation without equivalent-input admission; the branch adds that admission specifically to test preparation. (scripts/prepare-vitest-runtime.mts:19, 85f09d7ea34b)
  • Latest release retains strict preparation: The supplied v2026.9.7 release commit likewise lacks equivalent-input admission in test preparation; no shipped implementation was established. (scripts/prepare-vitest-runtime.mts:19, c074824a27c9)
  • Producer lifecycle preserves freshness: Native build orchestration captures input state and removes previous stamps before writes or cache restoration. Stamp publication verifies both content identity and transient file generation, rejecting inputs changed during preparation. (scripts/build-all.mts:589, 146d3b694396)
  • Legacy stamp compatibility: The reader treats absent fingerprint fields as legacy stamps and retains the existing HEAD and cleanliness checks. Regression coverage explicitly removes inputSignature and verifies that a changed HEAD requires rebuilding; the body reports legacy-stamp validation. These additive disposable artifact fields require no user-state migration. (src/infra/build-stamp.test.ts:230, 146d3b694396)
  • Recorded real preparation results: The captured PR body records separate source synchronizations on a retained 8-CPU Crabbox, including a real test-fixture correction. Ordinary and private-QA preparation then completed in 1.09s and 1.02s without rebuilding or changing artifact generation, compared with a 13m30s cold prerequisite. Production, package, stylesheet, and authored-manifest edits invalidated reuse. These observations exercise the changed native preparation owner rather than an unrelated startup smoke. (146d3b694396)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • DonnieFi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-10-01T14:00:36.315Z sha 77b47d6 :: needs changes before merge. :: none
  • reviewed 2026-10-01T14:30:17.970Z sha 146d3b6 :: needs changes before merge. :: none
  • reviewed 2026-10-01T14:38:26.292Z sha 146d3b6 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Oct 1, 2026
@shakkernerd shakkernerd self-assigned this Oct 1, 2026
@shakkernerd
shakkernerd merged commit cfe8791 into main Oct 1, 2026
157 checks passed
@shakkernerd
shakkernerd deleted the fix/test-runtime-reuse branch October 1, 2026 15:08
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Improved: test preparation reuses compatible runtimes after source refreshes and test-only edits.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 2, 2026
…2744)

Reuse compatible test runtimes across source refreshes and test-only edits while preserving input invalidation and strict UI/deployment checks.

Related: openclaw#57204.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant