feat(issue-42): add provider-neutral multi-subscription routing#43
Open
konard wants to merge 4 commits into
Open
feat(issue-42): add provider-neutral multi-subscription routing#43konard wants to merge 4 commits into
konard wants to merge 4 commits into
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: #42
konard
marked this pull request as ready for review
July 22, 2026 07:26
Contributor
Author
Working session summaryCompleted and marked ready for review: PR #43.
This summary was automatically extracted from the AI working session output. |
Contributor
Author
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
📊 Context and tokens usage:
Total: (773.7K + 21.3M cached) input tokens, 88.7K output tokens, $33.058331 cost 🤖 Models used:
📎 Log file uploaded as Gist (10575KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
Contributor
Author
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
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 this PR does
Extends multi-account routing from Claude-only pools to every subscription provider already supported by the router: Claude, Codex, Gemini, and Qwen. It also adds stable session assignment, strict token account pins, internal request caps, quota-aware selection/cooldowns, and Formal AI-style native protocol namespaces.
Root cause and reproduction
PR #38 added vendor credential readers and single-subscription forwarding, but
AccountRouterstill constructed Claude-onlyOAuthProviderinstances. Codex, Gemini, and Qwen therefore bypassed account selection; refreshed credentials were cached only by provider; and OpenAI translation discarded session metadata before selection.The regression tests added first reproduced those gaps as 26 missing API/type errors, including provider-neutral pool construction, strict session/pin selection, per-account refresh keys, request caps, and request-routing context extraction.
Routing behavior
SubscriptionReaderfor Claude, Codex, Gemini, or Qwen.round-robin,priority/fill-first, and normalizedleast-used/quota-firstselection for new sessions.ACCOUNT_REQUEST_LIMITSaccounting, including concurrent cap enforcement.Retry-Afterdelta/date values extend the configured minimum.(provider, account)and token-budget enforcement on subscription routes./v1/accounts,accounts list, anddoctor.Native protocol routes
Adds namespaced Anthropic, OpenAI, Codex, and Qwen aliases plus native Gemini
generateContent/streamGenerateContentand Vertex publisher-model paths. Existing unprefixed APIs remain unchanged. Provider-specific namespaces use the matching configuredUPSTREAM_PROVIDER; no cross-provider billing or protocol fallback is introduced.Research and requirement trace
The case-study package at
docs/case-studies/issue-42/records immutable Claudexor and Formal AI snapshots, related-project research, adopted design rules, deliberate boundaries, and an R1-R17 implementation/test trace.Testing
cargo fmt --all -- --checkcargo clippy --all-targets --all-features -- -D warningscargo test --all-features— 137 unit, 50 integration, and 10 release-workflow tests pass; doc tests passcargo doc --no-deps --all-featurescargo run -- servestartup — Axum route table starts without conflictsaccounts listanddoctorThis is a backend/configuration change, so no UI screenshots apply. The minor-release changelog fragment is included; release automation owns the version bump.
Closes #42