Skip to content

Your team of AI agents, on your Mac, Windows or Linux. Agents that talk in channels, write code, review each other and use your tools, on the Claude Code, Codex, OpenCode or Pi you already have. Anything that touches the real world waits for your yes.

Fix the reserve model not taking over on Claude Code's 5-hour limit (#88)

Alan Jones Riose11edc16c3aa
diff --git a/src/core/engines/cli.ts b/src/core/engines/cli.ts
index 85a5d73..db92a31 100644
--- a/src/core/engines/cli.ts
+++ b/src/core/engines/cli.ts
@@ -76,7 +76,7 @@ export function parseJson(line: string): Record<string, unknown> | null {
// "You've hit your limit" and 5-hour or weekly limit, Codex's "usage limit", Gemini's quota
// (RESOURCE_EXHAUSTED), OpenCode's and the providers' 429s. Not Tucano's own monthly limit,
// which never reaches here as an engine error.
-const OUT_OF_QUOTA = /usage limit|hit your (usage )?limit|limit reached|limit_reached|quota|resource_exhausted|rate.?limit|too many requests|\b429\b|insufficient_quota|credit balance is too low|out of (extra )?usage/i
+const OUT_OF_QUOTA = /usage limit|hit your (?:[\w-]+ ){0,2}limit|limit reached|limit_reached|quota|resource_exhausted|rate.?limit|too many requests|\b429\b|insufficient_quota|credit balance is too low|out of (extra )?usage/i
export const outOfQuota = (message: string): boolean => OUT_OF_QUOTA.test(message)
export const num = (v: unknown): number => (typeof v === 'number' && Number.isFinite(v) ? v : 0)
diff --git a/test/reserve.test.ts b/test/reserve.test.ts
index 7a470c5..a109d4a 100644
--- a/test/reserve.test.ts
+++ b/test/reserve.test.ts
@@ -118,6 +118,9 @@ describe('out of quota', () => {
it('knows the CLIs’ words for a subscription that’s out', () => {
for (const m of [
"You've hit your limit · resets 5pm (America/Sao_Paulo)",
+ "You've hit your 5-hour limit · resets 5:30pm (Europe/Madrid)",
+ "You've hit your weekly limit · resets Nov 5, 11pm (Europe/Madrid)",
+ "You've hit your Opus weekly limit · resets Nov 5, 11pm (Europe/Madrid)",
'Claude AI usage limit reached|1792374000',
'5-hour limit reached ∙ resets 3pm',
"You've hit your usage limit. Upgrade to Pro (https://chatgpt.com/explore/pro) or try again at 3:21 PM.",