Skip to content

Commit 8fe03f0

Browse files
nullStack65claude
andcommitted
fix(server): a usage limit no longer snoozes the thread
A limit stop stays in the inbox so the limited state is visible and the model can be switched. The per-thread "Snooze until reset" button still hides one thread until its allowance returns, and auto-resume is unchanged. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
1 parent 3ad1bfd commit 8fe03f0

12 files changed

Lines changed: 40 additions & 57 deletions

File tree

‎apps/mobile/src/features/settings/SettingsServerControlsRouteScreen.tsx‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ const AUTO_SETTLE_SETTING_KEYS: ReadonlySet<string> = new Set([
138138
"sidebarAutoSettleOnMerge",
139139
"sidebarAutoSettleAfterDays",
140140
"autoResumeLimitedThreads",
141-
"snoozeLimitedThreads",
142141
]);
143142

144143
function planServerSettingsWrites(

‎apps/mobile/src/features/settings/ThreadSettingsSections.tsx‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ export function AutoSettleSettingsRows(props: {
107107
const writeToAll = (
108108
patch: Partial<AutoSettleSettings> & {
109109
autoResumeLimitedThreads?: boolean;
110-
snoozeLimitedThreads?: boolean;
111110
},
112111
) => props.write(patch);
113112

@@ -142,14 +141,6 @@ export function AutoSettleSettingsRows(props: {
142141
disabled={disabledFor("autoResumeLimitedThreads")}
143142
onValueChange={(value) => writeToAll({ autoResumeLimitedThreads: value })}
144143
/>
145-
<SettingsSwitchRow
146-
icon="clock"
147-
label="Snooze until limits reset"
148-
subtitle="Snooze threads until their usage limits reset. Enable auto-resume to continue the agent after the reset."
149-
value={uniformMobileSetting(displayTargets, "snoozeLimitedThreads")}
150-
disabled={disabledFor("snoozeLimitedThreads")}
151-
onValueChange={(value) => writeToAll({ snoozeLimitedThreads: value })}
152-
/>
153144
</SettingsSection>
154145
) : null}
155146
<SettingsSection title="Auto-settle">

‎apps/mobile/src/features/settings/settings-scoped-server.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const firstProject = "first-project" as ProjectId;
2121
const secondProject = "second-project" as ProjectId;
2222

2323
describe("mobile usage-limit settings across environments", () => {
24-
it.each(["autoResumeLimitedThreads", "snoozeLimitedThreads"] as const)(
24+
it.each(["autoResumeLimitedThreads"] as const)(
2525
"shows %s as mixed and can enable it everywhere without changing other settings",
2626
(key) => {
2727
const targets = resolveMobileSettingsTargets(

‎apps/server/src/orchestration-v2/UsageLimitRecoveryWorker.test.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,18 @@ const failedThread = (failedAgoMs: number, resetAgoMs: number) => {
9393
};
9494

9595
describe("limitRecoveryCommand arming", () => {
96+
it("does not snooze a thread when a usage limit stops it", () => {
97+
const thread = failedThread(-HOUR_MS, -2 * HOUR_MS);
98+
const asked = limitRecoveryCommand(thread, false, nowMs, true);
99+
assert.isNull(asked);
100+
const armed = limitRecoveryCommand(thread, true, nowMs, true);
101+
assert.equal(armed?.type, "thread.metadata.update");
102+
if (armed?.type === "thread.metadata.update") {
103+
assert.equal(armed.limitRecovery?.snooze, false);
104+
assert.equal(armed.limitRecovery?.autoResume, true);
105+
}
106+
});
107+
96108
it("does not freshly arm a failure whose reset passed days ago", () => {
97109
const thread = failedThread(5 * 24 * HOUR_MS, 4 * 24 * HOUR_MS);
98110
assert.isNull(limitRecoveryCommand(thread, true, nowMs));

‎apps/server/src/orchestration-v2/UsageLimitRecoveryWorker.ts‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ export function limitRecoveryCommand(
1818
thread: ProjectionStore.ProjectionLimitRecoveryCandidate,
1919
autoResume: boolean,
2020
nowMs: number,
21-
snooze = false,
21+
// A usage limit no longer snoozes a thread by itself. The flag stays so an older caller
22+
// still compiles; the per-thread "Snooze until reset" button is the only way to hide one.
23+
_snooze = false,
2224
): OrchestrationV2Command | null {
2325
if (
2426
thread.status !== "failed" ||
@@ -41,7 +43,7 @@ export function limitRecoveryCommand(
4143
const recovery = thread.limitRecovery;
4244
if (recovery?.runId !== thread.latestRunId || recovery.resetAt !== thread.usageLimitResetAt) {
4345
if (nowMs - resetMs > MAX_OVERDUE_ARM_MS) return null;
44-
if (!autoResume && (!snooze || resetMs <= nowMs)) return null;
46+
if (!autoResume) return null;
4547
return {
4648
type: "thread.metadata.update",
4749
commandId: CommandId.make(`limit-arm:${identity}`),
@@ -50,7 +52,7 @@ export function limitRecoveryCommand(
5052
runId: thread.latestRunId,
5153
resetAt: thread.usageLimitResetAt,
5254
autoResume,
53-
snooze: snooze && resetMs > nowMs,
55+
snooze: false,
5456
},
5557
};
5658
}
@@ -108,16 +110,12 @@ const makeSweep = Effect.gen(function* () {
108110
const candidates = yield* projections.getLimitRecoveryCandidates({
109111
now,
110112
autoResume: preferences.autoResumeLimitedThreads,
111-
snooze: preferences.snoozeLimitedThreads,
113+
// Saved settings may still say to snooze. A usage limit leaves the thread in the inbox.
114+
snooze: false,
112115
});
113116
let acted = false;
114117
for (const thread of candidates) {
115-
const command = limitRecoveryCommand(
116-
thread,
117-
preferences.autoResumeLimitedThreads,
118-
nowMs,
119-
preferences.snoozeLimitedThreads,
120-
);
118+
const command = limitRecoveryCommand(thread, preferences.autoResumeLimitedThreads, nowMs);
121119
if (command === null) continue;
122120
acted = true;
123121
yield* Effect.gen(function* () {

‎apps/server/src/storageCleanup.test.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,12 @@ describe("V2 storage cleanup eligibility", () => {
205205
resetIn: -1_000,
206206
idle: true,
207207
},
208-
{ name: "not yet armed by the recovery worker", armed: false, resetIn: DAY_MS, idle: false },
208+
{
209+
name: "not yet armed, and the snooze setting no longer holds it",
210+
armed: false,
211+
resetIn: DAY_MS,
212+
idle: true,
213+
},
209214
{
210215
name: "not yet armed, auto-resume after reset",
211216
armed: false,
@@ -3684,7 +3689,7 @@ describe("storage cleanup reports and local file policies", () => {
36843689
});
36853690

36863691
describe("settled worktree rechecks", () => {
3687-
it.effect.each(["autoResumeLimitedThreads", "snoozeLimitedThreads"] as const)(
3692+
it.effect.each(["autoResumeLimitedThreads"] as const)(
36883693
"keeps a usage-limited checkout when %s is enabled during measurement",
36893694
(preference) =>
36903695
runCleanupTest(

‎apps/server/src/storageCleanup.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ function heldForLimitRecovery(
209209
now - resetMs > MAX_OVERDUE_ARM_MS
210210
)
211211
return false;
212-
return settings.autoResumeLimitedThreads || (settings.snoozeLimitedThreads && resetMs > now);
212+
// A usage limit no longer snoozes the thread, so that setting does not hold the checkout.
213+
return settings.autoResumeLimitedThreads;
213214
}
214215

215216
/** PR metadata refreshes must not reset the inactivity clock. */

‎apps/web/src/components/settings/SettingsPanels.tsx‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -510,9 +510,6 @@ export function useSettingsRestore(onRestored?: () => void) {
510510
...(settings.autoResumeLimitedThreads !== DEFAULT_UNIFIED_SETTINGS.autoResumeLimitedThreads
511511
? ["Resume after usage limits"]
512512
: []),
513-
...(settings.snoozeLimitedThreads !== DEFAULT_UNIFIED_SETTINGS.snoozeLimitedThreads
514-
? ["Snooze until limits reset"]
515-
: []),
516513
...(!Equal.equals(settings.snoozePresets, DEFAULT_UNIFIED_SETTINGS.snoozePresets)
517514
? ["Snooze options"]
518515
: []),
@@ -682,7 +679,6 @@ export function useSettingsRestore(onRestored?: () => void) {
682679
sidebarAutoSettleKeepPullRequests: DEFAULT_UNIFIED_SETTINGS.sidebarAutoSettleKeepPullRequests,
683680
sidebarAutoSettleOnMerge: DEFAULT_UNIFIED_SETTINGS.sidebarAutoSettleOnMerge,
684681
autoResumeLimitedThreads: DEFAULT_UNIFIED_SETTINGS.autoResumeLimitedThreads,
685-
snoozeLimitedThreads: DEFAULT_UNIFIED_SETTINGS.snoozeLimitedThreads,
686682
snoozePresets: DEFAULT_UNIFIED_SETTINGS.snoozePresets,
687683
responseStreamingMode: DEFAULT_UNIFIED_SETTINGS.responseStreamingMode,
688684
enableProviderUpdateChecks: DEFAULT_UNIFIED_SETTINGS.enableProviderUpdateChecks,
@@ -1871,22 +1867,6 @@ export function ThreadsSettingsPanel() {
18711867
/>
18721868
}
18731869
/>
1874-
<SettingsRow
1875-
serverScoped
1876-
{...searchableSetting("snooze-limited-threads")}
1877-
description="Snooze threads until their usage limits reset. Enable auto-resume to continue the agent after the reset."
1878-
settingKeys={["snoozeLimitedThreads"]}
1879-
control={
1880-
<ScopedSwitch
1881-
settingKeys={["snoozeLimitedThreads"]}
1882-
checked={settings.snoozeLimitedThreads}
1883-
onCheckedChange={(checked) =>
1884-
updateSettings({ snoozeLimitedThreads: Boolean(checked) })
1885-
}
1886-
aria-label="Snooze until limits reset"
1887-
/>
1888-
}
1889-
/>
18901870
</SettingsSection>
18911871

18921872
{hasServerTargets ? (

‎apps/web/src/components/settings/settingsSearch.ts‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -447,12 +447,6 @@ export const SETTINGS_SEARCH_ITEMS = [
447447
environmentOnly: true,
448448
scope: "environment-defaults",
449449
},
450-
{
451-
id: "snooze-limited-threads",
452-
title: "Snooze until limits reset",
453-
to: "/settings/threads",
454-
searchTerms: ["usage quota rate limit reset wake recover continue"],
455-
},
456450
{
457451
id: "auto-resume-limited-threads",
458452
title: "Resume after usage limits",

‎docs/user/thread-sidebar.md‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,13 @@ The environment must be running when the reset arrives; it resumes overdue
272272
continuations after a restart. Stopping the thread, sending a new message,
273273
archiving, or settling it prevents a pending continuation from starting.
274274

275-
Choose **Snooze until reset** to hide the thread until its allowance returns.
276-
Snooze and auto-resume are independent: snooze alone wakes the thread without
277-
sending a message; enabling both wakes and continues it. **Wake now** cancels
278-
the snooze. Enable **Snooze until limits reset** in thread behavior settings to
279-
snooze limit stops by default. Providers without a reset time offer manual
280-
retry and the normal snooze choices.
275+
A usage limit leaves the thread in the inbox, marked limited, so it is clear
276+
that the model or provider needs changing. Choose **Snooze until reset** on
277+
that thread to hide it until its allowance returns. Snooze and auto-resume are
278+
independent: snooze alone wakes the thread without sending a message; enabling
279+
both wakes and continues it. **Wake now** cancels the snooze. Nothing snoozes
280+
a limited thread on its own. Providers without a reset time offer manual retry
281+
and the normal snooze choices.
281282

282283
On web and desktop, use **Agents** to follow work delegated to subagents.
283284
On mobile, open a subagent from its conversation card or **Agents**. On iOS

0 commit comments

Comments
 (0)