mirror of
https://github.com/openai/codex.git
synced 2026-11-22 15:15:18 +00:00
Allow disabling the in-process code-mode host fallback (#35266)
## What changed - Allow `features.code_mode_host` to use a configuration table with `disable_in_process_fallback`. When enabled, failure to start the standalone host is returned as tool output instead of falling back to embedded V8. - Preserve the existing fallback behavior by default and continue accepting the boolean feature toggle. - Limit displayed host paths in spawn errors to 512 bytes while retaining the executable-bearing suffix and valid UTF-8 boundaries. ## Testing - Cover boolean and table-based feature configuration, fallback-disabled host failures, and bounded ASCII and UTF-8 error paths. GitOrigin-RevId: ab3d014e79054c2f8beef9a658915f01cca197b2
This commit is contained in:
1 parent
a453588416
commit
cba0e2701c
14 files changed
+297
-18
No files matched your search
@@ -537,6 +537,10 @@ async fn load_config_resolves_code_mode_config() -> std::io::Result<()> {
|
||||
enabled = true
|
||||
excluded_tool_namespaces = ["mcp__codex_apps", "multi_agent_v1"]
|
||||
direct_only_tool_namespaces = ["mcp__history", "mcp__notes"]
|
||||
|
||||
[features.code_mode_host]
|
||||
enabled = true
|
||||
disable_in_process_fallback = true
|
||||
"#,
|
||||
)
|
||||
.expect("TOML deserialization should succeed");
|
||||
@@ -555,7 +559,9 @@ direct_only_tool_namespaces = ["mcp__history", "mcp__notes"]
|
||||
config.code_mode.direct_only_tool_namespaces,
|
||||
vec!["mcp__history".to_string(), "mcp__notes".to_string()]
|
||||
);
|
||||
assert!(config.code_mode.disable_in_process_fallback);
|
||||
assert!(config.features.enabled(Feature::CodeMode));
|
||||
assert!(config.features.enabled(Feature::CodeModeHost));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -1099,6 +1099,7 @@ pub struct Config {
|
||||
pub struct CodeModeConfig {
|
||||
pub excluded_tool_namespaces: Vec<String>,
|
||||
pub direct_only_tool_namespaces: Vec<String>,
|
||||
pub disable_in_process_fallback: bool,
|
||||
}
|
||||
|
||||
pub(crate) const DEFAULT_TOKEN_BUDGET_REMINDER_MESSAGE_TEMPLATE: &str = concat!(
|
||||
@@ -2556,6 +2557,14 @@ fn resolve_orchestrator_feature_enabled(
|
||||
|
||||
fn resolve_code_mode_config(config_toml: &ConfigToml) -> CodeModeConfig {
|
||||
let base = code_mode_toml_config(config_toml.features.as_ref());
|
||||
let host = config_toml
|
||||
.features
|
||||
.as_ref()
|
||||
.and_then(|features| features.code_mode_host.as_ref())
|
||||
.and_then(|feature| match feature {
|
||||
FeatureToml::Enabled(_) => None,
|
||||
FeatureToml::Config(config) => Some(config),
|
||||
});
|
||||
|
||||
CodeModeConfig {
|
||||
excluded_tool_namespaces: base
|
||||
@@ -2566,6 +2575,9 @@ fn resolve_code_mode_config(config_toml: &ConfigToml) -> CodeModeConfig {
|
||||
.and_then(|config| config.direct_only_tool_namespaces.as_ref())
|
||||
.cloned()
|
||||
.unwrap_or_default(),
|
||||
disable_in_process_fallback: host
|
||||
.and_then(|config| config.disable_in_process_fallback)
|
||||
.unwrap_or_default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user