fix(cli): preserve Runtime outcomes and explicit JSON errors #6171
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 518 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.374
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #6171"
general
weight: 0.35
me2seeks
Summary
After a rejected sandbox expansion, the model can continue within existing permissions or explain the blocker. Previously Session status reported the Runtime's
completed, but wait/result overrode it with a generic sandbox failure and discarded the final answer. CLI now preserves the Runtime terminal outcome and original errors; tool failures alone do not change the exit code. The obsolete Session tool-retry matcher is removed. A legacy surface that cannot service an approval still denies it and reports that unsupported operation.Errors are brief text on stderr by default. Explicit
--jsonreturns an error on stdout and preserves the original Host message andcodewhen available. Operation failures do not invent a Session status; terminal task failures retainstatus: "failed". JSON errors are no longer duplicated on stderr. Successful status/receipts and pending-interaction JSON are unchanged. No cause classification, automatic retries, model switching, or permission changes are added.Refs #6168. Depends on #6170 (which depends on #6169); base is
refactor/cli-run-interface.Verification
82a7c11c4c: blocking stream errors now retain the created Session ID; the recap child-process harness preserves strict stderr assertions on Node 22.19.0 by disabling runtime ExperimentalWarning only in the test process. Both regressions fail with their prior behavior. 84 affected tests, the real Host integration on Node 22.19.0 and Node 26.12.0, full build/typecheck/lint/format, Desktop/UI Knip, ASF headers and Windows inventory pass. The changelog documents the error-output compatibility change.gpt-6-lunafollow-up: two Maka Sessions performed parent-coordinated review and cross-review, AskUser, approval/denial, recoverable tool errors, and explicit resume after a real insufficient-credit failure on another route. Deliberate step exhaustion exposed a generic-message fallback hiding an existing Runtime class; follow-up008bb67dd3preserveserrorClasswhen no original message exists. 67 targeted outcome/adapter/activation tests and CLI build/typecheck/lint/format passed; direct result now reportstool_step_cap_reached.completed; result preserved the model's explanation that approval was denied and no file was written. No new model call was needed. A real Host configuration error returned text by default and{sessionId,error,code:"operation_unavailable"}with--json, both exit 1.git diff --checkpassed.main.AI use
Tool(s) and scope: Codex implemented, tested and self-reviewed the CLI, documentation and skill reference at the contributor's request. This does not replace independent human review. Commit includes
Generated-by: Codex.Checklist
Does this PR entail a change in behavior?