The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Swarm route: offer Codex when its account reports only a weekly window
bitcoinbuildera2fcc12ef2cf
diff --git a/cli/src/superTabs/capacity.spec.ts b/cli/src/superTabs/capacity.spec.tsindex c0e99f224..74a5ee881 100644--- a/cli/src/superTabs/capacity.spec.ts+++ b/cli/src/superTabs/capacity.spec.ts@@ -15,6 +15,18 @@ it('uses the destination filesystem and reports missing tools/devices without exexpect(await readCapabilities({ cwd: '/fixture', tools: ['git; whoami'] }, deps)).toMatchObject({ error: 'INVALID_REQUEST' })expect(deps.tool).toHaveBeenCalledTimes(1)})+it('names a Codex window by its length, so an account with only its weekly window reads as weekly', () => {+ const reading = (rate_limit: unknown) => ({ providers: [{ provider: 'codex', outcome: 'answered', httpStatus: 200, body: { rate_limit } }] })+ expect(quotaOf(reading({ primary_window: { used_percent: 19, reset_at: 9, limit_window_seconds: 604800 }, secondary_window: null }), 'codex', false).windows)+ .toEqual([{ usedPercent: 19, resetsAt: 9, name: 'weekly' }])+ expect(quotaOf(reading({ primary_window: { used_percent: 5, reset_at: 1, limit_window_seconds: 18000 }, secondary_window: { used_percent: 9, reset_at: 2, limit_window_seconds: 604800 } }), 'codex', false).windows)+ .toEqual([{ usedPercent: 5, resetsAt: 1, name: '5-hour' }, { usedPercent: 9, resetsAt: 2, name: 'weekly' }])+ // Two windows of one length keep the first; a length that is not a number falls back to the position.+ expect(quotaOf(reading({ primary_window: { used_percent: 5, limit_window_seconds: 604800 }, secondary_window: { used_percent: 9, limit_window_seconds: 604800 } }), 'codex', false).windows)+ .toEqual([{ usedPercent: 5, resetsAt: null, name: 'weekly' }])+ expect(quotaOf(reading({ primary_window: { used_percent: 5, limit_window_seconds: 'x' } }), 'codex', false).windows)+ .toEqual([{ usedPercent: 5, resetsAt: null, name: '5-hour' }])+})it('keeps unknown quota distinct from unused quota and honors all limiting windows', () => {const input = { providers: [{ provider: 'codex', account: 'opaque', email: '[email protected]', outcome: 'answered', httpStatus: 200,body: { rate_limit: { primary_window: { used_percent: 10, reset_at: 1000 }, secondary_window: { used_percent: 100, reset_at: 2000 } } } }] }diff --git a/cli/src/superTabs/capacity.ts b/cli/src/superTabs/capacity.tsindex ee3c97848..b77a03a58 100644--- a/cli/src/superTabs/capacity.ts+++ b/cli/src/superTabs/capacity.ts@@ -78,10 +78,14 @@ export function quotaOf(reply: Json, engine: string, customAccount: boolean) {const body = object(reading.body)const raw = engine === 'claude' ? [body.five_hour, body.seven_day]: engine === 'codex' ? [object(body.rate_limit).primary_window, object(body.rate_limit).secondary_window] : []- // Both engines report the short window first and the weekly one second; the name is by that position, kept even when one is missing.+ // Both engines report the short window first and the weekly one second, so the name is by that position, kept even+ // when one is missing — unless the window says how long it is, as Codex's do (`limit_window_seconds`, the length the+ // Desktop names them by). 2026-10-24: a Codex account reported only its weekly window, first; read as its 5-hour one,+ // the weekly read as missing, and the route never offered Codex while a Claude candidate fit.raw.forEach((value, index) => {- const w = object(value), used = w.utilization ?? w.used_percentage ?? w.used_percent- if (finite(used) && used >= 0 && used <= 100) windows.push({ usedPercent: used, resetsAt: w.resets_at ?? w.reset_at ?? null, name: index === 0 ? '5-hour' : 'weekly' })+ const w = object(value), used = w.utilization ?? w.used_percentage ?? w.used_percent, length = w.limit_window_seconds+ const name = finite(length) && length > 0 ? (length >= 86_400 ? 'weekly' : '5-hour') : index === 0 ? '5-hour' : 'weekly'+ if (finite(used) && used >= 0 && used <= 100 && !windows.some(x => x.name === name)) windows.push({ usedPercent: used, resetsAt: w.resets_at ?? w.reset_at ?? null, name })})}return { known: windows.length > 0, account: typeof reading?.account === 'string' ? reading.account : null, windows }diff --git a/cli/src/superTabs/route.spec.ts b/cli/src/superTabs/route.spec.tsindex bf4e4f630..6028b2adf 100644--- a/cli/src/superTabs/route.spec.ts+++ b/cli/src/superTabs/route.spec.ts@@ -185,6 +185,15 @@ describe('strength, fit and effective cost', () => {expect(spent.shown[0].fit).toMatchObject({ status: 'short', effectiveCost: 2 })expect(spent.short).toBe('No candidate is expected to cover this task; its weekly quota is expected to run out partway and resets in 7 days.')})+ it('a Codex account that has only a weekly window is read in full; a Claude one missing its 5-hour window is not', () => {+ const CODEX = { engine: 'codex', model: 'default', effort: 'default', quality: 2, cost: 2 } as const+ const weekly = quotaOf2({ known: true, windows: [{ usedPercent: 19, resetsAt: (NOW + 6 * D) / 1000, name: 'weekly' }] })+ const r = route([on(CODEX, 'codex', weekly), on(SONNET, 'claude', windows([90, 3 * H], [80, 5 * D]))], { difficulty: 'low' })+ expect(r.shown.map(s => [s.engine, s.fit.status])).toEqual([['claude', 'fits'], ['codex', 'fits']])+ expect(r.excluded).toEqual([])+ const half = route([on(SONNET, 'half', weekly), on(SONNET, 'claude', windows([90, 3 * H], [80, 5 * D]))], { difficulty: 'low' })+ expect(half.excluded.map(e => e.title)).toEqual(['New agent · Claude sonnet medium · half'])+ })it('an engine on an API key is metered: it fits with no window, beside a subscription machine and ranked after it', () => {const metered = quotaOf2({ known: true, windows: [] })expect(metered).toEqual({ known: true, leftPercent: null, resetsAt: null, metered: true })diff --git a/cli/src/superTabs/route.ts b/cli/src/superTabs/route.tsindex 387e4098c..6e4dc01b0 100644--- a/cli/src/superTabs/route.ts+++ b/cli/src/superTabs/route.ts@@ -275,7 +275,10 @@ function sizeUp(p: Probe, policy: Policy, a: Assessment, now: number, open: Commreturn [{ name, usable: w.leftPercent - policy.quotaReserve - committed(name), resetsIn,needed: resetsIn !== null && resetsIn < runMs ? spend[name] * resetsIn / runMs : spend[name] }]})- const status = windows.some(w => w.usable < w.needed) ? 'short' : windows.length === WINDOWS.length ? 'fits' : 'unknown'+ // Every account has a weekly window; a Codex account may have no 5-hour one at all, reporting its weekly alone (2026-10-24),+ // and that reading is complete.+ const complete = windows.length === WINDOWS.length || (p.engine === 'codex' && windows.length === 1 && windows[0]!.name === 'weekly')+ const status = windows.some(w => w.usable < w.needed) ? 'short' : complete ? 'fits' : 'unknown'const tight = windows.length ? windows.reduce((x, y) => y.usable / y.needed < x.usable / x.needed ? y : x) : nullconst five = windows.find(w => w.name === '5-hour'), week = windows.find(w => w.name === 'weekly')// A 5-hour window that resets before the task ends, or soon after, loses what is left of it: spending it costs nothing.