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:
Channing Conger authored and copyberry committed 2026-07-25 00:01:43 +00:00
1 parent a453588416
commit cba0e2701c
14 files changed
+297 -18

No files matched your search

+12
View File
@@ -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(),
}
}