Skip to content

Commit 58e020a

Browse files
baileyclaude
authored andcommitted
feat(clients): mark threads with an open async question while they keep working
Since #15430 a thread whose run asks a non-blocking question stays Working until the run ends, but nothing in the thread list shows the question is waiting, and the default sidebar dims the row like any other running thread. The thread shell now carries hasPendingAsyncQuestion. The web sidebar row and the mobile thread list show the existing Input icon and label before the working spinner and timer, and keep the row from receding. The legacy sidebar shows the Awaiting Input pill beside Working. Status, ordering and blocking questions are unchanged. Reviewed-by: gpt-6.1-sol (Codex) Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 5b35402 commit 58e020a

8 files changed

Lines changed: 141 additions & 31 deletions

File tree

‎apps/mobile/src/features/threads/thread-list-v2-items.tsx‎

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,20 @@ interface StatusLabel {
7474
readonly className: string;
7575
readonly iconTintClassName: string;
7676
}
77+
const INPUT_STATUS_LABEL: StatusLabel = {
78+
label: "Input",
79+
icon: "questionmark.bubble",
80+
className: "text-adaptive-indigo-600-300",
81+
iconTintClassName: "accent-adaptive-indigo-600-300",
82+
};
7783
const STATUS_LABEL_BY_STATUS: Partial<Record<ThreadListV2Status, StatusLabel>> = {
7884
approval: {
7985
label: "Approval",
8086
icon: "exclamationmark.shield",
8187
className: "text-warning-foreground",
8288
iconTintClassName: "accent-warning-foreground",
8389
},
84-
input: {
85-
label: "Input",
86-
icon: "questionmark.bubble",
87-
className: "text-adaptive-indigo-600-300",
88-
iconTintClassName: "accent-adaptive-indigo-600-300",
89-
},
90+
input: INPUT_STATUS_LABEL,
9091
request: {
9192
label: "Request",
9293
icon: "person.crop.circle",
@@ -647,14 +648,15 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
647648
const rowAppearance = getThreadListV2RowAppearance(theme, sidebarPane, selected);
648649

649650
const status = resolveThreadListV2Status(thread);
651+
const hasAsyncQuestion = status === "working" && thread.hasPendingAsyncQuestion === true;
650652
const isUnread = status === "ready" && threadHasUnseenCompletion(thread);
651653
const workingLabel = STATUS_LABEL_BY_STATUS[status];
652654
const showsWoke = status === "ready" && props.wokeAt !== null;
653655
const statusLabel =
654656
(status === "working" && workingLabel !== undefined && thread.goal?.status === "active"
655657
? { ...workingLabel, label: "Goal" }
656658
: workingLabel) ?? (isUnread ? DONE_STATUS_LABEL : undefined);
657-
const recede = shouldRecedeThreadRow({ status, selected });
659+
const recede = !hasAsyncQuestion && shouldRecedeThreadRow({ status, selected });
658660
const timeLabel = props.timeLabel;
659661

660662
const visitThread = useAtomCommand(threadEnvironment.visit, { reportFailure: false });
@@ -1056,6 +1058,31 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
10561058
</Pressable>
10571059
) : statusLabel ? (
10581060
<View className="flex-row items-center gap-1">
1061+
{hasAsyncQuestion ? (
1062+
<>
1063+
<SymbolView
1064+
name={INPUT_STATUS_LABEL.icon}
1065+
size={13}
1066+
tintColorClassName={
1067+
selected
1068+
? selectedThreadRowColors.iconTintClassName
1069+
: INPUT_STATUS_LABEL.iconTintClassName
1070+
}
1071+
type="monochrome"
1072+
weight="semibold"
1073+
/>
1074+
<Text
1075+
className={cn(
1076+
"me-1.5 text-xs font-t3-bold",
1077+
selected
1078+
? selectedThreadRowColors.foregroundClassName
1079+
: INPUT_STATUS_LABEL.className,
1080+
)}
1081+
>
1082+
{INPUT_STATUS_LABEL.label}
1083+
</Text>
1084+
</>
1085+
) : null}
10591086
<SymbolView
10601087
name={statusLabel.icon}
10611088
size={13}
@@ -1072,7 +1099,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
10721099
selected ? selectedThreadRowColors.foregroundClassName : statusLabel.className,
10731100
)}
10741101
>
1075-
{statusLabel.label}
1102+
{hasAsyncQuestion ? null : statusLabel.label}
10761103
{status === "working" ? (
10771104
<ThreadListV2Duration startedAt={resolveThreadWorkingStartedAt(thread)} />
10781105
) : status === "waiting" ? (

‎apps/web/src/components/LegacySidebar.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ import {
194194
isTrailingDoubleClick,
195195
resolveProjectStatusIndicator,
196196
resolveThreadLastVisitedAt,
197+
resolveAsyncQuestionPill,
197198
resolveThreadStatusPill,
198199
orderItemsByPreferredIds,
199200
shouldClearThreadSelectionOnMouseDown,
@@ -454,6 +455,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
454455
lastVisitedAt,
455456
},
456457
});
458+
const asyncQuestionStatus = resolveAsyncQuestionPill(thread, threadStatus);
457459
const linkedPullRequestStatus = useLinkedThreadPullRequest(
458460
thread.environmentId,
459461
thread.linkedPullRequest,
@@ -730,6 +732,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
730732
<PullRequestGlyph.pullRequest className="size-3" />
731733
</a>
732734
) : null}
735+
{asyncQuestionStatus && <ThreadStatusLabel status={asyncQuestionStatus} />}
733736
{threadStatus && <ThreadStatusLabel status={threadStatus} />}
734737
{canOperateThread && renamingThreadKey === threadKey ? (
735738
<input

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
resolveSidebarSweepKeys,
1818
resolveSidebarThreadStatus,
1919
resolveSidebarV2TopStatus,
20+
resolveAsyncQuestionPill,
2021
resolveThreadStatusPill,
2122
resolveWorkingStartedAt,
2223
searchSidebarThreads,
@@ -454,6 +455,36 @@ describe("resolveThreadStatusPill", () => {
454455
});
455456
});
456457

458+
it("pairs Working with Awaiting Input while an async question waits", () => {
459+
const asking = { ...baseThread, hasPendingAsyncQuestion: true };
460+
const working = resolveThreadStatusPill({ thread: asking });
461+
expect(working).toMatchObject({ label: "Working" });
462+
expect(resolveAsyncQuestionPill(asking, working)).toMatchObject({ label: "Awaiting Input" });
463+
464+
const approval = resolveThreadStatusPill({
465+
thread: { ...asking, pendingSubagentRequest: "approval" },
466+
});
467+
expect(resolveAsyncQuestionPill(asking, approval)).toBeNull();
468+
469+
const connectingThread = {
470+
...asking,
471+
runtime: { ...baseThread.runtime, status: "starting" as const },
472+
};
473+
const connecting = resolveThreadStatusPill({ thread: connectingThread });
474+
expect(connecting).toMatchObject({ label: "Connecting" });
475+
expect(resolveAsyncQuestionPill(connectingThread, connecting)).toMatchObject({
476+
label: "Awaiting Input",
477+
});
478+
479+
const guest = resolveThreadStatusPill({ thread: { ...asking, pendingGuestMessageCount: 1 } });
480+
expect(guest).toMatchObject({ label: "Guest Request" });
481+
expect(resolveAsyncQuestionPill(asking, guest)).toBeNull();
482+
483+
const notAsking = { ...baseThread, hasPendingAsyncQuestion: false };
484+
expect(resolveAsyncQuestionPill(notAsking, working)).toBeNull();
485+
expect(resolveAsyncQuestionPill({}, working)).toBeNull();
486+
});
487+
457488
it("shows waiting for an idle thread with pending background tasks", () => {
458489
expect(
459490
resolveThreadStatusPill({

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

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,24 @@ export function resolveWorkingStartedAt(
10661066
return resolveThreadWorkingStartedAt(thread);
10671067
}
10681068

1069+
const AWAITING_INPUT_PILL: ThreadStatusPill = {
1070+
label: "Awaiting Input",
1071+
colorClass: "text-indigo-600 dark:text-indigo-300/90",
1072+
dotClass: "bg-indigo-500 dark:bg-indigo-300/90",
1073+
pulse: false,
1074+
};
1075+
1076+
/** Shown beside Working while an async question waits, which the status pill alone would hide. */
1077+
export function resolveAsyncQuestionPill(
1078+
thread: Pick<SidebarThreadSummary, "hasPendingAsyncQuestion">,
1079+
statusPill: ThreadStatusPill | null,
1080+
): ThreadStatusPill | null {
1081+
return thread.hasPendingAsyncQuestion === true &&
1082+
(statusPill?.label === "Working" || statusPill?.label === "Connecting")
1083+
? AWAITING_INPUT_PILL
1084+
: null;
1085+
}
1086+
10691087
export function resolveThreadStatusPill(input: {
10701088
thread: ThreadStatusInput;
10711089
}): ThreadStatusPill | null {
@@ -1081,12 +1099,7 @@ export function resolveThreadStatusPill(input: {
10811099
}
10821100

10831101
if (thread.hasPendingUserInput || thread.pendingSubagentRequest === "user_input") {
1084-
return {
1085-
label: "Awaiting Input",
1086-
colorClass: "text-indigo-600 dark:text-indigo-300/90",
1087-
dotClass: "bg-indigo-500 dark:bg-indigo-300/90",
1088-
pulse: false,
1089-
};
1102+
return AWAITING_INPUT_PILL;
10901103
}
10911104

10921105
if ((thread.pendingGuestMessageCount ?? 0) > 0) {

‎apps/web/src/components/ThreadStatusIndicators.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import { sourceControlClients } from "@t3tools/client-runtime/source-control-cli
4242
import {
4343
pullRequestMatchesSearchQuery,
4444
resolveThreadLastVisitedAt,
45+
resolveAsyncQuestionPill,
4546
resolveThreadStatusPill,
4647
type ThreadStatusPill,
4748
useRetainedValue,
@@ -916,6 +917,7 @@ export function ThreadRowLeadingStatus({
916917
lastVisitedAt,
917918
},
918919
});
920+
const asyncQuestionStatus = resolveAsyncQuestionPill(thread, threadStatus);
919921

920922
const supportsMultiplePullRequests = useSupportsMultiplePullRequests(thread.environmentId);
921923
const pendingLink =
@@ -953,6 +955,7 @@ export function ThreadRowLeadingStatus({
953955
aria-label={`${changeRequestTerminologyForUrl(pendingLink.url).shortLabel} #${pendingLink.number}, status pending`}
954956
/>
955957
) : null}
958+
{asyncQuestionStatus ? <ThreadStatusLabel status={asyncQuestionStatus} /> : null}
956959
{threadStatus ? <ThreadStatusLabel status={threadStatus} /> : null}
957960
</span>
958961
);

‎apps/web/src/components/sidebar/SidebarThreadRow.tsx‎

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,12 @@ function JumpHintBadge(props: { label: string }) {
157157
);
158158
}
159159

160+
const INPUT_STATUS = {
161+
label: "Input",
162+
icon: "input",
163+
className: "text-indigo-600 dark:text-indigo-300",
164+
} as const;
165+
160166
function WorkingDuration(props: { startedAt: string | null }) {
161167
const startedMs = props.startedAt !== null ? Date.parse(props.startedAt) : Number.NaN;
162168
if (Number.isNaN(startedMs)) return null;
@@ -636,19 +642,22 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
636642

637643
const isUnread = hasUnseenCompletion({ ...thread, lastVisitedAt });
638644
const status = resolveSidebarThreadStatus(thread);
645+
const hasAsyncQuestion = status === "working" && thread.hasPendingAsyncQuestion === true;
639646
const lastVisitedDate = lastVisitedAt === undefined ? null : parseTimestampDate(lastVisitedAt);
640647
const wokeAtDate = props.wokeAt === null ? null : parseTimestampDate(props.wokeAt);
641648
const isWoke =
642649
wokeAtDate !== null &&
643650
(lastVisitedDate === null || lastVisitedDate < wokeAtDate) &&
644651
thread.settledOverride !== "settled";
645-
const shouldRecede = shouldRecedeSidebarThread({
646-
status,
647-
isUnread,
648-
isWoke,
649-
isActive: props.isActive,
650-
isSelected,
651-
});
652+
const shouldRecede =
653+
!hasAsyncQuestion &&
654+
shouldRecedeSidebarThread({
655+
status,
656+
isUnread,
657+
isWoke,
658+
isActive: props.isActive,
659+
isSelected,
660+
});
652661
const topStatus =
653662
status === "working"
654663
? {
@@ -669,11 +678,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
669678
className: "text-warning-foreground",
670679
}
671680
: status === "input"
672-
? {
673-
label: "Input",
674-
icon: "input" as const,
675-
className: "text-indigo-600 dark:text-indigo-300",
676-
}
681+
? INPUT_STATUS
677682
: status === "request"
678683
? {
679684
label: "Request",
@@ -944,7 +949,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
944949

945950
const accessibility = resolveSidebarRowAccessibility({
946951
title: thread.title,
947-
statusLabel: topStatus?.label ?? null,
952+
statusLabel: hasAsyncQuestion ? "Input, still working" : (topStatus?.label ?? null),
948953
projectDisplayName: props.projectDisplayName,
949954
isActive: props.isActive,
950955
});
@@ -975,7 +980,11 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
975980
"truncate",
976981
shouldRecede
977982
? "text-secondary-label"
978-
: isUnread || isWoke || status === "input" || status === "request"
983+
: isUnread ||
984+
isWoke ||
985+
status === "input" ||
986+
status === "request" ||
987+
hasAsyncQuestion
979988
? "text-foreground"
980989
: status === "failed"
981990
? "text-foreground/95"
@@ -985,7 +994,11 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
985994
"truncate group-focus-within/sidebar-row:text-foreground group-hover/sidebar-row:text-foreground",
986995
shouldRecede
987996
? "text-secondary-label/70"
988-
: props.isActive || isWoke || status === "input" || status === "request"
997+
: props.isActive ||
998+
isWoke ||
999+
status === "input" ||
1000+
status === "request" ||
1001+
hasAsyncQuestion
9891002
? "text-foreground"
9901003
: isUnread
9911004
? "text-muted-foreground"
@@ -1336,6 +1349,17 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
13361349
topStatus.className,
13371350
)}
13381351
>
1352+
{hasAsyncQuestion ? (
1353+
<span
1354+
className={cn(
1355+
"me-1.5 inline-flex items-center gap-1",
1356+
INPUT_STATUS.className,
1357+
)}
1358+
>
1359+
<MessageCircleQuestionIcon aria-hidden className="size-4 shrink-0" />
1360+
{INPUT_STATUS.label}
1361+
</span>
1362+
) : null}
13391363
{topStatus.icon === "working" ? (
13401364
<CircleDashedIcon aria-hidden className="size-4 shrink-0" />
13411365
) : topStatus.icon === "waiting" ? (
@@ -1354,7 +1378,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
13541378
{/* Not a live region: a collapsed sidebar is inert, so
13551379
BackgroundThreadAnnouncer and the open thread's
13561380
timeline speak status changes instead. */}
1357-
{topStatus.label}
1381+
{hasAsyncQuestion ? null : topStatus.label}
13581382
{status === "working" ? (
13591383
<span aria-hidden>
13601384
<WorkingDuration startedAt={resolveWorkingStartedAt(thread)} />

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { canSnooze, effectiveSnoozed } from "./threadSettled.ts";
2222
const environmentId = EnvironmentId.make("environment-v2");
2323

2424
describe("V2 client presentation", () => {
25-
it("keeps async questions in Working until the run completes", () => {
25+
it("keeps async questions in Working, flagged as open, until the run completes", () => {
2626
const runId = RunId.make("run-async-question");
2727
const running = {
2828
...v2ThreadShell,
@@ -40,6 +40,7 @@ describe("V2 client presentation", () => {
4040
};
4141
const active = presentThreadShell(environmentId, running);
4242
expect(active.hasPendingUserInput).toBe(false);
43+
expect(active.hasPendingAsyncQuestion).toBe(true);
4344
expect(isThreadWorking(active)).toBe(true);
4445
expect(canSnooze(active, { now: "2026-06-20T00:05:00.000Z" })).toBe(false);
4546

@@ -49,6 +50,7 @@ describe("V2 client presentation", () => {
4950
status: "completed",
5051
});
5152
expect(completed.hasPendingUserInput).toBe(true);
53+
expect(completed.hasPendingAsyncQuestion).toBe(false);
5254
expect(isThreadWorking(completed)).toBe(false);
5355
expect(effectiveSnoozed(active, { now: "2026-06-20T00:05:00.000Z" })).toBe(false);
5456
});
@@ -68,6 +70,7 @@ describe("V2 client presentation", () => {
6870
},
6971
});
7072
expect(shell.hasPendingUserInput).toBe(true);
73+
expect(shell.hasPendingAsyncQuestion).toBe(false);
7174
expect(isThreadWorking(shell)).toBe(false);
7275
}
7376
});

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ export interface EnvironmentThreadShell {
155155
readonly latestUserAuthoredMessageAt?: string | null;
156156
readonly hasPendingApprovals: boolean;
157157
readonly hasPendingUserInput: boolean;
158+
/** An unanswered async question while the run keeps working; the thread still reads as Working. */
159+
readonly hasPendingAsyncQuestion?: boolean;
158160
readonly pendingSubagentRequest?: PendingSubagentRequest | null;
159161
/** Guest messages waiting for the owner to send or dismiss. */
160162
readonly pendingGuestMessageCount?: number;
@@ -313,6 +315,10 @@ export function presentThreadShell(
313315
hasPendingUserInput:
314316
thread.pendingRuntimeRequest?.kind === "user_input" &&
315317
(thread.pendingRuntimeRequest.blocking !== false || !runtimeIsWorking),
318+
hasPendingAsyncQuestion:
319+
thread.pendingRuntimeRequest?.kind === "user_input" &&
320+
thread.pendingRuntimeRequest.blocking === false &&
321+
runtimeIsWorking,
316322
pendingSubagentRequest,
317323
pendingGuestMessageCount: thread.pendingGuestMessageCount ?? 0,
318324
hasActionableProposedPlan: thread.hasActionableProposedPlan,

0 commit comments

Comments
 (0)