Skip to content

fix: Windows subprocess exit-code normalization#35

Merged
jbeckwith-oai merged 1 commit intomainfrom
codex/normalize-windows-exit-codes
Apr 2, 2026
Merged

fix: Windows subprocess exit-code normalization#35
jbeckwith-oai merged 1 commit intomainfrom
codex/normalize-windows-exit-codes

Conversation

@jbeckwith-oai
Copy link
Copy Markdown
Contributor

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 main and PR 34 started reporting config-error smoke test exit codes like 4294967295 and 3221226505 from the wrapper's sys.exit(result.returncode) path. Those values correspond to Windows-specific failure statuses rather than the expected shell-style 1 for config errors.

Validation

  • env -u VIRTUAL_ENV uv sync --extra dev --frozen
  • env -u VIRTUAL_ENV uv run --frozen pytest tests/test_cli.py -v
  • env -u VIRTUAL_ENV uv run --frozen pytest tests/smoke/test_smoke.py -k test_config_error_exit_code -v

Notes

This is intentionally separate from Dependabot PR #34 and targets main directly. Once CI is green here, PR #34 can be rerun or rebased.

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>
@JustinBeckwith JustinBeckwith requested a review from mldangelo April 2, 2026 05:13
@jbeckwith-oai jbeckwith-oai marked this pull request as ready for review April 2, 2026 18:19
@jbeckwith-oai jbeckwith-oai changed the title [codex] fix Windows subprocess exit-code normalization fix: Windows subprocess exit-code normalization Apr 2, 2026
Copy link
Copy Markdown
Contributor

@mldangelo-oai mldangelo-oai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jbeckwith-oai jbeckwith-oai merged commit 5e5a931 into main Apr 2, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants