fix: surface the real task error in the stop-review gate instead of stderr noise#442
Open
fabiogioachin wants to merge 1 commit into
Open
fix: surface the real task error in the stop-review gate instead of stderr noise#442fabiogioachin wants to merge 1 commit into
fabiogioachin 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 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.
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