Skip to content

fix(test): preserve managed child fixtures under Bun - #139834

Merged
steipete merged 1 commit into
mainfrom
codex/bun-managed-child-fixtures
Sep 6, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/bun-managed-child-fixtures

Conversation

@steipete

@steipete steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes nine managed-child fixture failures under Bun: eight snapshot cases did not intercept the intended child-process function, and a failed-spawn cleanup attempted to inspect a process that had no PID.

Why This Change Was Made

Use a partial test module mock that preserves real exports, clears each snapshot row's call history, and verifies the expected process-snapshot observation. Attempt rescue cleanup only when a child was actually spawned.

User Impact

No production behavior changes. The existing managed-process lifecycle coverage runs consistently on Node and Bun.

Evidence

  • Original focused Bun proof reproduced nine failures. Final full suite passes 82 tests on each runtime, with one unchanged Linux-only skip.
  • Complete changed-file gate and fresh P0–P2 review pass.
  • Snapshot policy, error diagnostics, process identity, and resource cleanup assertions remain intact.
  • The repository-wide Bun compatibility campaign remains in progress.

@clawsweeper

clawsweeper Bot commented Sep 6, 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 size: S maintainer Maintainer-authored PR labels Sep 6, 2026
@steipete
steipete marked this pull request as ready for review September 6, 2026 06:23
@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 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 2:28 AM ET / 06:28 UTC.

ClawSweeper review

What this changes

Repairs Bun compatibility in managed-child-process tests by preserving real process exports, isolating snapshot stubs, and skipping rescue cleanup for children without a PID.

Merge readiness

✅ Ready for maintainer review

This remains a useful, narrowly scoped fixture repair that is absent from inspected main and the latest release. No blocking patch defect was found; the maintainer-authored, protected PR should remain open for normal landing.

Priority: P3
Reviewed head: 59218a59824e34462deed7fb9d674a178bbf56b9

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused fixture repair with preserved lifecycle assertions, reported cross-runtime validation, and no identified blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored PR changes only fixture interception and rescue cleanup; the external-contributor live-proof gate does not apply, and the reported Node/Bun suite results remain supplemental validation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR changes only fixture interception and rescue cleanup; the external-contributor live-proof gate does not apply, and the reported Node/Bun suite results remain supplemental validation.
Evidence reviewed 8 items Pinned introduced scope: The independently inspected merge-base-to-head diff changes only the test module; production supervision, dependencies, workflows, and configuration are unchanged.
Snapshot and cleanup boundaries: The partial mock retains real spawn and initializes spawnSync with its real implementation. Snapshot rows restore that implementation in finally, retain state assertions, and verify interception. Rescue cleanup now requires a PID; existing launch-failure cases still assert ENOENT, listener restoration, and resource release.
Production owner inspected: The supervisor imports named spawnSync and uses it for Linux thread snapshots after leader exit. Failed or empty snapshots do not certify completion. This establishes the fixture interception boundary without a Codex dependency.
Findings None None.
Security None None.

How this fits together

OpenClaw’s tooling supervises child commands, forwards cancellation, and verifies process-tree cleanup. These tests combine synthetic process snapshots with real child fixtures to check lifecycle outcomes and retained errors.

flowchart TD
 A[Node or Bun test runner] --> B[Managed child fixtures]
 B --> C[Real child commands]
 B --> D[Controlled process snapshots]
 C --> E[Process lifecycle supervisor]
 D --> E
 E --> F[Exit and cleanup assertions]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +6. Total +6 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 37 31 +6
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 37 31 +6

Review metrics

None.

Technical review

Best possible solution:

Keep the repair within the fixture layer while preserving real subprocess execution, cleanup ownership, and original failure diagnostics.

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

Yes for the no-PID cleanup path: source shows the previous guard could call expectProcessPid(undefined). The Bun interception failures are supported by the author’s reported run, but were not independently executed.

Is this the best way to solve the issue?

Yes. A partial module mock addresses the named-import interception boundary while retaining real fixtures, and the PID guard narrowly handles failed spawning without weakening successful-child cleanup.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This repairs test-runtime compatibility without changing shipped product behavior.
  • 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 maintainer-authored PR changes only fixture interception and rescue cleanup; the external-contributor live-proof gate does not apply, and the reported Node/Bun suite results remain supplemental validation.

Label justifications:

  • P3: This repairs test-runtime compatibility without changing shipped product behavior.
  • 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 maintainer-authored PR changes only fixture interception and rescue cleanup; the external-contributor live-proof gate does not apply, and the reported Node/Bun suite results remain supplemental validation.

Evidence

What I checked:

  • Pinned introduced scope: The independently inspected merge-base-to-head diff changes only the test module; production supervision, dependencies, workflows, and configuration are unchanged. (test/scripts/managed-child-process.test.ts:31, 59218a59824e)
  • Snapshot and cleanup boundaries: The partial mock retains real spawn and initializes spawnSync with its real implementation. Snapshot rows restore that implementation in finally, retain state assertions, and verify interception. Rescue cleanup now requires a PID; existing launch-failure cases still assert ENOENT, listener restoration, and resource release. (test/scripts/managed-child-process.test.ts:1459, 59218a59824e)
  • Production owner inspected: The supervisor imports named spawnSync and uses it for Linux thread snapshots after leader exit. Failed or empty snapshots do not certify completion. This establishes the fixture interception boundary without a Codex dependency. (scripts/lib/managed-child-process.mts:259, 59218a59824e)
  • Mock restoration contract: Official Vitest documentation states that mockRestore on vi.fn behaves like mockReset, and vi.fn(implementation) resets to that original implementation: Vitest mock API. This supports retaining real subprocess behavior after each snapshot row.
  • Current-main necessity: Inspected main still uses the default-export spy and syncBuiltinESMExports for the snapshot cases. (test/scripts/managed-child-process.test.ts:712, d5144e4a97a9)
  • Latest release comparison: The supplied latest release, v2026.9.2, also retains syncBuiltinESMExports and the cleanup condition without a PID guard. (test/scripts/managed-child-process.test.ts:1453, 3928bad9badf)

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 d1c77cb into main Sep 6, 2026
172 checks passed
@steipete
steipete deleted the codex/bun-managed-child-fixtures branch September 6, 2026 09:20
@steipete

steipete commented Sep 6, 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 7, 2026
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. 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.

1 participant