Skip to content

fix(test): execute CLI fixture preloads on Node and Bun - #152076

Merged
steipete merged 1 commit into
mainfrom
codex/cli-json-runtime-preloads
Sep 18, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/cli-json-runtime-preloads

Conversation

@steipete

@steipete steipete commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

CLI JSON tests silently omit their offline and terminal fixtures under Bun because Bun does not load NODE_OPTIONS --import preloads.

User Impact

No production behavior changes. The tests now exercise their intended offline, TTY, and failure conditions with Node or Bun while preserving the selected runtime, permission flags, and output assertions.

Why This Change Was Made

Pass all 18 preload sites as explicit runtime arguments through the existing runBuiltCli helper. This activates the same fixture source on both runtimes and across launcher respawns. The malformed-JSON test checks the selected runtime's exact SyntaxError message while retaining the debug-on/off visibility check. Equivalent ESC/BEL assertions and redundant string escapes satisfy the current linter without changing the tested behavior.

Evidence

  • All 285 tests across all ten CLI JSON files pass under Node 26.8.2 and custom Bun 1.4.3-canary.1+043813609, using a fresh owned private-QA build of the candidate on fixed main d2a5196a2f951b1b100e1f7dec13d548f83aa5f4 (candidate 47911aeff7620632698c51d12f860fa7f9707960).
  • Before/after marker probes prove that the preload executes, including built CLI respawns. The original Bun environment-only path never executed it.
  • Actual child executables, frozen source/artifact hashes, separate caches, and completed cleanup were verified for both runs.
  • The previous CI merge failed on duplicate promisify bindings in three SQLite tests inherited unchanged from main. This identical patch is rebased over main’s correction in fix: preserve model failure causes and worker fallback runtime #152028; this PR does not touch those files. Their complete 81-case source slice passes on Node and v14, and the full core-test type lane passes.
  • Full changed-file checks and fresh independent P0–P2 review pass. Assertions, timeouts, and platform gates are unchanged.

This PR adds no production fallback or dependency and does not claim that Bun enforces Node's permission model.

@clawsweeper

clawsweeper Bot commented Sep 18, 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: M maintainer Maintainer-authored PR labels Sep 18, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 18, 2026
@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 18, 2026, 5:47 PM ET / 21:47 UTC (Revision 4).

ClawSweeper review

What this changes

The PR passes CLI test fixtures directly to Node or Bun and checks malformed-JSON diagnostics against the selected runtime’s error message.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused test-harness repair absent from current main and the latest release. No introduced correctness or security defects were found; the prior review contains no outstanding findings.

Priority: P2
Reviewed head: 47911aeff7620632698c51d12f860fa7f9707960

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair preserves existing contracts and has relevant reported runtime validation, with no actionable findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored test repair. The body reports fixture execution through the built CLI and respawns on Node and Bun; no production owner changes, and those runs were not independently executed here.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored test repair. The body reports fixture execution through the built CLI and respawns on Node and Bun; no production owner changes, and those runs were not independently executed here.
Evidence reviewed 7 items Introduced change and complete cutover: Reviewed the pinned merge-base-to-head diff and all affected test modules. All 18 preload sites now pass explicit runtime arguments through the existing helper; its executable, environment handling, timeout, and output capture remain intact.
Still necessary on current main: Fetched main still launches the entrypoint without an explicit runtime-argument option, leaving fixtures dependent on NODE_OPTIONS.
Latest-release comparison: The supplied latest release, v2026.9.4, also contains the old helper without execArgv support.
Findings None None.
Security None None.

How this fits together

The CLI test harness launches the built OpenClaw command with isolated test inputs and captures its output. Preloaded fixtures simulate offline failures and terminal behavior before the command runs.

flowchart LR
  A[Test scenarios] --> B[Shared CLI test helper]
  B --> C[Runtime arguments and isolated environment]
  C --> D[Node or Bun loads fixtures]
  D --> E[Built CLI and launcher respawns]
  E --> F[Output and exit assertions]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +86. Total +86 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 10 220 134 +86
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 220 134 +86

Review metrics

Metric Value Why it matters
Fixture cutover 18 preload sites use one shared helper The migration covers every preload in this CLI suite without introducing a competing launch path.

Technical review

Best possible solution:

Keep fixture loading in the shared test helper while preserving runtime selection, isolation, permission flags, and observable output assertions.

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

Yes: comparing preload markers in the same built CLI invocation under Node and Bun isolates the reported failure. The PR reports that comparison; this read-only review verified the source path but did not execute it.

Is this the best way to solve the issue?

Yes. Passing runtime arguments through the existing helper fixes fixture delivery at its owner, and deriving the parser diagnostic preserves the debug-visibility contract across runtimes.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This repairs meaningful CLI test coverage under Bun with no production behavior change.
  • 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 external-contributor proof gate does not apply to this MEMBER-authored test repair. The body reports fixture execution through the built CLI and respawns on Node and Bun; no production owner changes, and those runs were not independently executed here.

Evidence

What I checked:

  • Introduced change and complete cutover: Reviewed the pinned merge-base-to-head diff and all affected test modules. All 18 preload sites now pass explicit runtime arguments through the existing helper; its executable, environment handling, timeout, and output capture remain intact. (test/cli-json-stdout.test-support.ts:23, 47911aeff762)
  • Still necessary on current main: Fetched main still launches the entrypoint without an explicit runtime-argument option, leaving fixtures dependent on NODE_OPTIONS. (test/cli-json-stdout.test-support.ts:23, 8ef68bbfb0d1)
  • Latest-release comparison: The supplied latest release, v2026.9.4, also contains the old helper without execArgv support. (test/cli-json-stdout.test-support.ts:23, 3a9d69db306c)
  • Respawn and diagnostic contracts: Launcher compile-cache respawns preserve process.execArgv, as does the CLI respawn planner. The malformed-response owner uses JSON.parse and retains its cause, making the selected runtime’s SyntaxError message an appropriate independent expectation. (test/cli-json-stdout.skills.e2e.test.ts:175, 47911aeff762)
  • Existing helper history: Current-main blame and path history identify eaaa6da. GitHub’s commit response identifies steipete and shows the helper as added against recorded parent 2625d72; this provides routing context independent of the proposed branch. (test/cli-json-stdout.test-support.ts:4, eaaa6da895f6)
  • Reported validation and prior review: The captured PR body reports 285 passing cases under Node 26.8.2 and custom Bun 1.4.3-canary.1+043813609, plus before/after preload markers through built CLI respawns at the reviewed head. These are contributor-reported results, not reviewer executions. The previous completed review lists no findings or published rank-up moves. (47911aeff762)

Likely related people:

  • Peter Steinberger: Raw commit eaaa6da adds test/cli-json-stdout.test-support.ts:4 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: eaaa6da895f6; files: test/cli-json-stdout.test-support.ts)

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 (3 earlier review cycles)
  • reviewed 2026-09-18T19:02:41.138Z sha 8ee7a1d :: blocked before merge. :: none
  • reviewed 2026-09-18T20:16:20.238Z sha 5021174 :: needs changes before merge. :: none
  • reviewed 2026-09-18T20:25:14.260Z sha 5021174 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/cli-json-runtime-preloads branch from 8ee7a1d to 5021174 Compare September 18, 2026 20:08
@steipete
steipete marked this pull request as ready for review September 18, 2026 20:20
@steipete
steipete force-pushed the codex/cli-json-runtime-preloads branch from 5021174 to 47911ae Compare September 18, 2026 21:40
@steipete
steipete merged commit 085e19b into main Sep 18, 2026
142 of 143 checks passed
@steipete
steipete deleted the codex/cli-json-runtime-preloads branch September 18, 2026 22:12
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 18, 2026
…pr-149099-main-20260918

* commit '795e460278d4f8f41545dc8b4a66da1d12defd90': (1902 commits)
  refactor(slack): share Markdown preparation (#149129)
  fix(tooling): release completed PR operations with exited loaders (#152209)
  fix(release): allow stable npm bootstrap under an operator soak waiver (#152206)
  fix(daemon): avoid false restart timeouts during slow startup (#151387)
  feat: read agent documents from a host-owned workspace (#150584)
  improve(startup): skip redundant single-agent directory checks (#152192)
  test(ui): await board widget readiness before size reports (#152198)
  perf(browser): move dashboard event discovery to SQLite worker (#151952)
  improve(auth): reduce pauses during concurrent credential reads (#152140)
  improve(ui): load older chat history in smaller pages (#152093)
  fix(release): reject incomplete legacy npm install trees (#152186)
  refactor: share current-conversation binding row serialization (#152134)
  test(tooling): preserve Node and terminal fixture ownership under Bun (#152187)
  fix(sqlite): service worker admission through retained path aliases (#152190)
  improve: reduce CPU work for long CLI reasoning streams (#152191)
  chore(ui): refresh control ui locales (#152196)
  test(subagents): align lifecycle retries with durable completion owners (#152184)
  perf(gateway): defer participant maps for owned sessions (#152097)
  refactor(stream): share auxiliary queue overflow handling (#149282)
  fix(test): execute CLI fixture preloads on Node and Bun (#152076)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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