Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Keep environment-backed tools exposed across readiness changes (#50741)

Won Park550eb50545a7
diff --git a/codex-rs/core/src/tools/handlers/apply_patch.rs b/codex-rs/core/src/tools/handlers/apply_patch.rs
index 390e62dd2b..5b0bea21c3 100644
--- a/codex-rs/core/src/tools/handlers/apply_patch.rs
+++ b/codex-rs/core/src/tools/handlers/apply_patch.rs
@@ -345,15 +345,10 @@ impl ApplyPatchHandler {
require_environment_id(args.environment_id.as_deref(), self.multi_environment)?;
// Verify the parsed patch against the selected environment filesystem.
- let Some(turn_environment) = resolve_tool_environment(
+ let turn_environment = resolve_tool_environment(
&step_context.environments,
selected_environment_id.as_deref(),
- )?
- else {
- return Err(FunctionCallError::RespondToModel(
- "apply_patch is unavailable in this session".to_string(),
- ));
- };
+ )?;
let fs = turn_environment.environment.get_filesystem();
let sandbox = turn_environment.sandbox_context(/*additional_permissions*/ None);
match codex_apply_patch::verify_apply_patch_args_with_mode(
diff --git a/codex-rs/core/src/tools/handlers/mod.rs b/codex-rs/core/src/tools/handlers/mod.rs
index bd58aeda59..a4d92223c3 100644
--- a/codex-rs/core/src/tools/handlers/mod.rs
+++ b/codex-rs/core/src/tools/handlers/mod.rs
@@ -160,21 +160,30 @@ where
fn resolve_tool_environment<'a>(
environments: &'a TurnEnvironmentSnapshot,
environment_id: Option<&str>,
-) -> Result<Option<&'a TurnEnvironment>, FunctionCallError> {
+) -> Result<&'a TurnEnvironment, FunctionCallError> {
environment_id.map_or_else(
- || Ok(environments.primary()),
+ || environments.primary(),
|environment_id| {
environments
.turn_environments()
.find(|environment| environment.selection.environment_id == environment_id)
- .map(Some)
- .ok_or_else(|| {
- FunctionCallError::RespondToModel(format!(
- "unknown turn environment id `{environment_id}`"
- ))
- })
},
- )
+ ).ok_or_else(|| {
+ if let Some(environment_id) = environment_id
+ && !environments
+ .all_selections()
+ .iter()
+ .any(|selection| selection.environment_id == environment_id)
+ {
+ return FunctionCallError::RespondToModel(format!(
+ "unknown turn environment id `{environment_id}`"
+ ));
+ }
+ FunctionCallError::RespondToModel(
+ "No usable execution environment is available. Wait for an environment to become available before using this tool."
+ .to_string(),
+ )
+ })
}
/// Validates feature/policy constraints for `with_additional_permissions` and
diff --git a/codex-rs/core/src/tools/handlers/request_permissions.rs b/codex-rs/core/src/tools/handlers/request_permissions.rs
index a4edc0ce9a..b393766fb1 100644
--- a/codex-rs/core/src/tools/handlers/request_permissions.rs
+++ b/codex-rs/core/src/tools/handlers/request_permissions.rs
@@ -68,15 +68,10 @@ impl RequestPermissionsHandler {
};
let environment_args: RequestPermissionsEnvironmentArgs = parse_arguments(&arguments)?;
- let Some(turn_environment) = resolve_tool_environment(
+ let turn_environment = resolve_tool_environment(
&step_context.environments,
environment_args.environment_id.as_deref(),
- )?
- else {
- return Err(FunctionCallError::RespondToModel(
- "request_permissions requires a primary environment".to_string(),
- ));
- };
+ )?;
let sandbox_context =
turn_environment.sandbox_context(/*additional_permissions*/ None);
let context = sandbox_context.policy_context();
diff --git a/codex-rs/core/src/tools/handlers/shell_spec.rs b/codex-rs/core/src/tools/handlers/shell_spec.rs
index cabe62cbe8..ca48b21220 100644
--- a/codex-rs/core/src/tools/handlers/shell_spec.rs
+++ b/codex-rs/core/src/tools/handlers/shell_spec.rs
@@ -7,7 +7,6 @@ use std::collections::BTreeMap;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct CommandToolOptions {
- pub allow_login_shell: bool,
pub exec_permission_approvals_enabled: bool,
}
@@ -16,7 +15,6 @@ pub fn create_exec_command_tool(options: CommandToolOptions) -> ToolSpec {
create_exec_command_tool_with_environment_id(
options,
/*include_environment_id*/ false,
- /*include_shell_parameter*/ true,
/*include_windows_shell_guidance*/ cfg!(windows),
)
}
@@ -24,7 +22,6 @@ pub fn create_exec_command_tool(options: CommandToolOptions) -> ToolSpec {
pub(crate) fn create_exec_command_tool_with_environment_id(
options: CommandToolOptions,
include_environment_id: bool,
- include_shell_parameter: bool,
include_windows_shell_guidance: bool,
) -> ToolSpec {
let yield_time_ms_description = if cfg!(windows) {
@@ -62,23 +59,19 @@ pub(crate) fn create_exec_command_tool_with_environment_id(
)),
),
]);
- if include_shell_parameter {
- properties.insert(
- "shell".to_string(),
- JsonSchema::string(Some(
- "Shell binary to launch. Defaults to the user's default shell.".to_string(),
- )),
- );
- }
- if options.allow_login_shell {
- properties.insert(
- "login".to_string(),
- JsonSchema::boolean(Some(
- "True runs the shell with -l/-i semantics; false disables them. Defaults to true."
- .to_string(),
- )),
- );
- }
+ properties.insert(
+ "shell".to_string(),
+ JsonSchema::string(Some(
+ "Shell binary to launch. Defaults to the user's default shell.".to_string(),
+ )),
+ );
+ properties.insert(
+ "login".to_string(),
+ JsonSchema::boolean(Some(
+ "True runs the shell with -l/-i semantics; false disables them. Defaults to true."
+ .to_string(),
+ )),
+ );
if include_environment_id {
properties.insert(
"environment_id".to_string(),
diff --git a/codex-rs/core/src/tools/handlers/shell_spec_tests.rs b/codex-rs/core/src/tools/handlers/shell_spec_tests.rs
index ee2886a159..7f8007b17f 100644
--- a/codex-rs/core/src/tools/handlers/shell_spec_tests.rs
+++ b/codex-rs/core/src/tools/handlers/shell_spec_tests.rs
@@ -6,17 +6,9 @@ fn windows_shell_guidance_description() -> String {
format!("\n\n{}", windows_shell_guidance())
}
-fn has_parameter(tool: &ToolSpec, parameter_name: &str) -> bool {
- serde_json::to_value(tool)
- .expect("tool spec should serialize")
- .pointer(&format!("/parameters/properties/{parameter_name}"))
- .is_some()
-}
-
#[test]
fn exec_command_tool_matches_expected_spec() {
let tool = create_exec_command_tool(CommandToolOptions {
- allow_login_shell: true,
exec_permission_approvals_enabled: false,
});
@@ -98,22 +90,6 @@ fn exec_command_tool_matches_expected_spec() {
);
}
-#[test]
-fn exec_command_tool_can_hide_shell_parameter() {
- let tool = create_exec_command_tool_with_environment_id(
- CommandToolOptions {
- allow_login_shell: true,
- exec_permission_approvals_enabled: false,
- },
- /*include_environment_id*/ false,
- /*include_shell_parameter*/ false,
- /*include_windows_shell_guidance*/ cfg!(windows),
- );
-
- assert!(!has_parameter(&tool, "shell"));
- assert!(has_parameter(&tool, "cmd"));
-}
-
#[test]
fn write_stdin_tool_matches_expected_spec() {
let tool = create_write_stdin_tool();
diff --git a/codex-rs/core/src/tools/handlers/unified_exec/exec_command.rs b/codex-rs/core/src/tools/handlers/unified_exec/exec_command.rs
index 7358f1ef72..56e5aff362 100644
--- a/codex-rs/core/src/tools/handlers/unified_exec/exec_command.rs
+++ b/codex-rs/core/src/tools/handlers/unified_exec/exec_command.rs
@@ -58,11 +58,9 @@ const EXEC_COMMAND_REJECTION_MAX_BYTES: usize = 900;
#[derive(Clone, Copy)]
pub(crate) struct ExecCommandHandlerOptions {
- pub(crate) allow_login_shell: bool,
pub(crate) allow_tty: bool,
pub(crate) exec_permission_approvals_enabled: bool,
pub(crate) include_environment_id: bool,
- pub(crate) include_shell_parameter: bool,
pub(crate) include_windows_shell_guidance: bool,
}
@@ -82,11 +80,9 @@ impl Default for ExecCommandHandler {
Self {
lifetime: ExecCommandLifetime::Interactive,
options: ExecCommandHandlerOptions {
- allow_login_shell: false,
allow_tty: true,
exec_permission_approvals_enabled: false,
include_environment_id: false,
- include_shell_parameter: true,
include_windows_shell_guidance: cfg!(windows),
},
}
@@ -117,11 +113,9 @@ impl ToolExecutor<ToolInvocation> for ExecCommandHandler {
fn spec(&self) -> ToolSpec {
let spec = create_exec_command_tool_with_environment_id(
CommandToolOptions {
- allow_login_shell: self.options.allow_login_shell,
exec_permission_approvals_enabled: self.options.exec_permission_approvals_enabled,
},
self.options.include_environment_id,
- self.options.include_shell_parameter,
self.options.include_windows_shell_guidance,
);
let mut spec = match self.lifetime {
@@ -184,15 +178,10 @@ impl ExecCommandHandler {
call_id.clone(),
);
let environment_args: ExecCommandEnvironmentArgs = parse_arguments(&arguments)?;
- let Some(turn_environment) = resolve_tool_environment(
+ let turn_environment = resolve_tool_environment(
&step_context.environments,
environment_args.environment_id.as_deref(),
- )?
- else {
- return Err(FunctionCallError::RespondToModel(
- "unified exec is unavailable in this session".to_string(),
- ));
- };
+ )?;
let native_environment_cwd = turn_environment.cwd().clone();
let cwd = environment_args
.workdir
diff --git a/codex-rs/core/src/tools/handlers/unified_exec/write_stdin.rs b/codex-rs/core/src/tools/handlers/unified_exec/write_stdin.rs
index 5f9d9cf8ca..1fecb98b04 100644
--- a/codex-rs/core/src/tools/handlers/unified_exec/write_stdin.rs
+++ b/codex-rs/core/src/tools/handlers/unified_exec/write_stdin.rs
@@ -3,6 +3,7 @@ use crate::tools::context::ToolInvocation;
use crate::tools::context::ToolPayload;
use crate::tools::context::boxed_tool_output;
use crate::tools::handlers::parse_arguments;
+use crate::tools::handlers::resolve_tool_environment;
use crate::tools::registry::CoreToolRuntime;
use crate::tools::registry::PostToolUsePayload;
use crate::tools::registry::PreToolUsePayload;
@@ -79,6 +80,7 @@ impl WriteStdinHandler {
};
let args: WriteStdinArgs = parse_arguments(&arguments)?;
+ resolve_tool_environment(&step_context.environments, /*environment_id*/ None)?;
let context =
UnifiedExecContext::new(session.clone(), step_context, cancellation_token, call_id);
let response = session
diff --git a/codex-rs/core/src/tools/handlers/view_image.rs b/codex-rs/core/src/tools/handlers/view_image.rs
index e5ff7f2a43..903df019f9 100644
--- a/codex-rs/core/src/tools/handlers/view_image.rs
+++ b/codex-rs/core/src/tools/handlers/view_image.rs
@@ -142,13 +142,8 @@ impl ViewImageHandler {
}
};
- let Some(turn_environment) =
- resolve_tool_environment(&step_context.environments, environment_id.as_deref())?
- else {
- return Err(FunctionCallError::RespondToModel(
- "view_image is unavailable in this session".to_string(),
- ));
- };
+ let turn_environment =
+ resolve_tool_environment(&step_context.environments, environment_id.as_deref())?;
let path_uri = turn_environment.cwd().join(&path).map_err(|err| {
FunctionCallError::RespondToModel(format!(
"unable to resolve image path `{path}` against environment cwd `{}`: {err}",
diff --git a/codex-rs/core/src/tools/spec_plan.rs b/codex-rs/core/src/tools/spec_plan.rs
index a3ec808099..7b95414c05 100644
--- a/codex-rs/core/src/tools/spec_plan.rs
+++ b/codex-rs/core/src/tools/spec_plan.rs
@@ -89,7 +89,6 @@ use codex_tools::ToolExecutor;
use codex_tools::ToolExposures;
use codex_tools::ToolName;
use codex_tools::ToolSpec;
-use codex_tools::UnifiedExecShellMode;
use codex_tools::can_request_original_image_detail;
use codex_tools::collect_code_mode_exec_prompt_tool_definitions;
use codex_tools::collect_request_plugin_install_entries;
@@ -1081,13 +1080,8 @@ fn standalone_web_search_enabled(turn_context: &TurnContext, model_info: &ModelI
}
fn tool_environment_mode(environments: &TurnEnvironmentSnapshot) -> ToolEnvironmentMode {
- ToolEnvironmentMode::from_count(environments.turn_environments().count())
-}
-
-fn any_environment_allows_login_shell(environments: &TurnEnvironmentSnapshot) -> bool {
- environments
- .turn_environments()
- .any(|environment| environment.config().allow_login_shell)
+ // Keep environment selectors stable as selected attachments change readiness.
+ ToolEnvironmentMode::from_count(environments.environments.len())
}
fn should_include_windows_shell_guidance(environments: &TurnEnvironmentSnapshot) -> bool {
@@ -1114,14 +1108,12 @@ fn add_shell_tools(context: &CoreToolPlanContext<'_>, registry: &mut ToolRegistr
let turn_context = context.turn_context;
let features = turn_context.config.features.get();
let environment_mode = tool_environment_mode(context.environments);
- if !environment_mode.has_environment()
- || !features.enabled(Feature::ShellTool)
+ if !features.enabled(Feature::ShellTool)
|| matches!(context.model_info.shell_type, ConfigShellToolType::Disabled)
{
return;
}
- let allow_login_shell = any_environment_allows_login_shell(context.environments);
if context.tool_policy.require_unified_exec && !features.enabled(Feature::UnifiedExec) {
return;
}
@@ -1129,14 +1121,9 @@ fn add_shell_tools(context: &CoreToolPlanContext<'_>, registry: &mut ToolRegistr
&& context.tool_policy.expose_additional_permissions;
let include_environment_id = matches!(environment_mode, ToolEnvironmentMode::Multiple);
let options = ExecCommandHandlerOptions {
- allow_login_shell,
allow_tty: features.enabled(Feature::UnifiedExecTty),
exec_permission_approvals_enabled,
include_environment_id,
- include_shell_parameter: unified_exec_should_include_shell_parameter(
- turn_context,
- context.environments,
- ),
include_windows_shell_guidance: should_include_windows_shell_guidance(context.environments),
};
if features.enabled(Feature::UnifiedExec) {
@@ -1150,18 +1137,6 @@ fn add_shell_tools(context: &CoreToolPlanContext<'_>, registry: &mut ToolRegistr
}
}
-fn unified_exec_should_include_shell_parameter(
- turn_context: &TurnContext,
- environments: &TurnEnvironmentSnapshot,
-) -> bool {
- !matches!(
- &turn_context.unified_exec_shell_mode,
- UnifiedExecShellMode::ZshFork(_)
- ) || environments
- .turn_environments()
- .any(|environment| environment.environment.is_remote())
-}
-
#[instrument(level = "trace", skip_all)]
fn add_mcp_resource_tools(context: &CoreToolPlanContext<'_>, registry: &mut ToolRegistry) {
if context.mcp.has_servers()
@@ -1249,7 +1224,7 @@ fn add_core_utility_tools(context: &CoreToolPlanContext<'_>, registry: &mut Tool
registry.add_with_exposure(SendMessageToUserAsyncHandler, ToolExposure::DirectModelOnly);
}
- if environment_mode.has_environment() && features.enabled(Feature::RequestPermissionsTool) {
+ if features.enabled(Feature::RequestPermissionsTool) {
registry.add(RequestPermissionsHandler);
}
@@ -1302,7 +1277,7 @@ fn add_core_utility_tools(context: &CoreToolPlanContext<'_>, registry: &mut Tool
));
}
- if environment_mode.has_environment() && context.model_info.apply_patch_tool_type.is_some() {
+ if context.model_info.apply_patch_tool_type.is_some() {
let include_environment_id = matches!(environment_mode, ToolEnvironmentMode::Multiple);
registry.add(ApplyPatchHandler::new(include_environment_id));
}
@@ -1316,7 +1291,7 @@ fn add_core_utility_tools(context: &CoreToolPlanContext<'_>, registry: &mut Tool
registry.add(TestSyncHandler);
}
- if environment_mode.has_environment() && features.enabled(Feature::ViewImage) {
+ if features.enabled(Feature::ViewImage) {
let include_environment_id = matches!(environment_mode, ToolEnvironmentMode::Multiple);
registry.add(ViewImageHandler::new(ViewImageToolOptions {
can_request_original_image_detail: can_request_original_image_detail(
diff --git a/codex-rs/core/src/tools/spec_plan_tests.rs b/codex-rs/core/src/tools/spec_plan_tests.rs
index ce5a708749..952d1a7866 100644
--- a/codex-rs/core/src/tools/spec_plan_tests.rs
+++ b/codex-rs/core/src/tools/spec_plan_tests.rs
@@ -23,11 +23,9 @@ use codex_protocol::openai_models::InputModality;
use codex_protocol::openai_models::ModelInfo;
use codex_protocol::openai_models::ToolMode;
use codex_protocol::openai_models::WebSearchToolType;
-use codex_protocol::protocol::EnvironmentConfigState;
use codex_protocol::protocol::MultiAgentVersion;
use codex_protocol::protocol::SessionSource;
use codex_protocol::protocol::SubAgentSource;
-use codex_protocol::protocol::TurnEnvironmentSelection;
use codex_tools::DiscoverablePluginInfo;
use codex_tools::DiscoverableTool;
use codex_tools::ResponsesApiNamespaceTool;
@@ -278,21 +276,6 @@ fn set_features(turn: &mut TurnContext, features: &[Feature]) {
}
}
-fn zsh_fork_config_for_spec_plan_tests() -> codex_tools::ZshForkConfig {
- let placeholder_exe = codex_utils_absolute_path::AbsolutePathBuf::try_from(
- std::env::current_exe().expect("current exe path"),
- )
- .expect("current exe should be absolute");
-
- // Spec planning only checks whether the shell mode is ZshFork. These paths
- // are never executed, so use a stable absolute placeholder instead of
- // depending on packaged zsh-fork artifacts in schema tests.
- codex_tools::ZshForkConfig {
- shell_zsh_path: placeholder_exe.clone(),
- main_execve_wrapper_exe: placeholder_exe,
- }
-}
-
fn update_config(turn: &mut TurnContext, update: impl FnOnce(&mut crate::config::Config)) {
let mut config = (*turn.config).clone();
update(&mut config);
@@ -1028,74 +1011,6 @@ async fn exec_command_guidance_follows_executor_platform_and_fallbacks() {
}
}
-#[tokio::test]
-async fn login_shell_parameter_follows_selected_environment() {
- for guardian in [false, true] {
- for allow_login_shell in [false, true] {
- let plan = probe(|turn| {
- set_feature(turn, Feature::ShellTool, /*enabled*/ true);
- set_feature(turn, Feature::ShellZshFork, /*enabled*/ false);
- update_turn_settings_for_test(turn, |settings| {
- Arc::make_mut(&mut settings.model_info).shell_type =
- ConfigShellToolType::UnifiedExec;
- });
- update_config(turn, |config| {
- config.permissions.allow_login_shell = !allow_login_shell;
- });
- let TurnEnvironmentState::Ready(environment) = turn
- .initial_environments
- .environments
- .first_mut()
- .expect("primary environment")
- else {
- panic!("primary environment should be ready");
- };
- environment.config_mut().allow_login_shell = allow_login_shell;
- if guardian {
- turn.session_source = codex_protocol::protocol::SessionSource::SubAgent(
- codex_protocol::protocol::SubAgentSource::Other(
- crate::guardian::GUARDIAN_REVIEWER_NAME.to_string(),
- ),
- );
- }
- })
- .await;
-
- assert_eq!(
- has_parameter(plan.visible_spec("exec_command"), "login"),
- allow_login_shell
- );
- assert!(plan.has_terminal_controls);
- }
- }
-}
-
-#[tokio::test]
-async fn login_shell_parameter_is_available_when_any_environment_allows_it() {
- let plan = probe(|turn| {
- set_features(turn, &[Feature::ShellTool]);
- set_feature(turn, Feature::ShellZshFork, /*enabled*/ false);
- update_config(turn, |config| {
- config.permissions.allow_login_shell = false;
- });
- duplicate_primary_environment(turn);
- for (index, environment) in turn
- .initial_environments
- .environments
- .iter_mut()
- .enumerate()
- {
- let TurnEnvironmentState::Ready(environment) = environment else {
- panic!("environment should be ready");
- };
- environment.config_mut().allow_login_shell = index == 1;
- }
- })
- .await;
-
- assert!(has_parameter(plan.visible_spec("exec_command"), "login"));
-}
-
#[tokio::test]
async fn disabling_shell_tools_disables_command_tools_for_all_environments() {
let remote_environment = probe(|turn| {
@@ -1200,129 +1115,7 @@ async fn shell_zsh_fork_keeps_unified_exec_available() {
}
#[tokio::test]
-async fn zsh_fork_unified_exec_hides_shell_parameter() {
- if !codex_utils_pty::conpty_supported() {
- return;
- }
-
- let plan = probe(|turn| {
- set_features(
- turn,
- &[
- Feature::ShellTool,
- Feature::ShellZshFork,
- Feature::UnifiedExecZshFork,
- ],
- );
- turn.unified_exec_shell_mode =
- codex_tools::UnifiedExecShellMode::ZshFork(zsh_fork_config_for_spec_plan_tests());
- })
- .await;
-
- plan.assert_visible_contains(&["exec_command", "write_stdin"]);
- assert!(!has_parameter(plan.visible_spec("exec_command"), "shell"));
-}
-
-#[tokio::test]
-async fn zsh_fork_unified_exec_keeps_shell_parameter_when_remote_environment_available() {
- if !codex_utils_pty::conpty_supported() {
- return;
- }
-
- let plan = probe(|turn| {
- set_features(
- turn,
- &[
- Feature::ShellTool,
- Feature::ShellZshFork,
- Feature::UnifiedExecZshFork,
- ],
- );
- turn.unified_exec_shell_mode =
- codex_tools::UnifiedExecShellMode::ZshFork(zsh_fork_config_for_spec_plan_tests());
- let remote_cwd = turn
- .initial_environments
- .primary()
- .expect("primary environment")
- .cwd()
- .clone();
- turn.initial_environments
- .environments
- .push(TurnEnvironmentState::Ready(
- crate::session::turn_context::TurnEnvironment::new(
- TurnEnvironmentSelection {
- environment_id: "remote".to_string(),
- cwd: remote_cwd,
- workspace_roots: Vec::new(),
- config: EnvironmentConfigState::Ready(
- codex_protocol::protocol::EnvironmentConfig {
- allow_login_shell: true,
- workspace_roots: Vec::new(),
- windows_sandbox_level: turn.windows_sandbox_level,
- windows_sandbox_type: turn.config.permissions.windows_sandbox_type,
- use_legacy_landlock: turn.config.features.use_legacy_landlock(),
- permission_profile: turn
- .config
- .permissions
- .permission_profile_state()
- .snapshot(),
- shell_environment_policy: Default::default(),
- exec_policy: None,
- mcp_policy: None,
- network_policy: None,
- selected_capability_roots: Vec::new(),
- },
- ),
- },
- crate::environment_selection::EnvironmentConfigOrigin::Thread,
- Arc::new(
- codex_exec_server::Environment::create_for_tests(Some(
- "ws://127.0.0.1:1/remote-exec-server".to_string(),
- ))
- .expect("remote test environment"),
- ),
- /*shell*/ None,
- ),
- ));
- })
- .await;
-
- plan.assert_visible_contains(&["exec_command", "write_stdin"]);
- assert!(has_parameter(plan.visible_spec("exec_command"), "shell"));
- assert!(has_parameter(
- plan.visible_spec("exec_command"),
- "environment_id"
- ));
-}
-
-#[tokio::test]
-async fn environment_count_controls_environment_backed_tools() {
- let no_environment = probe(|turn| {
- turn.initial_environments.environments.clear();
- set_feature(turn, Feature::ShellTool, /*enabled*/ true);
- set_feature(turn, Feature::RequestPermissionsTool, /*enabled*/ true);
- update_turn_settings_for_test(turn, |settings| {
- Arc::make_mut(&mut settings.model_info).apply_patch_tool_type =
- Some(ApplyPatchToolType::Freeform);
- });
- })
- .await;
- no_environment.assert_visible_lacks(&[
- "exec_command",
- "write_stdin",
- "apply_patch",
- "view_image",
- "request_permissions",
- ]);
- no_environment.assert_registered_lacks(&[
- "exec_command",
- "write_stdin",
- "apply_patch",
- "view_image",
- "request_permissions",
- ]);
- assert!(!no_environment.has_terminal_controls);
-
+async fn multiple_environments_expose_environment_selectors() {
let multiple_environments = probe(|turn| {
duplicate_primary_environment(turn);
set_feature(turn, Feature::ShellTool, /*enabled*/ true);
diff --git a/codex-rs/core/tests/suite/remote_env.rs b/codex-rs/core/tests/suite/remote_env.rs
index f264ad5038..31cca21194 100644
--- a/codex-rs/core/tests/suite/remote_env.rs
+++ b/codex-rs/core/tests/suite/remote_env.rs
@@ -1827,23 +1827,6 @@ async fn shared_executor_keeps_ready_capability_roots_scoped_to_each_attachment(
]
);
- let login_shells = requests
- .iter()
- .map(|request| {
- let body = request.body_json();
- let exec_command = body["tools"]
- .as_array()
- .context("tools should be an array")?
- .iter()
- .find(|tool| tool["name"] == "exec_command")
- .context("exec_command should be available")?;
- Ok(exec_command["parameters"]["properties"]
- .get("login")
- .is_some())
- })
- .collect::<Result<Vec<_>>>()?;
- assert_eq!(login_shells, vec![false, true, false, true]);
-
Ok(())
}
@@ -1910,6 +1893,12 @@ async fn owner_network_policy_rejects_unsupported_environment_authority() -> Res
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn pending_attachment_installs_configuration_before_waiting_turn_resumes() -> Result<()> {
const WAIT_CALL_ID: &str = "wait-for-owner-configuration";
+ const EXEC_CALL_ID: &str = "exec-before-owner-configuration";
+ const STDIN_CALL_ID: &str = "stdin-without-environment";
+ const LOGIN_CALL_ID: &str = "login-disabled-by-owner-configuration";
+ const UNKNOWN_ENV_CALL_ID: &str = "permissions-unknown-environment";
+ const SELECTED_ENV_CALL_ID: &str = "permissions-selected-environment";
+ const WAIT_MESSAGE: &str = "No usable execution environment is available. Wait for an environment to become available before using this tool.";
let server = start_mock_server().await;
let mut extensions = ExtensionRegistryBuilder::new();
@@ -1919,6 +1908,19 @@ async fn pending_attachment_installs_configuration_before_waiting_turn_resumes()
.with_extensions(Arc::new(extensions.build()))
.with_config(|config| {
assert!(config.features.enable(Feature::DeferredExecutor).is_ok());
+ if cfg!(unix) {
+ assert!(config.features.enable(Feature::ShellZshFork).is_ok());
+ // Calls stop at environment/login validation, so these paths are never executed.
+ let executable = std::env::current_exe().expect("current executable");
+ config.zsh_path = Some(executable.clone());
+ config.main_execve_wrapper_exe = Some(executable);
+ }
+ assert!(
+ config
+ .features
+ .enable(Feature::RequestPermissionsTool)
+ .is_ok()
+ );
config
.permissions
.set_permission_profile(PermissionProfile::read_only())
@@ -1969,6 +1971,13 @@ async fn pending_attachment_installs_configuration_before_waiting_turn_resumes()
let requested_workspace_roots = waiting.thread.config_snapshot().await.workspace_roots;
let independent = start_pending_thread().await?;
let failed = start_pending_thread().await?;
+ let empty = test
+ .thread_manager
+ .start_thread(StartThreadOptions {
+ environments: Some(Vec::new()),
+ ..StartThreadOptions::new(test.config.clone())
+ })
+ .await?;
submit_thread_settings(
&waiting.thread,
@@ -1981,6 +1990,44 @@ async fn pending_attachment_installs_configuration_before_waiting_turn_resumes()
let response_mock = mount_sse_sequence(
&server,
vec![
+ sse(vec![
+ ev_function_call(EXEC_CALL_ID, "exec_command", r#"{"cmd":"pwd"}"#),
+ ev_function_call(STDIN_CALL_ID, "write_stdin", r#"{"session_id":1}"#),
+ ev_function_call(
+ UNKNOWN_ENV_CALL_ID,
+ "request_permissions",
+ r#"{"environment_id":"missing","permissions":{"network":{"enabled":true}}}"#,
+ ),
+ ev_completed("no-environment-exec"),
+ ]),
+ sse(vec![
+ ev_assistant_message("no-environment-message", "waiting for an environment"),
+ ev_completed("no-environment-done"),
+ ]),
+ sse(vec![
+ ev_response_created("pending-configuration-exec"),
+ ev_function_call(
+ EXEC_CALL_ID,
+ "exec_command",
+ &json!({ "cmd": "pwd" }).to_string(),
+ ),
+ ev_function_call(STDIN_CALL_ID, "write_stdin", r#"{"session_id":1}"#),
+ ev_function_call(
+ UNKNOWN_ENV_CALL_ID,
+ "request_permissions",
+ r#"{"environment_id":"missing","permissions":{"network":{"enabled":true}}}"#,
+ ),
+ ev_function_call(
+ SELECTED_ENV_CALL_ID,
+ "request_permissions",
+ &json!({
+ "environment_id": selection.environment_id,
+ "permissions": {"network": {"enabled": true}},
+ })
+ .to_string(),
+ ),
+ ev_completed("pending-configuration-exec"),
+ ]),
sse(vec![
ev_response_created("pending-configuration-wait"),
ev_function_call(
@@ -1992,12 +2039,78 @@ async fn pending_attachment_installs_configuration_before_waiting_turn_resumes()
]),
sse(vec![
ev_response_created("pending-configuration-ready"),
- ev_assistant_message("pending-configuration-message", "done"),
+ ev_function_call(
+ LOGIN_CALL_ID,
+ "exec_command",
+ r#"{"cmd":"pwd","login":true}"#,
+ ),
ev_completed("pending-configuration-ready"),
]),
+ sse(vec![
+ ev_assistant_message("pending-configuration-message", "done"),
+ ev_completed("pending-configuration-done"),
+ ]),
+ sse(vec![
+ ev_function_call(EXEC_CALL_ID, "exec_command", r#"{"cmd":"pwd"}"#),
+ ev_function_call(STDIN_CALL_ID, "write_stdin", r#"{"session_id":1}"#),
+ ev_function_call(
+ UNKNOWN_ENV_CALL_ID,
+ "request_permissions",
+ r#"{"environment_id":"missing","permissions":{"network":{"enabled":true}}}"#,
+ ),
+ ev_function_call(
+ SELECTED_ENV_CALL_ID,
+ "request_permissions",
+ &json!({
+ "environment_id": selection.environment_id,
+ "permissions": {"network": {"enabled": true}},
+ })
+ .to_string(),
+ ),
+ ev_completed("failed-environment-exec"),
+ ]),
+ sse(vec![
+ ev_assistant_message("failed-environment-message", "waiting for an environment"),
+ ev_completed("failed-environment-done"),
+ ]),
+ sse(vec![
+ ev_assistant_message("recovered-environment-message", "ready"),
+ ev_completed("recovered-environment-done"),
+ ]),
],
)
.await;
+ empty
+ .thread
+ .start_or_steer_turn(TurnInputRequest::user_input(vec![UserInput::Text {
+ text: "run a command without an attached environment".into(),
+ text_elements: Vec::new(),
+ }]))
+ .await?;
+ wait_for_event(&empty.thread, |event| {
+ matches!(event, EventMsg::TurnComplete(_))
+ })
+ .await;
+ let empty_requests = response_mock.requests();
+ let first_tool_names = tool_names(&empty_requests[0].body_json());
+ for tool in [
+ "exec_command",
+ "write_stdin",
+ "apply_patch",
+ "view_image",
+ "request_permissions",
+ ] {
+ assert!(
+ first_tool_names.contains(&tool.to_string()),
+ "missing tool: {tool}"
+ );
+ }
+ for call_id in [EXEC_CALL_ID, STDIN_CALL_ID] {
+ let (output, _) = empty_requests[1]
+ .function_call_output_content_and_success(call_id)
+ .context("tool output should be model visible without an environment")?;
+ assert_eq!(output.as_deref(), Some(WAIT_MESSAGE));
+ }
waiting
.thread
.start_or_steer_turn(TurnInputRequest::user_input(vec![UserInput::Text {
@@ -2005,10 +2118,19 @@ async fn pending_attachment_installs_configuration_before_waiting_turn_resumes()
text_elements: Vec::new(),
}]))
.await?;
- wait_for_response_request_count(&response_mock, /*expected_count*/ 1).await;
- let first_tool_names = tool_names(&response_mock.requests()[0].body_json());
+ wait_for_response_request_count(&response_mock, /*expected_count*/ 4).await;
+ let pending_requests = response_mock.requests();
+ assert_eq!(
+ tool_names(&pending_requests[2].body_json()),
+ first_tool_names
+ );
assert!(first_tool_names.contains(&"wait_for_environment".to_string()));
- assert!(!first_tool_names.contains(&"exec_command".to_string()));
+ for call_id in [EXEC_CALL_ID, STDIN_CALL_ID, SELECTED_ENV_CALL_ID] {
+ let (output, _) = pending_requests[3]
+ .function_call_output_content_and_success(call_id)
+ .context("premature tool output should be model visible")?;
+ assert_eq!(output.as_deref(), Some(WAIT_MESSAGE));
+ }
independent
.thread
@@ -2086,7 +2208,11 @@ async fn pending_attachment_installs_configuration_before_waiting_turn_resumes()
.thread
.environment_ready(&pending_selection, waiting_config)
.await?;
- wait_for_response_request_count(&response_mock, /*expected_count*/ 2).await;
+ wait_for_response_request_count(&response_mock, /*expected_count*/ 6).await;
+ wait_for_event(&waiting.thread, |event| {
+ matches!(event, EventMsg::TurnComplete(_))
+ })
+ .await;
assert_eq!(
waiting.thread.environment_selections().await,
vec![ready_selection]
@@ -2096,9 +2222,8 @@ async fn pending_attachment_installs_configuration_before_waiting_turn_resumes()
requested_workspace_roots
);
- let ready_request = response_mock
- .last_request()
- .context("waiting turn should resume")?;
+ let ready_requests = response_mock.requests();
+ let ready_request = &ready_requests[4];
let (wait_output, wait_succeeded) = ready_request
.function_call_output_content_and_success(WAIT_CALL_ID)
.context("wait_for_environment output should be model visible")?;
@@ -2108,16 +2233,13 @@ async fn pending_attachment_installs_configuration_before_waiting_turn_resumes()
json!({ "environment_id": selection.environment_id, "status": "ready" })
);
let body = ready_request.body_json();
- let exec_command = body["tools"]
- .as_array()
- .context("tools should be an array")?
- .iter()
- .find(|tool| tool["name"] == "exec_command")
- .context("exec_command should become available")?;
- assert!(
- exec_command["parameters"]["properties"]
- .get("login")
- .is_none()
+ assert_eq!(tool_names(&body), first_tool_names);
+ let (login_output, _) = ready_requests[5]
+ .function_call_output_content_and_success(LOGIN_CALL_ID)
+ .context("login policy error should be model visible")?;
+ assert_eq!(
+ login_output.as_deref(),
+ Some("login shell is disabled by config; omit `login` or set it to false.")
);
assert_eq!(
ready_request
@@ -2134,6 +2256,42 @@ async fn pending_attachment_installs_configuration_before_waiting_turn_resumes()
"waiting turn should observe owner-resolved workspace roots"
);
+ failed
+ .thread
+ .start_or_steer_turn(TurnInputRequest::user_input(vec![UserInput::Text {
+ text: "run a command after environment startup failed".into(),
+ text_elements: Vec::new(),
+ }]))
+ .await?;
+ wait_for_event(&failed.thread, |event| {
+ matches!(event, EventMsg::TurnComplete(_))
+ })
+ .await;
+ let failed_requests = response_mock.requests();
+ assert_eq!(
+ tool_names(&failed_requests[6].body_json()),
+ first_tool_names
+ );
+ for call_id in [EXEC_CALL_ID, STDIN_CALL_ID, SELECTED_ENV_CALL_ID] {
+ let (output, _) = failed_requests[7]
+ .function_call_output_content_and_success(call_id)
+ .context("tool output should be model visible after startup failed")?;
+ assert_eq!(output.as_deref(), Some(WAIT_MESSAGE));
+ }
+ for request in [
+ &empty_requests[1],
+ &pending_requests[3],
+ &failed_requests[7],
+ ] {
+ let (output, _) = request
+ .function_call_output_content_and_success(UNKNOWN_ENV_CALL_ID)
+ .context("unknown environment error should be model visible")?;
+ assert_eq!(
+ output.as_deref(),
+ Some("unknown turn environment id `missing`")
+ );
+ }
+
let recovered_selection = TurnEnvironmentSelection {
config: EnvironmentConfigState::Ready(owner_config(
"recovered-root",
@@ -2157,6 +2315,43 @@ async fn pending_attachment_installs_configuration_before_waiting_turn_resumes()
vec![recovered_selection]
);
+ failed
+ .thread
+ .start_or_steer_turn(TurnInputRequest::user_input(vec![UserInput::Text {
+ text: "continue after environment recovery".into(),
+ text_elements: Vec::new(),
+ }]))
+ .await?;
+ wait_for_event(&failed.thread, |event| {
+ matches!(event, EventMsg::TurnComplete(_))
+ })
+ .await;
+ let exec_command_parameters = response_mock
+ .requests()
+ .iter()
+ .map(|request| {
+ let body = request.body_json();
+ let exec_command = body["tools"]
+ .as_array()
+ .context("tools should be an array")?
+ .iter()
+ .find(|tool| tool["name"] == "exec_command")
+ .context("exec_command should stay available")?;
+ let parameters = &exec_command["parameters"];
+ parameters["properties"]
+ .get("login")
+ .context("login should be advertised regardless of environment state or policy")?;
+ parameters["properties"].get("shell").context(
+ "shell should be advertised regardless of environment state or shell mode",
+ )?;
+ Ok(parameters.clone())
+ })
+ .collect::<Result<Vec<_>>>()?;
+ assert_eq!(
+ exec_command_parameters,
+ vec![exec_command_parameters[0].clone(); exec_command_parameters.len()]
+ );
+
Ok(())
}
@@ -2635,6 +2830,7 @@ async fn ready_before_selection_resolves_resumed_thread_capability_root_after_wa
// The first request may legally see either Starting or Ready; the wait makes step two ready.
let first_tools = tool_names(&requests[0].body_json());
assert!(first_tools.contains(&"wait_for_environment".to_string()));
+ assert!(first_tools.contains(&"exec_command".to_string()));
let first_user_context = requests[0].message_input_texts("user");
let first_environment_context = first_user_context
.iter()
@@ -2643,13 +2839,12 @@ async fn ready_before_selection_resolves_resumed_thread_capability_root_after_wa
let first_has_ready_root = first_user_context
.iter()
.any(|text| text.contains("<ready_capability_roots>ready-first-root"));
- if first_tools.contains(&"exec_command".to_string()) {
- assert!(!first_environment_context.contains("<status>starting</status>"));
+ // Tool availability no longer distinguishes Starting from Ready.
+ if first_environment_context.contains("<status>starting</status>") {
+ assert!(!first_has_ready_root);
+ } else {
assert!(first_environment_context.contains("<shell>"));
assert!(first_has_ready_root);
- } else {
- assert!(first_environment_context.contains("<status>starting</status>"));
- assert!(!first_has_ready_root);
}
let (_, wait_succeeded) = requests[1]
@@ -2745,7 +2940,6 @@ async fn deferred_executor_stays_pending_after_materialization() -> Result<()> {
let starting_request_body = requests[0].body_json();
let starting_tools = tool_names(&starting_request_body);
assert!(starting_tools.contains(&"wait_for_environment".to_string()));
- assert!(!starting_tools.contains(&"exec_command".to_string()));
let wait_tool = starting_request_body["tools"]
.as_array()
.and_then(|tools| {
diff --git a/codex-rs/core/tests/suite/remote_env_spawn_tests.rs b/codex-rs/core/tests/suite/remote_env_spawn_tests.rs
index eee1da7395..ca5ccf76dd 100644
--- a/codex-rs/core/tests/suite/remote_env_spawn_tests.rs
+++ b/codex-rs/core/tests/suite/remote_env_spawn_tests.rs
@@ -266,16 +266,14 @@ pub(crate) async fn pending_subagent_scenario(
.map(|request| request.body_json().context("model request body"))
.collect::<Result<Vec<Value>>>()?;
requests.sort_by_key(|body| request_stage(body, &root_id));
- let [_, _, starting, resumed, _, next @ ..] = requests.as_slice() else {
+ let [_, _, starting, resumed, _, ..] = requests.as_slice() else {
anyhow::bail!("missing model request")
};
let starting_tools = tool_names(starting);
assert!(starting_tools.contains(&"wait_for_environment".to_string()));
- assert!(!starting_tools.contains(&"exec_command".to_string()));
let output = call_output(resumed, WAIT_ENV).context("child wait result")?;
if failed {
assert!(output.contains(FAILURE));
- assert!(!tool_names(resumed).contains(&"exec_command".to_string()));
} else {
assert_eq!(
serde_json::from_str::<Value>(output)?,
@@ -283,15 +281,6 @@ pub(crate) async fn pending_subagent_scenario(
);
assert!(tool_names(resumed).contains(&"exec_command".to_string()));
}
- if matches!(case, PendingSpawnCase::FirstResultOnly) {
- let exec = next.first().context("missing next child model request")?["tools"]
- .as_array()
- .context("child tools")?
- .iter()
- .find(|tool| tool["name"] == "exec_command")
- .context("child execution tool")?;
- assert!(exec["parameters"]["properties"].get("login").is_none());
- }
Ok(requests)
}
diff --git a/codex-rs/core/tests/suite/scenarios.rs b/codex-rs/core/tests/suite/scenarios.rs
index 722362710d..13080f7daa 100644
--- a/codex-rs/core/tests/suite/scenarios.rs
+++ b/codex-rs/core/tests/suite/scenarios.rs
@@ -1755,7 +1755,14 @@ async fn subagent_waits_for_its_inherited_environment_configuration() -> Result<
.replace_all(&snapshot, replacement)
.into_owned();
}
- insta::assert_snapshot!("subagent_inherits_pending_environment", snapshot);
+ // Windows guidance appears when the executor is ready, including under Wine.
+ let snapshot_name =
+ if core_test_support::test_target_os() == core_test_support::TestTargetOs::Windows {
+ "subagent_inherits_pending_environment_windows"
+ } else {
+ "subagent_inherits_pending_environment"
+ };
+ insta::assert_snapshot!(snapshot_name, snapshot);
Ok(())
}
diff --git a/codex-rs/core/tests/suite/skills_extension.rs b/codex-rs/core/tests/suite/skills_extension.rs
index a56b0a8c6d..0385577e82 100644
--- a/codex-rs/core/tests/suite/skills_extension.rs
+++ b/codex-rs/core/tests/suite/skills_extension.rs
@@ -42,6 +42,7 @@ use codex_otel::OtelSettings;
use codex_otel::THREAD_SKILLS_KEPT_TOTAL_METRIC;
use codex_protocol::capabilities::CapabilityRootLocation;
use codex_protocol::capabilities::SelectedCapabilityRoot;
+use codex_protocol::mcp_policy::EnvironmentMcpPolicy;
use codex_protocol::models::FileSystemPermissions;
use codex_protocol::models::PermissionProfile;
use codex_protocol::openai_models::ModelsResponse;
@@ -3163,6 +3164,11 @@ async fn production_turn_keeps_rebalanced_catalogs_stable_after_compaction_and_r
.await;
let mut ready_config = environment_config_for_selection(&test.config, &pending_selection);
+ // This fixture supplies its own skill catalogs; do not inherit the executor host's MCP servers.
+ ready_config.mcp_policy = Some(EnvironmentMcpPolicy {
+ servers: Some(Default::default()),
+ ..Default::default()
+ });
ready_config.selected_capability_roots = vec![SelectedCapabilityRoot {
id: "skills".to_string(),
location: CapabilityRootLocation::Environment {
@@ -3341,7 +3347,12 @@ async fn production_turn_keeps_rebalanced_catalogs_stable_after_compaction_and_r
}
insta::assert_snapshot!(
- "cloud_skills_across_executor_readiness",
+ // The in-process executor uses the host OS. Windows guidance appears when it is ready.
+ if cfg!(windows) {
+ "cloud_skills_across_executor_readiness_windows"
+ } else {
+ "cloud_skills_across_executor_readiness"
+ },
context_snapshot::format_request_history_snapshot(
"Cloud skills rebalance once to retain every executor skill. Post-turn compaction and resume restore the same cloud allocation before the executor reconnects; both catalogs are fully reinjected once into the new history.",
&requests,
diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__skill_catalog_dedup__dedup_before_budgeting.snap b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__skill_catalog_dedup__dedup_before_budgeting.snap
index 449e2a34b6..f03b58dab6 100644
--- a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__skill_catalog_dedup__dedup_before_budgeting.snap
+++ b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__skill_catalog_dedup__dedup_before_budgeting.snap
@@ -16,8 +16,8 @@ Settings:
text: {"verbosity":"low"}
tool_choice: "auto"
-- request 1 (turn) --
-00:additional_tools/developer (3; hash=b6ebf543280ec271):
- - namespace/functions; hash=bd9e182b4235cdc1
+00:additional_tools/developer (3; hash=91d402a1b9d55c34):
+ - namespace/functions; hash=7d26e086c1dbba28
- custom/exec
- function/wait
- function/request_user_input
diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__subagent_inherits_pending_environment.snap b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__subagent_inherits_pending_environment.snap
index 9ddf428957..57984ea659 100644
--- a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__subagent_inherits_pending_environment.snap
+++ b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__subagent_inherits_pending_environment.snap
@@ -53,29 +53,7 @@ Scenario: A parent spawns a child before the selected environment is configured.
<timezone><HOST_TIMEZONE></timezone>
</environment_context>
04:agent_message
-
-## Window 3 (after request 3: settings changed (tools))
-- request 4 (request; child receives the ready result and updated environment) --
-00:message/developer[2]:
- [01] <PERMISSIONS_INSTRUCTIONS>
- [02] <ENVIRONMENTS_INSTRUCTIONS>
-01:message/developer:
- You are an agent in a team of agents collaborating to complete a task.
- <STANDARD_MULTI_AGENT_INSTRUCTIONS>
-02:message/developer:
- <multi_agent_mode>Any earlier instruction enabling proactive multi-agent delegation no longer applies. D...elegation, or parallel agent work.</multi_agent_mode> [hash=2b6e037067b4390c]
-03:message/user:
- <environment_context>
- <environments>
- <environment id="<ENVIRONMENT>">
- <cwd><CWD></cwd>
- <status>starting</status>
- </environment>
- </environments>
- <current_date><CURRENT_DATE></current_date>
- <timezone><HOST_TIMEZONE></timezone>
- </environment_context>
-04:agent_message
05:function_call/functions.wait_for_environment:{"environment_id":"<ENVIRONMENT>"}
06:function_call_output:{"environment_id":"<ENVIRONMENT>","status":"ready"}
07:message/user:
@@ -87,7 +65,7 @@ Scenario: A parent spawns a child before the selected environment is configured.
<filesystem><workspace_roots><root><CWD></root></workspace_roots><permission_profile type="managed"><f...ntry></file_system></permission_profile></filesystem> [hash=e8c1de60307d0a3d]
</environment_context>
-## Window 4 (after request 4: input diverged at item 01, settings changed (tools))
+## Window 3 (after request 4: input diverged at item 01, settings changed (tools))
-- request 5 (request; parent receives the child result) --
00:message/developer[2]:
[01] <PERMISSIONS_INSTRUCTIONS>
diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__subagent_inherits_pending_environment_windows.snap b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__subagent_inherits_pending_environment_windows.snap
new file mode 100644
index 0000000000..9ddf428957
--- /dev/null
+++ b/codex-rs/core/tests/suite/snapshots/all__suite__scenarios__subagent_inherits_pending_environment_windows.snap
@@ -0,0 +1,128 @@
+---
+source: core/tests/suite/scenarios.rs
+expression: snapshot
+---
+Scenario: A parent spawns a child before the selected environment is configured. The child sees it starting, waits, and receives the ready result after an ordinary parent turn-settings update.
+
+## Window 1
+-- request 1 (request; parent delegates while the environment is starting) --
+00:message/developer[2]:
+ [01] <PERMISSIONS_INSTRUCTIONS>
+ [02] <ENVIRONMENTS_INSTRUCTIONS>
+01:message/developer:
+ You are `/root`, the primary agent in a team of agents collaborating to fulfill the user's goals.
+ <STANDARD_MULTI_AGENT_INSTRUCTIONS>
+02:message/developer:
+ <multi_agent_mode>Any earlier instruction enabling proactive multi-agent delegation no longer applies. D...elegation, or parallel agent work.</multi_agent_mode> [hash=2b6e037067b4390c]
+03:message/user:
+ <environment_context>
+ <environments>
+ <environment id="<ENVIRONMENT>">
+ <cwd><CWD></cwd>
+ <status>starting</status>
+ </environment>
+ </environments>
+ <current_date><CURRENT_DATE></current_date>
+ <timezone><HOST_TIMEZONE></timezone>
+ </environment_context>
+04:message/user:
+ Delegate waiting for the shared workspace, and report what the worker finds.
+-- request 2 (request; parent waits for the worker) --
+05:function_call/collaboration.spawn_agent:{"fork_turns":"none","message":"Wait for the shared workspace to become ready.","task_name":"worker"}
+06:function_call_output:{"task_name":"/root/worker"}
+
+## Window 2 (after request 2: input diverged at item 01, settings changed (tools))
+-- request 3 (request; child sees the inherited starting environment) --
+00:message/developer[2]:
+ [01] <PERMISSIONS_INSTRUCTIONS>
+ [02] <ENVIRONMENTS_INSTRUCTIONS>
+01:message/developer:
+ You are an agent in a team of agents collaborating to complete a task.
+ <STANDARD_MULTI_AGENT_INSTRUCTIONS>
+02:message/developer:
+ <multi_agent_mode>Any earlier instruction enabling proactive multi-agent delegation no longer applies. D...elegation, or parallel agent work.</multi_agent_mode> [hash=2b6e037067b4390c]
+03:message/user:
+ <environment_context>
+ <environments>
+ <environment id="<ENVIRONMENT>">
+ <cwd><CWD></cwd>
+ <status>starting</status>
+ </environment>
+ </environments>
+ <current_date><CURRENT_DATE></current_date>
+ <timezone><HOST_TIMEZONE></timezone>
+ </environment_context>
+04:agent_message
+
+## Window 3 (after request 3: settings changed (tools))
+-- request 4 (request; child receives the ready result and updated environment) --
+00:message/developer[2]:
+ [01] <PERMISSIONS_INSTRUCTIONS>
+ [02] <ENVIRONMENTS_INSTRUCTIONS>
+01:message/developer:
+ You are an agent in a team of agents collaborating to complete a task.
+ <STANDARD_MULTI_AGENT_INSTRUCTIONS>
+02:message/developer:
+ <multi_agent_mode>Any earlier instruction enabling proactive multi-agent delegation no longer applies. D...elegation, or parallel agent work.</multi_agent_mode> [hash=2b6e037067b4390c]
+03:message/user:
+ <environment_context>
+ <environments>
+ <environment id="<ENVIRONMENT>">
+ <cwd><CWD></cwd>
+ <status>starting</status>
+ </environment>
+ </environments>
+ <current_date><CURRENT_DATE></current_date>
+ <timezone><HOST_TIMEZONE></timezone>
+ </environment_context>
+04:agent_message
+05:function_call/functions.wait_for_environment:{"environment_id":"<ENVIRONMENT>"}
+06:function_call_output:{"environment_id":"<ENVIRONMENT>","status":"ready"}
+07:message/user:
+ <environment_context>
+ <cwd><CWD></cwd>
+ <shell><HOST_SHELL></shell>
+ <current_date><CURRENT_DATE></current_date>
+ <timezone><HOST_TIMEZONE></timezone>
+ <filesystem><workspace_roots><root><CWD></root></workspace_roots><permission_profile type="managed"><f...ntry></file_system></permission_profile></filesystem> [hash=e8c1de60307d0a3d]
+ </environment_context>
+
+## Window 4 (after request 4: input diverged at item 01, settings changed (tools))
+-- request 5 (request; parent receives the child result) --
+00:message/developer[2]:
+ [01] <PERMISSIONS_INSTRUCTIONS>
+ [02] <ENVIRONMENTS_INSTRUCTIONS>
+01:message/developer:
+ You are `/root`, the primary agent in a team of agents collaborating to fulfill the user's goals.
+ <STANDARD_MULTI_AGENT_INSTRUCTIONS>
+02:message/developer:
+ <multi_agent_mode>Any earlier instruction enabling proactive multi-agent delegation no longer applies. D...elegation, or parallel agent work.</multi_agent_mode> [hash=2b6e037067b4390c]
+03:message/user:
+ <environment_context>
+ <environments>
+ <environment id="<ENVIRONMENT>">
+ <cwd><CWD></cwd>
+ <status>starting</status>
+ </environment>
+ </environments>
+ <current_date><CURRENT_DATE></current_date>
+ <timezone><HOST_TIMEZONE></timezone>
+ </environment_context>
+04:message/user:
+ Delegate waiting for the shared workspace, and report what the worker finds.
+05:function_call/collaboration.spawn_agent:{"fork_turns":"none","message":"Wait for the shared workspace to become ready.","task_name":"worker"}
+06:function_call_output:{"task_name":"/root/worker"}
+07:function_call/collaboration.wait_agent:{"timeout_ms":10000}
+08:function_call_output:{"message":"Wait completed.","timed_out":false}
+09:agent_message
+10:message/user:
+ <environment_context>
+ <cwd><CWD></cwd>
+ <shell><HOST_SHELL></shell>
+ <current_date><CURRENT_DATE></current_date>
+ <timezone><HOST_TIMEZONE></timezone>
+ <filesystem><workspace_roots><root><CWD></root></workspace_roots><permission_profile type="managed"><f...ntry></file_system></permission_profile></filesystem> [hash=e8c1de60307d0a3d]
+ <subagents>
+ <agent name="/root/worker" />
+ </subagents>
+ </environment_context>
diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__skills_extension__cloud_skills_across_executor_readiness.snap b/codex-rs/core/tests/suite/snapshots/all__suite__skills_extension__cloud_skills_across_executor_readiness.snap
index d15989f510..40d24ce51c 100644
--- a/codex-rs/core/tests/suite/snapshots/all__suite__skills_extension__cloud_skills_across_executor_readiness.snap
+++ b/codex-rs/core/tests/suite/snapshots/all__suite__skills_extension__cloud_skills_across_executor_readiness.snap
@@ -1,6 +1,5 @@
---
source: core/tests/suite/skills_extension.rs
-assertion_line: 3190
expression: "context_snapshot::format_request_history_snapshot(\"Cloud skills rebalance once to retain every executor skill. Post-turn compaction and resume restore the same cloud allocation before the executor reconnects; both catalogs are fully reinjected once into the new history.\",\n&requests,\n&ContextSnapshotOptions::default().rewrite_known_segments().include_request_settings(),)"
---
Scenario: Cloud skills rebalance once to retain every executor skill. Post-turn compaction and resume restore the same cloud allocation before the executor reconnects; both catalogs are fully reinjected once into the new history.
@@ -17,9 +16,13 @@ Settings:
stream: true
text: {"verbosity":"low"}
tool_choice: "auto"
- tools (5; hash=fb9143ee40054f2b):
+ tools (9; hash=1df9146cc32e8188):
+ - function/exec_command: Runs a command in a PTY, returning output or a session ID for ongoing interaction.; args=[cmd, justification, login, max_output_tokens, prefix_rule, sandbox_permissions, shell, tty, workdir, yield_time_ms]; hash=c04108e51a8548c5
+ - function/write_stdin: Writes characters to an existing unified exec session and returns recent output.; args=[chars, max_output_tokens, session_id, yield_time_ms]; hash=7fb62d8a3e2df4e2
- function/wait_for_environment: Wait for the selected environment.; args=[environment_id]; hash=aac8552da86b3b20
- function/request_user_input: Request user input for one to three short questions and wait for the response. This tool is only ...; args=[questions]; hash=64a729b25c424fc6
+ - custom/apply_patch: The `apply_patch` tool can be used to edit files. This is a FREEFORM tool, so do not wrap the pat...; hash=dea9f12b0111a4ba
+ - function/view_image: View a local image file from the filesystem when visual inspection is needed. Use this for images...; args=[detail, path]; hash=3b766d5bdec5d50e
- namespace/skills: Tools in the skills namespace.; hash=998a720eb0f017bc
- function/list
- function/read
@@ -41,30 +44,7 @@ Settings:
<ENVIRONMENT_CONTEXT>
02:message/user:
Inspect the available skills.
-
-## Window 2 (after request 1)
-Settings: relative to window 1
- tools (9; hash=1df9146cc32e8188):
- + function/exec_command: Runs a command in a PTY, returning output or a session ID for ongoing interaction.; args=[cmd, justification, login, max_output_tokens, prefix_rule, sandbox_permissions, shell, tty, workdir, yield_time_ms]; hash=c04108e51a8548c5
- + function/write_stdin: Writes characters to an existing unified exec session and returns recent output.; args=[chars, max_output_tokens, session_id, yield_time_ms]; hash=7fb62d8a3e2df4e2
- + custom/apply_patch: The `apply_patch` tool can be used to edit files. This is a FREEFORM tool, so do not wrap the pat...; hash=dea9f12b0111a4ba
- + function/view_image: View a local image file from the filesystem when visual inspection is needed. Use this for images...; args=[detail, path]; hash=3b766d5bdec5d50e
-- request 2 (turn) --
-00:message/developer[3]:
- [01] <PERMISSIONS_INSTRUCTIONS>
- [02] <environments_instructions>
- ## Execution environments
- Execution environments are separate machines or workspaces with their own files, shell, and installed ca...text>` lists the environments selected for this task. [hash=bc910d398b9b4d83]
-
- An environment marked `starting` is not yet usable. Its files, commands, AGENTS.md instructions, skills,...CP tools may become available when startup completes. [hash=42a360e5075e8edb]
-
- Wait only when the current task needs that environment. Continue using tools that are already available for unrelated work.
- </environments_instructions>
- [03] <SKILLS_INSTRUCTIONS>
-01:message/user:
- <ENVIRONMENT_CONTEXT>
-02:message/user:
- Inspect the available skills.
03:function_call/wait_for_environment:{"environment_id":"skills-executor"}
04:function_call_output:{"environment_id":"skills-executor","status":"ready"}
05:message/user:
@@ -76,8 +56,8 @@ Settings: relative to window 1
07:message/user:
Inspect the available skills again.
-## Window 3 (after request 3)
-Settings: relative to window 2
+## Window 2 (after request 3)
+Settings: relative to window 1
parallel_tool_calls: false
tools (0; hash=09612b07b5ecb5a5):
- removed function/exec_command
@@ -117,7 +97,7 @@ Settings: relative to window 2
08:message/user:
<SUMMARIZATION_PROMPT>
-## Window 4 (after request 4: input diverged at item 00)
+## Window 3 (after request 4: input diverged at item 00)
Settings: same as window 1
-- request 5 (turn) --
00:message/user:
@@ -142,32 +122,7 @@ Settings: same as window 1
<ENVIRONMENT_CONTEXT>
05:message/user:
Inspect the skills after resuming.
-
-## Window 5 (after request 5)
-Settings: same as window 2
-- request 6 (turn) --
-00:message/user:
- Inspect the available skills.
-01:message/user:
- Inspect the available skills again.
-02:message/user:
- <COMPACTION_SUMMARY>
- The available skills were inspected.
-03:message/developer[3]:
- [01] <PERMISSIONS_INSTRUCTIONS>
- [02] <environments_instructions>
- ## Execution environments
- Execution environments are separate machines or workspaces with their own files, shell, and installed ca...text>` lists the environments selected for this task. [hash=bc910d398b9b4d83]
-
- An environment marked `starting` is not yet usable. Its files, commands, AGENTS.md instructions, skills,...CP tools may become available when startup completes. [hash=42a360e5075e8edb]
-
- Wait only when the current task needs that environment. Continue using tools that are already available for unrelated work.
- </environments_instructions>
- [03] <SKILLS_INSTRUCTIONS>
-04:message/user:
- <ENVIRONMENT_CONTEXT>
-05:message/user:
- Inspect the skills after resuming.
06:function_call/wait_for_environment:{"environment_id":"skills-executor"}
07:function_call_output:{"environment_id":"skills-executor","status":"ready"}
08:message/user:
diff --git a/codex-rs/core/tests/suite/snapshots/all__suite__skills_extension__cloud_skills_across_executor_readiness_windows.snap b/codex-rs/core/tests/suite/snapshots/all__suite__skills_extension__cloud_skills_across_executor_readiness_windows.snap
new file mode 100644
index 0000000000..980a174b01
--- /dev/null
+++ b/codex-rs/core/tests/suite/snapshots/all__suite__skills_extension__cloud_skills_across_executor_readiness_windows.snap
@@ -0,0 +1,176 @@
+---
+source: core/tests/suite/skills_extension.rs
+expression: "context_snapshot::format_request_history_snapshot(\"Cloud skills rebalance once to retain every executor skill. Post-turn compaction and resume restore the same cloud allocation before the executor reconnects; both catalogs are fully reinjected once into the new history.\",\n&requests,\n&ContextSnapshotOptions::default().rewrite_known_segments().include_request_settings(),)"
+---
+Scenario: Cloud skills rebalance once to retain every executor skill. Post-turn compaction and resume restore the same cloud allocation before the executor reconnects; both catalogs are fully reinjected once into the new history.
+
+## Window 1
+Settings:
+ include: ["reasoning.encrypted_content"]
+ instructions: <MODEL_INSTRUCTIONS>
+ model: "gpt-5.5"
+ parallel_tool_calls: true
+ prompt_cache_key: "<PROMPT_CACHE_KEY 1>"
+ reasoning: {"effort":"medium"}
+ store: false
+ stream: true
+ text: {"verbosity":"low"}
+ tool_choice: "auto"
+ tools (9; hash=1df9146cc32e8188):
+ - function/exec_command: Runs a command in a PTY, returning output or a session ID for ongoing interaction.; args=[cmd, justification, login, max_output_tokens, prefix_rule, sandbox_permissions, shell, tty, workdir, yield_time_ms]; hash=c04108e51a8548c5
+ - function/write_stdin: Writes characters to an existing unified exec session and returns recent output.; args=[chars, max_output_tokens, session_id, yield_time_ms]; hash=7fb62d8a3e2df4e2
+ - function/wait_for_environment: Wait for the selected environment.; args=[environment_id]; hash=aac8552da86b3b20
+ - function/request_user_input: Request user input for one to three short questions and wait for the response. This tool is only ...; args=[questions]; hash=64a729b25c424fc6
+ - custom/apply_patch: The `apply_patch` tool can be used to edit files. This is a FREEFORM tool, so do not wrap the pat...; hash=dea9f12b0111a4ba
+ - function/view_image: View a local image file from the filesystem when visual inspection is needed. Use this for images...; args=[detail, path]; hash=3b766d5bdec5d50e
+ - namespace/skills: Tools in the skills namespace.; hash=998a720eb0f017bc
+ - function/list
+ - function/read
+ - tool_search: # Tool discovery Searches over deferred tool metadata with BM25 and exposes matching tools for t...; args=[limit, query]; hash=400cd6ac61d524a9
+ - web_search; hash=f103e327c6870a46
+-- request 1 (turn) --
+00:message/developer[3]:
+ [01] <PERMISSIONS_INSTRUCTIONS>
+ [02] <environments_instructions>
+ ## Execution environments
+ Execution environments are separate machines or workspaces with their own files, shell, and installed ca...text>` lists the environments selected for this task. [hash=bc910d398b9b4d83]
+
+ An environment marked `starting` is not yet usable. Its files, commands, AGENTS.md instructions, skills,...CP tools may become available when startup completes. [hash=42a360e5075e8edb]
+
+ Wait only when the current task needs that environment. Continue using tools that are already available for unrelated work.
+ </environments_instructions>
+ [03] <SKILLS_INSTRUCTIONS>
+01:message/user:
+ <ENVIRONMENT_CONTEXT>
+02:message/user:
+ Inspect the available skills.
+
+## Window 2 (after request 1)
+Settings: relative to window 1
+ tools (9; hash=1df9146cc32e8188):
+ ~ function/exec_command: Runs a command in a PTY, returning output or a session ID for ongoing interaction.; args=[cmd, justification, login, max_output_tokens, prefix_rule, sandbox_permissions, shell, tty, workdir, yield_time_ms]; hash=c04108e51a8548c5
+-- request 2 (turn) --
+00:message/developer[3]:
+ [01] <PERMISSIONS_INSTRUCTIONS>
+ [02] <environments_instructions>
+ ## Execution environments
+ Execution environments are separate machines or workspaces with their own files, shell, and installed ca...text>` lists the environments selected for this task. [hash=bc910d398b9b4d83]
+
+ An environment marked `starting` is not yet usable. Its files, commands, AGENTS.md instructions, skills,...CP tools may become available when startup completes. [hash=42a360e5075e8edb]
+
+ Wait only when the current task needs that environment. Continue using tools that are already available for unrelated work.
+ </environments_instructions>
+ [03] <SKILLS_INSTRUCTIONS>
+01:message/user:
+ <ENVIRONMENT_CONTEXT>
+02:message/user:
+ Inspect the available skills.
+03:function_call/wait_for_environment:{"environment_id":"skills-executor"}
+04:function_call_output:{"environment_id":"skills-executor","status":"ready"}
+05:message/user:
+ <ENVIRONMENT_CONTEXT>
+06:message/developer[2]:
+ [01] <SKILLS_INSTRUCTIONS>
+ [02] <SKILLS_INSTRUCTIONS>
+-- request 3 (turn) --
+07:message/user:
+ Inspect the available skills again.
+
+## Window 3 (after request 3)
+Settings: relative to window 2
+ parallel_tool_calls: false
+ tools (0; hash=09612b07b5ecb5a5):
+ - removed function/exec_command
+ - removed function/write_stdin
+ - removed function/wait_for_environment
+ - removed function/request_user_input
+ - removed custom/apply_patch
+ - removed function/view_image
+ - removed namespace/skills
+ - removed tool_search
+ - removed web_search
+-- request 4 (compaction) --
+00:message/developer[3]:
+ [01] <PERMISSIONS_INSTRUCTIONS>
+ [02] <environments_instructions>
+ ## Execution environments
+ Execution environments are separate machines or workspaces with their own files, shell, and installed ca...text>` lists the environments selected for this task. [hash=bc910d398b9b4d83]
+
+ An environment marked `starting` is not yet usable. Its files, commands, AGENTS.md instructions, skills,...CP tools may become available when startup completes. [hash=42a360e5075e8edb]
+
+ Wait only when the current task needs that environment. Continue using tools that are already available for unrelated work.
+ </environments_instructions>
+ [03] <SKILLS_INSTRUCTIONS>
+01:message/user:
+ <ENVIRONMENT_CONTEXT>
+02:message/user:
+ Inspect the available skills.
+03:function_call/wait_for_environment:{"environment_id":"skills-executor"}
+04:function_call_output:{"environment_id":"skills-executor","status":"ready"}
+05:message/user:
+ <ENVIRONMENT_CONTEXT>
+06:message/developer[2]:
+ [01] <SKILLS_INSTRUCTIONS>
+ [02] <SKILLS_INSTRUCTIONS>
+07:message/user:
+ Inspect the available skills again.
+08:message/user:
+ <SUMMARIZATION_PROMPT>
+
+## Window 4 (after request 4: input diverged at item 00)
+Settings: same as window 1
+-- request 5 (turn) --
+00:message/user:
+ Inspect the available skills.
+01:message/user:
+ Inspect the available skills again.
+02:message/user:
+ <COMPACTION_SUMMARY>
+ The available skills were inspected.
+03:message/developer[3]:
+ [01] <PERMISSIONS_INSTRUCTIONS>
+ [02] <environments_instructions>
+ ## Execution environments
+ Execution environments are separate machines or workspaces with their own files, shell, and installed ca...text>` lists the environments selected for this task. [hash=bc910d398b9b4d83]
+
+ An environment marked `starting` is not yet usable. Its files, commands, AGENTS.md instructions, skills,...CP tools may become available when startup completes. [hash=42a360e5075e8edb]
+
+ Wait only when the current task needs that environment. Continue using tools that are already available for unrelated work.
+ </environments_instructions>
+ [03] <SKILLS_INSTRUCTIONS>
+04:message/user:
+ <ENVIRONMENT_CONTEXT>
+05:message/user:
+ Inspect the skills after resuming.
+
+## Window 5 (after request 5)
+Settings: same as window 2
+-- request 6 (turn) --
+00:message/user:
+ Inspect the available skills.
+01:message/user:
+ Inspect the available skills again.
+02:message/user:
+ <COMPACTION_SUMMARY>
+ The available skills were inspected.
+03:message/developer[3]:
+ [01] <PERMISSIONS_INSTRUCTIONS>
+ [02] <environments_instructions>
+ ## Execution environments
+ Execution environments are separate machines or workspaces with their own files, shell, and installed ca...text>` lists the environments selected for this task. [hash=bc910d398b9b4d83]
+
+ An environment marked `starting` is not yet usable. Its files, commands, AGENTS.md instructions, skills,...CP tools may become available when startup completes. [hash=42a360e5075e8edb]
+
+ Wait only when the current task needs that environment. Continue using tools that are already available for unrelated work.
+ </environments_instructions>
+ [03] <SKILLS_INSTRUCTIONS>
+04:message/user:
+ <ENVIRONMENT_CONTEXT>
+05:message/user:
+ Inspect the skills after resuming.
+06:function_call/wait_for_environment:{"environment_id":"skills-executor"}
+07:function_call_output:{"environment_id":"skills-executor","status":"ready"}
+08:message/user:
+ <ENVIRONMENT_CONTEXT>
+09:message/developer:
+ <SKILLS_INSTRUCTIONS>
diff --git a/codex-rs/core/tests/suite/tools.rs b/codex-rs/core/tests/suite/tools.rs
index c5e52157b7..a963ebdc60 100644
--- a/codex-rs/core/tests/suite/tools.rs
+++ b/codex-rs/core/tests/suite/tools.rs
@@ -245,7 +245,7 @@ async fn strict_tool_collisions_do_not_duplicate_unrelated_compaction_errors() -
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
-async fn empty_turn_environments_omits_environment_backed_tools() -> Result<()> {
+async fn empty_turn_environments_keeps_environment_backed_tools() -> Result<()> {
skip_if_no_network!(Ok(()));
let server = start_mock_server().await;
@@ -278,8 +278,8 @@ async fn empty_turn_environments_omits_environment_backed_tools() -> Result<()>
);
for environment_tool in ["exec_command", "write_stdin", "apply_patch", "view_image"] {
assert!(
- !tools.contains(&environment_tool.to_string()),
- "{environment_tool} should be omitted for explicit empty turn environments; got {tools:?}"
+ tools.contains(&environment_tool.to_string()),
+ "{environment_tool} should remain available for explicit empty turn environments; got {tools:?}"
);
}
diff --git a/codex-rs/core/tests/suite/unified_exec.rs b/codex-rs/core/tests/suite/unified_exec.rs
index 194652b926..2edf5a39c1 100644
--- a/codex-rs/core/tests/suite/unified_exec.rs
+++ b/codex-rs/core/tests/suite/unified_exec.rs
@@ -260,7 +260,7 @@ async fn create_workspace_directory(
}
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
-async fn exec_command_hides_and_rejects_login_when_disabled() -> Result<()> {
+async fn exec_command_rejects_login_when_disabled() -> Result<()> {
skip_if_no_network!(Ok(()));
let builder = test_codex().with_model("gpt-5.4").with_config(|config| {
@@ -272,7 +272,7 @@ async fn exec_command_hides_and_rejects_login_when_disabled() -> Result<()> {
"cmd": "echo should not run",
"login": true,
});
- let responses = mount_sse_sequence(
+ mount_sse_sequence(
harness.server(),
vec![
sse(vec![
@@ -294,14 +294,6 @@ async fn exec_command_hides_and_rejects_login_when_disabled() -> Result<()> {
harness.function_call_stdout(call_id).await,
"login shell is disabled by config; omit `login` or set it to false."
);
- let request = responses.requests()[0].body_json();
- let exec_tool = request["tools"]
- .as_array()
- .expect("tools should be an array")
- .iter()
- .find(|tool| tool["name"] == "exec_command")
- .expect("exec_command should be available");
- assert!(exec_tool["parameters"]["properties"].get("login").is_none());
Ok(())
}