diff --git a/codex-rs/app-server-protocol/schema/json/ClientRequest.json b/codex-rs/app-server-protocol/schema/json/ClientRequest.json index c3d7777c7c..c6755b7520 100644 --- a/codex-rs/app-server-protocol/schema/json/ClientRequest.json +++ b/codex-rs/app-server-protocol/schema/json/ClientRequest.json @@ -916,7 +916,7 @@ "type": "string" }, "maxBytes": { - "description": "Requested upper bound. Values above `maxChunkBytes` are capped.", + "description": "Requested upper bound. Values above the server limit are capped.", "format": "uint32", "minimum": 0.0, "type": [ diff --git a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json index 42d8481419..4bc2e2ac5b 100644 --- a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json +++ b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json @@ -9640,17 +9640,6 @@ "FsReadFileOpenResponse": { "$schema": "http://json-schema.org/draft-07/schema#", "description": "Successful response for `fs/readFile/open`.", - "properties": { - "maxChunkBytes": { - "description": "Maximum decoded bytes returned by one read.", - "format": "uint32", - "minimum": 0.0, - "type": "integer" - } - }, - "required": [ - "maxChunkBytes" - ], "title": "FsReadFileOpenResponse", "type": "object" }, @@ -9681,7 +9670,7 @@ "type": "string" }, "maxBytes": { - "description": "Requested upper bound. Values above `maxChunkBytes` are capped.", + "description": "Requested upper bound. Values above the server limit are capped.", "format": "uint32", "minimum": 0.0, "type": [ diff --git a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json index baa2fe676a..5fcb6ba340 100644 --- a/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json +++ b/codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json @@ -5982,17 +5982,6 @@ "FsReadFileOpenResponse": { "$schema": "http://json-schema.org/draft-07/schema#", "description": "Successful response for `fs/readFile/open`.", - "properties": { - "maxChunkBytes": { - "description": "Maximum decoded bytes returned by one read.", - "format": "uint32", - "minimum": 0.0, - "type": "integer" - } - }, - "required": [ - "maxChunkBytes" - ], "title": "FsReadFileOpenResponse", "type": "object" }, @@ -6023,7 +6012,7 @@ "type": "string" }, "maxBytes": { - "description": "Requested upper bound. Values above `maxChunkBytes` are capped.", + "description": "Requested upper bound. Values above the server limit are capped.", "format": "uint32", "minimum": 0.0, "type": [ diff --git a/codex-rs/app-server-protocol/schema/json/v2/FsReadFileOpenResponse.json b/codex-rs/app-server-protocol/schema/json/v2/FsReadFileOpenResponse.json index 761e270854..6ec200f39d 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/FsReadFileOpenResponse.json +++ b/codex-rs/app-server-protocol/schema/json/v2/FsReadFileOpenResponse.json @@ -1,17 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "description": "Successful response for `fs/readFile/open`.", - "properties": { - "maxChunkBytes": { - "description": "Maximum decoded bytes returned by one read.", - "format": "uint32", - "minimum": 0.0, - "type": "integer" - } - }, - "required": [ - "maxChunkBytes" - ], "title": "FsReadFileOpenResponse", "type": "object" } \ No newline at end of file diff --git a/codex-rs/app-server-protocol/schema/json/v2/FsReadFileReadParams.json b/codex-rs/app-server-protocol/schema/json/v2/FsReadFileReadParams.json index a927981f3f..fe79922366 100644 --- a/codex-rs/app-server-protocol/schema/json/v2/FsReadFileReadParams.json +++ b/codex-rs/app-server-protocol/schema/json/v2/FsReadFileReadParams.json @@ -6,7 +6,7 @@ "type": "string" }, "maxBytes": { - "description": "Requested upper bound. Values above `maxChunkBytes` are capped.", + "description": "Requested upper bound. Values above the server limit are capped.", "format": "uint32", "minimum": 0.0, "type": [ diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/FsReadFileOpenResponse.ts b/codex-rs/app-server-protocol/schema/typescript/v2/FsReadFileOpenResponse.ts index 4281378f82..20b136f6c4 100644 --- a/codex-rs/app-server-protocol/schema/typescript/v2/FsReadFileOpenResponse.ts +++ b/codex-rs/app-server-protocol/schema/typescript/v2/FsReadFileOpenResponse.ts @@ -5,8 +5,4 @@ /** * Successful response for `fs/readFile/open`. */ -export type FsReadFileOpenResponse = { -/** - * Maximum decoded bytes returned by one read. - */ -maxChunkBytes: number, }; +export type FsReadFileOpenResponse = Record; diff --git a/codex-rs/app-server-protocol/schema/typescript/v2/FsReadFileReadParams.ts b/codex-rs/app-server-protocol/schema/typescript/v2/FsReadFileReadParams.ts index 3c3d2b46ac..6309f3ddc1 100644 --- a/codex-rs/app-server-protocol/schema/typescript/v2/FsReadFileReadParams.ts +++ b/codex-rs/app-server-protocol/schema/typescript/v2/FsReadFileReadParams.ts @@ -7,6 +7,6 @@ */ export type FsReadFileReadParams = { handleId: string, offset: number, /** - * Requested upper bound. Values above `maxChunkBytes` are capped. + * Requested upper bound. Values above the server limit are capped. */ maxBytes?: number | null, }; diff --git a/codex-rs/app-server-protocol/src/protocol/v2/fs.rs b/codex-rs/app-server-protocol/src/protocol/v2/fs.rs index e3551cce37..f977fa4b31 100644 --- a/codex-rs/app-server-protocol/src/protocol/v2/fs.rs +++ b/codex-rs/app-server-protocol/src/protocol/v2/fs.rs @@ -54,10 +54,7 @@ pub struct FsReadFileOpenParams { #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] #[serde(rename_all = "camelCase")] #[ts(export_to = "v2/")] -pub struct FsReadFileOpenResponse { - /// Maximum decoded bytes returned by one read. - pub max_chunk_bytes: u32, -} +pub struct FsReadFileOpenResponse {} /// Read a bounded chunk from an open file at an absolute byte offset. #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] @@ -67,7 +64,7 @@ pub struct FsReadFileReadParams { pub handle_id: String, #[ts(type = "number")] pub offset: u64, - /// Requested upper bound. Values above `maxChunkBytes` are capped. + /// Requested upper bound. Values above the server limit are capped. #[ts(optional = nullable)] pub max_bytes: Option, } diff --git a/codex-rs/app-server/src/request_processors/fs_processor.rs b/codex-rs/app-server/src/request_processors/fs_processor.rs index 010452b425..c1f4db7109 100644 --- a/codex-rs/app-server/src/request_processors/fs_processor.rs +++ b/codex-rs/app-server/src/request_processors/fs_processor.rs @@ -133,8 +133,7 @@ impl FsRequestProcessor { connection_id: ConnectionId, params: FsReadFileOpenParams, ) -> Result { - let max_chunk_bytes = self - .handles(connection_id) + self.handles(connection_id) .await .open_read( self.file_system()?, @@ -144,10 +143,7 @@ impl FsRequestProcessor { ) .await .map_err(map_file_handle_error)?; - Ok(FsReadFileOpenResponse { - max_chunk_bytes: u32::try_from(max_chunk_bytes) - .map_err(|_| internal_error("file read chunk limit exceeds u32"))?, - }) + Ok(FsReadFileOpenResponse {}) } pub(crate) async fn read_file_read( diff --git a/codex-rs/app-server/tests/suite/v2/fs.rs b/codex-rs/app-server/tests/suite/v2/fs.rs index 51664de5f9..79fde05297 100644 --- a/codex-rs/app-server/tests/suite/v2/fs.rs +++ b/codex-rs/app-server/tests/suite/v2/fs.rs @@ -421,7 +421,7 @@ async fn fs_streaming_read_supports_stat_and_positional_reads() -> Result<()> { ) .await??, )?; - assert!(open.max_chunk_bytes >= 4); + assert_eq!(open, FsReadFileOpenResponse {}); let wrong_type_id = mcp .send_raw_request( diff --git a/file-streaming-api.md b/file-streaming-api.md index 12c38f8352..b9e323ab3a 100644 --- a/file-streaming-api.md +++ b/file-streaming-api.md @@ -30,15 +30,13 @@ Opens a file for positional reads. Response: ```json -{ - "maxChunkBytes": 262144 -} +{} ``` ### `fs/readFile/read` Reads at most `maxBytes` starting at the absolute byte offset. If `maxBytes` -is omitted or exceeds `maxChunkBytes`, the server uses `maxChunkBytes`. +is omitted or exceeds the server's read limit, the server uses that limit. ```json { @@ -184,8 +182,10 @@ Response: concurrently. - Reads are positional and do not maintain a server-side cursor. - Writes are sequential appends. -- Each read or write transfers at most `maxChunkBytes` decoded bytes. -- `maxChunkBytes` is currently 262144 bytes. +- Each read transfers at most the server's read limit. +- Each write transfers at most the `maxChunkBytes` returned by + `fs/writeFile/open`. +- Both limits are currently 262144 bytes. - Backpressure comes from awaiting bounded read and write responses. Clients should use a bounded pipeline of up to two read requests to hide transport round-trip latency without accumulating unbounded response data.