mirror of
https://github.com/openai/codex.git
synced 2026-11-22 07:13:50 +00:00
Rename the tool registry metadata setting (#37400)
## What changed Rename `features.tool_registry.include_tool_namespaces_info` to `features.tool_registry.include_tool_metadata` across configuration parsing, schema generation, resolved configuration locking, and tests. Update its description to cover authoritative tool information in request metadata. GitOrigin-RevId: 93b404483b71fed04031d767a41ac2bb70b836b2
This commit is contained in:
1 parent
4ee41929ea
commit
c87a218bd3
7 files changed
+22
-22
No files matched your search
@@ -95,8 +95,8 @@ fn strict_config_accepts_tool_registry_config() {
|
|||||||
for contents in [
|
for contents in [
|
||||||
"[features.tool_registry]\nerror_on_tool_collisions = true\n",
|
"[features.tool_registry]\nerror_on_tool_collisions = true\n",
|
||||||
"[profiles.work.features.tool_registry]\nerror_on_tool_collisions = true\n",
|
"[profiles.work.features.tool_registry]\nerror_on_tool_collisions = true\n",
|
||||||
"[features.tool_registry]\ninclude_tool_namespaces_info = true\n",
|
"[features.tool_registry]\ninclude_tool_metadata = true\n",
|
||||||
"[profiles.work.features.tool_registry]\ninclude_tool_namespaces_info = true\n",
|
"[profiles.work.features.tool_registry]\ninclude_tool_metadata = true\n",
|
||||||
] {
|
] {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
config_error_from_ignored_toml_fields::<ConfigToml>(path, contents),
|
config_error_from_ignored_toml_fields::<ConfigToml>(path, contents),
|
||||||
|
|||||||
@@ -3219,8 +3219,8 @@
|
|||||||
"description": "Fail the turn when multiple tools share the same effective name.",
|
"description": "Fail the turn when multiple tools share the same effective name.",
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"include_tool_namespaces_info": {
|
"include_tool_metadata": {
|
||||||
"description": "Include the resolved tool namespace inventory in per-turn request metadata.",
|
"description": "Include authoritative tool information in request metadata.",
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -574,7 +574,7 @@ disable_in_process_fallback = true
|
|||||||
async fn load_config_resolves_tool_registry_config() -> std::io::Result<()> {
|
async fn load_config_resolves_tool_registry_config() -> std::io::Result<()> {
|
||||||
let codex_home = tempdir()?;
|
let codex_home = tempdir()?;
|
||||||
|
|
||||||
for (config_toml, error_on_tool_collisions, include_tool_namespaces_info) in [
|
for (config_toml, error_on_tool_collisions, include_tool_metadata) in [
|
||||||
("", false, false),
|
("", false, false),
|
||||||
(
|
(
|
||||||
"[features.tool_registry]\nerror_on_tool_collisions = true\n",
|
"[features.tool_registry]\nerror_on_tool_collisions = true\n",
|
||||||
@@ -582,7 +582,7 @@ async fn load_config_resolves_tool_registry_config() -> std::io::Result<()> {
|
|||||||
false,
|
false,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"[features.tool_registry]\ninclude_tool_namespaces_info = true\n",
|
"[features.tool_registry]\ninclude_tool_metadata = true\n",
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
),
|
),
|
||||||
@@ -601,8 +601,8 @@ async fn load_config_resolves_tool_registry_config() -> std::io::Result<()> {
|
|||||||
error_on_tool_collisions
|
error_on_tool_collisions
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
config.tool_registry.include_tool_namespaces_info,
|
config.tool_registry.include_tool_metadata,
|
||||||
include_tool_namespaces_info
|
include_tool_metadata
|
||||||
);
|
);
|
||||||
assert!(!config.features.enabled(Feature::CodeMode));
|
assert!(!config.features.enabled(Feature::CodeMode));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1115,8 +1115,8 @@ pub struct Config {
|
|||||||
pub struct ToolRegistryConfig {
|
pub struct ToolRegistryConfig {
|
||||||
/// Fail the turn when multiple tools share the same effective name.
|
/// Fail the turn when multiple tools share the same effective name.
|
||||||
pub error_on_tool_collisions: bool,
|
pub error_on_tool_collisions: bool,
|
||||||
/// Include the resolved tool namespace inventory in per-turn request metadata.
|
/// Include authoritative tool information in request metadata.
|
||||||
pub include_tool_namespaces_info: bool,
|
pub include_tool_metadata: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
const DEFAULT_CODE_MODE_EXEC_YIELD_TIME_MS: u64 = 30_000;
|
const DEFAULT_CODE_MODE_EXEC_YIELD_TIME_MS: u64 = 30_000;
|
||||||
@@ -3719,11 +3719,11 @@ impl Config {
|
|||||||
.and_then(|features| features.tool_registry.as_ref())
|
.and_then(|features| features.tool_registry.as_ref())
|
||||||
.and_then(|config| config.error_on_tool_collisions)
|
.and_then(|config| config.error_on_tool_collisions)
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
include_tool_namespaces_info: cfg
|
include_tool_metadata: cfg
|
||||||
.features
|
.features
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(|features| features.tool_registry.as_ref())
|
.and_then(|features| features.tool_registry.as_ref())
|
||||||
.and_then(|config| config.include_tool_namespaces_info)
|
.and_then(|config| config.include_tool_metadata)
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
};
|
};
|
||||||
let code_mode = resolve_code_mode_config(&cfg);
|
let code_mode = resolve_code_mode_config(&cfg);
|
||||||
|
|||||||
@@ -155,12 +155,12 @@ fn save_config_resolved_fields(
|
|||||||
.get_or_insert_with(FeaturesToml::default);
|
.get_or_insert_with(FeaturesToml::default);
|
||||||
features.materialize_resolved_enabled(config.features.get());
|
features.materialize_resolved_enabled(config.features.get());
|
||||||
if config.tool_registry.error_on_tool_collisions
|
if config.tool_registry.error_on_tool_collisions
|
||||||
|| config.tool_registry.include_tool_namespaces_info
|
|| config.tool_registry.include_tool_metadata
|
||||||
|| features.tool_registry.is_some()
|
|| features.tool_registry.is_some()
|
||||||
{
|
{
|
||||||
features.tool_registry = Some(ToolRegistryConfigToml {
|
features.tool_registry = Some(ToolRegistryConfigToml {
|
||||||
error_on_tool_collisions: Some(config.tool_registry.error_on_tool_collisions),
|
error_on_tool_collisions: Some(config.tool_registry.error_on_tool_collisions),
|
||||||
include_tool_namespaces_info: Some(config.tool_registry.include_tool_namespaces_info),
|
include_tool_metadata: Some(config.tool_registry.include_tool_metadata),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
let mut multi_agent_v2: MultiAgentV2ConfigToml =
|
let mut multi_agent_v2: MultiAgentV2ConfigToml =
|
||||||
@@ -273,7 +273,7 @@ mod tests {
|
|||||||
let mut sc = crate::session::tests::make_session_configuration_for_tests().await;
|
let mut sc = crate::session::tests::make_session_configuration_for_tests().await;
|
||||||
let mut config = (*sc.original_config_do_not_use).clone();
|
let mut config = (*sc.original_config_do_not_use).clone();
|
||||||
config.tool_registry.error_on_tool_collisions = true;
|
config.tool_registry.error_on_tool_collisions = true;
|
||||||
config.tool_registry.include_tool_namespaces_info = true;
|
config.tool_registry.include_tool_metadata = true;
|
||||||
config.multi_agent_v2.subagent_developer_instructions =
|
config.multi_agent_v2.subagent_developer_instructions =
|
||||||
Some("Locked subagent developer instructions.".to_string());
|
Some("Locked subagent developer instructions.".to_string());
|
||||||
config.token_budget = Some(crate::config::TokenBudgetConfig {
|
config.token_budget = Some(crate::config::TokenBudgetConfig {
|
||||||
@@ -334,7 +334,7 @@ mod tests {
|
|||||||
features.tool_registry,
|
features.tool_registry,
|
||||||
Some(ToolRegistryConfigToml {
|
Some(ToolRegistryConfigToml {
|
||||||
error_on_tool_collisions: Some(true),
|
error_on_tool_collisions: Some(true),
|
||||||
include_tool_namespaces_info: Some(true),
|
include_tool_metadata: Some(true),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
let feature_entries = features.entries();
|
let feature_entries = features.entries();
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ pub struct ToolRegistryConfigToml {
|
|||||||
/// Fail the turn when multiple tools share the same effective name.
|
/// Fail the turn when multiple tools share the same effective name.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub error_on_tool_collisions: Option<bool>,
|
pub error_on_tool_collisions: Option<bool>,
|
||||||
/// Include the resolved tool namespace inventory in per-turn request metadata.
|
/// Include authoritative tool information in request metadata.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub include_tool_namespaces_info: Option<bool>,
|
pub include_tool_metadata: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq, JsonSchema)]
|
#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq, JsonSchema)]
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ fn under_development_features_are_disabled_by_default() {
|
|||||||
#[test]
|
#[test]
|
||||||
fn tool_registry_config_is_not_a_feature_toggle() {
|
fn tool_registry_config_is_not_a_feature_toggle() {
|
||||||
let features: FeaturesToml = toml::from_str(
|
let features: FeaturesToml = toml::from_str(
|
||||||
"[tool_registry]\nerror_on_tool_collisions = true\ninclude_tool_namespaces_info = true\n",
|
"[tool_registry]\nerror_on_tool_collisions = true\ninclude_tool_metadata = true\n",
|
||||||
)
|
)
|
||||||
.expect("tool registry settings should deserialize");
|
.expect("tool registry settings should deserialize");
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ fn tool_registry_config_is_not_a_feature_toggle() {
|
|||||||
features.tool_registry,
|
features.tool_registry,
|
||||||
Some(crate::ToolRegistryConfigToml {
|
Some(crate::ToolRegistryConfigToml {
|
||||||
error_on_tool_collisions: Some(true),
|
error_on_tool_collisions: Some(true),
|
||||||
include_tool_namespaces_info: Some(true),
|
include_tool_metadata: Some(true),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
assert!(features.entries().is_empty());
|
assert!(features.entries().is_empty());
|
||||||
@@ -554,7 +554,7 @@ fn materialize_resolved_enabled_writes_all_features_and_preserves_custom_config(
|
|||||||
let mut features_toml = FeaturesToml {
|
let mut features_toml = FeaturesToml {
|
||||||
tool_registry: Some(crate::ToolRegistryConfigToml {
|
tool_registry: Some(crate::ToolRegistryConfigToml {
|
||||||
error_on_tool_collisions: Some(true),
|
error_on_tool_collisions: Some(true),
|
||||||
include_tool_namespaces_info: Some(true),
|
include_tool_metadata: Some(true),
|
||||||
}),
|
}),
|
||||||
code_mode_host: Some(FeatureToml::Config(crate::CodeModeHostConfigToml {
|
code_mode_host: Some(FeatureToml::Config(crate::CodeModeHostConfigToml {
|
||||||
enabled: Some(false),
|
enabled: Some(false),
|
||||||
@@ -587,7 +587,7 @@ fn materialize_resolved_enabled_writes_all_features_and_preserves_custom_config(
|
|||||||
features_toml.tool_registry,
|
features_toml.tool_registry,
|
||||||
Some(crate::ToolRegistryConfigToml {
|
Some(crate::ToolRegistryConfigToml {
|
||||||
error_on_tool_collisions: Some(true),
|
error_on_tool_collisions: Some(true),
|
||||||
include_tool_namespaces_info: Some(true),
|
include_tool_metadata: Some(true),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
let entries = features_toml.entries();
|
let entries = features_toml.entries();
|
||||||
|
|||||||
Reference in new issue
Block a user