mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +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:
1 parent
b1ccaa0e08
commit
1c5f336c40
5 files changed
+2
-81
No files matched your search
@@ -3223,34 +3223,6 @@ mod tests {
|
|||||||
assert!(remove_result.is_err());
|
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 {
|
fn sample_exit_info(conversation_id: Option<&str>, thread_name: Option<&str>) -> AppExitInfo {
|
||||||
let token_usage = TokenUsage {
|
let token_usage = TokenUsage {
|
||||||
output_tokens: 2,
|
output_tokens: 2,
|
||||||
|
|||||||
@@ -39,16 +39,6 @@ pub struct Cli {
|
|||||||
#[arg(long = "ignore-rules", global = true, default_value_t = false)]
|
#[arg(long = "ignore-rules", global = true, default_value_t = false)]
|
||||||
pub ignore_rules: bool,
|
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.
|
/// Path to a JSON Schema file describing the model's final response shape.
|
||||||
#[arg(long = "output-schema", value_name = "FILE", global = true)]
|
#[arg(long = "output-schema", value_name = "FILE", global = true)]
|
||||||
pub output_schema: Option<PathBuf>,
|
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)]
|
#[derive(Debug, Default)]
|
||||||
pub struct ExecSharedCliOptions(SharedCliOptions);
|
pub struct ExecSharedCliOptions(SharedCliOptions);
|
||||||
|
|
||||||
|
|||||||
@@ -73,13 +73,3 @@ fn parses_config_isolation_flags() {
|
|||||||
assert!(cli.ignore_user_config);
|
assert!(cli.ignore_user_config);
|
||||||
assert!(cli.ignore_rules);
|
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<()> {
|
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()) {
|
if let Err(err) = set_default_originator("codex_exec".to_string()) {
|
||||||
tracing::warn!(?err, "Failed to set codex exec originator override {err:?}");
|
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,
|
ephemeral,
|
||||||
ignore_user_config,
|
ignore_user_config,
|
||||||
ignore_rules,
|
ignore_rules,
|
||||||
removed_full_auto,
|
|
||||||
color,
|
color,
|
||||||
last_message_file,
|
last_message_file,
|
||||||
json: json_mode,
|
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_writer(std::io::stderr)
|
||||||
.with_filter(exec_stderr_env_filter());
|
.with_filter(exec_stderr_env_filter());
|
||||||
|
|
||||||
let sandbox_mode = if removed_full_auto {
|
let sandbox_mode = if dangerously_bypass_approvals_and_sandbox {
|
||||||
Some(SandboxMode::WorkspaceWrite)
|
|
||||||
} else if dangerously_bypass_approvals_and_sandbox {
|
|
||||||
Some(SandboxMode::DangerFullAccess)
|
Some(SandboxMode::DangerFullAccess)
|
||||||
} else {
|
} else {
|
||||||
sandbox_mode_cli_arg.map(Into::<SandboxMode>::into)
|
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(
|
let config = build_exec_config(
|
||||||
overrides,
|
overrides,
|
||||||
dangerously_bypass_approvals_and_sandbox || removed_full_auto,
|
dangerously_bypass_approvals_and_sandbox,
|
||||||
build_config,
|
build_config,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|||||||
@@ -56,14 +56,3 @@ async fn exec_bypass_preserves_never_for_auto_review_config() -> anyhow::Result<
|
|||||||
|
|
||||||
Ok(())
|
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