Repository navigation
feat: keep numeric exit codes for shell commands (#80) - #160
Merged
Merged
Conversation
Shell events carry exitCode when the source reports one: Codex's metadata.exit_code and its text forms (refactored into exitCodeOf), Cursor's database exit code, and an exit code the output text itself reports (Claude Code). isError behaves as today.
This was referenced Nov 21, 2026
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.
What changed and why
Shell events carried only
isError, which hides the difference between a failing test, a missing command (127) and an interrupt (130). They now keepexitCode?: numberwherever the source reports one.Per adapter:
exitFailedbecameexitCodeOf— the JSONmetadata.exit_codepath returns the number itself, and the text forms ("Exit code: 1", "Process exited with code 1") are parsed with a sharedexitCodeFromText()incommon.ts. Failure semantics unchanged: a code is failure only when it is non-zero.isErrorstays as today).Process exited with code 2andexit code: 127covers both wordings.markResultgrew anexitCodeparameter; the field lives on shell events only (file and tool events keepisError/errorExcerpt).Docs
docs/architecture.md(the "Failed tool calls keep an excerpt" paragraph gains the exit-code sentence).Testing
pnpm lint,pnpm typecheck,pnpm build,pnpm test: 758 passed, 18 skipped.exitCode(the acceptance criterion): Claude (two wordings:code 2,exit code: 127), Codex (exit code: 2from the text form), Cursor (the database'sexitCode: 1).