From b6220327cfcb9b6671373503217d0ab301551969 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=81=D0=B5=D0=BB=D1=8C?= Date: Mon, 16 Nov 2026 15:01:59 +0500 Subject: [PATCH] =?UTF-8?q?PEP-166:=20the=20reset=20time=20is=20read=20fro?= =?UTF-8?q?m=20Claude=20Code's=20=C2=ABcontinuing=20automatically=20at=206?= =?UTF-8?q?pm=C2=BB=20banner?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- packages/runner/src/limits.ts | 5 +++-- packages/testkit/test/limits.test.ts | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/runner/src/limits.ts b/packages/runner/src/limits.ts index 0a49047b..703601f9 100644 --- a/packages/runner/src/limits.ts +++ b/packages/runner/src/limits.ts @@ -16,13 +16,14 @@ export const limitAutoResumeEnabled = () => process.env.PEPPA_LIMIT_AUTORESUME ! /** * Reset time from a limit message: "resets 5pm", "resets at 3:10 AM", "reset at 15:00", - * "try again at 5:00 PM", "resets in 2h 15m". A clock time without a date is the nearest + * "try again at 5:00 PM", "resets in 2h 15m", and Claude Code's newer banner + * "Usage limit reached · continuing automatically at 6pm" (PEP-166). A clock time without a date is the nearest * future one (local time of this machine). Null when there is no time in the text. */ export function parseResetTime(text: string, now: Date): Date | null { const rel = /reset[s]?\s+in\s+(?:(\d+)\s*h(?:ours?)?)?\s*(?:(\d+)\s*m(?:in(?:utes?)?)?)?/i.exec(text); if (rel && (rel[1] || rel[2])) return new Date(now.getTime() + (Number(rel[1] ?? 0) * 60 + Number(rel[2] ?? 0)) * 60_000); - const abs = /(?:reset[s]?|try again)(?:\s+at)?\s+(\d{1,2})(?::(\d{2}))?\s*(am|pm)?\b/i.exec(text); + const abs = /(?:reset[s]?|try again|continu(?:e|es|ing)(?:\s+automatically)?)(?:\s+at)?\s+(\d{1,2})(?::(\d{2}))?\s*(am|pm)?\b/i.exec(text); if (!abs) return null; let h = Number(abs[1]); const m = Number(abs[2] ?? 0); diff --git a/packages/testkit/test/limits.test.ts b/packages/testkit/test/limits.test.ts index 11ebd45c..f5e7b900 100644 --- a/packages/testkit/test/limits.test.ts +++ b/packages/testkit/test/limits.test.ts @@ -19,6 +19,11 @@ describe("Время сброса лимита", () => { ["resets at 3:10 AM", "2026-11-13T03:10:00"], ["resets in 2h 15m", "2026-11-13T00:55:00"], ["try again at 23:30", "2026-11-12T23:30:00"], + // PEP-166: Claude Code's newer banner — the time was not read, a 30-minute probe made the + // subscription look free again while it stayed limited until the evening. + ["⏺ Usage limit reached · continuing automatically at 6pm · esc to cancel", "2026-11-13T18:00:00"], + ["continuing automatically at 9:30 AM", "2026-11-13T09:30:00"], + ["continuing work on the task", null], ["limit reached", null], ] as const) { test(`Форматы времени сброса: «${text}»`, () => {