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:
cgst-oai authored and copyberry committed 2026-08-20 17:16:52 +00:00
1 parent 2e1f18e0db
commit a26d50852a
11 files changed
+668 -271

No files matched your search

+11
View File
@@ -22,6 +22,8 @@ use codex_exec_server::LOCAL_FS;
use codex_exec_server::ReadDirectoryEntry;
use codex_exec_server::ReadFileOptions;
use codex_exec_server::RemoveOptions;
use codex_exec_server::WalkOptions;
use codex_exec_server::WalkOutcome;
use codex_exec_server::WriteFileOptions;
use codex_extension_api::UserInstructions;
use codex_features::Feature;
@@ -272,6 +274,15 @@ impl ExecutorFileSystem for FailingFileSystem {
Box::pin(FailingFileSystem::read_directory(self, path, sandbox))
}
fn walk<'a>(
&'a self,
_path: &'a PathUri,
_options: WalkOptions,
_sandbox: Option<&'a FileSystemSandboxContext>,
) -> ExecutorFileSystemFuture<'a, WalkOutcome> {
Box::pin(async { unreachable!("walk should not be called") })
}
fn remove<'a>(
&'a self,
path: &'a PathUri,
+11
View File
@@ -11,6 +11,8 @@ use codex_exec_server::LOCAL_FS;
use codex_exec_server::ReadDirectoryEntry;
use codex_exec_server::ReadFileOptions;
use codex_exec_server::RemoveOptions;
use codex_exec_server::WalkOptions;
use codex_exec_server::WalkOutcome;
use codex_exec_server::WriteFileOptions;
use codex_git_utils::GitInfo;
use codex_git_utils::GitSha;
@@ -140,6 +142,15 @@ impl ExecutorFileSystem for MetadataOverrideFileSystem {
Box::pin(async { Self::unsupported() })
}
fn walk<'a>(
&'a self,
_path: &'a PathUri,
_options: WalkOptions,
_sandbox: Option<&'a FileSystemSandboxContext>,
) -> ExecutorFileSystemFuture<'a, WalkOutcome> {
Box::pin(async { Self::unsupported() })
}
fn remove<'a>(
&'a self,
_path: &'a PathUri,