Skip to content

fix(cli): report exit codes for silent help-render failures - #187644

Open
ydnmu wants to merge 1 commit into
openclaw:mainfrom
ydnmu:codex/cli-render-exit-code
Open

ydnmu wants to merge 1 commit into
openclaw:mainfrom
ydnmu:codex/cli-render-exit-code

Conversation

@ydnmu

@ydnmu ydnmu commented Oct 29, 2026 •

Copy link
Copy Markdown

Related: #160064

What Problem This Solves

CLI startup metadata failures omit the child exit code when a help renderer exits unsuccessfully without stderr or a signal.

User Impact

Failed build or update preflights now report that exit code, giving users a concrete diagnostic instead of only a generic render failure. This diagnostic change does not fix the original Windows update failure reported in #160064.

Why This Change Was Made

Use the child exit code as the existing error-detail fallback. Stderr still takes precedence over the signal, and the signal over the exit code; timeout, cancellation, and earlier-error precedence remain unchanged.

Evidence

  • Windows x64, Node 24.22.1: node scripts/run-vitest.mjs test/scripts/write-cli-startup-metadata.test.ts --maxWorkers=1 passed 15 tests; 6 POSIX/Linux process-lifecycle tests were skipped on Windows. Test-file time: 720 ms; wrapper wall time: 13.67 s. Hosted CI timing is not yet available.
  • The real-child regression (process.exit(23)) failed on the base because the diagnostic omitted 23, then passed with this fix. It also verifies that failed metadata is not published.
  • Scripts typecheck, a focused projection of the existing root-scripts test typecheck, changed-file lint and format, script erasability, and git diff --check passed.
  • All 12 boundary probes passed for stderr/signal precedence, success, timeout, cancellation, output limits, and spawn/stream errors. These synthetic events do not prove native POSIX process cleanup.
  • The required 18-line allocation exactly covers the new real-child regression; the test-line ratchet passed and the shared scalar is unchanged.
  • Linux/macOS execution and a full build were not run locally. Hosted CI was not run before publication.

Shipped entrypoint capture on Windows x64, Node 24.22.1: disposable checkouts of unchanged upstream parent 74f111a74dbd and PR head f4e74e31eb85 both used the same ignored, injected dist/root-help-proof.js containing export function outputRootHelp() { process.exit(23); }. The generator and all tracked files were unchanged; no in-process metadata API or mocked spawn was used.

# Same command in both checkouts
node --import tsx scripts/write-cli-startup-metadata.ts

# Upstream 74f111a74dbd — generator exit 1
Error: Failed to render bundled root help from root-help-proof.js (elapsed 60ms)

# PR f4e74e31eb85 — generator exit 1
Error: Failed to render bundled root help from root-help-proof.js: exited with code 23 (elapsed 83ms)

Independent child controls exited 23 with empty stdout/stderr and no signal in both checkouts. Both generators exited 1, retained ECLI_STARTUP_METADATA_RENDER / nonzero-exit, and published no dist/cli-startup-metadata.json. This controlled failure proves the entrypoint diagnostic; no full build or original Windows update failure was reproduced.

@clawsweeper

clawsweeper Bot commented Oct 29, 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 scripts Repository scripts size: XS labels Oct 29, 2026
@ydnmu
ydnmu marked this pull request as ready for review October 29, 2026 12:02
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 29, 2026
@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Adds the child exit code to help-render failure messages when neither stderr nor a termination signal is available.

Example: A bundled help renderer exits with code 23 and produces no stderr or signal.

  • Before: Failed to render bundled root help from root-help-proof.js
  • After: Failed to render bundled root help from root-help-proof.js: exited with code 23

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused repair with relevant entry-point proof, a distinct regression, preserved lifecycle behavior, and no open findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The updated body exercises scripts/write-cli-startup-metadata.ts directly on Windows x64 with Node 24.22.1 at the pinned parent and head, using an actual child that exits 23 silently; the head prints the missing exit code and still refuses metadata publication, satisfying the prior review's entry-point request.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A failed build reports which help renderer failed but loses the child's only available failure detail.
Reason: Exposing the existing exit code provides concrete diagnostic value with a narrow change and no new setting or lifecycle machinery.

Merge readiness

✅ Ready for maintainer review

This PR provides a useful, focused diagnostic fix that current main still lacks; the new entry-point capture resolves the previous proof request, and no actionable defects remain.

Priority: P3
Reviewed head: f4e74e31eb856d799e8953337334ea481dedacac

Before merge

None.

Findings

None.

Agent review details

How this fits together

The build-time metadata generator runs help-renderer subprocesses, collects their output, and publishes startup metadata only after successful rendering.

flowchart TD
  A[Build command] --> B[Startup metadata generator]
  B --> C[Help renderer subprocess]
  C --> D[Shared subprocess owner]
  D --> E[Failure diagnostic]
  D --> F[Successful metadata publication]
Loading

Technical review

Best possible solution:

Land the existing fallback-detail change while preserving stderr, signal, and earlier-failure precedence.

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

Current-main source demonstrably drops a silent child's exit code, and the contributor supplies a controlled parent-versus-head entry-point capture; this review executed no target code.

Is this the best way to solve the issue?

The patch is the smallest complete repair: use the exit code in both existing diagnostic fallback sites, retain the current subprocess owner, and add one regression for the lost information.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Help-renderer failure detail and precedence keeps the original intent (4fcd9e1: The merged supervisor repair established command-specific first-failure reporting while cancelling and draining sibling process trees.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Raw commit fb1c32b adds scripts/write-cli-startup-metadata.ts:523 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: fb1c32ba78b2; files: scripts/write-cli-startup-metadata.ts)

PR surface

Tests +18, Other +7. Total +25 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 18 0 +18
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 9 2 +7
Total 3 27 2 +25

Labels

Label changes:

No label changes.

Label justifications:

  • P3: Improves diagnostics for an already-failing build subprocess without changing failure handling or runtime availability.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • 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 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-29T12:18:37.161Z sha f4e74e3 :: needs real behavior proof before merge. :: none

Reviewed October 29, 2026, 10:25 AM ET / 14:25 UTC (Revision 2).

@ydnmu

ydnmu commented Oct 29, 2026

Copy link
Copy Markdown
Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 29, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts 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