Skip to content

Commit 51d362b

Browse files
committed
fix(threads): surface child requests on filed parents
1 parent de73435 commit 51d362b

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

‎apps/web/src/components/Sidebar.logic.test.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { presentThreadShell } from "@t3tools/client-runtime/state/models";
2+
import { isFiledAsSettled } from "@t3tools/client-runtime/state/thread-settled";
23
import { isThreadWorking as isSidebarThreadWorking } from "@t3tools/client-runtime/state/thread-inbox";
34
import * as DateTime from "effect/DateTime";
45
import { deriveActiveWorkStartedAt } from "../session-logic.ts";
@@ -76,6 +77,10 @@ it("dragging working threads to Settled files them, and dragging back cancels it
7677
};
7778
const filed = applySidebarThreadDrop(thread, "settled", now);
7879
expect(filed).toMatchObject({ settleWhenIdleAt: now, settledOverride: null, settledAt: null });
80+
expect(isFiledAsSettled(filed)).toBe(true);
81+
for (const pendingSubagentRequest of ["approval", "user_input"] as const) {
82+
expect(isFiledAsSettled({ ...filed, pendingSubagentRequest })).toBe(false);
83+
}
7984
expect(applySidebarThreadDrop(filed, "active", now)).toMatchObject({
8085
settleWhenIdleAt: null,
8186
settledOverride: "active",

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,18 @@ export function pickSnoozePreset(input: {
351351
/** Settled threads and threads filed to settle once their work ends share the settled shelf. */
352352
export function isFiledAsSettled(
353353
thread:
354-
| { readonly settledOverride?: string | null; readonly settleWhenIdleAt?: string | null }
354+
| {
355+
readonly settledOverride?: string | null;
356+
readonly settleWhenIdleAt?: string | null;
357+
readonly pendingSubagentRequest?: PendingSubagentRequest | null;
358+
}
355359
| null
356360
| undefined,
357361
): boolean {
358-
return thread?.settledOverride === "settled" || thread?.settleWhenIdleAt != null;
362+
return (
363+
thread?.pendingSubagentRequest == null &&
364+
(thread?.settledOverride === "settled" || thread?.settleWhenIdleAt != null)
365+
);
359366
}
360367

361368
export function snoozeWakeLabel(snoozedUntil: string, options: { readonly now: string }): string {

0 commit comments

Comments
 (0)