Business operating system for Claude Code — 57 skills, 21 agents, smart daemon. Unified inbox (WhatsApp/Email/Slack/Telegram), autonomous PR merge, full-AWS monitoring, revenue (Stripe+RevenueCat), e-commerce (Shopify), marketing (Klaviyo/Meta/GA4), voice (Bland/ElevenLabs), APM (Datadog/NewRelic/OTEL), YOLO mode.
Shell agent-teamsai-agentai-automationanthropicautonomous-agentawsbusiness-operationsclaudeclaude-codeclaude-code-plugindevopsecommerceinbox-zeroklaviyomarketingmcpmorning-briefingpr-automationshopifyterminal
Fix account-rotation lease, migration, timeout, and OAuth cleanup bugs
Cursor Agentdf1ef57f190b
diff --git a/claude-ops/scripts/account-rotation/bg-spawn.mjs b/claude-ops/scripts/account-rotation/bg-spawn.mjsindex 0ea47514..9f9a1630 100644--- a/claude-ops/scripts/account-rotation/bg-spawn.mjs+++ b/claude-ops/scripts/account-rotation/bg-spawn.mjs@@ -30,6 +30,7 @@ import { readFileSync, existsSync } from 'fs';import { join, dirname } from 'path';import { fileURLToPath } from 'url';import { spawnSync } from 'child_process';+import { applyAccountLeases } from './account-leases.mjs';const __dirname = dirname(fileURLToPath(import.meta.url));@@ -73,6 +74,8 @@ try {fallback();}+applyAccountLeases(config, { log });+// Import router dynamically (same dir as this shim in repo; ROTATION_DIR in production)let pickAccountForSession, recordSessionLease, releaseSessionLease;try {diff --git a/claude-ops/scripts/account-rotation/claude-settings-mode.mjs b/claude-ops/scripts/account-rotation/claude-settings-mode.mjsindex e8f3c39b..68bb77e9 100644--- a/claude-ops/scripts/account-rotation/claude-settings-mode.mjs+++ b/claude-ops/scripts/account-rotation/claude-settings-mode.mjs@@ -226,6 +226,7 @@ export function clearHardcodedModelsForOAuthClaudeSettings() {for (const k of ['CLAUDE_CODE_USE_BEDROCK','AWS_BEDROCK_REGION',+ 'AWS_REGION','ANTHROPIC_API_KEY','ANTHROPIC_AUTH_TOKEN','ANTHROPIC_BASE_URL',diff --git a/claude-ops/scripts/account-rotation/daemon.mjs b/claude-ops/scripts/account-rotation/daemon.mjsindex 2a5da563..f29c8eec 100644--- a/claude-ops/scripts/account-rotation/daemon.mjs+++ b/claude-ops/scripts/account-rotation/daemon.mjs@@ -132,6 +132,17 @@ function notify(title, msg) {} catch {}}+// Legacy account-key renames: old label → new canonical key.+// Applied once per readState() call to keep state.json consistent as labels evolve.+// Safe to run repeatedly (no-op when the old key doesn't exist).+const STATE_KEY_MIGRATIONS = {+ 'account-personal': 'account-main', // label changed: personal org is now just "account-main"+};++function migrateStateKey(key) {+ return key && STATE_KEY_MIGRATIONS[key] ? STATE_KEY_MIGRATIONS[key] : key;+}+// Cross-machine account leases (Sam 2026-06-06): NOT a static per-machine split.// Both machines may use ALL accounts; the only constraint is the same account is// never ACTIVE on both at once. readConfig() drops accounts a FOREIGN host holds@@ -143,7 +154,7 @@ function readConfig() {let keepKey = null;try {const st = JSON.parse(readFileSync(STATE_PATH, 'utf8'));- keepKey = st.activeAccount || null;+ keepKey = migrateStateKey(st.activeAccount || null);} catch {}return applyAccountLeases(config, {keepKey,@@ -154,12 +165,6 @@ function readConfig() {},});}-// Legacy account-key renames: old label → new canonical key.-// Applied once per readState() call to keep state.json consistent as labels evolve.-// Safe to run repeatedly (no-op when the old key doesn't exist).-const STATE_KEY_MIGRATIONS = {- 'account-personal': 'account-main', // label changed: personal org is now just "account-main"-};function readState() {let state;@@ -1120,6 +1125,7 @@ async function refreshSingleToken(account) {refresh_token: refreshToken,client_id: OAUTH_CLIENT_ID,}),+ signal: AbortSignal.timeout(5000),});const body = await res.json();if (!res.ok || !body.access_token) return false;