Add LLM fallback chains, multi-LLM init wizard, and OpenAI OAuth#7
Merged
initializ-mk merged 2 commits intomainfrom Feb 25, 2026
Merged
Add LLM fallback chains, multi-LLM init wizard, and OpenAI OAuth#7initializ-mk merged 2 commits intomainfrom
initializ-mk merged 2 commits intomainfrom
Conversation
- Fallback chain: FallbackChain, CooldownTracker, error classification in forge-core/llm/ with full test coverage - Runtime integration: ResolveModelConfig resolves fallbacks from forge.yaml, FORGE_MODEL_FALLBACKS env var, and auto-detection - Runner builds FallbackChain wrapping primary + fallback clients - TUI wizard: FallbackStep for selecting fallback providers and collecting API keys during forge init - OpenAI OAuth: browser-based login (Authorization Code + PKCE) via auth.openai.com with local callback server - ResponsesClient: new llm.Client for the OpenAI Responses API used by ChatGPT OAuth tokens (Codex endpoint) - OAuthClient: auto-refreshing wrapper that detects token expiry - Model selection: provider-specific model choices during init based on auth method (OAuth vs API key) - Fix OAuth/API-key routing: only use stored OAuth credentials when no API key is configured, preventing Codex endpoint misuse - Fix multi-select UX: auto-check cursor item on Enter when nothing is checked, so single-selection works intuitively
Update TestBuildTemplateData_DefaultModels to expect gpt-5.2-2025-12-11 instead of the old gpt-4o-mini default.
a495f9e to
5450eac
Compare
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
FallbackChain(implementsllm.Client) with cooldown tracking and error classification. When the primary provider fails (rate limit, auth error, server error), requests automatically failover to the next provider in the chain.ResolveModelConfigresolves fallback providers fromforge.yaml,FORGE_MODEL_FALLBACKSenv var, or auto-detection from available API keys. Runner builds aFallbackChainwrapping primary + fallback clients.FallbackStepin the TUI wizard lets users select fallback providers and enter API keys duringforge init. Also supports--fallbacksflag for non-interactive mode.auth.openai.comwith a local callback server.OAuthClientauto-refreshes expired tokens.ResponsesClientimplementsllm.Clientfor the OpenAI Responses API (required by ChatGPT OAuth/Codex endpoint).Test plan
cd forge-core && go test ./llm/... ./runtime/...— fallback chain, cooldown, errors, config resolution, OAuth packagescd forge-cli && go build ./...— compilation checkforge init, select a primary provider, verify fallback step appears, add a fallback, verifyforge.yamlincludes fallbacks sectionforge init, select OpenAI, choose "Login with OpenAI", verify browser opens and OAuth completesANTHROPIC_API_KEYandOPENAI_API_KEY, verify auto-detected fallback in startup bannerforge init my-agent --model-provider anthropic --fallbacks openai,gemini --non-interactive— verify forge.yaml has fallbacks