mirror of
https://github.com/openai/codex.git
synced 2026-10-27 18:48:37 +00:00
## What changed - Add `agents.enabled` as a user override for multi-agent tools while keeping an enabled `features.multi_agent_v2` authoritative. - Rename the shared spawned-thread limit to `agents.max_concurrent_threads_per_session`, retain `agents.max_threads` as an alias, and apply the setting to both multi-agent backends. - Add reserved subagent model, reasoning effort, and agent-type settings to the config surface and persist all resolved agent settings in config locks. - Show the resolved `[agents]` values in TUI debug-config output. ## Testing - Cover config loading, legacy alias normalization across merged layers, backend-selection precedence, V2 concurrency, and debug output. GitOrigin-RevId: 2957c954a2e1aef51592768dbbccd56c4bf8f118
60 lines
1.8 KiB
Rust
60 lines
1.8 KiB
Rust
use toml::Value as TomlValue;
|
|
use toml::map::Map as TomlMap;
|
|
|
|
#[derive(Debug, Clone, Copy)]
|
|
struct ConfigKeyAlias {
|
|
table_path: &'static [&'static str],
|
|
legacy_key: &'static str,
|
|
canonical_key: &'static str,
|
|
}
|
|
|
|
const CONFIG_KEY_ALIASES: &[ConfigKeyAlias] = &[
|
|
ConfigKeyAlias {
|
|
table_path: &["memories"],
|
|
legacy_key: "no_memories_if_mcp_or_web_search",
|
|
canonical_key: "disable_on_external_context",
|
|
},
|
|
ConfigKeyAlias {
|
|
table_path: &["agents"],
|
|
legacy_key: "max_threads",
|
|
canonical_key: "max_concurrent_threads_per_session",
|
|
},
|
|
];
|
|
|
|
pub(crate) fn normalize_key_aliases(path: &[String], table: &mut TomlMap<String, TomlValue>) {
|
|
for alias in CONFIG_KEY_ALIASES {
|
|
if path
|
|
.iter()
|
|
.map(String::as_str)
|
|
.eq(alias.table_path.iter().copied())
|
|
&& let Some(value) = table.remove(alias.legacy_key)
|
|
{
|
|
table
|
|
.entry(alias.canonical_key.to_string())
|
|
.or_insert(value);
|
|
}
|
|
}
|
|
}
|
|
|
|
pub(crate) fn normalized_with_key_aliases(value: &TomlValue, path: &[String]) -> TomlValue {
|
|
match value {
|
|
TomlValue::Table(table) => {
|
|
let mut normalized = TomlMap::new();
|
|
for (key, child) in table {
|
|
let mut child_path = path.to_vec();
|
|
child_path.push(key.clone());
|
|
normalized.insert(key.clone(), normalized_with_key_aliases(child, &child_path));
|
|
}
|
|
normalize_key_aliases(path, &mut normalized);
|
|
TomlValue::Table(normalized)
|
|
}
|
|
TomlValue::Array(items) => TomlValue::Array(
|
|
items
|
|
.iter()
|
|
.map(|item| normalized_with_key_aliases(item, path))
|
|
.collect(),
|
|
),
|
|
_ => value.clone(),
|
|
}
|
|
}
|