[codex] Add symlink flag to fs metadata (#17719)

Add `is_symlink` to FsMetadata struct.
This commit is contained in:
pakrym-oai
2026-04-13 17:46:56 -07:00
committed by GitHub
parent 495ed22dfb
commit f3cbe3d385
16 changed files with 101 additions and 13 deletions

View File

@@ -89,6 +89,7 @@ async fn fs_get_metadata_returns_only_used_fields() -> Result<()> {
"createdAtMs".to_string(),
"isDirectory".to_string(),
"isFile".to_string(),
"isSymlink".to_string(),
"modifiedAtMs".to_string(),
]
);
@@ -99,6 +100,7 @@ async fn fs_get_metadata_returns_only_used_fields() -> Result<()> {
FsGetMetadataResponse {
is_directory: false,
is_file: true,
is_symlink: false,
created_at_ms: stat.created_at_ms,
modified_at_ms: stat.modified_at_ms,
}
@@ -111,6 +113,35 @@ async fn fs_get_metadata_returns_only_used_fields() -> Result<()> {
Ok(())
}
#[cfg(unix)]
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn fs_get_metadata_reports_symlink() -> Result<()> {
let codex_home = TempDir::new()?;
let file_path = codex_home.path().join("note.txt");
let symlink_path = codex_home.path().join("note-link.txt");
std::fs::write(&file_path, "hello")?;
symlink(&file_path, &symlink_path)?;
let mut mcp = initialized_mcp(&codex_home).await?;
let request_id = mcp
.send_fs_get_metadata_request(codex_app_server_protocol::FsGetMetadataParams {
path: absolute_path(symlink_path),
})
.await?;
let response = timeout(
DEFAULT_READ_TIMEOUT,
mcp.read_stream_until_response_message(RequestId::Integer(request_id)),
)
.await??;
let stat: FsGetMetadataResponse = to_response(response)?;
assert_eq!(stat.is_directory, false);
assert_eq!(stat.is_file, true);
assert_eq!(stat.is_symlink, true);
Ok(())
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn fs_methods_cover_current_fs_utils_surface() -> Result<()> {
let codex_home = TempDir::new()?;