Skip to content

Add a Claude account pool with OrcaRouter keys and usage-limit rotation - #467

Merged
BunsDev merged 9 commits into
mainfrom
claude-accounts
Nov 1, 2026
Merged

BunsDev merged 9 commits into
mainfrom
claude-accounts

Conversation

@BunsDev

@BunsDev BunsDev commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Settings → Coding CLIs → Claude Code now manages several Claude accounts inside Modex. Every turn still runs through the installed claude CLI; Modex only chooses the environment that child starts with. There is no proxy and no API mode.

  • Profiles. Each profile is its own Claude Code configuration directory (CLAUDE_CONFIG_DIR, owner-only, under app/claude-profiles/). Sign in runs claude auth login there and confirms it with claude auth status. Modex never reads a token.
  • OrcaRouter keys. sk-orca-… keys are stored with OS encryption in secrets.json and never cross IPC again. A gateway turn gets ANTHROPIC_BASE_URL=https://api.orcarouter.ai, ANTHROPIC_AUTH_TOKEN and an optional model. Inherited ANTHROPIC_API_KEY is removed. CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1 keeps the key out of the model's shell commands. The key is redacted from failures.
  • Binding. A Claude thread binds to the account its first turn ran on (Thread.claudeAccount), mirroring Codex. Approval bindings compare the account for the thread's current backend.
  • Rotation (opt-in). A usage-limited account sits out until the reset time Claude Code printed, or one hour. New conversations move to the next account. A turn that had not started work retries once, only where the session can follow: a new conversation, or between the CLI login and gateways, which share ~/.claude.

OmniRouter (omnilabs-ai/OmniRouter) was evaluated and not integrated. It is a pre-alpha model-swap evidence layer with no account switching. Details are in docs/claude-accounts.md.

Destination approval and acceptance

Choosing an OrcaRouter account sends that conversation's prompts, files and tool results to OrcaRouter through the claude child. Signed commit 6a959580405356880cacdf819f10ee3a2fae9e22 records Val's 2026-11-01 approval of that destination in AGENTS.md. Live acceptance with a second Claude subscription, a real usage-limit message and an OrcaRouter turn remains unrun.

Review repairs

#469 merged into this branch as 82fe8fdc22c0fa5666e7f04fdc0a904e9ecb8c84. It isolates inherited profile credentials, redacts gateway transcript output before journal/IPC delivery, denies secret-bearing approval actions, and cools down the second limited account without a third retry. The merge tree matches the reviewed repair exactly and its signature is verified. Local build and full tests passed with 2,298 passes and 26 skips; the focused account Electron E2E passed. Hosted macOS unit/E2E, iPhone, Linux and Windows checks all passed. First failures and validation boundaries are retained in docs/reviews/2026-11-01-claude-pool-repair.md.

#471 reconciled the documentation conflict with main and merged as 17c83be15c11200c0f4b1849e1923309e32a90ce. Its signed merge tree exactly matches the reviewed candidate. Hosted validation passed with 482 desktop E2E passes, 4 skips and 7 site passes; its cold-open median was 288.4 ms against the unchanged 500 ms limit. The current feature head still requires its own checks and protected queue validation before main. The original feature validation below is retained as historical evidence.

Test plan

  • pnpm --filter @modex/desktop test: 2,106 passed, 20 skipped, 0 failed, including 13 new tests in test/claude-accounts.test.ts
  • pnpm --filter @modex/store-desktop test: 16 passed
  • Full desktop playwright test: 479 passed, 7 skipped, 0 failed, including the new e2e/claude-accounts.spec.ts (synthetic claude, real IPC and UI)
  • Live acceptance: a real second Claude subscription, a real usage-limit message, and a real OrcaRouter turn. None of these have been run.

Settings → Coding CLIs → Claude Code now keeps several Claude accounts: separate
Claude Code profiles (each its own CLAUDE_CONFIG_DIR and browser login) and
OrcaRouter gateway keys stored with OS encryption. New conversations start on
the selected account. With rotation on, an account that reports a usage limit
sits out until its reset time, and a turn that had not started work retries
once on the next account. Threads bind to their first account, as Codex
threads do. Every turn still runs through the installed claude CLI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
modex Ready Ready Preview Nov 1, 2026 7:08pm UTC

Request Review

@github-code-quality

github-code-quality Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Code coverage overview

Languages: TypeScript

TypeScript / code-coverage-agent

main 66d0031 claude-accounts eff9cb9 +/-
66% 66% 0%
View coverage of the 10 most impacted files.
File main 66d0031 claude-accounts eff9cb9 +/-
apps/desktop/sr...ngine/runner.ts 98% 98% 0%
apps/store-desk...rc/main/demo.ts 95% 95% 0%
apps/desktop/sr...kends/claude.ts 98% 98% 0%
apps/desktop/sr...claude-login.ts 100% 100% 0%
apps/desktop/sr...gine/secrets.ts 100% 100% 0%
apps/desktop/sr...udeAccounts.tsx 0% 0% 0%
apps/desktop/sr...ain/commands.ts 87% 88% +1%
apps/desktop/sr...count-claude.ts 0% 87% +87%
apps/desktop/sr...-secret-sink.ts 0% 95% +95%
apps/desktop/sr...ude-accounts.ts 0% 99% +99%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated November 01, 2026 19:43 UTC

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reconcile main documentation for Claude account delivery
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@BunsDev
BunsDev added this pull request to the merge queue Nov 1, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 1, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@BunsDev
BunsDev enabled auto-merge November 1, 2026 19:08
@BunsDev
BunsDev added this pull request to the merge queue Nov 1, 2026
Merged via the queue into main with commit 8a28df3 Nov 1, 2026
13 checks passed
@BunsDev
BunsDev deleted the claude-accounts branch November 1, 2026 20:25

This branch was successfully deployed

1 active deployment
Preview — eff9cb90 Deployed Nov 1, 2026 by vercel[bot]
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