Skip to content

fix(test): preserve Vitest cache generations - #138248

Merged
steipete merged 1 commit into
mainfrom
codex/fix-vitest-cache-generation
Sep 5, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/fix-vitest-cache-generation

Conversation

@steipete

@steipete steipete commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Vitest could preload a custom reporter before validating its persistent transform cache, then delete the directory backing a memoized cache path when the installed lock changed. The initialization failure was reproduced through the normal test runner. Public API probes also exposed stale transforms after an awaited idle cache clear, across separate project cache roots, and after clearing, repopulating, then restarting with a changed lock.

Keep cache readiness and generation in the cache owner: prepare the workspace lock hash before reporter imports, include that generation in cache keys, and retire cached path metadata through the existing invalidation flow on clear. Early configuration-hook imports use ordinary uncached transforms until initialization completes; same-generation reporters and tests retain warm reuse. Existing worker shutdown behavior and the Vitest version are preserved.

Regression coverage uses the public Vitest APIs and existing fixture/process limits. Original-engine runs reproduced the hook/idle-clear failures; two later generation regressions failed on the first repair and pass on the final repair. The signed integration head 251e8d12 passes all 18 cache/reporter/compiler cases, all 14 Gateway session-tool cases, and the normal 28-command changed gate, including 94 generated npm-lock validations. Independent Codex review completed two passes without findings. An earlier review identified the two generation gaps; both were reproduced and fixed before the clean reviews.

The earlier hosted run 33875933007 failed on the old head. The integration includes main's Android test observation fix and Gateway fixture updates; the historical Gateway timeout phase remains unproven. That failed result stays recorded, and hosted CI must validate this updated head. Source qualification against captured main 0062f2b1 confirms the three-file patch composes; local execution is attributed to 251e8d12 and its tested dependency graph.

Scope: OpenClaw production code +0/-0; patched Vitest implementation +37/-25 (net +12) for cache lifecycle ownership; tests +258/-39 (net +219); lockfile +8/-8 for the unchanged-version Vitest patch identity.

@clawsweeper

clawsweeper Bot commented Sep 4, 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.

@steipete
steipete marked this pull request as ready for review September 4, 2026 12:07
@steipete
steipete requested a review from a team as a code owner September 4, 2026 12:07
@openclaw-barnacle openclaw-barnacle Bot added the maintainer Maintainer-authored PR label Sep 4, 2026
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Dependency Guard

This PR changes dependency-related files. Maintainers should confirm these changes are intentional.

Changed files:

Maintainer follow-up:

  • Review whether the dependency changes are intentional.
  • Inspect resolved package deltas when lockfiles or workspace dependency policy changes are present.
  • Treat pnpm-lock.yaml and package-lock.json diffs as dependency security-review surfaces.
  • Run pnpm deps:changes:report -- --base-ref origin/main --markdown /tmp/dependency-changes.md --json /tmp/dependency-changes.json locally for detailed release-style evidence.

@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label Sep 4, 2026
@github-actions

github-actions Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Dependency graph changes noted

This PR includes dependency graph changes. The dependency guard is informational because the PR author is a repository admin, a member of @openclaw/openclaw-secops, or an OpenClaw organization member with Maintain or Admin repository access.

  • Current SHA: 251e8d12e597799a26aeb070b95161fff1651d54
  • Trusted actor: @steipete
  • Trusted role: pull request author; openclaw-secops

Security review is still recommended before merge when the dependency graph change is intentional.

@sylvesterkaczmarek sylvesterkaczmarek left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cache generation now sits with the cache owner, and invalidation clears both disk state and retained path metadata. The lifecycle boundary looks consistent.

@steipete
steipete force-pushed the codex/fix-vitest-cache-generation branch from ee0dadd to 251e8d1 Compare September 4, 2026 19:30
@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 Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 4, 2026, 3:38 PM ET / 19:38 UTC.

ClawSweeper review

What this changes

The branch updates OpenClaw’s patched Vitest runtime and regression tests so filesystem transform caches use the current lockfile generation during startup and cache clearing.

Regression provenance

Possible regression — probable (reviewed change; known regression link). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

Keep open for normal maintainer review. The branch contains a focused cache-lifecycle repair with regression coverage, and its member author plus maintainer label prohibit automated cleanup closure.

Priority: P2
Reviewed head: 251e8d12e597799a26aeb070b95161fff1651d54

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The cache-owner repair is focused and its behavior-level regression coverage is credible.
Proof confidence 🌊 off-meta tidepool Not applicable: This is maintainer-authored, so the external-contributor proof gate does not apply. The supplied body describes process-level regression runs, while this read-only checkout lacks the installed dependency for independent execution.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is maintainer-authored, so the external-contributor proof gate does not apply. The supplied body describes process-level regression runs, while this read-only checkout lacks the installed dependency for independent execution.
Evidence reviewed 5 items Changed cache owner: The introduced patch keeps the lockfile hash in the filesystem-cache owner, uses it in transform-cache keys, invalidates retained paths on clear, and avoids persistent-cache reads before initialization.
Boundary-level regression coverage: The added tests use the public Vitest APIs to cover reporter imports after a lock transition, awaited configure hooks, separate project cache roots, and an idle cache clear followed by a restart.
Patched dependency declaration: The workspace continues to pin Vitest 4.1.11 and declares this exact local patch; the lockfile changes only the patch identity, not the resolved Vitest version.
Findings None None.
Security None None.

How this fits together

OpenClaw’s test runner uses a pinned, locally patched Vitest dependency. Vitest turns test configuration and source files into cached transforms that reporters, projects, and test workers consume.

flowchart LR
  A[Test configuration] --> B[Vitest startup]
  B --> C[Filesystem transform cache]
  C --> D[Reporters and test projects]
  D --> E[Test results]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +219, Other +174. Total +393 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 257 38 +219
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 214 40 +174
Total 3 471 78 +393

Review metrics

Metric Value Why it matters
Production versus test delta OpenClaw production +0/-0; patched Vitest +37/-25; tests +257/-38; lockfile +8/-8 The production behavior change is contained in the existing Vitest patch; most introduced surface is regression coverage.

Technical review

Best possible solution:

Retain the single cache-owner generation model and land only after the exact-head CI run validates the patched Vitest package and its cache-generation scenarios.

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

Source-reproducible: the added fixtures exercise lock transitions, early configuration imports, separate project cache roots, and an idle clear. This read-only checkout has no installed Vitest dependency, so the scenarios could not be executed here.

Is this the best way to solve the issue?

Yes: carrying the lock generation in the cache owner and excluding pre-initialization imports from persistent-cache lookup is the narrowest coherent repair; the tests cover the distinct lifecycle boundaries.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against da906236e643.

Labels

Label changes:

  • add P2: The PR repairs test-runner cache correctness with limited direct user-facing blast radius.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is maintainer-authored, so the external-contributor proof gate does not apply. The supplied body describes process-level regression runs, while this read-only checkout lacks the installed dependency for independent execution.

Label justifications:

  • P2: The PR repairs test-runner cache correctness with limited direct user-facing blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is maintainer-authored, so the external-contributor proof gate does not apply. The supplied body describes process-level regression runs, while this read-only checkout lacks the installed dependency for independent execution.

Evidence

What I checked:

  • Changed cache owner: The introduced patch keeps the lockfile hash in the filesystem-cache owner, uses it in transform-cache keys, invalidates retained paths on clear, and avoids persistent-cache reads before initialization. (patches/[email protected]:34, 251e8d12e597)
  • Boundary-level regression coverage: The added tests use the public Vitest APIs to cover reporter imports after a lock transition, awaited configure hooks, separate project cache roots, and an idle cache clear followed by a restart. (test/vitest-performance-config.test.ts:401, 251e8d12e597)
  • Patched dependency declaration: The workspace continues to pin Vitest 4.1.11 and declares this exact local patch; the lockfile changes only the patch identity, not the resolved Vitest version. (pnpm-workspace.yaml:114, 251e8d12e597)
  • Current-main comparison: Current main retains the earlier Vitest patch but does not contain the introduced filesystem-cache generation hunks, so this PR is neither implemented nor superseded on main. (patches/[email protected]:13, da906236e643)
  • Feature history: Recent merged history shows the same contributor maintaining filesystem-cache configuration, cache ownership, and warm-cache collection behavior before this PR. (test/vitest-performance-config.test.ts:109, 924d02d74100)

Likely related people:

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

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Confirm the patched Vitest package and cache-generation suite on exact-head CI before merge.

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.

@steipete steipete self-assigned this Sep 5, 2026
@steipete
steipete merged commit 57dffbf into main Sep 5, 2026
161 checks passed
@steipete
steipete deleted the codex/fix-vitest-cache-generation branch September 5, 2026 07:06
@steipete

steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies-changed PR changes dependency-related files maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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.

2 participants