Skip to content

free: failover and cooldowns for Kimi and Vertex logins - #29

Merged
playgrndlabs-bot merged 2 commits into
mainfrom
claude/project-thread-foif0l
Oct 29, 2026
Merged

playgrndlabs-bot merged 2 commits into
mainfrom
claude/project-thread-foif0l

Conversation

@playgrndlabs-bot

Copy link
Copy Markdown
Contributor

Requested by PlaygrndLabs · project thread

What

Follow-up to #24. Kimi logins and Vertex service accounts now route the same way Claude and ChatGPT logins already do:

  • One candidate per login. Each Kimi login and Vertex service account is now its own candidate (id file:<name>, group oauth-served). It used to be a single candidate per provider that the Durable Object rotated through.
  • Failover and cooldowns. A rate-limited, refused or failing login rests on CPA's cooldowns, and the next login serves the request.
    • The cooldowns are shared through the DO.
    • They show in Auth Files and can be cleared with the reset button.
  • Routing fields. The auth-file fields priority, weight, prefix, disable-cooling and request-retry now apply to these logins.
  • Tokens by name.
    • Backend.loginToken(provider, name?) fetches a named login's token.
    • Tokens are cached per provider:name in each isolate.
    • On a 401, only that login's token is dropped and refreshed (still at most once a minute per login).
  • Fallback for older Durable Objects. A table with no logins list still gets one "next in turn" candidate per provider.

Security pass

  • Login names. Names sent to the DO come from the server's own routing table and are never taken from the client. A client's prefix/ only filters the list.
  • Lookup scope.
    • Account.loginToken(provider, name) only looks among that provider's enabled files.
    • A name belonging to another provider is refused with a generic 503, so no tokens or file details leak (covered by a test).
  • Token isolation. Cached tokens are keyed per provider and login, so one login's token is never sent with another's request.
  • Limits. The existing caps still hold: 10 upstream attempts and 120 s of waiting per request (Free plan's 50 subrequests). Refreshes after a 401 are still limited to once a minute per login.
  • No new data stored. Nothing new is logged or stored beyond the cooldown rows Route across logins and keys with CPA's strategies, retries and cooldowns #24 already keeps (id, model, reason, status, until).
  • Not ported. No cloaking, impersonation or TLS fingerprinting.

Tests

npm run verify: typecheck, lint and 227 tests all pass. New tests:

  • Two Kimi logins: the rate-limited one cools (file:k1.json, model-scoped) and the other serves the request. Usage is counted per login.
  • Two Vertex logins: a 401 refreshes only the refused token. team/ picks the login with that prefix.
  • A Kimi login that can't get a token is skipped for the next one.
  • DO level: Vertex appears in routing().logins, its token can be fetched by name, and a name from another provider is refused.

Generated by Claude Code

Each Kimi login and Vertex service account is now its own routing
candidate (id file:<name>), fetched by name from the Durable Object and
cached per login, so a rate-limited, refused or failing login rests on
CPA's cooldowns while the next one serves the request, as Claude and
ChatGPT logins already do. Auth file priority, weight, prefix,
disable-cooling and request-retry apply to them too.
@playgrndlabs-bot playgrndlabs-bot self-assigned this Oct 28, 2026
@playgrndlabs-bot
playgrndlabs-bot merged commit ff9c643 into main Oct 29, 2026
4 checks passed
playgrndlabs-bot pushed a commit that referenced this pull request Oct 29, 2026
#29 gave Vertex and Kimi logins routing entries with prefixes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants