Repository navigation
fix(ai): preserve stdout errors and exit diagnostics - #1342
Merged
Merged
Conversation
- Keep stderr as the primary AI failure reason and use stdout when the CLI reports its error there. - Fall back to the nonzero exit code or termination signal when both captured streams contain no diagnostic text. - Preserve successful output, timeout and spawn-error behavior; update bilingual knowledge guidance and the wiki reference. - Verify 23 client tests plus real built-CLI OpenClaw import/deep-enrichment with a stdout-only provider failure, type checking and lint.
|
No findings in the specified PR diff. The change preserves stderr priority, falls back to stdout, and reports the exit code or termination signal when both streams are empty. Regression tests cover these cases. The PR description satisfies the testing requirement: it records a passing real built-CLI E2E run covering the stdout-only failure. Additional provider/agent coverage is not required. Review was read-only; I did not run, build, or install anything from the PR. |
28 of 48 tasks
This was referenced Oct 23, 2026
jeff-r2026
approved these changes
Oct 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
An AI CLI that reports failure on stdout surfaced as an empty 'AI call failed:' message because the client read stderr only. Preserve stderr priority, fall back to stdout, and report the exit code or termination signal when both streams are empty.
Type of Change
Test Plan
npx tsc --noEmitnpm run lintnpm run buildAdded behavioral regression coverage
Entire unit suite green (baseline failures documented below)
npx vitest run src/__tests__/ai-client.test.ts src/__tests__/ai-client-openclaw.test.ts: 23 passed. New cases cover stdout-only errors, stderr priority, whitespace-only streams and signal termination; three fail on unchanged main.Real built CLI: after
npm run build,openclaw-ai-import.test.tsthrough the E2E config passes: an isolated OpenClaw executable imports code successfully, then a stdout-only provider failure remains visible through the real deep-enrich command.Broader regression record: a full combined runtime/test snapshot of these five fixes on
main83f6d1dbrannpx vitest run --maxWorkers=8: 12,266 passed, 36 skipped, 4 failed across 502 files. Two failures were Pi normal-file diagnostic labels, subsequently corrected; the final combined rerun ofinstruction-targets.test.tsanduser-rules-files.test.tspasses 373/373, including both regressions. The other two are existingsubmodule-checkout.test.tsempty legacy Claude/Codex settings cases: a separate clean83f6d1dbworktree reproduces exactly 24 passed / 2 failed on Apple Git 2.50.1 (missinghook.teamai-post-checkout.command). They are not hidden or skipped here.The final combined snapshot passes type checking, lint and build. Four focused real built-CLI files pass 14 tests on the updated main; the final Pi/ZCode integration rerun passes 2/2 after the diagnostic-label correction. An earlier broader run of those four E2E files passed 56/56.
Local verification used isolated HOME directories and local Git remotes on macOS / Node 22.22.1. Additional live agent, native Windows and GitLab/GitHub provider combinations were not run locally.
Related Issues
Related #1221: addresses stderr-only AI failure reporting. OpenClaw session retention is a separate finding and is not changed here.
Notes for Reviewers
Successful output, timeout handling, spawn errors, CLI selection and parallel task behavior keep their existing contracts. English/Chinese knowledge docs and the wiki reference explain the diagnostic fallback.