Skip missing paths in filesystem sandbox entries (#34598)

## Why

Default read-only protections for project metadata should apply when paths such
as `.git`, `.agents`, and `.codex` exist, without causing sandbox setup to
materialize missing paths as ACL targets.

## What changed

- Add an optional `missing_path_behavior` to filesystem sandbox entries and
  mark default project-metadata protections with `skip`.
- Preserve the behavior through permission transforms and exec/MCP protocol
  serialization while keeping existing path wire variants stable.
- Ignore skip-missing entries when projecting configuration or Windows sandbox
  overrides, while retaining explicit metadata carveouts.

## Testing

- Cover protocol round trips for path and special-path entries.
- Verify default metadata protections and Windows explicit carveout handling.

GitOrigin-RevId: 6df13dadacdd131c44aab9f15a967c81051355c1
This commit is contained in:
iceweasel-oai authored and copyberry committed 2026-07-21 19:17:18 +00:00
1 parent ee71c4a90f
commit 87f71e35b8
63 files changed
+825 -132

No files matched your search

+5
View File
@@ -8,6 +8,7 @@ use codex_protocol::models::SandboxEnforcement;
use codex_protocol::permissions::FileSystemAccessMode;
use codex_protocol::permissions::FileSystemPath;
use codex_protocol::permissions::FileSystemSandboxEntry;
use codex_protocol::permissions::FileSystemSandboxEntryMissingPathBehavior;
use codex_protocol::permissions::FileSystemSandboxKind;
use codex_protocol::permissions::FileSystemSandboxPolicy;
use codex_protocol::permissions::FileSystemSpecialPath;
@@ -160,6 +161,8 @@ impl TryFrom<ExecFileSystemPath> for FileSystemPath {
pub struct ExecFileSystemSandboxEntry {
pub path: ExecFileSystemPath,
pub access: FileSystemAccessMode,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub missing_path_behavior: Option<FileSystemSandboxEntryMissingPathBehavior>,
}
impl From<FileSystemSandboxEntry> for ExecFileSystemSandboxEntry {
@@ -167,6 +170,7 @@ impl From<FileSystemSandboxEntry> for ExecFileSystemSandboxEntry {
Self {
path: value.path.into(),
access: value.access,
missing_path_behavior: value.missing_path_behavior,
}
}
}
@@ -178,6 +182,7 @@ impl TryFrom<ExecFileSystemSandboxEntry> for FileSystemSandboxEntry {
Ok(Self {
path: value.path.try_into()?,
access: value.access,
missing_path_behavior: value.missing_path_behavior,
})
}
}