Skip to content

fix(runtime): reclaim test scratch after each case - #1329

Merged
aviggiano merged 5 commits into
unstablefrom
codex/fix-runtime-test-scratch-1322
Oct 26, 2026
Merged

aviggiano merged 5 commits into
unstablefrom
codex/fix-runtime-test-scratch-1322

Conversation

@aviggiano

@aviggiano aviggiano commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Reclaim fixtures created by the monolithic runtime.test.ts after each case, including failing cases and after their own teardown hooks. Restore owner write permission on sealed directories before removal without changing hard-linked file modes.
  • Keep the one cached cross-test Smithers fixture until process exit.
  • Run the Node runtime suite inside an owned TMPDIR, preserve scratch while test workers or detached descendants may still use it, and diagnose both ENOSPC and EDQUOT (including Node's Unknown system error -122).

This follows the contributor change in #1320 and addresses the dominant leak reported in #1322. Supporting runtime test files still clean their fixtures at process exit, so #1322 remains open for their per-test cleanup.

Scratch recovery safety

  • The runner records its process group and forwards termination signals to the whole group. A missing or torn group marker prevents stale cleanup.
  • On Linux, stale cleanup requires the recorded group to be gone and a same-UID /proc scan to find no process with this scratch in TMPDIR/TMP/TEMP, cwd, or open file descriptors. The scan checks both the original run path and any claimed reap-* path. Unknown process state retains scratch for later inspection; it never authorizes deletion. Process start ticks distinguish PID reuse for both launchers and active reap-* claimants. The harness passes scratch paths only to processes launched after scratch creation; with this boundary, unreadable /proc data for preexisting daemons can be ignored after checking any readable env, cwd, and descriptors. Unreadable newer processes retain scratch. Zombie processes do not hold scratch. A successful current run keeps its success status when an unrelated process makes the scan uncertain, and prints the retained path for later recovery.
  • Other platforms skip stale auto-recovery. A closed POSIX runner releases current scratch after its group exits; Windows releases it after a successful normal exit. A retained path is printed on stderr for manual cleanup.

Validation

  • Runtime dependency build and test TypeScript compilation passed on unstable b33cb2d.
  • Node scratch and temporary-root tests: 12 passed, including orphan worker, signal forwarding, missing/torn markers, PID reuse, claimed-path retention, hard-link modes, after-hook order, quota diagnostics, and marker-write failure cleanup. Four consecutive wrapper runs passed on the final head.
  • Monolithic Node runtime smoke: 1 passed. Focused Bun adapter contracts: 8 passed. The complete Bun adapter contract run passed 59 with 1 expected skip before the final base rebase.
  • Strict CI diff lint, Prettier, and git diff --check passed. The full runtime suite remains for CI.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; the concurrent cleanup finding is fixed.

Summary

The PR removes test fixtures after each case and runs Node tests inside an owned temporary directory.

  • Runtime test cases release their temporary fixtures after teardown.
  • Node test runs use private scratch and keep it while workers may need it.

Reviews (6) · Last reviewed commit: "fix(runtime): preserve live scratch reap..." · Reviewed by Greptile

@aviggiano
aviggiano requested a review from a team as a code owner October 26, 2026 19:42
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T19:44:41.283676Z 9d32f9f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@aviggiano
aviggiano force-pushed the codex/fix-runtime-test-scratch-1322 branch from 9d32f9f to 3505ff2 Compare October 26, 2026 19:45
Comment thread packages/runtime/test/temporary-root.test.ts
@aviggiano
aviggiano force-pushed the codex/fix-runtime-test-scratch-1322 branch from e3e89da to cba6ced Compare October 26, 2026 20:03
@aviggiano
aviggiano force-pushed the codex/fix-runtime-test-scratch-1322 branch from cba6ced to 1dd4f91 Compare October 26, 2026 20:20
Comment thread packages/runtime/scripts/test-scratch.mjs Outdated
Comment thread packages/runtime/scripts/test-scratch.mjs Outdated
@aviggiano
aviggiano merged commit ee990b2 into unstable Oct 26, 2026
11 of 16 checks passed
@aviggiano
aviggiano deleted the codex/fix-runtime-test-scratch-1322 branch October 26, 2026 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant