fix: Windows subprocess exit-code normalization#35
Merged
jbeckwith-oai merged 1 commit intomainfrom Apr 2, 2026
Merged
Conversation
Map unsigned and NTSTATUS-style Windows subprocess failures to exit code 1 before sys.exit(), and preserve POSIX signal semantics on Unix. Co-authored-by: Codex <noreply@openai.com>
mldangelo-oai
approved these changes
Apr 2, 2026
Contributor
mldangelo-oai
left a comment
There was a problem hiding this comment.
Reviewed the exit-code normalization path and tests. This fixes the Windows smoke regression by collapsing unsigned/NTSTATUS-style failures to exit code 1 while preserving normal CLI codes like 0/1/100, and the POSIX signal mapping to 128+signal is a good portability improvement over passing negative codes to sys.exit(). CI is green across Linux/Windows and the added unit coverage hits both the helper and main(). One non-blocking note: Windows statuses with the sign bit set are intentionally lossy now, but that seems like the right tradeoff for promptfoo’s documented low-range exit codes.
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.
Summary
Normalize Windows subprocess failure statuses before exiting the Python wrapper so missing-config errors produce a stable process exit code instead of unsigned DWORD/NTSTATUS values.
Root cause
Recent Windows CI runs on
mainand PR 34 started reporting config-error smoke test exit codes like4294967295and3221226505from the wrapper'ssys.exit(result.returncode)path. Those values correspond to Windows-specific failure statuses rather than the expected shell-style1for config errors.Validation
env -u VIRTUAL_ENV uv sync --extra dev --frozenenv -u VIRTUAL_ENV uv run --frozen pytest tests/test_cli.py -venv -u VIRTUAL_ENV uv run --frozen pytest tests/smoke/test_smoke.py -k test_config_error_exit_code -vNotes
This is intentionally separate from Dependabot PR #34 and targets
maindirectly. Once CI is green here, PR #34 can be rerun or rebased.