[codex] increase tool schema compaction threshold (#31497)

## Why

The 4,000-byte limit is compacting the tool schemas of some hero
usecases.

## What changed

Raise the limit to 5,000 bytes and update compaction test fixtures
accordingly.
This commit is contained in:
fbauer33 authored and GitHub committed 2026-07-08 15:14:23 -07:00
1 parent 5c7624a69e
commit b6f9aee16d
2 files changed
+8 -8

No files matched your search

+1 -1
View File
@@ -219,7 +219,7 @@ fn deserialize_tool_input_schema(input_schema: JsonValue) -> Result<JsonSchema,
// Use compact normalized JSON bytes as a cheap local proxy for the 1k-token // Use compact normalized JSON bytes as a cheap local proxy for the 1k-token
// schema budget. // schema budget.
const MAX_COMPACT_TOOL_SCHEMA_BYTES: usize = 4_000; const MAX_COMPACT_TOOL_SCHEMA_BYTES: usize = 5_000;
const MAX_COMPACT_TOOL_SCHEMA_DEPTH: usize = 3; const MAX_COMPACT_TOOL_SCHEMA_DEPTH: usize = 3;
/// Shrink unusually large tool schemas while preserving the top-level argument /// Shrink unusually large tool schemas while preserving the top-level argument
+7 -7
View File
@@ -912,7 +912,7 @@ fn many_string_properties(count: usize) -> serde_json::Map<String, serde_json::V
fn parse_large_tool_input_schema_compacts_descriptions_only_on_default_path() { fn parse_large_tool_input_schema_compacts_descriptions_only_on_default_path() {
let input_schema = serde_json::json!({ let input_schema = serde_json::json!({
"type": "object", "type": "object",
"description": "x".repeat(4_500), "description": "x".repeat(5_500),
"properties": { "properties": {
"metadata": { "metadata": {
"$ref": "#/$defs/metadata" "$ref": "#/$defs/metadata"
@@ -949,7 +949,7 @@ fn parse_large_tool_input_schema_compacts_descriptions_only_on_default_path() {
serde_json::to_value(schema).expect("serialize schema"), serde_json::to_value(schema).expect("serialize schema"),
serde_json::json!({ serde_json::json!({
"type": "object", "type": "object",
"description": "x".repeat(4_500), "description": "x".repeat(5_500),
"properties": { "properties": {
"metadata": { "metadata": {
"$ref": "#/$defs/metadata" "$ref": "#/$defs/metadata"
@@ -978,7 +978,7 @@ fn parse_large_tool_input_schema_ignores_dropped_metadata_for_budget() {
"type": "object", "type": "object",
"examples": [ "examples": [
{ {
"payload": "x".repeat(4_500) "payload": "x".repeat(5_500)
} }
], ],
"properties": { "properties": {
@@ -1021,7 +1021,7 @@ fn parse_large_tool_input_schema_ignores_dropped_metadata_for_budget() {
fn parse_large_tool_input_schema_stops_after_dropping_root_definitions_when_under_budget() { fn parse_large_tool_input_schema_stops_after_dropping_root_definitions_when_under_budget() {
let schema = parse_tool_input_schema(&serde_json::json!({ let schema = parse_tool_input_schema(&serde_json::json!({
"type": "object", "type": "object",
"description": "x".repeat(4_500), "description": "x".repeat(5_500),
"properties": { "properties": {
"event": { "event": {
"type": "object", "type": "object",
@@ -1081,7 +1081,7 @@ fn parse_large_tool_input_schema_stops_after_dropping_root_definitions_when_unde
fn parse_large_tool_input_schema_strips_descriptions_without_removing_description_property() { fn parse_large_tool_input_schema_strips_descriptions_without_removing_description_property() {
let schema = parse_tool_input_schema(&serde_json::json!({ let schema = parse_tool_input_schema(&serde_json::json!({
"type": "object", "type": "object",
"description": "x".repeat(4_500), "description": "x".repeat(5_500),
"properties": { "properties": {
"description": { "description": {
"type": "string", "type": "string",
@@ -1225,7 +1225,7 @@ fn parse_large_tool_input_schema_prunes_single_composition_variant_if_still_over
"anyOf": [ "anyOf": [
{ {
"type": "string", "type": "string",
"enum": ["x".repeat(4_500)] "enum": ["x".repeat(5_500)]
} }
] ]
} }
@@ -1248,7 +1248,7 @@ fn parse_large_tool_input_schema_prunes_single_composition_variant_if_still_over
fn parse_large_tool_input_schema_preserves_object_enum_literal_descriptions() { fn parse_large_tool_input_schema_preserves_object_enum_literal_descriptions() {
let schema = parse_tool_input_schema(&serde_json::json!({ let schema = parse_tool_input_schema(&serde_json::json!({
"type": "object", "type": "object",
"description": "x".repeat(4_500), "description": "x".repeat(5_500),
"properties": { "properties": {
"choice": { "choice": {
"enum": [ "enum": [