[codex] add provider fallback routing and credential pools#367
Draft
[codex] add provider fallback routing and credential pools#367
Conversation
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.
What changed
This adds Hermes-style primary model routing for the main session model path.
Why
HybridClaw auto-discovers model providers today, but it still executes the primary model path as a single resolved provider credential. That means a transient provider outage, an exhausted key, or a long-context 429 can fail the whole turn even when alternate providers or keys are already configured.
Impact
Users with multiple provider credentials or fallback models configured can now recover from more provider-side failures automatically without manually switching models.
Root cause
The main session model execution path only resolved one provider credential up front and retried that same route. It had no ordered fallback chain, no pooled credential rotation, and no adaptive downgrade for long-context rate-limit scenarios.
Validation
Passed:
npm run typechecknpm run lintnpm run formatnpm exec vitest -- run tests/provider-api-key-utils.test.ts tests/providers.model-routing.test.ts tests/container.model-routing-state.test.ts tests/ipc.test.ts tests/worker-signature.test.tsBlocked in this desktop environment:
better-sqlite3native binary mismatch (NODE_MODULE_VERSION 127vs141), so they could not be used as final validation here