Repository navigation
Add ordered Gemini credential failover - #86
Merged
Merged
Conversation
Contributor
Resolve the known integration regressions. |
jserv
requested changes
Sep 22, 2026
jserv
left a comment
Contributor
There was a problem hiding this comment.
Check https://cbea.ms/git-commit/ carefully and enforce the rules.
matthiola0
force-pushed
the
feat/gemini-key-failover
branch
2 times, most recently
from
September 23, 2026 07:18
2afccb9 to
863eb6f
Compare
Contributor
Author
|
Squashed the fixups into the commits they belong to; the tree is identical to 2afccb9, which passed CI. |
ColtenOuO
reviewed
Sep 23, 2026
ColtenOuO
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for working on this, left some suggestions in comment.
matthiola0
force-pushed
the
feat/gemini-key-failover
branch
from
September 23, 2026 14:51
863eb6f to
016958f
Compare
jserv
reviewed
Sep 23, 2026
jserv
reviewed
Sep 23, 2026
jserv
reviewed
Sep 23, 2026
jserv
reviewed
Sep 23, 2026
jserv
reviewed
Sep 23, 2026
jserv
reviewed
Sep 23, 2026
jserv
reviewed
Sep 23, 2026
matthiola0
force-pushed
the
feat/gemini-key-failover
branch
from
September 24, 2026 11:02
016958f to
86264d7
Compare
matthiola0
force-pushed
the
feat/gemini-key-failover
branch
from
September 24, 2026 12:50
86264d7 to
7ca1578
Compare
ColtenOuO
reviewed
Sep 24, 2026
matthiola0
force-pushed
the
feat/gemini-key-failover
branch
from
September 24, 2026 22:11
7ca1578 to
e6a69a3
Compare
jserv
reviewed
Sep 25, 2026
jserv
reviewed
Sep 25, 2026
jserv
reviewed
Sep 25, 2026
matthiola0
force-pushed
the
feat/gemini-key-failover
branch
from
September 25, 2026 10:10
e6a69a3 to
708c13f
Compare
ColtenOuO
reviewed
Sep 25, 2026
Collaborator
|
The PR description might need to be updated due to recent review changes. |
A rejected or quota-exhausted Gemini key ended the interview even when another key was available. Read an ordered GOOGLE_API_KEYS list and move to the next key while staying in the original LiveKit room and project. With backups configured, credential failures cool down across interviews so each one does not rediscover an exhausted key; a sole key is never marked, because one failure would otherwise refuse every later room. When every key is out on quota, an interview waits for the first one back, as a sole key would retry. Every other failure keeps the existing retry budget on the same key, and an interview's first open still ends within the time one attempt always took. A Google key or list set by a provider or by the config file replaces what it would inherit, so its rooms never bill another project. A Live key switch starts a cold session from retained state, because resumption across keys is unverified. check-gemini selects keys the same way and tries no more keys than an interview's first open could reach.
Explain credential precedence, cooldowns and session recovery so operators can configure backup keys and understand their limits.
Windows cannot unlink open SQLite files or launch shell scripts directly. Drain test servers before cleanup and invoke scripts through the shell. Use occupied ports and portable file fixtures so the same assertions run without depending on Unix privileges, line endings or timestamp precision.
matthiola0
force-pushed
the
feat/gemini-key-failover
branch
from
September 25, 2026 15:31
708c13f to
b17d12e
Compare
Contributor
|
Thank @matthiola0 for contributing! |
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.
Fixes #78.
Summary
A rejected or exhausted Gemini key can end an interview even when another credential is available. Add an ordered key list so the interview can switch credentials while staying in its original LiveKit room and project.
Changes
GOOGLE_API_KEYS, then globalGOOGLE_API_KEY, resolved into one list at load time. Keys from a provider or the config file replace what they would inherit, and a blank value counts as unset. Reject empty entries and duplicate keys.check-geminiselects keys the same way: it skips rejected keys, tries no more keys than an interview's first open could reach, and reports any other failure at once.Testing
Add coverage for selection order, shared and per-surface cooldowns and their expiry, the wait on an all-quota rotation, reason codes in responses and close frames, blank key lists, redaction, bounded retries, a first-open 503 retried on the selected key with and without a backup, and
check-geminifailover and its attempt limit.cargo testpasses on Windows: lib 272, cli 45, config 44 and web 126.scripts/test.shpasses on Ubuntu 24.04 (WSL), andcargo-mutantsover the changes since the last review leaves no missed mutants. Formatting and Clippy pass.Summary by cubic
Adds ordered Gemini credential failover so a rejected or quota-exhausted key no longer ends an interview. The interview switches to the next key while staying in its original LiveKit room and project.
GOOGLE_API_KEYStakes precedence over legacyGOOGLE_API_KEY; a provider list replaces the global list. Precedence, cooldowns, and session recovery are documented indocs/providers.md.check-geminiselects keys the same way and tries no more than an interview's first open could reach.The integration tests also pass on Windows: test servers are drained before cleanup, shell scripts run through
sh, and the tests use occupied ports and portable fixtures.Written for commit b17d12e. Summary will update on new commits.