Skip to content

Add codex-local default CLI flags - #2

Open
ehrvs wants to merge 2 commits into
merge/rust-v0.157.1from
feat/local-default-args-stacked
Open

ehrvs wants to merge 2 commits into
merge/rust-v0.157.1from
feat/local-default-args-stacked

Conversation

@ehrvs

@ehrvs ehrvs commented Sep 28, 2026

Copy link
Copy Markdown
Owner

Summary

Add fork-only default CLI flags from <codex_home>/codex-local.toml for runtime invocations. Supported defaults are -c/--config, -m/--model, and -p/--profile. Explicit user model and profile flags win; a user profile also drops the default model. CODEX_LOCAL_NO_DEFAULTS=1 bypasses the file.

The implementation is stacked on A1, and its upstream-merge guidance is in codex-rs/chat-completions/MERGE_NOTES.md.

Verification

  • cargo test -p codex-cli --bin codex local_defaults -j 1: 21 passed.
  • cargo fmt --check: passed.
  • cargo clippy -p codex-cli --bin codex -j 1 -- -D warnings: passed.
  • The original A2 implementation was also smoke-tested before stacking. The live defaults/session-metadata check on this stacked binary remains pending: repeated session interruptions stopped its full binary build. A parallel test build also exhausted the Windows paging file; the focused one-job test then passed.

Please review against the A1 branch. After A1 merges, retarget this PR to main and merge with a merge commit.

ehrvs and others added 2 commits September 28, 2026 09:40
Read `default_args` from `<codex_home>/codex-local.toml` and insert them
after argv[0] before clap parses the multitool CLI. Only -c/--config,
-m/--model and -p/--profile are allowed (`--flag v` and `--flag=v`).

Defaults are skipped when CODEX_LOCAL_NO_DEFAULTS=1, when a pre-parse of
the original argv fails, or when the subcommand is outside the runtime
set accepted by profile_v2_for_subcommand (RUNTIME_SUBCOMMANDS, guarded
by a parity test over every subcommand). A user -m drops the default -m;
a user -p drops the default -p and -m; -c defaults are always kept. A
malformed file prints one warning and leaves argv unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185nJxTpL8i9DEagqMF4r8H
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant