fix(cli): keep openai passthrough during ocx init so gpt-* models still route (issue #261) - #262
Merged
Conversation
Add actionable guidance to the error message: tell users to run 'ocx init' or check their config. The previous message was technical and did not help users who had not configured a provider yet (issue lidge-jun#261).
…tion
The previous wording ('Available providers' / 'Select provider') made it seem like the user was enabling all providers rather than choosing a default. Updated to 'Choose your default provider (you can add more later)' and 'Select default provider (number)' per user feedback on issue lidge-jun#261.
5 tasks
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
Fixes the root cause behind #261.
The reporter selected Kimi as their default provider, then every built-in
gpt-*request 404'd withNo enabled canonical OpenAI provider for model: gpt-5.6-sol.Root cause
ocx initassembled the saved config by spreading the defaults and then replacing the wholeprovidersmap with just the chosen provider:s const config = { ...getDefaultConfig(), providers: { [providerName]: providerConfig }, // wipes the baseline openai passthrough defaultProvider: providerName, };The default config ships an
openaiforward provider that passes Codex's ChatGPT login through to the backend. The router sends every baregpt-*model straight toproviders["openai"]regardless ofdefaultProvider:s if (isBareOpenAiFamilyModel(modelId)) { const provider = config.providers[OPENAI_CODEX_PROVIDER_ID]; // "openai" if (provider && provider.disabled !== true) return routeResult(...); throw new NoEnabledOpenAiProviderError(modelId); // 404 }So the moment
ocx initdropped theopenaiprovider,gpt-*routing broke. The default being Kimi was a red herring; the passthrough deletion was the actual bug.Fix
buildInitConfig(extracted, pure, tested) now layers the chosen provider on top of the baseline defaults instead of replacing them, so theopenaipassthrough survives.ocx initprints a note when a non-openai default is chosen, so users knowgpt-*still routes through their ChatGPT login.NoEnabledOpenAiProviderErroras a safety net for configs that still end up without anopenaiprovider.Changes
src/cli/init.ts: Preserve baseline providers, extractbuildInitConfig, add note, clarify promptssrc/router.ts: ActionableNoEnabledOpenAiProviderErrormessagetests/init-config.test.ts: Cover passthrough preservation, openai-as-default, and portVerification
bun teston init-config, startup-prompt, router: 26 pass, 0 failbun run typecheck: clean