Skip to content

test: isolate and clean temporary test roots - #1099

Open
hxy91819 wants to merge 2 commits into
mainfrom
codex/disk-full-incident
Open

test: isolate and clean temporary test roots#1099
hxy91819 wants to merge 2 commits into
mainfrom
codex/disk-full-incident

Conversation

@hxy91819

@hxy91819 hxy91819 commented Aug 10, 2026

Copy link
Copy Markdown
Member

Summary

Repeated test runs can leave fixture directories behind in the shared system temporary directory. Some fixtures intentionally contain non-regular files such as FIFOs, which can also cause content-inspecting host cleanup tools to block indefinitely.

This change keeps the FIFO safety coverage while tightening the test lifecycle:

  • track and remove validation fixtures after each test
  • run standard test commands inside a unique per-run temporary root
  • clean the run root after success, assertion failure, and termination signals
  • reap abandoned run roots after a TTL while protecting active concurrent runs with a heartbeat
  • remove roots recursively without opening fixture contents

The tracker follows the established OpenClaw auto-cleanup temp-directory pattern, adapted locally so ClawSweeper does not depend on another repository's test helpers.

Review follow-up

Validated at head a602f2ba67.

  • P2 fixed at the supported test-entry boundary: target-validation is now a canonical run-node-tests.mjs target. Validation fixtures created through the supported narrow-test command inherit the run root, so a SIGKILL, crash, or reboot leaves a clawsweeper-test-run-* root that the existing heartbeat/TTL reaper recognizes. The raw node --test ... target-validation.test.ts command is no longer used as the recommended evidence path.
  • P3 fixed: the Windows CI job no longer passes test/codex-process.test.ts twice; the named target remains the single source of file selection.
  • A new heartbeat-specific unit test was not added because this follow-up does not change heartbeat semantics; the existing lifecycle suite continues to cover stale-root reaping, assertion failure, SIGTERM, and successful cleanup.

Local black-box validation

Linux, Node v24.15.0. Corepack resolved the repository pin to pnpm 11.10.0.

Runner and lifecycle behavior

node --test test/run-node-tests.test.ts test/test-temp-root-runner.test.ts

Result: 10 passed, 0 failed. This covers named-target selection plus successful FIFO cleanup, assertion-failure cleanup, stale-root TTL cleanup, and SIGTERM cleanup through the real CLI runner.

Incident-equivalent FIFO fixture through the canonical target

node scripts/run-node-tests.mjs target-validation --test-concurrency=1 -- \
  --test-name-pattern "workspace preflight rejects non-regular package metadata without blocking"

Result: 1 passed, 0 failed; FIFO behavior completed in 19.75 ms. Matching counts were unchanged:

clawsweeper-test-run-*   0 -> 0
clawsweeper-validation-* 0 -> 0

Repeated full target validation through the canonical target

Executed twice:

node scripts/run-node-tests.mjs target-validation --test-concurrency=1 -- \
  --test-reporter=tap

Results:

  • run 1: 198 passed, 3 skipped, 0 failed; 133.8 s test duration / 134 s wall clock
  • run 2: 198 passed, 3 skipped, 0 failed; 131.6 s test duration / 131 s wall clock
  • clawsweeper-test-run-*: 0 -> 0 -> 0
  • clawsweeper-validation-*: 0 -> 0 -> 0
  • no run root or validation fixture remained after either run

Repository checks

  • corepack pnpm run check: static checks, formatting, builds, lint, and changed coverage passed; the final full-coverage run failed only in three test/review-blob-hydration.test.ts partial-clone hydration cases, which returned hydrated: false / blobs: 0 in this environment. The same failures reproduce when that file is run directly outside the new runner; this PR does not modify that test or hydration code. The current-head hosted pnpm check passed: https://github.com/openclaw/clawsweeper/actions/runs/31464912192/job/93695706262.
  • focused autoreview before commit: clean; TruffleHog clean
  • branch autoreview against origin/main after commit: clean; TruffleHog clean

Scope boundary

This change affects only test fixture and test-runner lifecycle. It does not change OpenClaw Bay state, queues, sweep workflows, publication behavior, or dashboard contracts. It does not downgrade pnpm and does not delete host-level pnpm, npm, or Docker caches.

@hxy91819
hxy91819 requested a review from a team as a code owner August 10, 2026 15:27
@clawsweeper

clawsweeper Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 10, 2026
@clawsweeper

clawsweeper Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 5:02 AM ET / 09:02 UTC.

ClawSweeper review

What this changes

The PR isolates named Node test runs in a per-run temporary root, removes that root after completion or signals, reaps stale roots, and converts validation-test fixtures to automatic cleanup.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open for maintainer handling: this MEMBER-authored PR remains a coherent, unmerged test-lifecycle change, but GitHub reports a dirty merge state. Current main still has the pre-isolation test runner, so the central change is not already implemented there; rebase and refresh the exact-head proof before landing.

Priority: P3
Reviewed head: a602f2ba67f9db0b25c604324cacd307a1075ed8
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is coherent and accompanied by useful lifecycle evidence, with merge readiness limited by the unresolved dirty merge state rather than an identified code defect.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored PR is exempt from the external-contributor proof gate; nevertheless, the reviewed body supplies head-specific real CLI evidence for FIFO, assertion-failure, stale-root, SIGTERM, and repeated canonical validation cleanup. That evidence must be refreshed after rebase because GitHub reports a dirty merge state.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored PR is exempt from the external-contributor proof gate; nevertheless, the reviewed body supplies head-specific real CLI evidence for FIFO, assertion-failure, stale-root, SIGTERM, and repeated canonical validation cleanup. That evidence must be refreshed after rebase because GitHub reports a dirty merge state.
Evidence reviewed 6 items Current-main comparison: The fetched current-main runner still uses the earlier direct child-process invocation and has no per-run temporary-root lifecycle; the proposed runner isolation is therefore not already on main.
Introduced implementation: The pinned PR delta changes the runner, its lifecycle tests, validation-fixture cleanup, package command routing, and the Windows CI invocation.
Behavior evidence supplied at the reviewed head: The PR body documents a real CLI lifecycle run, FIFO cleanup, stale-root cleanup, SIGTERM cleanup, and two canonical target-validation runs at the reviewed head; it also records no OpenClaw Bay impact.
Findings None None.
Security None None.

How this fits together

ClawSweeper’s Node test runner starts unit and repair tests that validate automation and repair-lane behavior. Named commands enter the runner, which launches child test processes that create temporary filesystem fixtures and feeds their result back to CI or local validation.

flowchart LR
  A[Named test command] --> B[Test runner]
  B --> C[Per-run temporary root]
  C --> D[Node test process]
  D --> E[Temporary fixtures]
  D --> F[Exit or termination signal]
  F --> G[Cleanup and stale-root reaper]
  G --> H[Clean temporary area]
Loading

Decision needed

Question Recommendation
Should this MEMBER-authored test-runner cleanup be rebased onto current main and revalidated as a landing candidate? Rebase and refresh proof: Resolve the current-main conflicts, then rerun the lifecycle and canonical target-validation proof against the resulting head.

Why: The patch is coherent, but the dirty merge state prevents this review from determining the behavior of the resolved merge, and repository policy reserves maintainer-authored work for explicit judgment.

Before merge

  • Resolve merge risk (P1) - Merging cannot currently be evaluated as the tested branch because GitHub reports a dirty merge state; conflict resolution could alter the runner or validation-fixture behavior.
  • Complete next step (P2) - No discrete repair finding was identified; a maintainer must decide whether to rebase and retain this MEMBER-authored change, then refresh proof on the resolved branch.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch scope 8 files affected; 342 added, 111 removed The change spans the shared test runner, CI command routing, and high-volume validation fixtures, so the resolved merge needs focused lifecycle proof.

Merge-risk options

Maintainer options:

  1. Rebase and revalidate the resolved runner (recommended)
    Resolve the dirty merge state and repeat the documented FIFO, signal, stale-root, and canonical validation-target proof on the resulting head before merge.

Technical review

Best possible solution:

Rebase the focused test-lifecycle change onto current main, preserve the per-run cleanup contract, and refresh the documented lifecycle proof against the resolved head before merge.

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

Yes, source and the submitted lifecycle fixtures define a focused reproduction path for temporary-root cleanup, but no new execution was performed in this read-only review and the current merge result is unavailable.

Is this the best way to solve the issue?

Unclear until rebase: isolating the shared runner and using per-test cleanup is a maintainable direction, but the dirty merge must be resolved before the exact landing behavior can be confirmed.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P3: This is test and CI hygiene with no demonstrated production-user regression.
  • merge-risk: 🚨 automation: The PR changes the shared Node test command and a Windows CI invocation, so a resolved merge could affect validation automation despite passing checks on the old base.
  • 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 MEMBER-authored PR is exempt from the external-contributor proof gate; nevertheless, the reviewed body supplies head-specific real CLI evidence for FIFO, assertion-failure, stale-root, SIGTERM, and repeated canonical validation cleanup. That evidence must be refreshed after rebase because GitHub reports a dirty merge state.

Evidence

What I checked:

  • Current-main comparison: The fetched current-main runner still uses the earlier direct child-process invocation and has no per-run temporary-root lifecycle; the proposed runner isolation is therefore not already on main. (scripts/run-node-tests.mjs:132, fa535d54a032)
  • Introduced implementation: The pinned PR delta changes the runner, its lifecycle tests, validation-fixture cleanup, package command routing, and the Windows CI invocation. (scripts/run-node-tests.mjs:144, a602f2ba67f9)
  • Behavior evidence supplied at the reviewed head: The PR body documents a real CLI lifecycle run, FIFO cleanup, stale-root cleanup, SIGTERM cleanup, and two canonical target-validation runs at the reviewed head; it also records no OpenClaw Bay impact. (test/test-temp-root-runner.test.ts:12, a602f2ba67f9)
  • Current merge state: GitHub reports the PR as dirty, so the supplied old-base proof cannot establish behavior of the actual merged result until the branch is rebased and re-reviewed.
  • Feature history: The runner’s earlier implementation dates to the dedicated heavy-runner commit; subsequent repair-validation maintenance is concentrated in the same area. The PR’s two commits are branch-only and are not used for historical ownership attribution. (scripts/run-node-tests.mjs:20, 6d5ce41fc489)
  • Repository policy: The full target policy requires focused behavior proof and a fresh review for the current head before landing code-bearing changes; it also treats maintainer-authored items as non-closeable. (AGENTS.md:58, a602f2ba67f9)

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.

  • Rebase onto current main and update the lifecycle proof for the resolved head.

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 (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-10T15:50:37.034Z sha 1aa53a6 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-11T00:28:19.431Z sha 1aa53a6 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-11T06:29:52.041Z sha a602f2b :: found issues before merge. :: [P2] Refresh proof for the latest runner invocation
  • reviewed 2026-08-11T06:36:47.348Z sha a602f2b :: needs maintainer review before merge. :: none
  • reviewed 2026-08-11T12:11:07.285Z sha a602f2b :: needs maintainer review before merge. :: none
  • reviewed 2026-08-12T06:24:31.715Z sha a602f2b :: needs maintainer review before merge. :: none
  • reviewed 2026-08-12T23:32:24.400Z sha a602f2b :: needs maintainer review before merge. :: none
  • reviewed 2026-08-23T15:00:03.905Z sha a602f2b :: needs maintainer review before merge. :: none

@hxy91819
hxy91819 force-pushed the codex/disk-full-incident branch from 4b99634 to 1aa53a6 Compare August 10, 2026 15:46
@hxy91819
hxy91819 changed the base branch from feature/automerge-stable-red-proof to main August 10, 2026 15:46
@clawsweeper clawsweeper Bot added 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. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 10, 2026
@hxy91819

Copy link
Copy Markdown
Member Author

Local black-box validation completed against commit 1aa53a6a09.

Environment:

  • Linux, Node v24.15.0
  • Corepack resolved the repository pin to pnpm 11.10.0

Evidence:

  1. Lifecycle and runner behavior

    Command:

    node --test test/run-node-tests.test.ts test/test-temp-root-runner.test.ts
    

    Result: 10 passed, 0 failed. This exercises successful FIFO cleanup, assertion-failure cleanup, stale-root TTL cleanup, and SIGTERM cleanup through the real CLI runner. Matching run-root and validation-directory counts were unchanged before and after.

  2. Incident-equivalent FIFO fixture

    Command:

    node --test --test-name-pattern "workspace preflight rejects non-regular package metadata without blocking" test/repair/target-validation.test.ts
    

    Result: 1 passed, 0 failed. The FIFO preflight itself completed in 28.8 ms, below its 1-second behavior bound, and left no matching validation directory behind.

  3. Repeated full target-validation runs

    Command, executed twice:

    node --test --test-reporter=tap test/repair/target-validation.test.ts
    

    Results:

    • run 1: 198 passed, 3 skipped, 0 failed; 132.9 s
    • run 2: 198 passed, 3 skipped, 0 failed; 130.6 s
    • the total count of matching top-level ClawSweeper temporary directories was identical before and after each run
    • no clawsweeper-validation-* directory remained after either run

No pre-existing historical temporary directories were deleted during this validation.

The PR CI pnpm check also passed: https://github.com/openclaw/clawsweeper/actions/runs/31405434604/job/93510465585

steipete added a commit that referenced this pull request Aug 10, 2026
…ck finalization (#1109)

Three repair lanes rolled up PR status checks independently, and the
finalizer's copy had a live bug: it processed every check entry instead of
deduplicating to the newest run per check identity, so an older failed run of
a re-run check remained a blocker after the newer run succeeded. The
finalizer's classifications feed the published repair queue via
repair-publish-results, making stale failures veto finalization.

All three lanes now share src/repair/status-check-rollup.ts (latest-run
selection, ignored-name parsing, casing and timestamp precedence implemented
once); lane policy stays in the callers.

Proof (docs/proof/status-check-rollup): a red-then-green regression test, and
a real-payload production-boundary trace -- the identical real 26-entry check
payload from PR #1099 classified by both implementations: pre-change code
reports two stale CANCELLED blockers, this head reports zero, and the real
report-only finalizer confirms needs_checks=0. Verified in a Docker-backed
Crabbox local-container with committed provenance.

Automation-risk disposition: the newest run of a check identity is its
current state (the rule the router and post-flight lanes already applied);
blast radius is finalizer classifications in the published repair queue;
rollback is a revert restoring per-entry processing.
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Aug 11, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed 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. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 11, 2026
@clawsweeper clawsweeper Bot removed the proof: sufficient Contributor real behavior proof is sufficient. label Aug 12, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 23, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant