Enable writable file streaming in exec-server (#50177)

## What changed

Advertise `fileWriteStreaming` and support `fs/open` with `mode: "replace"` to create or truncate a file for writing. Implement `fs/writeBlock` with explicit offsets and nonempty chunks of up to 1 MiB, rejecting ranges beyond the signed 64-bit file offset limit.

Apply write sandbox permissions when opening writable handles, including when full-disk reads are allowed. Keep `read` as the default open mode.

## Testing

Add integration coverage for positional writes, chunk and offset bounds, replacement truncation, read/write handle permissions, and sandbox write restrictions. Verify that duplicate handle IDs and exhausted handle capacity reject replacement opens without creating or truncating files.

GitOrigin-RevId: 696ee6437dd5f5b69d5a7667dddea0ff44472094
This commit is contained in:
Adam Perry @ OpenAI
2026-10-02 04:25:52 +00:00
committed by copyberry
parent 7135b303d9
commit c39bfa4c8f
14 changed files with 425 additions and 50 deletions
@@ -7,6 +7,7 @@ use std::collections::BTreeMap;
use std::io;
use crate::LocalFileSystem;
use crate::protocol::FsOpenMode;
use codex_config::loader::system_config_toml_file;
use codex_file_system::ExecutorFileSystem;
use codex_file_system::WalkEntryKind;
@@ -182,7 +183,7 @@ async fn discover_cached_plugins(
async fn read_remote_plugin_id(path: &std::path::Path) -> io::Result<Option<String>> {
// Nonblocking open and handle validation reject FIFOs and other non-regular files.
let file = match crate::regular_file::open(path).await {
let file = match crate::regular_file::open(path, FsOpenMode::Read).await {
Ok(file) => file,
Err(error) if error.kind() == io::ErrorKind::NotFound => return Ok(None),
Err(error) => return Err(error),