mirror of
https://github.com/openai/codex.git
synced 2026-10-18 17:18:52 +00:00
Remove legacy --full-auto handling from codex exec (#36054)
## What changed Stop accepting the hidden, deprecated `--full-auto` flag in `codex exec` and remove its implicit mapping to the `workspace-write` sandbox. Callers must now select the sandbox mode explicitly with `--sandbox workspace-write`. GitOrigin-RevId: 0a739eb028eb3e2dd16a7650569256a01123d742
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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.")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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?;
|
||||
|
||||
@@ -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(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user