Skip to content

improve(tests): speed up snapshot ownership checks - #155973

Merged
steipete merged 1 commit into
mainfrom
codex/test-snapshot-ownership-qualified
Sep 22, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/test-snapshot-ownership-qualified

Conversation

@steipete

@steipete steipete commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Snapshot ownership checks spend several seconds loading TypeScript in fresh subprocesses.

User Impact

There is no product behavior change. The tests finish sooner while retaining their process ownership and race coverage.

Why This Change Was Made

Register the snapshot, staging, and logger import roots with the existing invocation-owned compiler and resolve prepared JavaScript entries for finite runs. All 14 case bodies, 33 fresh process starts—including 24 orphan-race roles—parent SIGKILLs, tokens, IPC/file barriers, assertions, and deadlines remain unchanged. Standalone/watch runs retain the existing source fallback.

Evidence

Natural ABBA at f0d26603a5c1210dab73e4362b017eccdd585931 used one configured Blacksmith Testbox, Node 24.19.0, four CPUs, 16.56 GB RAM, and the default cache policy. Every arm passed all 14 cases. Times are seconds:

Arm Command Test phase Collection Worker preparation* Orphan race
A1 baseline 30.974 15.089 11.784 9.955 8.830
B1 candidate 23.594 7.989 11.769 9.905 4.114
B2 candidate 23.846 9.228 11.719 10.348 4.933
A2 baseline 56.958 31.135 21.748 18.474 20.110

Worker preparation overlaps collection; these phases are not additive. The first pair reduced command time by 23.8%, with nearly identical collection/preparation cost. A2 slowed broadly, including compilation and unchanged cases; its cause is unproven, so the larger aggregate reduction cannot be attributed solely to this patch. ABBA run.

Correctness qualification on 85a481530c44cebb0736f9bf00a9da18cd786fcf retained the identical four-file patch. Temporarily removing parent-token admission made both source and prepared execution fail the same original copyExists assertion in the first inspection cell. Production bytes were restored and verified before positive proof:

  • 150 passed: all 14 ownership cases, 89 SQLite/resolver sibling cases, and 47 compiler-owner cases. Four existing skips: one Windows-only retirement case and three CI generation-custody cases gated off on constrained hosts.
  • Current full-file command: 22.622 seconds. This is current-base correctness cost; the paired performance result remains bound to f0d266.
  • Complete selected changed gate passed in 1,672.377 seconds, including all 25 core test type partitions, script types, dead-export scans, lint, and repository guards. Fresh isolated P2 review found no actionable findings.

Qualification run. All 53 pinned source hashes and 60 qualification artifact entries verified. Two earlier capture-harness startup attempts stopped before collection and executed zero tests; their failure archives remain preserved. Stock-reporter qualification completed successfully, and all benchmark/qualification leases were verified stopped.

Published-head CI cost

Exact-head CI passed on 02539aae99963cd3765bbc7b9c265718b6d1ebf9, with both required openclaw/ci-gate entries successful. In checks-node-compact-small-11, all 14 snapshot ownership cases passed, with 6.926 seconds of summed rounded case time; the orphan-race case took 3.471 seconds. These are verbose case durations, not a standalone file command wall or a new before/after comparison. The earlier 22.622-second standalone qualification cost remains bound to its recorded source. The CI job executed merge 259b6564b1a7ed80cc799b8053544de85ab1e187 into main d30f66fc26f9203c9ea4debf81f64b1757d18a9a.

@clawsweeper

clawsweeper Bot commented Sep 22, 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 scripts Repository scripts size: XS maintainer Maintainer-authored PR labels Sep 22, 2026
@steipete
steipete marked this pull request as ready for review September 22, 2026 21:48
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 22, 2026
@clawsweeper

clawsweeper Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 22, 2026, 5:54 PM ET / 21:54 UTC.

ClawSweeper review

What this changes

Reuse prepared JavaScript in SQLite snapshot ownership tests to reduce subprocess startup cost while preserving standalone TypeScript execution.

Merge readiness

✅ Ready for maintainer review

The optimization remains useful: current main still loads TypeScript in these subprocesses. No actionable correctness or security defect was found, and the maintainer-authored PR is protected from automatic closure.

Priority: P3
Reviewed head: 02539aae99963cd3765bbc7b9c265718b6d1ebf9

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused optimization that reuses established infrastructure, preserves coverage, and documents measured cost without overstating the benchmark.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this maintainer-authored tooling PR. Its body nevertheless reports execution of the changed subprocess path on a real Testbox, paired timings, and matching source/prepared fault detection; this review did not independently rerun that evidence. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this maintainer-authored tooling PR. Its body nevertheless reports execution of the changed subprocess path on a real Testbox, paired timings, and matching source/prepared fault detection; this review did not independently rerun that evidence. No stored-data contract changes.
Evidence reviewed 6 items Introduced patch preserves test behavior: The pinned introduction changes compiler registrations and subprocess import selection. Existing case bodies, process launches, barriers, assertions, and deadlines remain unchanged.
Existing compiler and fallback owner: The compiler builds runtime roots and declarations together. The Vitest plugin redirects registered declarations only for managed finite runs; standalone and watch execution retain source imports. The existing URL/argument resolver selects the TypeScript preload when needed.
Current main still needs the optimization: Fetched main retains the explicit tsx preload and three TypeScript module URLs. No verified merged replacement was established, and no shipped-fix claim is made.
Findings None None.
Security None None.

How this fits together

SQLite snapshot ownership tests check that cleanup preserves files still held by readers or child processes. The test runner prepares shared JavaScript artifacts, which fresh subprocesses load to exercise the existing ownership and reclamation behavior.

flowchart TD
 A[Ownership tests] --> B{Managed finite run?}
 B -->|Yes| C[Invocation compiler]
 C --> D[Prepared JavaScript imports]
 B -->|No| E[TypeScript imports]
 D --> F[Fresh child processes]
 E --> F
 F --> G[Ownership and cleanup assertions]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +26, Other +4. Total +30 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 30 4 +26
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 4 0 +4
Total 4 34 4 +30

Review metrics

Metric Value Why it matters
Reported subprocess optimization First pair: 30.974s → 23.594s, 23.8% faster This measures the intended tooling benefit; the noisier final baseline does not support a larger attributable improvement.

Technical review

Best possible solution:

Keep one invocation-owned compiler for finite test runs while retaining source execution for standalone and watch runs.

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

Not applicable as a product bug: this is a test-performance optimization supported by a reported paired benchmark, not a locally reproduced failure.

Is this the best way to solve the issue?

Yes. Registering these imports with the existing compiler removes repeated source-loading work without introducing another build owner or weakening the test scenarios.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a bounded test-performance improvement with no product behavior change.
  • 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: The external-contributor proof gate does not apply to this maintainer-authored tooling PR. Its body nevertheless reports execution of the changed subprocess path on a real Testbox, paired timings, and matching source/prepared fault detection; this review did not independently rerun that evidence. No stored-data contract changes.

Label justifications:

  • P3: This is a bounded test-performance improvement with no product behavior change.
  • 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: The external-contributor proof gate does not apply to this maintainer-authored tooling PR. Its body nevertheless reports execution of the changed subprocess path on a real Testbox, paired timings, and matching source/prepared fault detection; this review did not independently rerun that evidence. No stored-data contract changes.

Evidence

What I checked:

  • Introduced patch preserves test behavior: The pinned introduction changes compiler registrations and subprocess import selection. Existing case bodies, process launches, barriers, assertions, and deadlines remain unchanged. (src/infra/sqlite-snapshot-staging.ownership.test.ts:41, 02539aae9996)
  • Existing compiler and fallback owner: The compiler builds runtime roots and declarations together. The Vitest plugin redirects registered declarations only for managed finite runs; standalone and watch execution retain source imports. The existing URL/argument resolver selects the TypeScript preload when needed. (test/vitest/vitest.worker-artifacts.ts:34, 02539aae9996)
  • Current main still needs the optimization: Fetched main retains the explicit tsx preload and three TypeScript module URLs. No verified merged replacement was established, and no shipped-fix claim is made. (src/infra/sqlite-snapshot-staging.ownership.test.ts:39, a10c28dca079)
  • Reported performance and correctness qualification: The captured PR body reports a real Blacksmith Testbox ABBA comparison: 30.974s baseline versus 23.594s candidate in the first pair, with all 14 cases passing in every arm. It explicitly declines to attribute the slower final baseline to this patch. Qualification reports 150 passing cases and a parent-token mutation rejected by both source and prepared execution. These are contributor-reported results, not tests executed by this review. (02539aae9996)
  • Merge ownership checked: The recorded test merge has the pinned base followed by the exact PR head as parents; its base-relative result contains the same four-file optimization. Base-only work was not attributed to this PR. (259b6564b1a7)
  • Area history and review limits: Available main history identifies Peter Steinberger's adjacent compiler preparation work and Galin Iliev's SQLite ownership work. Exact-line blame could not complete because historical object retrieval failed, so routing candidates carry no introduction claim. Source and diff inspection succeeded; tests were not run under the read-only contract, and the final working tree was clean. (src/infra/sqlite-snapshot-staging.ownership.test.ts, a10c28dca079)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Galin Iliev: 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 370e174 into main Sep 22, 2026
228 checks passed
@steipete
steipete deleted the codex/test-snapshot-ownership-qualified branch September 22, 2026 23:20
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 22, 2026
* commit '7d7f977ccfc1ac177526232e4f4960febd010015': (91 commits)
  test: avoid unused target setup in package profile fixtures (#155972)
  fix(worktrees): batch snapshot metadata reads
  test(plugin-state): distinguish borrowed and foreign lifecycle owners
  refactor(agents): share external harness session and attempt machinery (#152181)
  chore(i18n): refresh native locales (#156006)
  chore(test): retain Doctor fixture settlement diagnostics (#155944)
  perf(codex): reuse unchanged inference request bytes (#155987)
  perf(test): prepare snapshot ownership subprocess imports (#155973)
  perf(test): consolidate channel registry coverage (#155014)
  fix(runtime): preserve Node worker dependencies and cleanup diagnostics (#155292)
  perf(test): prepare worktree GC child runtime (#155928)
  fix(ui): open browser cards after delayed panel renders (#153253)
  fix(update): retain the running updater by hard link instead of copying the package (#155977)
  feat(decisions): add explicit evaluation and Labs opt-in foundation (#155134)
  fix(state): preserve lifecycle custody across worker dispatch
  improve: reuse shared tooling fixtures and defer legacy updater proof (#155731)
  improve(ui): reduce real-Gateway test preparation (#155979)
  perf(state): move session RPC SQL off the Gateway main thread (#155740)
  docs(freebsd): explain native Codex runtime limits (#155980)
  fix(qa): count Code Mode nested tool activity as transcript tool evidence (#155976)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 23, 2026
@roboclaw-bot roboclaw-bot mentioned this pull request Sep 24, 2026
2 of 8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XS 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