mirror of
https://github.com/openai/codex.git
synced 2026-11-09 08:40:33 +00:00
Preserve bounds in reserved tool schemas (#40719)
## Why Reserved tool parameter constraints must survive schema parsing so the model receives the declared limits. ## What changed - Preserve `minimum` and `maximum` as exact JSON numbers. - Preserve `maxLength` and infer a string schema when it is the only type hint. ## Testing - Cover bounded integer, number, and string schemas through both parsing paths. - Verify history and notes tools retain their constraints in app-server model requests. GitOrigin-RevId: 4cc89722b5b226d595b57232ec3b8e825863faf3
This commit is contained in:
1 parent
de70ec840f
commit
42624fd63b
3 files changed
+78
-3
No files matched your search
@@ -170,6 +170,31 @@ async fn app_server_uses_configured_notes_backend_for_context_window_hints(
|
||||
"app-server should expose {namespace}.{tool_name} to the model"
|
||||
);
|
||||
}
|
||||
// Reserved tools must retain their parameter constraints in the model request.
|
||||
for (namespace, tool_name, property, expected) in [
|
||||
(
|
||||
"history",
|
||||
"list_items",
|
||||
"limit",
|
||||
json!({"type": "integer", "minimum": 1, "maximum": 20}),
|
||||
),
|
||||
(
|
||||
"notes",
|
||||
"search_contents",
|
||||
"query",
|
||||
json!({"type": "string", "maxLength": 1000}),
|
||||
),
|
||||
] {
|
||||
let tool = request
|
||||
.tool_by_name(namespace, tool_name)
|
||||
.expect("history/notes tool should be exposed");
|
||||
let mut schema = tool["parameters"]["properties"][property].clone();
|
||||
schema
|
||||
.as_object_mut()
|
||||
.expect("parameter schema")
|
||||
.remove("description");
|
||||
assert_eq!(schema, expected, "{namespace}.{tool_name}.{property}");
|
||||
}
|
||||
}
|
||||
assert!(request.tool_by_name("notes", "thread_hint").is_none());
|
||||
|
||||
|
||||
Reference in new issue
Block a user