Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Remove legacy `--full-auto` handling from `codex exec` (#36054)

Dylan Hurd1c5f336c4057
diff --git a/codex-rs/cli/src/main.rs b/codex-rs/cli/src/main.rs
index f5ef489cb0..60d1566142 100644
--- a/codex-rs/cli/src/main.rs
+++ b/codex-rs/cli/src/main.rs
@@ -3223,34 +3223,6 @@ mod tests {
assert!(remove_result.is_err());
}
- #[test]
- fn full_auto_no_longer_parses_at_top_level() {
- let result = MultitoolCli::try_parse_from(["codex", "--full-auto"]);
-
- assert!(result.is_err());
- }
-
- #[test]
- fn exec_full_auto_reports_migration_path() {
- let cli = MultitoolCli::try_parse_from(["codex", "exec", "--full-auto", "summarize"])
- .expect("exec should accept removed flag long enough to report a migration path");
- let Some(Subcommand::Exec(exec)) = cli.subcommand else {
- panic!("expected exec subcommand");
- };
-
- assert_eq!(
- exec.removed_full_auto_warning(),
- Some("warning: `--full-auto` is deprecated; use `--sandbox workspace-write` instead.")
- );
- }
-
- #[test]
- fn sandbox_full_auto_no_longer_parses() {
- let result = MultitoolCli::try_parse_from(["codex", "sandbox", "--full-auto", "--"]);
-
- assert!(result.is_err());
- }
-
fn sample_exit_info(conversation_id: Option<&str>, thread_name: Option<&str>) -> AppExitInfo {
let token_usage = TokenUsage {
output_tokens: 2,
diff --git a/codex-rs/exec/src/cli.rs b/codex-rs/exec/src/cli.rs
index 53124c11a5..694630c9b0 100644
--- a/codex-rs/exec/src/cli.rs
+++ b/codex-rs/exec/src/cli.rs
@@ -39,16 +39,6 @@ pub struct Cli {
#[arg(long = "ignore-rules", global = true, default_value_t = false)]
pub ignore_rules: bool,
- /// Legacy compatibility trap for the removed `--full-auto` flag.
- #[arg(
- long = "full-auto",
- hide = true,
- global = true,
- default_value_t = false,
- conflicts_with = "dangerously_bypass_approvals_and_sandbox"
- )]
- pub removed_full_auto: bool,
-
/// Path to a JSON Schema file describing the model's final response shape.
#[arg(long = "output-schema", value_name = "FILE", global = true)]
pub output_schema: Option<PathBuf>,
@@ -99,18 +89,6 @@ impl std::ops::DerefMut for Cli {
}
}
-impl Cli {
- pub fn removed_full_auto_warning(&self) -> Option<&'static str> {
- if self.removed_full_auto {
- return Some(
- "warning: `--full-auto` is deprecated; use `--sandbox workspace-write` instead.",
- );
- }
-
- None
- }
-}
-
#[derive(Debug, Default)]
pub struct ExecSharedCliOptions(SharedCliOptions);
diff --git a/codex-rs/exec/src/cli_tests.rs b/codex-rs/exec/src/cli_tests.rs
index 524067dd66..f17707bf77 100644
--- a/codex-rs/exec/src/cli_tests.rs
+++ b/codex-rs/exec/src/cli_tests.rs
@@ -73,13 +73,3 @@ fn parses_config_isolation_flags() {
assert!(cli.ignore_user_config);
assert!(cli.ignore_rules);
}
-
-#[test]
-fn removed_full_auto_flag_reports_migration_path() {
- let cli = Cli::parse_from(["codex-exec", "--full-auto", "summarize"]);
-
- assert_eq!(
- cli.removed_full_auto_warning(),
- Some("warning: `--full-auto` is deprecated; use `--sandbox workspace-write` instead.")
- );
-}
diff --git a/codex-rs/exec/src/lib.rs b/codex-rs/exec/src/lib.rs
index 31a502da31..962dba866a 100644
--- a/codex-rs/exec/src/lib.rs
+++ b/codex-rs/exec/src/lib.rs
@@ -238,11 +238,6 @@ fn exec_stderr_env_filter() -> EnvFilter {
}
pub async fn run_main(cli: Cli, arg0_paths: Arg0DispatchPaths) -> anyhow::Result<()> {
- #[allow(clippy::print_stderr)]
- if let Some(message) = cli.removed_full_auto_warning() {
- eprintln!("{message}");
- }
-
if let Err(err) = set_default_originator("codex_exec".to_string()) {
tracing::warn!(?err, "Failed to set codex exec originator override {err:?}");
}
@@ -255,7 +250,6 @@ pub async fn run_main(cli: Cli, arg0_paths: Arg0DispatchPaths) -> anyhow::Result
ephemeral,
ignore_user_config,
ignore_rules,
- removed_full_auto,
color,
last_message_file,
json: json_mode,
@@ -290,9 +284,7 @@ pub async fn run_main(cli: Cli, arg0_paths: Arg0DispatchPaths) -> anyhow::Result
.with_writer(std::io::stderr)
.with_filter(exec_stderr_env_filter());
- let sandbox_mode = if removed_full_auto {
- Some(SandboxMode::WorkspaceWrite)
- } else if dangerously_bypass_approvals_and_sandbox {
+ let sandbox_mode = if dangerously_bypass_approvals_and_sandbox {
Some(SandboxMode::DangerFullAccess)
} else {
sandbox_mode_cli_arg.map(Into::<SandboxMode>::into)
@@ -460,7 +452,7 @@ pub async fn run_main(cli: Cli, arg0_paths: Arg0DispatchPaths) -> anyhow::Result
};
let config = build_exec_config(
overrides,
- dangerously_bypass_approvals_and_sandbox || removed_full_auto,
+ dangerously_bypass_approvals_and_sandbox,
build_config,
)
.await?;
diff --git a/codex-rs/exec/tests/suite/approval_policy.rs b/codex-rs/exec/tests/suite/approval_policy.rs
index b04bf9a6b6..de650ef978 100644
--- a/codex-rs/exec/tests/suite/approval_policy.rs
+++ b/codex-rs/exec/tests/suite/approval_policy.rs
@@ -56,14 +56,3 @@ async fn exec_bypass_preserves_never_for_auto_review_config() -> anyhow::Result<
Ok(())
}
-
-#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
-async fn exec_full_auto_preserves_never_for_auto_review_config() -> anyhow::Result<()> {
- let stderr = run_exec_with_auto_review_config(&["--full-auto"]).await?;
- assert!(
- stderr.contains("approval: never"),
- "stderr missing full-auto approval mode: {stderr}"
- );
-
- Ok(())
-}