Repository navigation
Conversation
…pans Codex code-mode `exec` outputs carry one JSON part per nested command with its `exit_code`. The parent tool span stays DEFAULT because the script itself completed, so a nested failure (for example `rg` on a missing path, exit 2) is invisible to level-based monitoring. Emit an `exec_command` child tool span per nested result with `codex.exit_code` (and `codex.chunk_id`). Exit codes >= 2 are ERROR; exit 1 stays DEFAULT because rg/grep use it for "no match". The parent keeps its own level and status and gets `codex.nested_failed_count` when it is non-zero. Co-Authored-By: Claude Opus 5.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
In Codex code mode, one
exectool call can run several commands. The output has one JSON part per command, with that command'sexit_code:{"chunk_id":"a4b7b0","wall_time_seconds":0.0,"exit_code":2,"output":"rg: path: No such file or directory ..."}The
execspan isDEFAULTbecause the script itself finished. A failing command inside it is only visible in the output text. Filtering or alerting onlevelmisses it.Change
extractNestedResults(inparse.ts) reads text parts offunction_call_output/custom_tool_call_outputthat are JSON objects with a numericexit_code. It skips non-JSON or malformed parts without throwing.emitToolCalladds oneexec_commandchild tool span per nested result, withcodex.exit_code(andcodex.chunk_idwhen present) as metadata and the nestedoutput.exit_code >= 2:ERROR, with a status message.exit_code0 or 1:DEFAULT.rgandgrepuse 1 for "no match".codex.nested_failed_count, but only when that count is above zero.Tests
parse.test.ts: the extraction cases, including malformed parts.trace.test.ts:ERRORwith its chunk id and output;ERROR;pnpm run lintandpnpm testpass (125/125). I also ran the parser on a real Codex rollout: the failing nestedrgcame out as exit code 2.🤖 Generated with Claude Code