mirror of
https://github.com/openai/codex.git
synced 2026-05-28 15:00:16 +00:00
Fix thread/list cwd filtering for Windows verbatim paths (#17414)
Addresses #17302 Problem: `thread/list` compared cwd filters with raw path equality, so `resume --last` could miss Windows sessions when the saved cwd used a verbatim path form and the current cwd did not. Solution: Normalize cwd comparisons through the existing path comparison utilities before falling back to direct equality, and add Windows regression coverage for verbatim paths. I made this a general utility function and replaced all of the duplicated instance of it across the code base.
This commit is contained in:
@@ -78,3 +78,38 @@ mod native_workdir {
|
||||
assert_eq!(normalized, path);
|
||||
}
|
||||
}
|
||||
|
||||
mod path_comparison {
|
||||
use super::super::paths_match_after_normalization;
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[test]
|
||||
fn matches_identical_existing_paths() -> std::io::Result<()> {
|
||||
let dir = tempfile::tempdir()?;
|
||||
|
||||
assert!(paths_match_after_normalization(dir.path(), dir.path()));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn falls_back_to_raw_equality_when_paths_cannot_be_normalized() {
|
||||
assert!(paths_match_after_normalization(
|
||||
PathBuf::from("missing"),
|
||||
PathBuf::from("missing"),
|
||||
));
|
||||
assert!(!paths_match_after_normalization(
|
||||
PathBuf::from("missing-a"),
|
||||
PathBuf::from("missing-b"),
|
||||
));
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
#[test]
|
||||
fn matches_windows_verbatim_paths() -> std::io::Result<()> {
|
||||
let dir = tempfile::tempdir()?;
|
||||
let verbatim_dir = PathBuf::from(format!(r"\\?\{}", dir.path().display()));
|
||||
|
||||
assert!(paths_match_after_normalization(verbatim_dir, dir.path()));
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user