Preserve special filesystem subpaths as wire strings (#33107)

## Why

Special filesystem subpaths can contain relative or foreign-platform path
spellings. Treating this wire text as a host-native path can reinterpret it.

## What changed

- Store special filesystem subpaths as strings in the core permissions model.
- Represent app-server subpaths as `LegacyAppPathString` and convert them at
  the protocol boundary without changing their spelling.
- Add `LegacyAppPathString::from_string` for callers that already own legacy
  app-server path text.

GitOrigin-RevId: 2214f03aa997fd0e6eb2ab60d425304bb4bd6132
This commit is contained in:
Adam Perry @ OpenAI authored and copyberry committed 2026-07-14 16:40:13 +00:00
1 parent fca8c00f11
commit 0396f99cf1
19 files changed
+199 -97

No files matched your search

@@ -55,6 +55,7 @@ use codex_protocol::ThreadId;
use codex_protocol::request_permissions::PermissionGrantScope;
use codex_protocol::request_permissions::RequestPermissionProfile;
use codex_utils_absolute_path::AbsolutePathBuf;
use codex_utils_path_uri::LegacyAppPathString;
use crossterm::event::KeyCode;
use crossterm::event::KeyEvent;
use crossterm::event::KeyEventKind;
@@ -1028,9 +1029,9 @@ fn special_path_label(value: &FileSystemSpecialPath) -> String {
}
}
fn path_label(base: &str, subpath: &Option<PathBuf>) -> String {
fn path_label(base: &str, subpath: &Option<LegacyAppPathString>) -> String {
match subpath {
Some(subpath) => format!("{base}/{}", subpath.display()),
Some(subpath) => format!("{base}/{subpath}"),
None => base.to_string(),
}
}
@@ -1871,7 +1872,9 @@ mod tests {
entries: Some(vec![FileSystemSandboxEntry {
path: FileSystemPath::Special {
value: FileSystemSpecialPath::ProjectRoots {
subpath: Some(".git".into()),
subpath: Some(LegacyAppPathString::from_path(std::path::Path::new(
".git",
))),
},
},
access: FileSystemAccessMode::Read,