Repository navigation
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Greptile SummaryThis PR adds Codex configuration, shared receipt-based agent configuration, environment-aware config paths, and optional agent launching
Confidence Score: 3/5The PR is not yet safe to merge because existing Codex and legacy Claude receipts can become unreadable or undiscoverable Relocated Codex configurations now look only for a new hashed receipt, so users configured by the preceding revision cannot safely reconfigure or undo those changes. The earlier flat Claude receipt compatibility finding also remains outstanding because the sections-only parser still has no legacy conversion path. The shared-profile receipt issue is fixed through path-keyed receipts, and the multi-agent launch recovery issue is fixed Files Needing Attention: litellm/proxy/client/cli/commands/codex_settings.py, litellm/proxy/client/cli/commands/agent_config.py
|
| Filename | Overview |
|---|---|
| litellm/proxy/client/cli/commands/codex_settings.py | Adds Codex provider configuration and path-keyed receipts, but relocated receipts do not migrate or fall back to the previous sidecar |
| litellm/proxy/client/cli/commands/agent_config.py | Introduces the shared atomic configure and unconfigure engine; the earlier flat Claude receipt compatibility finding remains outstanding |
| litellm/proxy/client/cli/commands/configured_launch.py | Adds safe environment filtering, platform launch behavior, and independent recovery attempts for multiple agents |
| litellm/proxy/client/cli/commands/configure.py | Adds Codex commands, interactive agent selection, launch options, and actionable configuration error boundaries |
| tests/test_litellm/proxy/client/cli/test_codex_settings.py | Covers relocated receipt placement but does not verify migration or fallback from the previously written sidecar |
| tests/test_litellm/proxy/client/cli/test_configured_launch.py | Strengthens coverage to require the second agent launch attempt after either terminal launch fails |
Reviews (11): Last reviewed commit: "feat(cli): add lite configure codex, --l..." | Re-trigger Greptile
| CLAUDE_SETTINGS_PATH: Final = claude_config_dir() / "settings.json" | ||
| BACKUP_PATH: Final = Path.home() / ".litellm" / "claude_settings_backup.json" | ||
| AUTOROUTE_BACKUP_PATH: Final = Path.home() / ".litellm" / "autorouter" / "claude_settings_backup.json" | ||
| CONFIGURE_STATE_PATH: Final = Path.home() / ".litellm" / "claude_configure_state.json" |
| if not state_path.exists(): | ||
| return None | ||
| try: | ||
| return ConfigureReceipt.model_validate_json(state_path.read_bytes()) |
There was a problem hiding this comment.
Existing Receipts Become Unreadable
Existing flat Claude receipts fail the new sections-only parser, blocking reconfigure and unconfigure and violating the directive against unflagged backward-incompatible changes
Rule Used: What: avoid backwards-incompatible changes without... (source)
f7e2c11 to
dfdb427
Compare
4bf19b5 to
f1d655f
Compare
2176ad6 to
69cfd5f
Compare
f37b220 to
59e1124
Compare
|
@greptile-apps please review the latest commit |
|
@BugBot please review the latest commit |
59e1124 to
4274fea
Compare
|
@greptile-apps fixed the AgentConfigError boundary. Please re-review. |
4274fea to
b4fbfe4
Compare
|
@greptile-apps fixed the remaining receipt and interactive Codex error paths. Please re-review. |
|
bugbot run |
b4fbfe4 to
965a0a1
Compare
|
@BugBot holistic fixes pushed in 965a0a112c: real prompt coverage, argv auth execution, TTY snapshot, relocated profile default, and agent-specific listing errors. Please re-review. |
|
@greptile-apps holistic Bugbot fixes pushed in 965a0a112c. Please re-review the latest commit. |
965a0a1 to
eab8f24
Compare
PR overviewAdds lightweight CLI configuration for Codex, including a One low-risk issue remains: when the Codex configuration file is a symlink, a static token may be written to a tracked or synchronized target without warning. Exposure depends on the user having this symlink setup and another party being able to access the target; one other issue has already been addressed. Open issues (1)
Fixed/addressed: 1 · PR risk: 3/10 |
eab8f24 to
bc51a22
Compare
|
@BugBot rebuilt the configure flow around the selected agents and persisted config. Latest commit bc51a22bf2: |
|
@greptile-apps configure flow rebuilt in bc51a22bf2. Please re-review the latest commit. |
|
bugbot run |
bc51a22 to
9c79931
Compare
|
bugbot run |
|
@greptile-apps fixed the backward-compatible key forms, inherited model overrides, agent-neutral helper error, lint, and the uv.lock rebase in 9c7993186c. Please re-review. |
9c79931 to
7ce5dae
Compare
|
bugbot run |
|
@greptile-apps final flow fix pushed in 7ce5dae30b: both API-key orderings, persisted config writes, native client launch, Windows CreateNewConsole quoting, and model-env stripping. Please re-review. |
145c95f to
32f1eba
Compare
|
bugbot run |
|
@greptile-apps final rollback and launch-failure fixes are in 32f1ebafd3. Claude keeps its legacy flat receipt parser; Codex now reports double write/rollback failures safely. Please re-review. |
…CODEX_HOME Codex gets the same persistent, receipt-based wiring as Claude Code: a litellm model provider in config.toml on the Responses transport with the credential inline or read through lite auth print-token, an optional pinned model with its context window from the proxy, and lite unconfigure codex. The configure/unconfigure core moves into agent_config.py as one codec-agnostic mechanism (JSON settings, tomlkit TOML that keeps comments), configure claude/codex take --launch, plain lite configure lists both agents and offers to start one, and the config directories honor CLAUDE_CONFIG_DIR and CODEX_HOME
32f1eba to
961f40b
Compare
|
bugbot run |
|
@greptile-apps final holistic fixes pushed in 961f40b: explicit launch error boundaries, both-agent recovery attempts, Windows CreateNewConsole quoting, and relocated Codex receipts outside CODEX_HOME. Please re-review. |
| default_state: Final = state_root.parent / "codex_configure_state.json" | ||
| if config_path.resolve() == default.resolve(): | ||
| return default_state | ||
| digest: Final = hashlib.sha256(str(config_path.resolve()).encode()).hexdigest() |
There was a problem hiding this comment.
Relocated Receipts Become Undiscoverable
A relocated CODEX_HOME now uses only the new hashed receipt path. Configurations created by the preceding revision still have a sidecar receipt, so reconfigure and unconfigure cannot find their saved state or safely restore the original configuration. This violates the directive against unflagged backward-incompatible changes.
Rule Used: What: avoid backwards-incompatible changes without user-controlled flags Why: This breaks current behaviour for users using existing functionality Example of BAD: this PR (#22164) introduced run_post_custom... (source)
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 961f40b. Configure here.
| fd, tmp_path = tempfile.mkstemp(dir=str(parent), prefix=".tmp-", suffix=Path(path).suffix or ".json") | ||
| try: | ||
| with os.fdopen(fd, "w") as f: | ||
| json.dump(data, f, indent=2) |
There was a problem hiding this comment.
TOML staging uses locale encoding
Medium Severity
_stage opens the temp file with os.fdopen(fd, "w") and no encoding="utf-8", so writes use the process locale. TomlDocument.parse always decodes as UTF-8, and TOML is UTF-8 by spec. A config.toml with non-ASCII comments then fails to write or is rewritten in the locale encoding, so lite configure codex can crash or corrupt the file on Windows and other non-UTF-8 locales.
Reviewed by Cursor Bugbot for commit 961f40b. Configure here.
| raise click.ClickException(str(e)) from e | ||
| click.echo(f"Configured Codex: {config_path} now routes through {session.base_url}.") | ||
| click.echo( | ||
| "Credential: your virtual key, stored in the file as a bearer token." |
There was a problem hiding this comment.
Low: Warn when the key is written through a Codex symlink
write_target() deliberately follows a symlinked config.toml, so a common dotfiles setup causes this static bearer token to be written into the tracked or synchronized target. Anyone who can access that repository can then use the virtual key. Mirror the Claude flow by warning when session.credential is a StaticToken and config_path.is_symlink(), naming the resolved target and advising the user to keep it out of version control.


TLDR
Problem this solves:
lite configureonly knew Claude Code; Codex still needed hand edits toconfig.tomlCLAUDE_CONFIG_DIRorCODEX_HOMEgot the wrong file patchedHow it solves it:
lite configure codex/lite unconfigure codexon the same receipt-based undo as Claude Code--launchon both subcommands, and plainlite configureoffers to start an agent it just wiredCLAUDE_CONFIG_DIRandCODEX_HOMEhonoredStacked on #40319 (base branch
litellm_lit7355_claude_configure); the diff here is the one commit on top of itUser Flow
Before: a developer with a LiteLLM key can wire Claude Code with one command but Codex only by editing TOML by hand
lite configure codex --api-key sk-...and getError: No such command 'codex'~/.codex/config.tomlthemselves: a[model_providers.litellm]table,model_provider, a bearer token, and remember what they changedlite configure claudethey still open a new terminal and typeclaudethemselvesAfter: both agents are one command each, undoable, and can start right away
lite --base-url https://proxy.example.com configure codex --api-key sk-... --model claude-auto; the command checks the key againstGET /v1/models, writes the provider table,model_provider,modeland the model's context window intoconfig.tomlunder their existing comments, and prints how to undo itcodex(or open the Codex app); every turn lands onPOST /v1/responsesat the proxylite configure claude --launchwrites settings.json and hands the terminal straight to Claude Code on the proxy; plainlite configureasks which agents to wire, which model each starts on, and whether to start onelite unconfigure codexreturnsconfig.tomlto what it held before, comments includedRelevant issues
lite configure codexandlite unconfigure codex: a provider table on the Responses transport, the credential inline (virtual key) or as Codex's provider auth command (lite auth print-tokenfor the login), an optional pinned model plusmodel_context_windowfrom the proxyagent_config.py: sectioned receipt with fingerprints, staged two-file commit with receipt rollback, credential restore groups,JsonDocumentand a tomlkit-backedTomlDocumentthat handles standard, dotted, inline and split table shapes--launch, the launch prompt in the interactive flow, a Codex row in the picker, andCLAUDE_CONFIG_DIR/CODEX_HOMEresolutiontomlkitin thecliandproxyextras (already a transitive dependency through prisma)Linear ticket
Resolves LIT-7355
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Screenshots / Proof of Fix
Shared setup: a proxy from this worktree on
http://127.0.0.1:4735(no database), master keysk-rig-lit7355, servingclaude-haiku-4-5,claude-sonnet-4-6,claude-opus-4-7,claude-opus-5,gpt-5.6-luna(all upstream to a real gateway, real spend) andclaude-auto, a complexity auto-router over the Claude groups. Every run uses a freshHOMEandCODEX_HOME, Codex CLI 0.146.0, Claude Code v2.1.266, and the worktree'sliteBefore (9eab2a5)
configure codex
lite --base-url http://127.0.0.1:4735 configure codex --api-key sk-rig-lit7355Error: No such command 'codex'.launch
lite --base-url http://127.0.0.1:4735 configure claude --api-key sk-rig-lit7355 --launchError: No such option: --launchAfter (dfdb427)
configure codex
config.tomlseeded with a comment, a hand-pinnedmodel = "gpt-6-astra" # pinned by hand,model_reasoning_effortand a[projects."..."]tablelite --base-url http://127.0.0.1:4735 configure codex --api-key sk-rig-lit7355 --model claude-autocat $CODEX_HOME/config.toml(comments and the projects table kept, provider table appended)codex exec --skip-git-repo-check -C $T "Reply with exactly: routed ok" < /dev/null(real Codex CLI, no wrapper)POST /v1/responses HTTP/1.1 200 OKpreceded byComplexityRouter: routing decision cause=heuristic_scorer, tier=SIMPLE ... routed_model=claude-haiku-4-5lite configure codex --api-key sk-rig-lit7355again, without--modelconfig.tomlreadsmodel = "gpt-6-astra" # pinned by handagainlite unconfigure codexcat $CODEX_HOME/config.tomlis the seeded file again, comment and projects table includedlaunch
lite --base-url http://127.0.0.1:4735 configure claude --api-key sk-rig-lit7355 --launchin a ptyinteractive configure
lite --base-url http://127.0.0.1:4735 configurein a pty withLITELLM_PROXY_API_KEYset; both agents ticked in the checkbox, Claude Code left on its default, Codex set toclaude-auto, "Start Claude Code now?" answered No, "Start Codex now?" answered Yesconfig.tomlafterwards holdsmodel_provider = "litellm"andmodel = "claude-auto"; settings.json has nomodelkey;lite unconfigure claudeandlite unconfigure codexrestore both filesType
🆕 New Feature
Caveats (if any)
Medium
/modelpicker keeps its built-in catalog; a gateway-served Codex catalog is a proxy follow-up, so switching proxy models isconfigure codex --modelagain orcodex -mOutputTextDelta without active itemonce per turn on the proxy's Responses stream; the reply still arrives, and the stream shape is a proxy question outside this PRLow
lite logincredential runslite --base-url ... auth print-tokenas its provider auth command, solitemust stay on PATH for the desktop app too; a virtual key never needs itmodel_context_windowis written only when/model_group/inforeports a limit for the chosen model; an auto-router group reports nonemodel_providersspelled as dotted keys or an inline table, the new provider is written as an inline table so the file keeps meaning what it saysFinal Attestation
🤖 Generated with Claude Code
Note
Medium Risk
Changes how local agent configs and credentials are written on disk (including symlink targets and TOML merges), but scope is limited to the
liteCLI configure path with staged commits and undo receipts.Overview
Adds
lite configure codex/lite unconfigure codexso Codex routes through the LiteLLM proxy viaconfig.toml(Responses provider table, optional model pin andmodel_context_windowfrom the proxy), with the same receipt-based undo semantics as Claude Code.Introduces
agent_config.pyas the shared configure core: fingerprinted section receipts, staged two-file commits with receipt rollback,JsonDocument/ tomlkitTomlDocument(comments and varied TOML table shapes preserved), plusstage_private_textfor non-JSON atomic writes.lite configurenow takes--api-keyon the group (before the agent subcommand), supports Codex in the interactive picker, and can launch agents after wiring—--launchon subcommands, or prompts that hand off to one terminal or open separate windows on macOS/Linux/Windows without putting secrets on the command line. Codex can use a virtual key in the file orlite loginvia Codex’s provider auth command (print_token_commandwith an absolutelitepath).CLAUDE_CONFIG_DIR/CODEX_HOMEresolution is documented and tested.tomlkitis added tocliandproxyextras; agent launch helpers are exported fromagents.pyfor reuse.Reviewed by Cursor Bugbot for commit 961f40b. Bugbot is set up for automated code reviews on this repo. Configure here.