mirror of
https://github.com/openai/codex.git
synced 2026-11-30 00:10:49 +00:00
feat(app-server): supports windows sandbox setting
This commit is contained in:
Generated
+1
@@ -849,6 +849,7 @@ dependencies = [
|
||||
"codex-login",
|
||||
"codex-protocol",
|
||||
"codex-utils-json-to-toml",
|
||||
"codex-windows-sandbox",
|
||||
"core_test_support",
|
||||
"mcp-types",
|
||||
"opentelemetry-appender-tracing",
|
||||
|
||||
@@ -539,6 +539,7 @@ mod tests {
|
||||
developer_instructions: None,
|
||||
compact_prompt: None,
|
||||
include_apply_patch_tool: None,
|
||||
experimental_windows_sandbox: None,
|
||||
},
|
||||
};
|
||||
assert_eq!(
|
||||
|
||||
@@ -63,6 +63,7 @@ pub struct NewConversationParams {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub compact_prompt: Option<String>,
|
||||
pub include_apply_patch_tool: Option<bool>,
|
||||
pub experimental_windows_sandbox: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
@@ -385,6 +386,7 @@ pub struct SendUserTurnParams {
|
||||
pub model: String,
|
||||
pub effort: Option<ReasoningEffort>,
|
||||
pub summary: ReasoningSummary,
|
||||
pub experimental_windows_sandbox: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
|
||||
@@ -40,6 +40,7 @@ tracing = { workspace = true, features = ["log"] }
|
||||
tracing-subscriber = { workspace = true, features = ["env-filter", "fmt"] }
|
||||
opentelemetry-appender-tracing = { workspace = true }
|
||||
uuid = { workspace = true, features = ["serde", "v7"] }
|
||||
codex-windows-sandbox.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
app_test_support = { workspace = true }
|
||||
|
||||
@@ -111,6 +111,7 @@ use codex_core::config_loader::load_config_as_toml;
|
||||
use codex_core::default_client::get_codex_user_agent;
|
||||
use codex_core::exec::ExecParams;
|
||||
use codex_core::exec_env::create_env;
|
||||
use codex_core::features::Feature;
|
||||
use codex_core::find_conversation_path_by_id_str;
|
||||
use codex_core::get_platform_sandbox;
|
||||
use codex_core::git_info::git_diff_to_remote;
|
||||
@@ -118,6 +119,7 @@ use codex_core::parse_cursor;
|
||||
use codex_core::protocol::EventMsg;
|
||||
use codex_core::protocol::Op;
|
||||
use codex_core::protocol::ReviewRequest;
|
||||
use codex_core::protocol::WindowsWorldWritableWarningEvent;
|
||||
use codex_core::read_head_for_summary;
|
||||
use codex_feedback::CodexFeedback;
|
||||
use codex_login::ServerOptions as LoginServerOptions;
|
||||
@@ -1221,6 +1223,7 @@ impl CodexMessageProcessor {
|
||||
developer_instructions,
|
||||
compact_prompt,
|
||||
include_apply_patch_tool,
|
||||
experimental_windows_sandbox,
|
||||
} = params;
|
||||
|
||||
let overrides = ConfigOverrides {
|
||||
@@ -1235,10 +1238,11 @@ impl CodexMessageProcessor {
|
||||
developer_instructions,
|
||||
compact_prompt,
|
||||
include_apply_patch_tool,
|
||||
experimental_windows_sandbox,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let config = match derive_config_from_params(overrides, cli_overrides).await {
|
||||
let mut config = match derive_config_from_params(overrides, cli_overrides).await {
|
||||
Ok(config) => config,
|
||||
Err(err) => {
|
||||
let error = JSONRPCErrorError {
|
||||
@@ -1250,6 +1254,10 @@ impl CodexMessageProcessor {
|
||||
return;
|
||||
}
|
||||
};
|
||||
if let Some(experimental_windows_sandbox) = experimental_windows_sandbox {
|
||||
self.handle_windows_sandbox(experimental_windows_sandbox, &mut config)
|
||||
.await;
|
||||
}
|
||||
|
||||
match self.conversation_manager.new_conversation(config).await {
|
||||
Ok(conversation_id) => {
|
||||
@@ -1878,7 +1886,7 @@ impl CodexMessageProcessor {
|
||||
} = params;
|
||||
|
||||
// Derive a Config using the same logic as new conversation, honoring overrides if provided.
|
||||
let config = match overrides {
|
||||
let config = match overrides.clone() {
|
||||
Some(overrides) => {
|
||||
let NewConversationParams {
|
||||
model,
|
||||
@@ -1892,6 +1900,7 @@ impl CodexMessageProcessor {
|
||||
developer_instructions,
|
||||
compact_prompt,
|
||||
include_apply_patch_tool,
|
||||
experimental_windows_sandbox,
|
||||
} = overrides;
|
||||
|
||||
let overrides = ConfigOverrides {
|
||||
@@ -1906,6 +1915,7 @@ impl CodexMessageProcessor {
|
||||
developer_instructions,
|
||||
compact_prompt,
|
||||
include_apply_patch_tool,
|
||||
experimental_windows_sandbox,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
@@ -1913,7 +1923,7 @@ impl CodexMessageProcessor {
|
||||
}
|
||||
None => Ok(self.config.as_ref().clone()),
|
||||
};
|
||||
let config = match config {
|
||||
let mut config = match config {
|
||||
Ok(cfg) => cfg,
|
||||
Err(err) => {
|
||||
self.send_invalid_request_error(
|
||||
@@ -1924,6 +1934,12 @@ impl CodexMessageProcessor {
|
||||
return;
|
||||
}
|
||||
};
|
||||
if let Some(experimental_windows_sandbox) =
|
||||
overrides.and_then(|o| o.experimental_windows_sandbox)
|
||||
{
|
||||
self.handle_windows_sandbox(experimental_windows_sandbox, &mut config)
|
||||
.await;
|
||||
}
|
||||
|
||||
let conversation_history = if let Some(path) = path {
|
||||
match RolloutRecorder::get_rollout_history(&path).await {
|
||||
@@ -2269,13 +2285,14 @@ impl CodexMessageProcessor {
|
||||
.await;
|
||||
}
|
||||
|
||||
async fn send_user_turn(&self, request_id: RequestId, params: SendUserTurnParams) {
|
||||
async fn send_user_turn(&mut self, request_id: RequestId, params: SendUserTurnParams) {
|
||||
let SendUserTurnParams {
|
||||
conversation_id,
|
||||
items,
|
||||
cwd,
|
||||
approval_policy,
|
||||
sandbox_policy,
|
||||
experimental_windows_sandbox,
|
||||
model,
|
||||
effort,
|
||||
summary,
|
||||
@@ -2303,6 +2320,11 @@ impl CodexMessageProcessor {
|
||||
WireInputItem::LocalImage { path } => CoreInputItem::LocalImage { path },
|
||||
})
|
||||
.collect();
|
||||
let mut config = self.config.as_ref().clone();
|
||||
if let Some(experimental_windows_sandbox) = experimental_windows_sandbox {
|
||||
self.handle_windows_sandbox(experimental_windows_sandbox, &mut config)
|
||||
.await;
|
||||
}
|
||||
|
||||
let _ = conversation
|
||||
.submit(Op::UserTurn {
|
||||
@@ -2310,6 +2332,7 @@ impl CodexMessageProcessor {
|
||||
cwd,
|
||||
approval_policy,
|
||||
sandbox_policy,
|
||||
experimental_windows_sandbox,
|
||||
model,
|
||||
effort,
|
||||
summary,
|
||||
@@ -2788,6 +2811,47 @@ impl CodexMessageProcessor {
|
||||
Err(_) => None,
|
||||
}
|
||||
}
|
||||
|
||||
async fn handle_windows_sandbox(
|
||||
&self,
|
||||
experimental_windows_sandbox: bool,
|
||||
config: &mut Config,
|
||||
) {
|
||||
if !cfg!(windows) {
|
||||
return;
|
||||
}
|
||||
let previous = config.features.enabled(Feature::WindowsSandbox);
|
||||
|
||||
config.set_windows_sandbox_globally(experimental_windows_sandbox);
|
||||
let should_skip_world_writable_warning = self
|
||||
.config
|
||||
.notices
|
||||
.hide_world_writable_warning
|
||||
.unwrap_or(false);
|
||||
|
||||
if !should_skip_world_writable_warning
|
||||
&& !previous
|
||||
&& experimental_windows_sandbox
|
||||
&& let Some((sample_paths, extra_count, failed_scan)) =
|
||||
codex_windows_sandbox::world_writable_warning_details(
|
||||
self.config.codex_home.as_path(),
|
||||
)
|
||||
{
|
||||
self.outgoing
|
||||
.send_notification(OutgoingNotification {
|
||||
method: "codex/event/WindowsWorldWritableWarning".to_string(),
|
||||
params: Some(
|
||||
serde_json::to_value(WindowsWorldWritableWarningEvent {
|
||||
sample_paths,
|
||||
extra_count,
|
||||
failed_scan,
|
||||
})
|
||||
.unwrap(),
|
||||
),
|
||||
})
|
||||
.await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn derive_config_from_params(
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -361,6 +361,13 @@ impl SessionConfiguration {
|
||||
if let Some(cwd) = updates.cwd.clone() {
|
||||
next_configuration.cwd = cwd;
|
||||
}
|
||||
if let Some(experimental_windows_sandbox) = updates.experimental_windows_sandbox {
|
||||
if experimental_windows_sandbox {
|
||||
next_configuration.features.enable(Feature::WindowsSandbox);
|
||||
} else {
|
||||
next_configuration.features.disable(Feature::WindowsSandbox);
|
||||
}
|
||||
}
|
||||
next_configuration
|
||||
}
|
||||
}
|
||||
@@ -374,6 +381,7 @@ pub(crate) struct SessionSettingsUpdate {
|
||||
pub(crate) reasoning_effort: Option<Option<ReasoningEffortConfig>>,
|
||||
pub(crate) reasoning_summary: Option<ReasoningSummaryConfig>,
|
||||
pub(crate) final_output_json_schema: Option<Option<Value>>,
|
||||
pub(crate) experimental_windows_sandbox: Option<bool>,
|
||||
}
|
||||
|
||||
impl Session {
|
||||
@@ -698,7 +706,36 @@ impl Session {
|
||||
pub(crate) async fn update_settings(&self, updates: SessionSettingsUpdate) {
|
||||
let mut state = self.state.lock().await;
|
||||
|
||||
state.session_configuration = state.session_configuration.apply(&updates);
|
||||
let new_configuration = state.session_configuration.apply(&updates);
|
||||
|
||||
// on Windows, when we enable Windows sandbox, we need to warn the user about world writable roots
|
||||
#[cfg(windows)]
|
||||
{
|
||||
if new_configuration.features.enabled(Feature::WindowsSandbox)
|
||||
&& !state
|
||||
.session_configuration
|
||||
.features
|
||||
.enabled(Feature::WindowsSandbox)
|
||||
{
|
||||
if let Some((sample_paths, extra_count, failed_scan)) =
|
||||
codex_windows_sandbox::world_writable_warning_details(
|
||||
new_configuration.codex_home.as_path(),
|
||||
)
|
||||
{
|
||||
self.send_event(
|
||||
&turn_context,
|
||||
EventMsg::WindowsWorldWritableWarning(WindowsWorldWritableWarningEvent {
|
||||
sample_paths,
|
||||
extra_count,
|
||||
failed_scan,
|
||||
}),
|
||||
)
|
||||
.await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
state.session_configuration = new_configuration;
|
||||
}
|
||||
|
||||
pub(crate) async fn new_turn(&self, updates: SessionSettingsUpdate) -> Arc<TurnContext> {
|
||||
@@ -1455,6 +1492,7 @@ mod handlers {
|
||||
cwd,
|
||||
approval_policy,
|
||||
sandbox_policy,
|
||||
experimental_windows_sandbox,
|
||||
model,
|
||||
effort,
|
||||
summary,
|
||||
@@ -1470,6 +1508,7 @@ mod handlers {
|
||||
reasoning_effort: Some(effort),
|
||||
reasoning_summary: Some(summary),
|
||||
final_output_json_schema: Some(final_output_json_schema),
|
||||
experimental_windows_sandbox,
|
||||
},
|
||||
),
|
||||
Op::UserInput { items } => (items, SessionSettingsUpdate::default()),
|
||||
|
||||
@@ -899,6 +899,7 @@ pub struct ConfigOverrides {
|
||||
pub show_raw_agent_reasoning: Option<bool>,
|
||||
pub tools_web_search_request: Option<bool>,
|
||||
pub experimental_sandbox_command_assessment: Option<bool>,
|
||||
pub experimental_windows_sandbox: Option<bool>,
|
||||
/// Additional directories that should be treated as writable roots for this session.
|
||||
pub additional_writable_roots: Vec<PathBuf>,
|
||||
}
|
||||
@@ -959,6 +960,7 @@ impl Config {
|
||||
tools_web_search_request: override_tools_web_search_request,
|
||||
experimental_sandbox_command_assessment: sandbox_command_assessment_override,
|
||||
additional_writable_roots,
|
||||
experimental_windows_sandbox: experimental_windows_sandbox_override,
|
||||
} = overrides;
|
||||
|
||||
let active_profile_name = config_profile_key
|
||||
@@ -983,6 +985,7 @@ impl Config {
|
||||
include_apply_patch_tool: include_apply_patch_tool_override,
|
||||
web_search_request: override_tools_web_search_request,
|
||||
experimental_sandbox_command_assessment: sandbox_command_assessment_override,
|
||||
experimental_windows_sandbox: experimental_windows_sandbox_override,
|
||||
};
|
||||
|
||||
let features = Features::from_config(&cfg, &config_profile, feature_overrides);
|
||||
|
||||
@@ -93,6 +93,7 @@ pub struct FeatureOverrides {
|
||||
pub include_apply_patch_tool: Option<bool>,
|
||||
pub web_search_request: Option<bool>,
|
||||
pub experimental_sandbox_command_assessment: Option<bool>,
|
||||
pub experimental_windows_sandbox: Option<bool>,
|
||||
}
|
||||
|
||||
impl FeatureOverrides {
|
||||
|
||||
@@ -84,6 +84,7 @@ pub(crate) fn should_persist_event_msg(ev: &EventMsg) -> bool {
|
||||
| EventMsg::ItemCompleted(_)
|
||||
| EventMsg::AgentMessageContentDelta(_)
|
||||
| EventMsg::ReasoningContentDelta(_)
|
||||
| EventMsg::ReasoningRawContentDelta(_) => false,
|
||||
| EventMsg::ReasoningRawContentDelta(_)
|
||||
| EventMsg::WindowsWorldWritableWarning(_) => false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,6 +206,7 @@ impl TestCodex {
|
||||
cwd: self.cwd.path().to_path_buf(),
|
||||
approval_policy,
|
||||
sandbox_policy,
|
||||
experimental_windows_sandbox: None,
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
|
||||
@@ -297,6 +297,7 @@ async fn apply_patch_cli_move_without_content_change_has_no_turn_diff(
|
||||
cwd: cwd.path().to_path_buf(),
|
||||
approval_policy: AskForApproval::Never,
|
||||
sandbox_policy: SandboxPolicy::DangerFullAccess,
|
||||
experimental_windows_sandbox: None,
|
||||
model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
@@ -757,6 +758,7 @@ async fn apply_patch_shell_failure_propagates_error_and_skips_diff() -> Result<(
|
||||
cwd: cwd.path().to_path_buf(),
|
||||
approval_policy: AskForApproval::Never,
|
||||
sandbox_policy: SandboxPolicy::DangerFullAccess,
|
||||
experimental_windows_sandbox: None,
|
||||
model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
@@ -909,6 +911,7 @@ async fn apply_patch_emits_turn_diff_event_with_unified_diff(
|
||||
cwd: cwd.path().to_path_buf(),
|
||||
approval_policy: AskForApproval::Never,
|
||||
sandbox_policy: SandboxPolicy::DangerFullAccess,
|
||||
experimental_windows_sandbox: None,
|
||||
model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
@@ -968,6 +971,7 @@ async fn apply_patch_turn_diff_for_rename_with_content_change(
|
||||
cwd: cwd.path().to_path_buf(),
|
||||
approval_policy: AskForApproval::Never,
|
||||
sandbox_policy: SandboxPolicy::DangerFullAccess,
|
||||
experimental_windows_sandbox: None,
|
||||
model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
@@ -1036,6 +1040,7 @@ async fn apply_patch_aggregates_diff_across_multiple_tool_calls() -> Result<()>
|
||||
cwd: cwd.path().to_path_buf(),
|
||||
approval_policy: AskForApproval::Never,
|
||||
sandbox_policy: SandboxPolicy::DangerFullAccess,
|
||||
experimental_windows_sandbox: None,
|
||||
model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
@@ -1104,6 +1109,7 @@ async fn apply_patch_aggregates_diff_preserves_success_after_failure() -> Result
|
||||
cwd: cwd.path().to_path_buf(),
|
||||
approval_policy: AskForApproval::Never,
|
||||
sandbox_policy: SandboxPolicy::DangerFullAccess,
|
||||
experimental_windows_sandbox: None,
|
||||
model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
|
||||
@@ -513,6 +513,7 @@ async fn submit_turn(
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -84,6 +84,7 @@ async fn codex_returns_json_result(model: String) -> anyhow::Result<()> {
|
||||
model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -462,6 +462,7 @@ async fn per_turn_overrides_keep_cached_prefix_and_key_constant() -> anyhow::Res
|
||||
exclude_tmpdir_env_var: true,
|
||||
exclude_slash_tmp: true,
|
||||
},
|
||||
experimental_windows_sandbox: None,
|
||||
model: "o3".to_string(),
|
||||
effort: Some(ReasoningEffort::High),
|
||||
summary: ReasoningSummary::Detailed,
|
||||
@@ -551,6 +552,7 @@ async fn send_user_turn_with_no_changes_does_not_send_environment_context() -> a
|
||||
effort: default_effort,
|
||||
summary: default_summary,
|
||||
final_output_json_schema: None,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
wait_for_event(&codex, |ev| matches!(ev, EventMsg::TaskComplete(_))).await;
|
||||
@@ -567,6 +569,7 @@ async fn send_user_turn_with_no_changes_does_not_send_environment_context() -> a
|
||||
effort: default_effort,
|
||||
summary: default_summary,
|
||||
final_output_json_schema: None,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
wait_for_event(&codex, |ev| matches!(ev, EventMsg::TaskComplete(_))).await;
|
||||
@@ -638,6 +641,7 @@ async fn send_user_turn_with_changes_sends_environment_context() -> anyhow::Resu
|
||||
effort: default_effort,
|
||||
summary: default_summary,
|
||||
final_output_json_schema: None,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
wait_for_event(&codex, |ev| matches!(ev, EventMsg::TaskComplete(_))).await;
|
||||
@@ -654,6 +658,7 @@ async fn send_user_turn_with_changes_sends_environment_context() -> anyhow::Resu
|
||||
effort: Some(ReasoningEffort::High),
|
||||
summary: ReasoningSummary::Detailed,
|
||||
final_output_json_schema: None,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
wait_for_event(&codex, |ev| matches!(ev, EventMsg::TaskComplete(_))).await;
|
||||
|
||||
@@ -118,6 +118,7 @@ async fn stdio_server_round_trip() -> anyhow::Result<()> {
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -256,6 +257,7 @@ async fn stdio_image_responses_round_trip() -> anyhow::Result<()> {
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -452,6 +454,7 @@ async fn stdio_image_completions_round_trip() -> anyhow::Result<()> {
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -592,6 +595,7 @@ async fn stdio_server_propagates_whitelisted_env_vars() -> anyhow::Result<()> {
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -741,6 +745,7 @@ async fn streamable_http_tool_call_round_trip() -> anyhow::Result<()> {
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -922,6 +927,7 @@ async fn streamable_http_with_oauth_round_trip() -> anyhow::Result<()> {
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@ async fn shell_tool_executes_command_and_streams_output() -> anyhow::Result<()>
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -160,6 +161,7 @@ async fn update_plan_tool_emits_plan_update_event() -> anyhow::Result<()> {
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -236,6 +238,7 @@ async fn update_plan_tool_rejects_malformed_payload() -> anyhow::Result<()> {
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -324,6 +327,7 @@ async fn apply_patch_tool_executes_and_emits_patch_events() -> anyhow::Result<()
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -420,6 +424,7 @@ async fn apply_patch_reports_parse_diagnostics() -> anyhow::Result<()> {
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ async fn run_turn(test: &TestCodex, prompt: &str) -> anyhow::Result<()> {
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -435,6 +435,7 @@ async fn mcp_image_output_preserves_image_and_no_text_summary() -> Result<()> {
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -206,6 +206,7 @@ async fn unified_exec_emits_exec_command_begin_event() -> Result<()> {
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -287,6 +288,7 @@ async fn unified_exec_respects_workdir_override() -> Result<()> {
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -376,6 +378,7 @@ async fn unified_exec_emits_exec_command_end_event() -> Result<()> {
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -447,6 +450,7 @@ async fn unified_exec_emits_output_delta_for_exec_command() -> Result<()> {
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -538,6 +542,7 @@ async fn unified_exec_emits_output_delta_for_write_stdin() -> Result<()> {
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -637,6 +642,7 @@ async fn unified_exec_emits_begin_for_write_stdin() -> Result<()> {
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -739,6 +745,7 @@ async fn unified_exec_emits_begin_event_for_write_stdin_requests() -> Result<()>
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -848,6 +855,7 @@ async fn exec_command_reports_chunk_and_exit_metadata() -> Result<()> {
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -989,6 +997,7 @@ async fn write_stdin_returns_exit_metadata_and_clears_session() -> Result<()> {
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -1151,6 +1160,7 @@ async fn unified_exec_emits_end_event_when_session_dies_via_stdin() -> Result<()
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -1237,6 +1247,7 @@ async fn unified_exec_reuses_session_via_stdin() -> Result<()> {
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -1365,6 +1376,7 @@ PY
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
// This is a worst case scenario for the truncate logic.
|
||||
@@ -1476,6 +1488,7 @@ async fn unified_exec_timeout_and_followup_poll() -> Result<()> {
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -1569,6 +1582,7 @@ PY
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -1648,6 +1662,7 @@ async fn unified_exec_runs_under_sandbox() -> Result<()> {
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -86,6 +86,7 @@ async fn user_turn_with_local_image_attaches_image() -> anyhow::Result<()> {
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -177,6 +178,7 @@ async fn view_image_tool_attaches_local_image() -> anyhow::Result<()> {
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -287,6 +289,7 @@ async fn view_image_tool_errors_when_path_is_directory() -> anyhow::Result<()> {
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -359,6 +362,7 @@ async fn view_image_tool_placeholder_for_non_image_files() -> anyhow::Result<()>
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -450,6 +454,7 @@ async fn view_image_tool_errors_when_file_missing() -> anyhow::Result<()> {
|
||||
model: session_model,
|
||||
effort: None,
|
||||
summary: ReasoningSummary::Auto,
|
||||
experimental_windows_sandbox: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
|
||||
@@ -570,7 +570,8 @@ impl EventProcessor for EventProcessorWithHumanOutput {
|
||||
| EventMsg::ReasoningContentDelta(_)
|
||||
| EventMsg::ReasoningRawContentDelta(_)
|
||||
| EventMsg::UndoCompleted(_)
|
||||
| EventMsg::UndoStarted(_) => {}
|
||||
| EventMsg::UndoStarted(_)
|
||||
| EventMsg::WindowsWorldWritableWarning(_) => {}
|
||||
}
|
||||
CodexStatus::Running
|
||||
}
|
||||
|
||||
@@ -230,6 +230,7 @@ pub async fn run_main(cli: Cli, codex_linux_sandbox_exe: Option<PathBuf>) -> any
|
||||
show_raw_agent_reasoning: oss.then_some(true),
|
||||
tools_web_search_request: None,
|
||||
experimental_sandbox_command_assessment: None,
|
||||
experimental_windows_sandbox: None,
|
||||
additional_writable_roots: add_dir,
|
||||
};
|
||||
|
||||
@@ -296,6 +297,9 @@ pub async fn run_main(cli: Cli, codex_linux_sandbox_exe: Option<PathBuf>) -> any
|
||||
let default_model = config.model.clone();
|
||||
let default_effort = config.model_reasoning_effort;
|
||||
let default_summary = config.model_reasoning_summary;
|
||||
let default_experimental_windows_sandbox = config
|
||||
.features
|
||||
.enabled(codex_core::features::Feature::WindowsSandbox);
|
||||
|
||||
if !skip_git_repo_check && get_git_repo_root(&default_cwd).is_none() {
|
||||
eprintln!("Not inside a trusted directory and --skip-git-repo-check was not specified.");
|
||||
@@ -392,6 +396,11 @@ pub async fn run_main(cli: Cli, codex_linux_sandbox_exe: Option<PathBuf>) -> any
|
||||
effort: default_effort,
|
||||
summary: default_summary,
|
||||
final_output_json_schema: output_schema,
|
||||
experimental_windows_sandbox: if cfg!(windows) {
|
||||
Some(default_experimental_windows_sandbox)
|
||||
} else {
|
||||
None
|
||||
},
|
||||
})
|
||||
.await?;
|
||||
info!("Sent prompt with event ID: {initial_prompt_task_id}");
|
||||
|
||||
@@ -171,6 +171,7 @@ impl CodexToolCallParam {
|
||||
tools_web_search_request: None,
|
||||
experimental_sandbox_command_assessment: None,
|
||||
additional_writable_roots: Vec::new(),
|
||||
experimental_windows_sandbox: None,
|
||||
};
|
||||
|
||||
let cli_overrides = cli_overrides
|
||||
|
||||
@@ -301,6 +301,7 @@ async fn run_codex_tool_session_inner(
|
||||
| EventMsg::UndoStarted(_)
|
||||
| EventMsg::UndoCompleted(_)
|
||||
| EventMsg::ExitedReviewMode(_)
|
||||
| EventMsg::WindowsWorldWritableWarning(_)
|
||||
| EventMsg::DeprecationNotice(_) => {
|
||||
// For now, we do not do anything extra for these
|
||||
// events. Note that
|
||||
|
||||
@@ -88,6 +88,10 @@ pub enum Op {
|
||||
/// Policy to use for tool calls such as `local_shell`.
|
||||
sandbox_policy: SandboxPolicy,
|
||||
|
||||
/// Whether to enable the experimental Windows sandbox.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
experimental_windows_sandbox: Option<bool>,
|
||||
|
||||
/// Must be a valid model slug for the [`crate::client::ModelClient`]
|
||||
/// associated with this conversation.
|
||||
model: String,
|
||||
@@ -560,6 +564,16 @@ pub enum EventMsg {
|
||||
AgentMessageContentDelta(AgentMessageContentDeltaEvent),
|
||||
ReasoningContentDelta(ReasoningContentDeltaEvent),
|
||||
ReasoningRawContentDelta(ReasoningRawContentDeltaEvent),
|
||||
|
||||
/// Windows world-writable directories warning.
|
||||
WindowsWorldWritableWarning(WindowsWorldWritableWarningEvent),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, TS, JsonSchema)]
|
||||
pub struct WindowsWorldWritableWarningEvent {
|
||||
pub sample_paths: Vec<String>,
|
||||
pub extra_count: usize,
|
||||
pub failed_scan: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, TS, JsonSchema)]
|
||||
|
||||
@@ -1685,7 +1685,8 @@ impl ChatWidget {
|
||||
| EventMsg::ItemCompleted(_)
|
||||
| EventMsg::AgentMessageContentDelta(_)
|
||||
| EventMsg::ReasoningContentDelta(_)
|
||||
| EventMsg::ReasoningRawContentDelta(_) => {}
|
||||
| EventMsg::ReasoningRawContentDelta(_)
|
||||
| EventMsg::WindowsWorldWritableWarning(_) => {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -217,6 +217,7 @@ pub async fn run_main(
|
||||
show_raw_agent_reasoning: cli.oss.then_some(true),
|
||||
tools_web_search_request: None,
|
||||
experimental_sandbox_command_assessment: None,
|
||||
experimental_windows_sandbox: None,
|
||||
additional_writable_roots: additional_dirs,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user