fix: surface the real task error in the stop-review gate instead of stderr noise - #442
fix: surface the real task error in the stop-review gate instead of stderr noise#442fabiogioachin wants to merge 1 commit into
Conversation
…tderr noise When the companion task fails, the stop-review gate reported result.stderr || result.stdout. On setups where the child's stderr contains only Node runtime noise (e.g. the DEP0190 DeprecationWarning emitted for shell:true spawns), that noise masked the actual failure reason, which was only available as the run's rendered message. - codex-companion.mjs: include the human-readable rendered message in the --json payload of foreground commands (additive field). - stop-review-gate-hook.mjs: on non-zero exit, prefer payload.rendered from the JSON stdout, then stderr with DeprecationWarning lines filtered out, then raw stdout. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
This fixes the reported path, but there's a sibling failure it doesn't reach — and the symptom looks almost identical, so it's easy to miss.
I reproduced it against this PR's approach using a fake app-server that emits a failed terminal turn with only
rather than the actual cause, which in that fixture is One line covers it: const failureMessage =
result.turn?.error?.message || result.error?.message || result.stderr || "";Worth folding in here, since the serialisation half is already yours and the two are only useful together. |
Problem
When the stop-review gate's companion task fails (
codex-companion.mjs task --jsonexits non-zero), the hook reportsresult.stderr || result.stdoutas the failure reason:On some setups (observed on Windows + recent Node), the child's stderr contains only Node runtime noise:
Since a non-empty stderr wins over stdout, this deprecation warning masks the real error, which is only available as the human-readable message of the failed run. The user sees the gate block with a
DeprecationWarningas the "reason" and has no idea what actually failed.Real-world example: the actual failure was a Codex usage-limit error (
You've hit your usage limit... try again at Aug 5th), but the hook surfaced only the DEP0190 line. Diagnosing it required digging into the job log files under the plugin state directory.Fix
Two small, backward-compatible changes:
codex-companion.mjs—runForegroundCommandnow includes the human-readablerenderedmessage in the--jsonpayload (additive field; existing consumers that parserawOutput,status, etc. are unaffected).stop-review-gate-hook.mjs— on non-zero exit, the hook now resolves the failure detail in order of usefulness:payload.renderedparsed from the JSON stdout (the real error),DeprecationWarningnoise lines filtered out,Before / after
Before:
After:
Verified end-to-end on Windows 11 / Node against a live failing Codex run (usage-limit error): the gate now blocks with the actual cause in
reason, exit code 0, valid decision JSON.node --testsuite passes locally.🤖 Generated with Claude Code