Skip to content

improve(test): speed up Crabbox staging recovery checks - #188561

Merged
roboclaw-bot merged 1 commit into
mainfrom
test-health/crabbox-staging
Oct 30, 2026
Merged

roboclaw-bot merged 1 commit into
mainfrom
test-health/crabbox-staging

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Crabbox staging recovery tests repeatedly load the source runtime even though their invocation has already prepared that runtime.

User Impact

Faster focused test feedback for developers: median wall time falls from 107.29s to 85.37s, saving 21.92s (20.4%) in the same capped container. No user-visible product behavior changes.

Why This Change Was Made

Reuse the existing preparedScriptWrapperEnv helper and wrapper entrypoint declaration. The public .mjs wrapper, source module identity, managed-child supervision, native receipts, SQLite locks, real lsof custody checks, source witnesses, and teardown remain exercised. Resolve the immutable capsule URL once and remove three unused fixture fields.

No production code or shared helper changes. All 40 behavioral cases and assertions remain. This is separate from the already-landed wrapper fixture-copy change in #188403.

Evidence

All six whole-file runs passed 40/40 cases. Same command, source snapshot, frozen dependencies, toolchain, container, resource caps, and warmed compiler-output cache before and after:

timeout 600 /usr/bin/time -v pnpm test test/scripts/crabbox-staging.test.ts --maxWorkers=1 --reporter=verbose
Run Wall (s) Vitest (s) User CPU (s) System CPU (s) Peak RSS (MiB)
Before 1 107.29 103.68 85.86 23.47 507.5
Before 2 93.30 90.58 82.90 19.52 613.1
Before 3 115.70 112.57 89.88 22.43 583.5
After 1 76.76 73.61 74.63 18.49 590.3
After 2 88.63 83.19 77.02 20.28 601.8
After 3 85.37 81.08 74.35 19.29 591.1

Median Vitest duration: 103.68s → 81.08s. Median total CPU: 109.33s → 93.64s (14.4% lower). Median peak RSS: 583.5 → 591.1 MiB (slightly higher; no memory-saving claim).

Environment, profile, coverage, and limitations
  • Rootless Podman container 22dd7c73db8d, labels loop=test-health, lane=crabbox-staging, 4 CPUs / 8 GiB, private PID/mount namespaces, default isolated networking, no published ports, no real home/state/credential/socket mounts. Container memory events report zero OOMs.
  • Official node:24.22.1-bookworm base image ID sha256:739f342b809d803f7351c2825e9bb6eb31ace41d16373f2ff3048270261d0d66; Node 24.22.1, pnpm 12.15.0, Git 2.53.0, lsof 4.95.0-1, repository-pinned Bun fork. Git source archive SHA-256: 5818bd7d80b061bbbdfec8a433d609dc8818a05991f731ffc4a561e2ca18c653.
  • Private ordinary Git snapshot verified against source tree 6dfcb4cfbad19296ec97b743d7510f40b8908d65 at original head 2eef065f0f89960d0aaebfc64647386715cc9abe; its dependencies were installed with pnpm install --frozen-lockfile. Cache environment: OPENCLAW_VITEST_FS_MODULE_CACHE_PATH=/proof/vitest-cache; import-duration instrumentation enabled in all six runs.
  • Compiler preparation already shared its output; this change adds no compiler or cache. Import self/total seconds: before 4.52/6.09, 3.06/4.13, 11.16/12.06; after 3.31/4.39, 3.31/4.43, 3.83/4.87. Timing variation is visible in the three-run results.
  • Per-case median profile: preparation callbacks/additional Git workspaces 17.855s → 13.443s; independent retained refs/dirty bytes/modes/symlinks/deletions 6.876s → 4.864s; claim-bound stages/changed namespaces 7.093s → 5.319s.
  • Failed attempts retained separately and excluded from these measurements: native host 21 passed / 19 failed because lsof could not inspect host mounts; initial container with Git 2.39.5 28 passed / 12 failed because that Git lacks the witness owner's --no-lazy-fetch flag. The isolated namespace and pinned Git corrected those setup gaps without filtering lsof or changing custody admission.
  • Linux container measurements only; no CI or native-host speedup extrapolation. PR CI supplies broad proof; exact-head CI runtime for this change is not yet available.
  • Production LOC 0; shared helper LOC 0; test LOC -1 (8 added / 9 removed). No behavioral deletions, so no replacement coverage map is needed. All 40 target cases remain at their original owning boundary.
  • Existing allocation credit 17,813 is unchanged. Scalar 6,295,757 → 6,284,797, giving exact effective ceiling 6,302,610 tracked test LF bytes. No budget or allocation growth.
  • pr-simplify completed: existing owner/helper reuse, unused fixture surface removed, no new production seams.

Focused verification passed:

  • 149/149 tests across source-capsule, all eight staging sibling files, and the public direct-run entrypoint file.
  • Root scripts test typecheck; scoped lint and format; test-line, line-cap, timeout-race and mock-export ratchets; git diff --check.

Fresh isolated Codex autoreview of the complete local candidate against 2eef065f0f89960d0aaebfc64647386715cc9abe: P0–P2 scoped-clean, no findings. Full target-file and owner context supplied; static review did not rerun the implementation-agent measurements. Helper source receipt: ea4d3415094d50a670f28a1ee092e928a9dbcf7327103014c3a9f909d9a6ef17.

Credit

Requested by Peter Steinberger (@steipete) for the test-health campaign; human co-author credit is retained in the commit.

Work sessions

@clawsweeper

clawsweeper Bot commented Oct 30, 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.

@roboclaw-bot
roboclaw-bot marked this pull request as ready for review October 30, 2026 17:24
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR reuses the prepared Crabbox wrapper runtime in staging recovery tests and lowers the test-line ceiling.

Example: A developer runs the Crabbox staging recovery suite in the reported Linux container.

  • Before: Wrapper subprocesses reload the source runtime; reported median suite duration is 107.29 seconds.
  • After: Wrapper subprocesses reuse prepared modules; reported median duration is 85.37 seconds with all 40 cases passing.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, correct test optimization with reported comparative measurements; proof remains suite-based rather than an independently observed shipped-product run.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored test-only PR is outside the ordinary product proof gate; its body supplies whole-suite before/after measurements and passing recovery and sibling coverage, which were inspected but not rerun.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: Developers wait for repeated source-runtime loading during focused Crabbox staging recovery checks.
Reason: The maintainer-authored direction is established, the reported measurements show useful focused-suite savings, and the implementation preserves existing behavioral coverage.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it is a focused, maintainer-directed test optimization that preserves recovery coverage, with no actionable introduced defect found.

Priority: P3
Reviewed head: 41605a397eafd57ee36ca0726f455ea832c1df38

Before merge

None.

Findings

None.

Agent review details

How this fits together

The staging recovery suite creates isolated Git repositories and abandoned source capsules, invokes the public Crabbox wrapper, and checks recovery decisions, retained source, claims, diagnostics, and child cleanup.

flowchart LR
  A[Staging recovery tests] --> B[Prepared wrapper environment]
  B --> C[Public Crabbox wrapper]
  C --> D[Prepared staging modules]
  D --> E[Git witnesses and native claims]
  D --> F[Recovery result and retained files]
Loading

Technical review

Best possible solution:

Reuse the existing prepared-wrapper owner while retaining the public launcher, recovery assertions, process supervision, and exact shrink-only ceiling.

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

This is a test-performance improvement rather than a product bug; the supplied comparisons exercise the changed suite, and no target code was executed during this read-only review.

Is this the best way to solve the issue?

The change removes repeated source-runtime loading through an existing helper without adding a cache, production seam, or competing owner; the unused fixture fields have no remaining consumers.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Prepared subprocess runtime and public wrapper identity keeps the original intent (2a911a7: Keep cold compilation outside test deadlines while retaining native process boundaries; test(tooling): prepare Crabbox wrapper before child deadlines #158086 subsequently established the prepared-wrapper mapping reused here.)
  • Recovery fixture surface and checks keeps the original intent (d5b46df: Exercise abandoned staging recovery through the real producer and public wrapper, protecting claims, source witnesses, diagnostics, and unsettled writers.)
  • Test-line scalar keeps the original intent (cf448bc: Lower the scalar to the measured tracked total without increasing allocations; this PR continues the shrink-only ratchet.)
  • Shared prepared-wrapper helper history keeps the original intent (unknown: Local git log -S and blame could not read an unavailable historical helper blob; the merged rationale in test(tooling): prepare Crabbox wrapper before child deadlines #158086 independently establishes the intended wrapper preparation contract.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit c5b5d5a adds test/scripts/crabbox-staging.test.ts:232 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c5b5d5ac952f; files: test/scripts/crabbox-staging.test.ts)
  • Shakker: Raw commit d5b46df adds test/scripts/crabbox-staging.test.ts:348 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d5b46dfea58a; files: test/scripts/crabbox-staging.test.ts)
  • Vincent Koc: Raw commit 28f8cab adds test/scripts/crabbox-staging.test.ts:1700 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 28f8cab70da1; files: test/scripts/crabbox-staging.test.ts)

PR surface

Tests -1, Other 0. Total -1 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 8 9 -1
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 1 0
Total 2 9 10 -1

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is a developer test-feedback improvement with no production behavior change.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 30, 2026, 1:41 PM ET / 17:41 UTC.

@roboclaw-bot
roboclaw-bot merged commit 9f56370 into main Oct 30, 2026
157 checks passed
@roboclaw-bot
roboclaw-bot deleted the test-health/crabbox-staging branch October 30, 2026 18:21
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

steipete added a commit that referenced this pull request Oct 30, 2026
Normalize the shared scalar to the native census total minus all existing named allocations. Preserve 152 grants totaling 19,943 lines and zero headroom. Correct the stale measurement from #188561 without changing test-growth policy.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 31, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 31, 2026
Normalize the shared scalar to the native census total minus all existing named allocations. Preserve 152 grants totaling 19,943 lines and zero headroom. Correct the stale measurement from openclaw#188561 without changing test-growth policy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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