Conversation
There was a problem hiding this comment.
💡 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".
| format!( | ||
| "Bearer {}", | ||
| std::env::var(existing_env_var_with_random_value).unwrap() | ||
| std::env::var(existing_env_var_with_non_empty_value).unwrap() |
There was a problem hiding this comment.
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 👍 / 👎.
#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 tocodex-rs/core/, though the full set of changes seems to be too broad.This PR tries to port the key changes, which are:
USERNAMEenvironment 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 usePATH. Note thatPATHis unlikely to contain characters that are not allowed in an HTTP header value."powershell.exe"instead of just"powershell"in case thePATHEXTenv var gets lost in the shuffle.