Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion codex-rs/tools/src/json_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 argument
Expand Down
14 changes: 7 additions & 7 deletions codex-rs/tools/src/json_schema_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
let input_schema = serde_json::json!({
"type": "object",
"description": "x".repeat(4_500),
"description": "x".repeat(5_500),
"properties": {
"metadata": {
"$ref": "#/$defs/metadata"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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() {
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",
Expand Down Expand Up @@ -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)]
}
]
}
Expand All @@ -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() {
let schema = parse_tool_input_schema(&serde_json::json!({
"type": "object",
"description": "x".repeat(4_500),
"description": "x".repeat(5_500),
"properties": {
"choice": {
"enum": [
Expand Down
Loading