Add tool namespace metadata configuration (#37389)

## What changed

- Add `features.tool_registry.include_tool_namespaces_info` to the TOML model,
  generated schema, and resolved runtime configuration. The setting defaults to
  `false` and controls whether per-turn request metadata includes the resolved
  tool namespace inventory.
- Preserve the resolved setting in session configuration locks.
- Cover top-level and profile-scoped strict configuration, deserialization,
  resolution, and lock-file persistence.

GitOrigin-RevId: 74124086c0d7de30094b411001f0ec0af490935d
This commit is contained in:
rka-oai
2026-08-07 06:23:43 +00:00
committed by copyberry
parent 0bdce9f424
commit 4ee41929ea
7 changed files with 43 additions and 6 deletions

View File

@@ -10,6 +10,9 @@ pub struct ToolRegistryConfigToml {
/// Fail the turn when multiple tools share the same effective name.
#[serde(skip_serializing_if = "Option::is_none")]
pub error_on_tool_collisions: Option<bool>,
/// Include the resolved tool namespace inventory in per-turn request metadata.
#[serde(skip_serializing_if = "Option::is_none")]
pub include_tool_namespaces_info: Option<bool>,
}
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq, JsonSchema)]

View File

@@ -29,14 +29,16 @@ fn under_development_features_are_disabled_by_default() {
#[test]
fn tool_registry_config_is_not_a_feature_toggle() {
let features: FeaturesToml =
toml::from_str("[tool_registry]\nerror_on_tool_collisions = true\n")
.expect("tool registry settings should deserialize");
let features: FeaturesToml = toml::from_str(
"[tool_registry]\nerror_on_tool_collisions = true\ninclude_tool_namespaces_info = true\n",
)
.expect("tool registry settings should deserialize");
assert_eq!(
features.tool_registry,
Some(crate::ToolRegistryConfigToml {
error_on_tool_collisions: Some(true),
include_tool_namespaces_info: Some(true),
})
);
assert!(features.entries().is_empty());
@@ -552,6 +554,7 @@ fn materialize_resolved_enabled_writes_all_features_and_preserves_custom_config(
let mut features_toml = FeaturesToml {
tool_registry: Some(crate::ToolRegistryConfigToml {
error_on_tool_collisions: Some(true),
include_tool_namespaces_info: Some(true),
}),
code_mode_host: Some(FeatureToml::Config(crate::CodeModeHostConfigToml {
enabled: Some(false),
@@ -584,6 +587,7 @@ fn materialize_resolved_enabled_writes_all_features_and_preserves_custom_config(
features_toml.tool_registry,
Some(crate::ToolRegistryConfigToml {
error_on_tool_collisions: Some(true),
include_tool_namespaces_info: Some(true),
})
);
let entries = features_toml.entries();