fix(cli): report arg errors on stdout as JSON for machine formats (closes #315)#318
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…oses #315) An argparse error printed to stderr and left stdout empty, so an agent parsing stdout saw "no results" instead of an error — the silent-wrong class of #293/#300. A _StdoutErrorParser now emits {"s":"error",...} on stdout for machine formats (json/compact/ai/sarif/...) while keeping the friendly stderr message for humans. Found by dogfooding: `search . --mode symbol execute` (the workspace-positional form other umbrellas accept) returned zero bytes on stdout. Exposed three vacuous tests in test_hybrid_engine: they invoked pre-#195 forms (`impact X <ws>`, the dropped `dead-code <ws>`) that always errored, and passed only because the error went to stderr and their `if idx >= 0` guard skipped the assert. Fixed to valid post-#195 umbrella invocations that actually assert confidence — three vacuous tests become three real ones. Added timeout=60 to every subprocess in the file so a hang (cf #303) fails fast instead of running to the 6h ceiling. Verified: trap case now emits stdout JSON error; human mode unchanged; valid calls unaffected; 4 new CLI-error tests; full suite 19 = 19 on main. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
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.



Closes #315. Found by dogfooding (north-star #279).
Masalah
argparse error → stderr, stdout kosong. Agent yang parse stdout dapat nol byte = simpul "tak ada hasil", bukan error. Silent-wrong, kelas #293/#300.
Fix
_StdoutErrorParseremit{"s":"error",...}ke stdout untuk machine format (json/compact/ai/sarif/…); human mode tetap stderr ramah. Terapkan ke main parser + subparsers.Bonus: 3 test vacuous ter-ekspos & diperbaiki
Perubahan ini mengungkap 3 test di
test_hybrid_engineyang tak pernah menguji apapun: mereka memakai invocation pra-#195 (impact X <ws>,dead-code <ws>yang sudah di-drop) yang selalu error, dan lolos hanya karena error ke stderr + guardif idx >= 0melewati assert. Diperbaiki ke invocation umbrella valid yang benar-benar assert confidence — 3 vacuous jadi 3 real. Plustimeout=60ke SEMUA subprocess di file itu, jadi hang (cf #303) gagal cepat, bukan 6 jam.Verifikasi (dijalankan)
timeout, disiplin fix(ci): test suite hangs on CI and burns the full 6h limit — CodeLens CI has not gone green in 60+ runs, no timeout-minutes anywhere #303).Ini agent-ergonomics: agent selalu bisa bedakan error vs empty dari stdout.
🤖 Generated with Claude Code