Use optional default environment for disabled mode

Restore CODEX_EXEC_SERVER_URL=none semantics by making EnvironmentManager::default_environment return None when environment access is disabled. Remove the separate disabled-for-agent flag and derive tool availability from the optional default environment.

Add an end-to-end tool exposure test for CODEX_EXEC_SERVER_URL=none.

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
starr-openai
2026-04-21 10:35:53 -07:00
co-authored by Codex
parent 64a9a98695
commit 9d3188f79b
11 changed files with 145 additions and 107 deletions
@@ -5698,7 +5698,8 @@ impl CodexMessageProcessor {
let environment = self
.thread_manager
.environment_manager()
.default_environment();
.default_environment()
.unwrap_or_else(|| Arc::new(codex_exec_server::Environment::default()));
// Status listing has no turn cwd. This fallback is used only
// by executor-backed stdio MCPs whose config omits `cwd`.
McpRuntimeEnvironment::new(environment, config.cwd.to_path_buf())
@@ -5855,7 +5856,8 @@ impl CodexMessageProcessor {
let environment = self
.thread_manager
.environment_manager()
.default_environment();
.default_environment()
.unwrap_or_else(|| Arc::new(codex_exec_server::Environment::default()));
// Resource reads without a thread have no turn cwd. This fallback
// is used only by executor-backed stdio MCPs whose config omits `cwd`.
McpRuntimeEnvironment::new(environment, config.cwd.to_path_buf())
@@ -6449,8 +6451,7 @@ impl CodexMessageProcessor {
.thread_manager
.environment_manager()
.default_environment()
.get_filesystem();
let fs = Some(fs);
.map(|environment| environment.get_filesystem());
let mut data = Vec::new();
for cwd in cwds {
let extra_roots = extra_roots_by_cwd