Make history and notes tools Bridge-compatible (#40775)

## What changed

- Express nullable history and notes arguments with `anyOf` and remove unsupported schema constraints.
- Forward valid JSON object arguments to the backend without enforcing client-side limits.
- Clarify history ID, ordering, cross-agent path, and consistency semantics in the tool descriptions.

## Testing

- Cover forwarding previously restricted argument values for every history and notes tool.
- Verify app-server requests expose the Bridge-compatible schemas and still reject non-object arguments locally.

GitOrigin-RevId: 28809fe9da5099944fd04962b5e71ffda4163eea
This commit is contained in:
Brandon Zhang authored and copyberry committed 2026-08-26 03:46:23 +00:00
1 parent e24190caa9
commit 25a6e316c8
4 files changed
+123 -127

No files matched your search

@@ -170,19 +170,19 @@ 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.
// Reserved tools must retain Bridge-compatible constraints in the model request.
for (namespace, tool_name, property, expected) in [
(
"history",
"list_items",
"limit",
json!({"type": "integer", "minimum": 1, "maximum": 20}),
json!({"type": "integer", "minimum": 1}),
),
(
"notes",
"search_contents",
"query",
json!({"type": "string", "maxLength": 1000}),
json!({"type": "string"}),
),
] {
let tool = request
@@ -286,7 +286,11 @@ async fn history_notes_and_async_message_emit_control_tool_analytics() -> Result
"send_user_message_async",
json!({"message": "PRIVATE_MESSAGE"}),
),
("notes", "list_files_by_prefix", json!({"max_results": 101})),
(
"notes",
"list_files_by_prefix",
json!(["PRIVATE_INVALID_ARGUMENTS"]),
),
(
"functions",
"send_user_message_async",
@@ -417,6 +421,10 @@ async fn history_notes_and_async_message_emit_control_tool_analytics() -> Result
response_mock.requests()[10].function_call_output_text("call-9"),
Some(r#"{"accepted":true}"#.to_string())
);
assert_eq!(
response_mock.requests()[11].function_call_output_text("call-10"),
Some("History tool arguments must be a JSON object".to_string())
);
Ok(())
}