mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08: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:
committed by
GitHub
Unverified
parent
a9796e39c4
commit
e9e7ef3d36
@@ -629,14 +629,7 @@ fn validate_config(value: &TomlValue) -> Result<(), toml::de::Error> {
|
||||
}
|
||||
|
||||
fn paths_match(expected: impl AsRef<Path>, provided: impl AsRef<Path>) -> bool {
|
||||
if let (Ok(expanded_expected), Ok(expanded_provided)) = (
|
||||
path_utils::normalize_for_path_comparison(&expected),
|
||||
path_utils::normalize_for_path_comparison(&provided),
|
||||
) {
|
||||
expanded_expected == expanded_provided
|
||||
} else {
|
||||
expected.as_ref() == provided.as_ref()
|
||||
}
|
||||
path_utils::paths_match_after_normalization(expected, provided)
|
||||
}
|
||||
|
||||
fn value_at_path<'a>(root: &'a TomlValue, segments: &[String]) -> Option<&'a TomlValue> {
|
||||
|
||||
@@ -76,14 +76,7 @@ pub(crate) fn maybe_wrap_shell_lc_with_snapshot(
|
||||
return command.to_vec();
|
||||
}
|
||||
|
||||
if if let (Ok(snapshot_cwd), Ok(command_cwd)) = (
|
||||
path_utils::normalize_for_path_comparison(snapshot.cwd.as_path()),
|
||||
path_utils::normalize_for_path_comparison(cwd),
|
||||
) {
|
||||
snapshot_cwd != command_cwd
|
||||
} else {
|
||||
snapshot.cwd != cwd
|
||||
} {
|
||||
if !path_utils::paths_match_after_normalization(snapshot.cwd.as_path(), cwd) {
|
||||
return command.to_vec();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user