Lightweight coding agent that runs in your terminal
Rust
[codex] increase tool schema compaction threshold (#31497)
fbauer33b6f9aee16dc7
diff --git a/codex-rs/tools/src/json_schema.rs b/codex-rs/tools/src/json_schema.rsindex acffb78b11..7c9edd08e1 100644--- a/codex-rs/tools/src/json_schema.rs+++ b/codex-rs/tools/src/json_schema.rs@@ -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// 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;/// Shrink unusually large tool schemas while preserving the top-level argumentdiff --git a/codex-rs/tools/src/json_schema_tests.rs b/codex-rs/tools/src/json_schema_tests.rsindex 3011c54f93..c7377f31d9 100644--- a/codex-rs/tools/src/json_schema_tests.rs+++ b/codex-rs/tools/src/json_schema_tests.rs@@ -912,7 +912,7 @@ fn many_string_properties(count: usize) -> serde_json::Map<String, serde_json::Vfn parse_large_tool_input_schema_compacts_descriptions_only_on_default_path() {let input_schema = serde_json::json!({"type": "object",- "description": "x".repeat(4_500),+ "description": "x".repeat(5_500),"properties": {"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::json!({"type": "object",- "description": "x".repeat(4_500),+ "description": "x".repeat(5_500),"properties": {"metadata": {"$ref": "#/$defs/metadata"@@ -978,7 +978,7 @@ fn parse_large_tool_input_schema_ignores_dropped_metadata_for_budget() {"type": "object","examples": [{- "payload": "x".repeat(4_500)+ "payload": "x".repeat(5_500)}],"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() {let schema = parse_tool_input_schema(&serde_json::json!({"type": "object",- "description": "x".repeat(4_500),+ "description": "x".repeat(5_500),"properties": {"event": {"type": "object",@@ -1081,7 +1081,7 @@ fn parse_large_tool_input_schema_stops_after_dropping_root_definitions_when_undefn parse_large_tool_input_schema_strips_descriptions_without_removing_description_property() {let schema = parse_tool_input_schema(&serde_json::json!({"type": "object",- "description": "x".repeat(4_500),+ "description": "x".repeat(5_500),"properties": {"description": {"type": "string",@@ -1225,7 +1225,7 @@ fn parse_large_tool_input_schema_prunes_single_composition_variant_if_still_over"anyOf": [{"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_overfn parse_large_tool_input_schema_preserves_object_enum_literal_descriptions() {let schema = parse_tool_input_schema(&serde_json::json!({"type": "object",- "description": "x".repeat(4_500),+ "description": "x".repeat(5_500),"properties": {"choice": {"enum": [