feat(tui): add Codex API format picker (fix meta revert bug)#254
Open
heliar-k wants to merge 1 commit into
Open
feat(tui): add Codex API format picker (fix meta revert bug)#254heliar-k wants to merge 1 commit into
heliar-k wants to merge 1 commit into
Conversation
Adds a TUI form picker for Codex providers to select between openai_responses and openai_chat wire API formats. Unifies the previously separate ClaudeApiFormat and CodexApiFormat enums into a single shared ApiFormat enum used by both Claude and Codex provider forms. Also fixes a bug where api_format would revert after editing an existing provider (preserves empty meta objects in JSON output so ProviderService::update() treats the form as authoritative). Includes end-to-end tests for the api_format roundtrip through the TUI form, JSON serialization, and DB persistence.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add an API format picker to the Codex provider form and unify the Claude/Codex/Gemini API format representation under a single
ApiFormatenum. Also fixes a bug where changing a provider'sapiFormatin the TUI would appear to save but revert to the old value after restart.Changes
1. Codex API Format Picker
2.
ApiFormatEnum Unification (TUI layer only)ClaudeApiFormat→ApiFormat(describes generic wire protocols, not Claude-specific)ProviderAddField::ClaudeApiFormat→::ApiFormatOverlay::ClaudeApiFormatPicker→::ApiFormatPickerapi_formatfield on the form state replaces previousclaude_api_format/codex_api_formatfields3. Bug Fix: Meta Revert After Edit
Symptom: changing a provider's
apiFormat(e.g.openai_chat→ Anthropic) in the TUI appeared to save, but reverted to the old value after restart.Root cause:
provider_json.rsremoved the entiremetakey when the meta object became empty. Deserialization then producedmeta: None, and the merge logic inProviderService::update()preserved the old meta (including the oldapiFormat).Fix: keep
"meta": {}in the JSON output even when empty, so deserialization producesSome(ProviderMeta::default())and the merge logic correctly treats the form output as authoritative.Test plan
cargo test --lib -- api_format— 29 tests pass (including newtest_exact_tui_form_api_format_roundtripregression test)cargo test --lib -- codex_local_routing— passescargo test --lib -- provider_add_form_codex— passescargo check— no errors (only pre-existing warnings from main)