Skip to content

fix(test): preserve subprocess runtime identity - #173446

Merged
steipete merged 1 commit into
mainfrom
steipete/bunfix-census2-1015
Oct 16, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/bunfix-census2-1015

Conversation

@steipete

@steipete steipete commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Subprocess tests lose the runtime they intend to exercise when the development suite runs on Bun.

User Impact

Developers running tests on Bun retain real Node coverage for npm lifecycle handoff, and the nested MCP retention test follows its parent runtime.

Why This Change Was Made

Both changes address test runtime assumptions (bucket 2):

  • src/process/exec.test.ts used process.execPath as a fixture named node and compared the child's version to its parent. Under Bun, that tested Bun while claiming to test Node. Resolve a real Node executable with the existing test helper and assert that npm's lifecycle child uses its canonical executable path. Keep the conflicting PATH sentinel assertion.
  • src/agents/agent-bundle-mcp-retention.test.ts removed every OPENCLAW_VITEST* variable. A Node parent consequently launched default Bun, and an isolated Bun child could stage another runtime. Restore the actual parent runtime and pass its exact Bun executable to the nested run. Keep the shared-worker retention and ordering assertions unchanged.

The npm census timeout did not reproduce in isolation; the incorrect executable fixture was established directly from its setup. The original retention Node comparison visibly selected and staged Bun before its nested watchdog failure. These changes correct those fixtures without asserting that every census timeout had the same cause.

Production LOC: +0 / -0. Test LOC: +9 / -3 (net +6). No timeout increases or runtime skips.

Evidence

Both touched files pass together, with all 34 outer tests passing on each runtime. The retention test also verifies both nested files and their ordering.

env -u OPENCLAW_VITEST_RUNTIME -u OPENCLAW_BUN_PATH -u CI \
  TMPDIR=/private/tmp/oc-census2 \
  OPENCLAW_VITEST_FS_MODULE_CACHE_PATH=/private/tmp/oc-census2/fix-proofs/cache/bun \
  pnpm test src/process/exec.test.ts src/agents/agent-bundle-mcp-retention.test.ts --maxWorkers=1

env -u OPENCLAW_BUN_PATH -u CI OPENCLAW_VITEST_RUNTIME=node \
  TMPDIR=/private/tmp/oc-census2 \
  OPENCLAW_VITEST_FS_MODULE_CACHE_PATH=/private/tmp/oc-census2/fix-proofs/cache/node \
  pnpm test src/process/exec.test.ts src/agents/agent-bundle-mcp-retention.test.ts --maxWorkers=1
Runtime Exec file Retention file Total command wall
Pinned Bun 1.4.3-canary.1+94f8f5ffe 33 passed, 34.51s 1 passed, 170.36s 214.82s
Node v26.11.1 33 passed, 29.49s 1 passed, 179.07s 222.49s

The retention file needs a real nested two-file run to prove shared-worker lifetime; its command wall includes compilation and process startup on a loaded host.

Also passed: oxfmt --check, scoped run-oxlint, test typechecks for agents-root and services, and independent Codex autoreview through P2.

The separate untargeted census ended after 4h29m32s with infrastructure exit 2: 29 of 610 outer shards completed (1,878 passed / 42 failed / 31 skipped files). A tooling fixture timed out and retained an unverified cleanup claim; 581 planned shards were not run. This PR does not claim a green full suite. Other census failures, including the standalone node:vm fork repro, are tracked separately.

Exact-head CI: run 38800328083 completed successfully (8m41s total wall). checks-node-changed passed in 263s and checks-node-changed-boundary in 136s. The native exact-head watcher reported green; superseded check records were excluded.

@clawsweeper

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

@steipete
steipete marked this pull request as ready for review October 15, 2026 20:14
@chatgpt-codex-connector

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

Copy link
Copy Markdown
Contributor

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-16T01:24:58.859016Z d7e2ef6 New commits
ℹ️ 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.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS labels Oct 15, 2026
@clawsweeper clawsweeper Bot added 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. labels Oct 15, 2026
@clawsweeper

clawsweeper Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

The PR resolves a real Node executable for npm lifecycle coverage and preserves the parent runtime in nested MCP retention tests.

Example: Run the subprocess tests under Bun 1.4.3-canary.1+94f8f5ffe.

  • Before: The npm fixture names Bun as node and compares its Node-compatibility version.
  • After: The fixture launches real Node and checks the lifecycle child's executable path.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused patch is correct by source review; validation consists of reported test executions and CI rather than independently inspected runtime artifacts.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored test repair is outside the contributor proof gate; its supplied validation exercises real npm subprocesses and nested Vitest under both runtimes, while this review independently inspected source only.
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 can exercise the wrong runtime while believing they retain Node lifecycle coverage or parent-runtime MCP coverage.
Reason: This maintainer-authored repair restores the tests' stated contracts with a small, focused change.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it corrects two concrete test-fixture runtime mistakes still present on main, with no introduced correctness or security findings.

Priority: P3
Reviewed head: d9f49cc19869a0502a490e24336e4d1bd7a2469d

Before merge

None.

Findings

None.

Agent review details

How this fits together

These developer tests exercise the process execution wrapper and an ordered pair of MCP lifecycle tests; runtime selection enters through executable paths and environment variables, and subprocess results establish the assertions.

flowchart TD
  A[Parent test runtime] --> B[Npm lifecycle fixture]
  A --> C[MCP retention fixture]
  B --> D[Existing Node executable resolver]
  D --> E[Real npm lifecycle child]
  C --> F[Existing Vitest runtime selector]
  F --> G[Ordered shared worker tests]
Loading

Technical review

Best possible solution:

Retain this focused fixture repair through the normal merge workflow.

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

Source inspection establishes both runtime-selection mistakes; no target code was executed, and the PR explicitly avoids attributing unrelated census timeouts to them.

Is this the best way to solve the issue?

The patch repairs fixture inputs at their owners, reuses existing runtime helpers, strengthens executable identity checking, and preserves the original regression contracts.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Npm lifecycle executable fixture keeps the original intent (070b747: Protect explicit private Node handoff against a conflicting system Node; the test later moved into exec.test.ts during consolidation.)
  • Nested MCP retention runtime and fixture custody keeps the original intent (15e2d99: Exercise memory-before-requester ordering in one shared worker; subsequent fixture lifetime custody prevents input deletion before cancelled work settles.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 15e2d99 adds src/agents/agent-bundle-mcp-retention.test.ts:10 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 15e2d991282e; files: src/agents/agent-bundle-mcp-retention.test.ts)
  • Jason (Json): Raw commit 8d9179b adds src/agents/agent-bundle-mcp-retention.test.ts:16 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 8d9179bca949; files: src/agents/agent-bundle-mcp-retention.test.ts)

PR surface

Tests +6. Total +6 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 9 3 +6
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 9 3 +6

Review metrics

Metric Value Why it matters
Production versus test LOC Production +0/-0; tests +9/-3 The small test-only increase reuses existing runtime selection rather than introducing another implementation.

Labels

Label changes:

  • add P3: This improves developer test fidelity without changing shipped runtime behavior.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This improves developer test fidelity without changing shipped runtime behavior.
  • 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 15, 2026, 4:30 PM ET / 20:30 UTC.

@steipete
steipete force-pushed the steipete/bunfix-census2-1015 branch from d9f49cc to d7e2ef6 Compare October 16, 2026 01:22
@steipete
steipete merged commit 22b2747 into main Oct 16, 2026
98 checks passed
@steipete
steipete deleted the steipete/bunfix-census2-1015 branch October 16, 2026 01:39
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Oct 16, 2026
* commit '56c315156f4542f197a2b7f727681ba3f41c21b5': (23 commits)
  fix(ui): remove stale Lit cleanup from model catalog tests
  refactor(tests): consolidate iMessage discovery checks (#173624)
  fix(auto-reply): retire older collect cancellation after admission
  fix(memory): avoid rebuilding initially empty indexes after restart (#173622)
  fix(test): preserve subprocess runtime identity (#173446)
  perf(sessions): batch transcript index reconciliation (#173620)
  fix(gateway): share GitHub options preparation during reconnects (#173589)
  perf(control-ui): open the composer model picker without list-wide work (#173275)
  fix: finish compile-cache cleanup after short CLI commands exit (#173603)
  refactor(ui): finish native shell rendering (#171554)
  fix: preserve standalone CLI profiles and settle Doctor shutdown (#173154)
  refactor: centralize agent memory host typing (#173619)
  fix: camera fallback picker opens away from the attachment button (#173618)
  refactor: deduplicate existing CI runner routing with YAML anchors (#172670)
  fix(ai): preserve multiline Google replies and report malformed streams (#173612)
  refactor(tests): remove duplicate speech policy test (#173606)
  refactor(ui): simplify page rendering and derivations (#173608)
  fix(release): Linux channel promotion fails after a withdrawn Windows companion (#173615)
  fix(update): wait for native Gateway ownership before restarting (#173588)
  test(sessions): admit schema probe fixture writes behind maintenance
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 16, 2026
vincentkoc added a commit that referenced this pull request Oct 16, 2026
* fix(ci): share the iOS screenshot build

* fix(ci): preserve the screenshot artifact container on download

* merge: integrate main for iOS screenshot workflow conflicts

* style(ci): format the combined screenshot evidence changes

* docs(ci): name the combined screenshot capture

* fix(ios): expose screenshot simulator creation errors

* Merge main at 56c3151 to include the UI test cleanup fix

* commit '56c315156f4542f197a2b7f727681ba3f41c21b5': (23 commits)
  fix(ui): remove stale Lit cleanup from model catalog tests
  refactor(tests): consolidate iMessage discovery checks (#173624)
  fix(auto-reply): retire older collect cancellation after admission
  fix(memory): avoid rebuilding initially empty indexes after restart (#173622)
  fix(test): preserve subprocess runtime identity (#173446)
  perf(sessions): batch transcript index reconciliation (#173620)
  fix(gateway): share GitHub options preparation during reconnects (#173589)
  perf(control-ui): open the composer model picker without list-wide work (#173275)
  fix: finish compile-cache cleanup after short CLI commands exit (#173603)
  refactor(ui): finish native shell rendering (#171554)
  fix: preserve standalone CLI profiles and settle Doctor shutdown (#173154)
  refactor: centralize agent memory host typing (#173619)
  fix: camera fallback picker opens away from the attachment button (#173618)
  refactor: deduplicate existing CI runner routing with YAML anchors (#172670)
  fix(ai): preserve multiline Google replies and report malformed streams (#173612)
  refactor(tests): remove duplicate speech policy test (#173606)
  refactor(ui): simplify page rendering and derivations (#173608)
  fix(release): Linux channel promotion fails after a withdrawn Windows companion (#173615)
  fix(update): wait for native Gateway ownership before restarting (#173588)
  test(sessions): admit schema probe fixture writes behind maintenance
  ...

Co-authored-by: Vincent Koc <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
* fix(ci): share the iOS screenshot build

* fix(ci): preserve the screenshot artifact container on download

* merge: integrate main for iOS screenshot workflow conflicts

* style(ci): format the combined screenshot evidence changes

* docs(ci): name the combined screenshot capture

* fix(ios): expose screenshot simulator creation errors

* Merge main at a11e38b to include the UI test cleanup fix

* commit 'a11e38b8bb1eb58aaf392a0eab458dbb47aad30f': (23 commits)
  fix(ui): remove stale Lit cleanup from model catalog tests
  refactor(tests): consolidate iMessage discovery checks (openclaw#173624)
  fix(auto-reply): retire older collect cancellation after admission
  fix(memory): avoid rebuilding initially empty indexes after restart (openclaw#173622)
  fix(test): preserve subprocess runtime identity (openclaw#173446)
  perf(sessions): batch transcript index reconciliation (openclaw#173620)
  fix(gateway): share GitHub options preparation during reconnects (openclaw#173589)
  perf(control-ui): open the composer model picker without list-wide work (openclaw#173275)
  fix: finish compile-cache cleanup after short CLI commands exit (openclaw#173603)
  refactor(ui): finish native shell rendering (openclaw#171554)
  fix: preserve standalone CLI profiles and settle Doctor shutdown (openclaw#173154)
  refactor: centralize agent memory host typing (openclaw#173619)
  fix: camera fallback picker opens away from the attachment button (openclaw#173618)
  refactor: deduplicate existing CI runner routing with YAML anchors (openclaw#172670)
  fix(ai): preserve multiline Google replies and report malformed streams (openclaw#173612)
  refactor(tests): remove duplicate speech policy test (openclaw#173606)
  refactor(ui): simplify page rendering and derivations (openclaw#173608)
  fix(release): Linux channel promotion fails after a withdrawn Windows companion (openclaw#173615)
  fix(update): wait for native Gateway ownership before restarting (openclaw#173588)
  test(sessions): admit schema probe fixture writes behind maintenance
  ...

Co-authored-by: Vincent Koc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling 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