Skip to content

Commit bff275c

Browse files
chledowskiclaude
andcommitted
test(server): a pending request holds back a recovery that was reset early
Also say in the docs that a thread snoozed by hand starts its scheduled continuation on waking, since one without a schedule only wakes. Co-Authored-By: Claude Fable 5.2 <[email protected]>
1 parent dd2a9d8 commit bff275c

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6375,16 +6375,17 @@ it.layer(layerTest)("ProjectionStoreV2", (it) => {
63756375
yield* sql`UPDATE orchestration_v2_projection_threads
63766376
SET payload_json = json_set(payload_json, '$.limitRecovery.resetEarly', json('true'))
63776377
WHERE thread_id = ${threadId}`;
6378-
assert.isDefined(
6379-
(yield* store.getLimitRecoveryCandidates({ ...recoveryOptions, autoResume: true })).find(
6380-
(row) => row.id === threadId,
6381-
),
6382-
);
6383-
yield* sql`UPDATE orchestration_v2_projection_threads
6384-
SET payload_json = ${armedRow!.payload_json} WHERE thread_id = ${threadId}`;
6378+
const dueEarly = store
6379+
.getLimitRecoveryCandidates({ ...recoveryOptions, autoResume: true })
6380+
.pipe(Effect.map((rows) => rows.find((row) => row.id === threadId)));
6381+
assert.isDefined(yield* dueEarly);
63856382
yield* sql`INSERT INTO orchestration_v2_projection_runtime_requests
63866383
(runtime_request_id, thread_id, node_id, kind, status, created_at, payload_json)
63876384
VALUES ('limit-shell:pending-request', ${threadId}, ${original.rootNodeId}, 'approval', 'pending', ${DateTime.formatIso(now)}, '{}')`;
6385+
// A pending approval or question holds back a recovery that was reset early too.
6386+
assert.isUndefined(yield* dueEarly);
6387+
yield* sql`UPDATE orchestration_v2_projection_threads
6388+
SET payload_json = ${armedRow!.payload_json} WHERE thread_id = ${threadId}`;
63886389
assert.isUndefined(
63896390
(yield* store.getLimitRecoveryCandidates({ ...recoveryOptions, now: reset })).find(
63906391
(row) => row.id === threadId,

‎docs/user/thread-sidebar.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,9 @@ retry and the normal snooze choices.
271271
Using a banked reset from [**Usage → Limits**](./usage.md#track-subscription-limits)
272272
counts as the reset for threads that account stopped in the same environment:
273273
their snooze until reset ends and scheduled continuations start right away. A
274-
thread you snoozed yourself stays snoozed and continues when it wakes. Threads
275-
keep waiting for their reset time if, after the reset, the account still has a
276-
used-up limit that resets by then.
274+
thread you snoozed yourself stays snoozed, and its scheduled continuation starts
275+
when it wakes. Threads keep waiting for their reset time if, after the reset,
276+
the account still has a used-up limit that resets by then.
277277

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

0 commit comments

Comments
 (0)