Skip to content

fix: native JSON reports fail after grouped test runs pass - #138250

Merged
steipete merged 1 commit into
mainfrom
steipete/retention-report-ready-20260904
Sep 4, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/retention-report-ready-20260904

Conversation

@steipete

@steipete steipete commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Closes #138174 (native JSON aggregation fails after successful grouped and direct project runs).

Additional instructions

Keep Allow edits from maintainers enabled for this PR.

What Problem This Solves

Resolves a problem where developers requesting a native JSON report across grouped and direct Vitest configurations receive a failed wrapper exit after all tests pass. The original affected run completed 500 tests but could not publish its aggregate because Vitest rejected duplicate project names.

Why This Change Was Made

The capture reporter now records the projects that own terminal native test modules, including an empty owner list for a successful empty selection. The merge owner uses Vitest's default host only for wholly empty replay; original config validation, exact project/root/pool/task identities, case inventory, and completion checks remain authoritative.

This also fixes the empty-grouped-plus-direct case missed by the first candidate's empty-run fallback. Actually executed same-name projects with incompatible roots still fail publication rather than losing or renaming cases. The repair uses native blob replay and native JSON reporting throughout.

User Impact

Developers can obtain a complete native JSON aggregate from these supported grouped/direct invocations, including explicitly successful empty runs. Complete failed runs still produce failing command exits; incomplete evidence retains the originals and leaves an existing output untouched. Session-retention behavior and public configuration are unchanged.

Evidence

On pinned main 72a1d6f78af36fb8723c733a9de981af5a74d42c, with Node 24.20.0, pnpm 12.1.0, Vitest 4.1.11 and Vite 8.2.2:

  • pnpm install --frozen-lockfile --package-import-method=copy — passed with an independent dependency install.
  • node scripts/run-vitest.mjs test/scripts/vitest-report-owner.test.ts — 73/73 passed, one native shard. Covers grouped and mixed/wholly empty runs, incompatible executed roots, exact case union, failure/suite/unhandled errors, config/name/pool drift, coverage artifacts, incomplete/corrupt output, cancellation/crashes/timeouts, overlap, native controls and planner chunks.
  • All 19 planned changed-file gates passed, including formatting, script and root-test typechecks, and both scoped typed-lint calls; git diff --check passed.
  • Exact-head CI run 33871794397, attempt 1 completed successfully for 5a09662070d8eb96a405d8d508304388ac3764fc; the native CI watcher reported GREEN.
  • Final deslop required no edits. One fresh normal default-P0 Codex autoreview completed scoped-clean with no findings; scanner and restricted empty-workspace isolation remained enabled. This verdict is P0-scoped.
node scripts/check-changed.mjs --dry-run -- scripts/lib/vitest-report-capture.mts scripts/lib/vitest-report-owner.mts test/scripts/vitest-report-fixture.ts test/scripts/vitest-report-owner.test.ts
node scripts/check-changed.mjs -- scripts/lib/vitest-report-capture.mts scripts/lib/vitest-report-owner.mts test/scripts/vitest-report-fixture.ts test/scripts/vitest-report-owner.test.ts
git diff --check

The retained pre-fix regression failed for the intended duplicate-name error after successful native children. Its baseline source bytes match this pinned main. The supported empty-group regression likewise failed the first candidate after both children exited zero; the earlier invalid top-level project-filter probe is not counted as regression evidence.

The separately completed Linux integration proof on configured Blacksmith Testbox (run 33866394276) used base c861706c2d8af6300a8597ebe3bd9f2b96ffcb2d, the session-retention candidate, and this byte-identical four-file repair: 29 files, 502 cases, seven native child exits 0, native merge exit 0, index.complete=true. Source manifests matched before and after. This is prior integration evidence, not a new full-selection run on the PR base. The difference from 500 is explained by three added Kysely cases replacing one earlier case; no selected case was dropped to make aggregation pass.

Exact prior Linux integration command (original input order)
OPENCLAW_TEST_PROJECTS_PARALLEL=1 \
  node scripts/run-vitest.mjs \
  packages/gateway-protocol/src/schema/sessions-row.test.ts \
  src/agents/command/session-store.test.ts \
  src/commands/sessions-cleanup.harness.test.ts \
  src/commands/sessions-cleanup.test.ts \
  src/config/sessions/cleanup-service.applied-summary.test.ts \
  src/config/sessions/conversation-delivery-store.test.ts \
  src/config/sessions/incognito-session-transcript.test.ts \
  src/config/sessions/session-accessor.conformance.test.ts \
  src/config/sessions/session-accessor.sqlite-cap-archive.test.ts \
  src/config/sessions/session-accessor.sqlite-cleanup-race.test.ts \
  src/config/sessions/session-accessor.sqlite-data-version.test.ts \
  src/config/sessions/session-accessor.sqlite-maintenance-writer.test.ts \
  src/config/sessions/session-history-eviction.test.ts \
  src/config/sessions/store-maintenance-recent-preservation.test.ts \
  src/config/sessions/store-maintenance.dashboard-archive.test.ts \
  src/config/sessions/store.pruning.test.ts \
  src/gateway/server-worker-placement-startup-maintenance.test.ts \
  src/gateway/server.sessions.archive-worktree-lifecycle.test.ts \
  src/infra/session-maintenance-warning.test.ts \
  src/infra/state-migrations.legacy-session-store.test.ts \
  src/plugin-sdk/channel-inbound.test.ts \
  src/plugin-sdk/session-store-runtime.test.ts \
  src/config/sessions/session-accessor.sqlite-archive.byte-limit.test.ts \
  src/config/sessions/session-accessor.sqlite-archive.worker.test.ts \
  src/config/sessions/session-accessor.sqlite-reclamation-admission-race.test.ts \
  src/commands/sessions-cleanup.runtime.test.ts \
  src/config/sessions/session-accessor.sqlite-reclamation-commit.test.ts \
  src/config/sessions/session-accessor.sqlite-cleanup-reclamation.test.ts \
  src/infra/kysely-sync.test.ts \
  --maxWorkers=2 \
  --reporter=verbose \
  --reporter=json \
  --outputFile=/tmp/retention-live-linux-nybxfhtz/vitest.json

LOC: product/runtime 0; report tooling +13/-3 (net +10); tests and fixture +150/-4 (net +146). The tooling growth represents terminal module ownership and native empty-replay hosting. No dependency, version, schema, environment-variable or public configuration surface changed. A product build is not required for this standalone Node/Vitest tooling boundary.

Overlap: #137202 (Vitest 5 migration), checked at 6c0b2946e423e1a6c5f890e8f4ebfe055c551f0b, changes merge configuration loading but leaves this capture producer unchanged. Its integration must retain this identity and empty-replay behavior.

ClawSweeper follow-through

Addressed the completed review on unchanged head 5a09662070d8eb96a405d8d508304388ac3764fc. The review reports no actionable code defect; its dependency inspection was blocked by missing local dependencies and DNS failure.

  • Pinned dependency contract confirmed directly. The available installed package is Vitest 4.1.11. In dist/chunks/index.UpGiHP7g.js:2025–2057, native BlobReporter serializes the terminal testModules tasks. At 2091–2117, native replay ignores environment graphs for absent projects while preserving the complete files/errors/coverage collections. In dist/chunks/cli-api.CnMVyzaz.js:13380–13388, an omitted project list uses the default project; at 13417–13444, native merge reconstructs specifications from the projects owning those file tasks and invokes the normal reporter lifecycle. This confirms both terminal-owner capture and empty-replay hosting without accepting an unverified dependency assumption.
  • Evidence/confidence request resolved with source plus execution. Direct source inspection agrees with the 73-case real native-process suite, source-identical 29-file/502-case Linux aggregate, and successful exact-head CI. No code changed after review. The original review environment's inability to inspect dependencies is recorded, not represented as a successful inspection there. A new bot rating is not being requested solely to repeat this already fresh review.
  • Data-model compatibility item: not applicable to OpenClaw runtime persistence. createVitestReportOwner creates a fresh .reports-* artifact directory for each invocation (scripts/lib/vitest-report-owner.mts:105–128); attempt() creates that invocation's native reports, and finish() reads its own accepted attempts. This change does not alter a SQLite schema/version, session storage, migrations, runtime state, or public configuration. Capture field names and native JSON output format are unchanged. The public test-report artifact contract is covered by exact case inventory, complete failed runs, coverage, and old-output preservation tests. Native Vitest itself rejects cross-version blobs (index.UpGiHP7g.js:2085–2089); there is no new cross-version replay or stored-state upgrade promise to migrate.

Inspected dependency-file SHA256 values: cli-api.CnMVyzaz.js = f06cba2e720559ab6d347e155f8806fa011ce99aa993c6d5f2110d20ef028b87; index.UpGiHP7g.js = cdafaf8e508042dddba72f8c7bbae84e2836ddb6b06c7026520c35d91af4e798. The evidence and maintainer-side decision requests are resolved by this inspection, not by waiving the checks. No separate persistent-store design is included or approved here.

Fix native JSON publication after successful grouped and direct project runs, including mixed empty selections. Preserve native identities, failure outcomes, coverage and exact case inventory. Fixes #138174.
@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.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: S maintainer Maintainer-authored PR labels Sep 4, 2026
@steipete
steipete marked this pull request as ready for review September 4, 2026 12:14

@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.

Good boundary. Project ownership is now derived from terminal modules rather than every loaded config project, which fixes duplicate-name aggregation without weakening incompatible-root validation. The empty-run host fallback stays contained to replay.

@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready proof for head 5a09662070d8eb96a405d8d508304388ac3764fc:

The fix is four files only: terminal native module owners determine replay projects; wholly empty replay uses Vitest's native host. Exact project/root/pool/task identities, case conservation, native failures, coverage evidence, and incomplete-output protection remain enforced. Product runtime delta is 0; tooling +10 net lines; tests/support +146 net lines.

Fresh exact-source local proof: 73/73 native owner tests, all 19 scoped checks, formatting/diff checks, and one default-P0 Codex autoreview with no accepted findings. The committed files match the tested/reviewed hashes.

node scripts/run-vitest.mjs test/scripts/vitest-report-owner.test.ts
node scripts/check-changed.mjs -- scripts/lib/vitest-report-capture.mts scripts/lib/vitest-report-owner.mts test/scripts/vitest-report-fixture.ts test/scripts/vitest-report-owner.test.ts
git diff --check

Exact-head CI run 33871794397, attempt 1 completed successfully. The separately attributed Linux integration run also published the original ordered 29-file selection: 502 cases, seven successful native children, native merge exit 0, and a complete index, using the byte-identical reporter repair. Its baseline/retention integration and the historical failed aggregation are distinguished in the PR body.

Native main/PR checkout, guard, and review-artifact validation passed. Current main still has the reproduced defect. Latest ClawSweeper content is the receipt acknowledgement, not a completed review; there are no published findings or rank-up moves to address at this point. The Vitest 5 migration owner has recorded the terminal-owner and empty-host requirements for later integration. No retention policy, avatar code, dependency patch, or private stress driver is included here.

Proceeding through the required native prepare/merge gates; this comment is not a merge-completion claim.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦞 diamond lobster Very strong PR readiness with only minor 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: blocked before merge. Reviewed September 4, 2026, 8:38 AM ET / 12:38 UTC.

ClawSweeper review

What this changes

The PR records only Vitest projects that own completed test modules and omits an empty project list for wholly empty native-report replay, allowing grouped and direct runs to publish one JSON aggregate.

Regression provenance

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

Merge readiness

⛔ Blocked before merge - 5 items remain

Keep this focused bug-fix PR open for maintainer landing. The source repair moves replay-project ownership to completed modules and the added native integration fixtures cover the reported grouped/direct and empty-selection cases; the remaining review limitation is independent inspection of the pinned Vitest implementation, unavailable from this node_modules-less checkout while GitHub DNS was unavailable.

Priority: P2
Reviewed head: 5a09662070d8eb96a405d8d508304388ac3764fc
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused owner-boundary repair with strong native-path regression coverage and captured exact-head validation; only independent dependency-source access remains unavailable to this reviewer.
Proof confidence 🦞 diamond lobster (5/6) Not applicable: The repository state identifies this as maintainer-authored, so the external-contributor proof gate does not apply; the supplied exact-head native wrapper run and CI success are still relevant after-fix evidence, although they could not be independently fetched in this environment.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The repository state identifies this as maintainer-authored, so the external-contributor proof gate does not apply; the supplied exact-head native wrapper run and CI success are still relevant after-fix evidence, although they could not be independently fetched in this environment.
Evidence reviewed 7 items Introduced owner-boundary repair: The verified introduced diff replaces initialized-project capture with terminal module-owner capture, addressing the producer of duplicate replay entries.
Replay validation remains strict: The merge owner continues to preserve task-identity, coverage, output-destination, merge-completion, and exact case-inventory checks; only an empty project list is omitted for a wholly empty replay.
Caller and sibling entrypoints: Both the ordinary project runner and extension batch runner create the same report owner and invoke its merge finish path, so the repair applies at their shared artifact owner rather than one caller.
Findings None None.
Security None None.

How this fits together

OpenClaw’s test wrapper splits a selection across Vitest projects, captures native shard outputs, then replays those outputs into one JSON report. This change supplies the replay configuration from the projects that actually produced completed modules.

flowchart LR
  A[Test selection] --> B[Vitest project shards]
  B --> C[Native shard capture]
  C --> D[Completed module owners]
  D --> E[Merge configuration]
  E --> F[Native report replay]
  F --> G[Aggregate JSON report]
Loading

Decision needed

Question Recommendation
Is the captured exact-head native-run and CI evidence sufficient for this maintainer-owned patch despite this review environment being unable to inspect the pinned Vitest source directly? Confirm with Vitest source: Re-run the focused review where Vitest 4.1.11 source is available and confirm the reporter and empty-project replay contract before landing.

Why: The changed production tooling executes Vitest APIs, so repository policy normally requires direct dependency-contract inspection; the local dependency tree and upstream network path were unavailable to this reviewer.

Before merge

  • Resolve merge risk (P1) - Vitest 4.1.11 reporter and empty-project replay semantics could not be independently inspected because the review worktree lacks dependency sources and upstream GitHub access failed; this is an evidence limitation, not a demonstrated patch defect.
  • Complete next step (P2) - Before merge, confirm the pinned Vitest reporter and empty-replay contract from an available dependency source, or explicitly accept the captured native integration evidence.
  • Resolve review confidence - ClawSweeper must reach high confidence before merge readiness is known.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Tests +146, Other +10. Total +156 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 150 4 +146
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 13 3 +10
Total 4 163 7 +156

Review metrics

Metric Value Why it matters
Production versus test delta report tooling +10 net; test and fixture support +146 net The production change is confined to the shared report owner, while most added code verifies grouped, empty, and identity-sensitive native replay behavior.

Stored data model

Persistent data-model change detected: serialized state: scripts/lib/vitest-report-owner.mts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #138174
Summary: This PR is the explicit open candidate fix for the native JSON aggregation failure documented by the linked issue.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain this shared report-owner repair and its native grouped/empty/identity regressions, with a maintainer confirming the captured native integration evidence or reviewing the pinned Vitest source before merge.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain this shared report-owner repair and its native grouped/empty/identity regressions, with a maintainer confirming the captured native integration evidence or reviewing the pinned Vitest source before merge.

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

Unclear for independent reproduction in this review environment: the current-main source retains the documented trigger and the PR supplies a concrete native test path, but this read-only worktree has no dependencies to execute it.

Is this the best way to solve the issue?

Yes, subject to the dependency-contract evidence gap: deriving replay projects from completed modules repairs the producer that feeds merge configuration, rather than weakening downstream duplicate-identity validation.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: The PR repairs developer test-report publication for supported mixed-project runs without changing OpenClaw product runtime behavior.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository state identifies this as maintainer-authored, so the external-contributor proof gate does not apply; the supplied exact-head native wrapper run and CI success are still relevant after-fix evidence, although they could not be independently fetched in this environment.

Label justifications:

  • P2: The PR repairs developer test-report publication for supported mixed-project runs without changing OpenClaw product runtime behavior.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository state identifies this as maintainer-authored, so the external-contributor proof gate does not apply; the supplied exact-head native wrapper run and CI success are still relevant after-fix evidence, although they could not be independently fetched in this environment.

Evidence

What I checked:

  • Introduced owner-boundary repair: The verified introduced diff replaces initialized-project capture with terminal module-owner capture, addressing the producer of duplicate replay entries. (scripts/lib/vitest-report-capture.mts:139, 5a09662070d8)
  • Replay validation remains strict: The merge owner continues to preserve task-identity, coverage, output-destination, merge-completion, and exact case-inventory checks; only an empty project list is omitted for a wholly empty replay. (scripts/lib/vitest-report-owner.mts:205, 5a09662070d8)
  • Caller and sibling entrypoints: Both the ordinary project runner and extension batch runner create the same report owner and invoke its merge finish path, so the repair applies at their shared artifact owner rather than one caller. (scripts/test-projects-run.mts:381, 5a09662070d8)
  • Behavioral regression coverage: The added fixtures exercise grouped execution, an empty grouped selection plus an executed direct child, and same-name projects with incompatible roots while retaining failure and output-protection coverage. (test/scripts/vitest-report-owner.test.ts:442, 5a09662070d8)
  • Current and shipped baseline: Current main and release v2026.8.2 retain the previous initialized-project behavior, while the PR head is not an ancestor of fetched main; the repair is not already merged. (scripts/lib/vitest-report-capture.mts:82, f1e1dca03d2b)
  • Dependency-contract inspection gap: The changed files import and execute Vitest APIs, but this worktree has no node_modules and attempts to read the upstream source through GitHub failed because the host could not resolve github.com. The captured native-run and exact-head CI evidence remain available, but direct dependency-source inspection was not possible.

Likely related people:

  • steipete: 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.

@steipete
steipete merged commit dc2c017 into main Sep 4, 2026
197 checks passed
@steipete
steipete deleted the steipete/retention-report-ready-20260904 branch September 4, 2026 12:53
@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 5, 2026
…law#138250)

Fix native JSON publication after successful grouped and direct project runs, including mixed empty selections. Preserve native identities, failure outcomes, coverage and exact case inventory. Fixes openclaw#138174.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts size: S 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.

[Bug]: Native test JSON aggregation fails on unused duplicate projects

2 participants