Preserve large gRPC code-mode tool errors (#38621)

## Why

Code-mode tool failure messages larger than 64 KiB were truncated before they
reached the host.

## What changed

- Remove the tool error size limit from the gRPC protocol and host validation.
- Forward failed tool completion messages without truncation.

## Testing

- Verify that a multibyte error larger than 64 KiB is preserved exactly.

GitOrigin-RevId: 264ae4ba4adea5c19b669e4f41ccfd41a0c30fb5
This commit is contained in:
Adam Perry @ OpenAI
2026-08-14 18:30:45 +00:00
committed by copyberry
parent 395723b238
commit 478215c5c1
5 changed files with 11 additions and 40 deletions
+1 -8
View File
@@ -83,14 +83,7 @@ impl GrpcCodeModeHost {
Status::invalid_argument(format!("invalid code-mode tool output JSON: {error}"))
})?,
),
Some(proto::complete_tool_call_request::Outcome::Failed(error)) => {
validation::bounded(
&error.message,
validation::MAX_TOOL_ERROR_BYTES,
"tool error message",
)?;
Err(error.message)
}
Some(proto::complete_tool_call_request::Outcome::Failed(error)) => Err(error.message),
None => {
return Err(Status::invalid_argument(
"tool completion is missing its outcome",
@@ -3,7 +3,6 @@ use tonic::Status;
use uuid::Uuid;
pub(super) use codex_code_mode_protocol::grpc::MAX_IDENTIFIER_BYTES;
pub(super) use codex_code_mode_protocol::grpc::MAX_TOOL_ERROR_BYTES;
pub(super) const MAX_TOOL_FILTERS: usize = 64;
pub(super) fn identifier(value: &str, field: &str) -> Result<(), Status> {