Support Windows registry overrides for requirements.toml (#55456)

## What changed

Read `RequirementsPath` from the 64-bit registry view of `HKLM\SOFTWARE\Policies\OpenAI\Codex` to select the system requirements file on Windows. Require an absolute path and return an error for relative values. If the registry key or value cannot be read, retain the default `OpenAI\Codex\requirements.toml` location under ProgramData.

## Testing

Expand absolute-path validation tests to cover empty, drive-relative, and root-relative paths. Update the Windows default-directory test to remain independent of registry overrides.

GitOrigin-RevId: c31045d749e32cf266b389245ae4db2440156e8e
This commit is contained in:
johnl-oai
2026-10-20 04:49:25 +00:00
committed by copyberry
parent 8196bcdc18
commit 18795fc125
5 changed files with 27 additions and 18 deletions
+10 -3
View File
@@ -477,10 +477,17 @@ mod tests {
#[test]
fn from_absolute_path_checked_rejects_relative_path() {
let err = AbsolutePathBuf::from_absolute_path_checked("relative/path")
.expect_err("relative path should fail");
for path in [
"",
"relative/path",
r"C:requirements.toml",
r"\requirements.toml",
] {
let err = AbsolutePathBuf::from_absolute_path_checked(path)
.expect_err("relative path should fail");
assert_eq!(err.kind(), std::io::ErrorKind::InvalidInput);
assert_eq!(err.kind(), std::io::ErrorKind::InvalidInput);
}
}
#[test]