Deprecate --config and limit it to legacy keys (#65357)

## What changed

Mark `-c` and `--config` as deprecated in CLI help and direct users to
dedicated flags or `config.toml`. Check explicit overrides against a fixed
list of legacy keys before expanding dedicated flags. Reject unknown keys
even without `--strict-config`, including keys inside inline tables and
arrays of tables. The `app-server` subcommand skips the legacy-key check.

Preserve the meaning of positional `features.guardianv3.housekeeper`
overrides by mapping the legacy positions to named fields.

## Testing

Cover unknown nested keys and verify that `codex-exec resume` checks
overrides on both sides of the subcommand while preserving their order.
Test that a legacy positional housekeeper override still sets
`batch_timeout_ms`.

GitOrigin-RevId: ae13d976ad5e13068096c0f2548fdf0ab35535f3
This commit is contained in:
Benjamin Carlsson
2026-12-02 23:38:59 +00:00
committed by copyberry
parent 3a6ecd7366
commit 7aa5d4ea3a
14 changed files with 628 additions and 63 deletions
+3
View File
@@ -30,6 +30,9 @@ pub fn run_standalone() -> anyhow::Result<()> {
let mut cli = ExecServerCli::parse_from(&args);
cli.config_overrides = collect_config_overrides(ExecServerCli::command(), args)
.unwrap_or_else(|error| error.exit());
cli.config_overrides
.legacy_keys()
.map_err(anyhow::Error::msg)?;
cli.command.run(&paths, &cli.config_overrides).await
})
}
@@ -13,14 +13,11 @@ Commands:
Options:
-c, --config <key=value>
Override a configuration value that would otherwise be loaded from
`~/.codex/config.toml`. Use a dotted path (`foo.bar.baz`) to override
nested values. The `value` portion is parsed as TOML. If it fails to
parse as TOML, the raw string is used as a literal.
Deprecated. Override a legacy configuration key.
Examples: - `-c model="o3"` - `-c
'sandbox_permissions=["disk-full-read-access"]'` - `-c
shell_environment_policy.inherit=all`
Prefer a dedicated flag or set the key in `config.toml`. Use dotted
paths for nested keys. Values are parsed as TOML or, if parsing fails,
as literal strings.
--strict-config
Error out when config.toml contains fields that are not recognized by