Fix fs/readDirectory to skip broken symlinks (#17907)

## Summary
- Skip directory entries whose metadata lookup fails during
`fs/readDirectory`
- Add an exec-server regression test covering a broken symlink beside
valid entries

## Testing
- `just fmt`
- `cargo test -p codex-exec-server` (started, but dependency/network
updates stalled before completion in this environment)
This commit is contained in:
willwang-openai
2026-04-15 10:50:22 -07:00
committed by GitHub
parent 8e784bba2f
commit a3d475d33f
2 changed files with 8 additions and 1 deletions

View File

@@ -305,7 +305,9 @@ impl ExecutorFileSystem for DirectFileSystem {
let mut entries = Vec::new();
let mut read_dir = tokio::fs::read_dir(path.as_path()).await?;
while let Some(entry) = read_dir.next_entry().await? {
let metadata = tokio::fs::metadata(entry.path()).await?;
let Ok(metadata) = tokio::fs::metadata(entry.path()).await else {
continue;
};
entries.push(ReadDirectoryEntry {
file_name: entry.file_name().to_string_lossy().into_owned(),
is_directory: metadata.is_dir(),