mirror of
https://github.com/openai/codex.git
synced 2026-11-10 16:44:38 +00:00
Require filesystem backends to implement directory walks (#39749)
## What changed - Make `ExecutorFileSystem::walk` a required backend operation instead of providing a fallback built from directory reads and metadata requests. - Implement bounded local walks on a blocking task with cancellation, symlink cycle detection, deterministic ordering, error collection, and response-size limits. - Have remote filesystems use the server's walk operation directly. ## Testing - Cover local and remote handling of invalid roots and limits, directory symlinks, non-UTF-8 names, cancellation, sandbox contexts, and response budgets. GitOrigin-RevId: 7499bf05080c3f9965a5eb7ffd593de604d62c2a
This commit is contained in:
1 parent
2e1f18e0db
commit
a26d50852a
11 files changed
+668
-271
No files matched your search
@@ -25,6 +25,10 @@ use codex_exec_server::GetMetadataOptions;
|
||||
use codex_exec_server::ReadDirectoryEntry;
|
||||
use codex_exec_server::ReadFileOptions;
|
||||
use codex_exec_server::RemoveOptions;
|
||||
use codex_exec_server::WalkEntry;
|
||||
use codex_exec_server::WalkEntryKind;
|
||||
use codex_exec_server::WalkOptions;
|
||||
use codex_exec_server::WalkOutcome;
|
||||
use codex_exec_server::WriteFileOptions;
|
||||
use codex_protocol::capabilities::CapabilityRootLocation;
|
||||
use codex_protocol::capabilities::SelectedCapabilityRoot;
|
||||
@@ -191,6 +195,34 @@ impl ExecutorFileSystem for SyntheticFileSystem {
|
||||
Box::pin(SyntheticFileSystem::read_directory(self, path))
|
||||
}
|
||||
|
||||
fn walk<'a>(
|
||||
&'a self,
|
||||
path: &'a PathUri,
|
||||
options: WalkOptions,
|
||||
_sandbox: Option<&'a FileSystemSandboxContext>,
|
||||
) -> ExecutorFileSystemFuture<'a, WalkOutcome> {
|
||||
Box::pin(async move {
|
||||
self.metadata(path)?;
|
||||
assert_eq!(path, &self.canonical_root);
|
||||
assert!(options.max_depth >= 1);
|
||||
assert!(options.max_directories >= 2);
|
||||
assert!(options.max_entries >= 2);
|
||||
Ok(WalkOutcome {
|
||||
entries: vec![
|
||||
WalkEntry {
|
||||
path: self.path("skill")?,
|
||||
kind: WalkEntryKind::Directory,
|
||||
},
|
||||
WalkEntry {
|
||||
path: self.path("skill/SKILL.md")?,
|
||||
kind: WalkEntryKind::File,
|
||||
},
|
||||
],
|
||||
..WalkOutcome::default()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
fn remove<'a>(
|
||||
&'a self,
|
||||
_path: &'a PathUri,
|
||||
|
||||
Reference in new issue
Block a user