Skip to content

Commit 85dfbea

Browse files
fix(clients): wake snoozed threads for async questions
1 parent 879f6e2 commit 85dfbea

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

‎packages/client-runtime/src/state/entities.test.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { v2Projection, v2ThreadShell } from "./orchestrationV2TestFixtures.ts";
2828
import { deriveLatestThreadRun, deriveThreadRuntime } from "./threadExecution.ts";
2929
import { isThreadWorking } from "./threadInbox.ts";
3030
import { derivePendingThreadRequests } from "./threadRequests.ts";
31-
import { canSnooze } from "./threadSettled.ts";
31+
import { canSnooze, effectiveSnoozed } from "./threadSettled.ts";
3232

3333
const environmentId = EnvironmentId.make("environment-v2");
3434

@@ -117,6 +117,8 @@ describe("V2 client presentation", () => {
117117
const runId = RunId.make("run-async-question");
118118
const running = {
119119
...v2ThreadShell,
120+
snoozedAt: DateTime.makeUnsafe("2026-06-19T23:59:00.000Z"),
121+
snoozedUntil: DateTime.makeUnsafe("2026-06-20T01:00:00.000Z"),
120122
latestRunId: runId,
121123
activeRunId: runId,
122124
status: "running" as const,
@@ -139,6 +141,7 @@ describe("V2 client presentation", () => {
139141
});
140142
expect(completed.hasPendingUserInput).toBe(true);
141143
expect(isThreadWorking(completed)).toBe(false);
144+
expect(effectiveSnoozed(active, { now: "2026-06-20T00:05:00.000Z" })).toBe(false);
142145
});
143146

144147
it("keeps blocking and legacy questions out of Working", () => {

‎packages/client-runtime/src/state/threadSettled.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export interface ThreadSnoozeShell extends QueuedThreadShell {
8181

8282
export function threadRaisedHandWhileSnoozed(shell: ThreadSnoozeShell): boolean {
8383
if (shell.hasPendingApprovals || shell.hasPendingUserInput) return true;
84+
if (shell.source?.pendingRuntimeRequest != null) return true;
8485
if (shell.pendingSubagentRequest != null) return true;
8586
const runtime = shell.runtime ?? shell.session ?? null;
8687
const latestRun = shell.latestRun ?? shell.latestTurn ?? null;

0 commit comments

Comments
 (0)