Skip to content

fix: changes to test that should help them pass on Windows under Bazel#16662

Merged
bolinfest merged 1 commit intomainfrom
pr16662
Apr 3, 2026
Merged

fix: changes to test that should help them pass on Windows under Bazel#16662
bolinfest merged 1 commit intomainfrom
pr16662

Conversation

@bolinfest
Copy link
Copy Markdown
Collaborator

@bolinfest bolinfest commented Apr 3, 2026

#16460 was a large PR created by Codex to try to get the tests to pass under Bazel on Windows. Indeed, it successfully ran all of the tests under //codex-rs/core: with its changes to codex-rs/core/, though the full set of changes seems to be too broad.

This PR tries to port the key changes, which are:

  • Under Bazel, the USERNAME environment variable is not guaranteed to be set on Windows, so for tests that need a non-empty env var as a convenient substitute for an env var containing an API key, just use PATH. Note that PATH is unlikely to contain characters that are not allowed in an HTTP header value.
  • Specify "powershell.exe" instead of just "powershell" in case the PATHEXT env var gets lost in the shuffle.

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1965ff03cb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/core/tests/suite/client.rs Outdated
format!(
"Bearer {}",
std::env::var(existing_env_var_with_random_value).unwrap()
std::env::var(existing_env_var_with_non_empty_value).unwrap()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Badge Escape env value before using it as regex pattern

Using std::env::var(existing_env_var_with_non_empty_value) as the pattern for header_regex makes this matcher depend on the raw PATH contents, which often include regex metacharacters (especially backslashes on Windows like C:\Users\...). In that case the regex can either fail to compile or match incorrectly, so this test can still fail on the Windows/Bazel setup this change is targeting. Use header(...) for exact matching or regex::escape(...) around the value before passing it to header_regex.

Useful? React with 👍 / 👎.

@bolinfest bolinfest merged commit b4787bf into main Apr 3, 2026
36 checks passed
@bolinfest bolinfest deleted the pr16662 branch April 3, 2026 06:06
@github-actions github-actions bot locked and limited conversation to collaborators Apr 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant