The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 22:00 UTC
fix(clients): show Waiting when a turn waits on another thread (#21500)
Julius Marminge committed
Oct 19, 2026 at 22:09 UTC
b0ed393c6c7c5a7b895ddae1a186e834e46664bb
6 files changed
+91
-11
apps/mobile/src/features/threads/threadListV2.test.ts
+27
@@ -1,5 +1,6 @@
1
import { presentThreadShell } from "@t3tools/client-runtime/state/models";
2
import * as DateTime from "effect/DateTime";
3
+import * as Schema from "effect/Schema";
4
import { planPinnedMove } from "@t3tools/client-runtime/state/thread-sort";
5
import {
6
createPendingThreadOrder,
@@ -17,6 +18,7 @@ import {
18
CommandId,
19
EnvironmentId,
20
MessageId,
21
+ OrchestrationV2ThreadShell,
22
ProjectId,
23
ProviderInstanceId,
24
RunId,
@@ -43,6 +45,7 @@ import {
45
} from "./threadListV2";
46
47
const environmentId = EnvironmentId.make("environment-1");
48
+const decodeThreadShell = Schema.decodeUnknownSync(OrchestrationV2ThreadShell);
49
50
function makeThread(
51
input: Partial<EnvironmentThreadShell> & Pick<EnvironmentThreadShell, "id" | "title">,
@@ -111,6 +114,30 @@ describe("resolveThreadListV2SnoozeMenuSelection", () => {
114
});
115
116
describe("resolveThreadListV2Status", () => {
117
+ it("presents decoded thread waits as Waiting while preserving requests and older servers", () => {
118
+ const raw = makeRawThreadShell({
119
+ status: "running",
120
+ activeRunId: RunId.make("run-wait"),
121
+ latestRunId: RunId.make("run-wait"),
122
+ });
123
+ const present = (shell: unknown) => presentThreadShell(environmentId, decodeThreadShell(shell));
124
+
125
+ expect(resolveThreadListV2Status(present(raw))).toBe("working");
126
+ const blocked = present({ ...raw, blockedOnThreadWait: true });
127
+ expect(
128
+ resolveThreadListV2Status({
129
+ ...blocked,
130
+ hasPendingApprovals: true,
131
+ hasPendingUserInput: true,
132
+ }),
133
+ ).toBe("approval");
134
+ expect(resolveThreadListV2Status({ ...blocked, hasPendingUserInput: true })).toBe("input");
135
+ expect(resolveThreadListV2Status(blocked)).toBe("waiting");
136
+ expect(resolveThreadListV2Status(present({ ...raw, blockedOnThreadWait: false }))).toBe(
137
+ "working",
138
+ );
139
+ });
140
+
141
it("distinguishes usage limits from ordinary failures and clears the label after recovery", () => {
142
const thread = makeThread({
143
id: ThreadId.make("limited"),
apps/mobile/src/features/threads/threadListV2.ts
+8
-1
@@ -154,7 +154,11 @@ export function threadHasUnseenCompletion(
154
export function resolveThreadListV2Status(
155
thread: Pick<
156
EnvironmentThreadShell,
157
- "hasPendingApprovals" | "hasPendingUserInput" | "pendingSubagentRequest" | "runtime"
157
+ | "hasPendingApprovals"
158
+ | "hasPendingUserInput"
159
+ | "pendingSubagentRequest"
160
+ | "runtime"
161
+ | "blockedOnThreadWait"
162
>,
163
): ThreadListV2Status {
164
if (thread.hasPendingApprovals || thread.pendingSubagentRequest === "approval") {
@@ -163,6 +167,9 @@ export function resolveThreadListV2Status(
167
if (thread.hasPendingUserInput || thread.pendingSubagentRequest === "user_input") {
168
return "input";
169
}
170
+ if (thread.runtime?.status === "running" && thread.blockedOnThreadWait === true) {
171
+ return "waiting";
172
+ }
173
if (
174
thread.runtime !== null &&
175
["preparing", "queued", "starting", "running", "waiting"].includes(thread.runtime.status)
apps/web/src/components/Sidebar.logic.test.ts
+36
-6
@@ -935,20 +935,31 @@ describe("resolveSidebarThreadStatus", () => {
935
const idle = { hasPendingApprovals: false, hasPendingUserInput: false, runtime: null };
936
937
it("prioritizes approval over a running runtime", () => {
938
- expect(resolveSidebarThreadStatus({ ...idle, hasPendingApprovals: true, runtime })).toBe(
939
- "approval",
940
- );
938
+ expect(
939
+ resolveSidebarThreadStatus({
940
+ ...idle,
941
+ hasPendingApprovals: true,
942
+ runtime,
943
+ blockedOnThreadWait: true,
944
+ }),
945
+ ).toBe("approval");
946
});
947
948
it("prioritizes awaiting input over a running runtime, below approval", () => {
944
- expect(resolveSidebarThreadStatus({ ...idle, hasPendingUserInput: true, runtime })).toBe(
945
- "input",
946
- );
949
+ expect(
950
+ resolveSidebarThreadStatus({
951
+ ...idle,
952
+ hasPendingUserInput: true,
953
+ runtime,
954
+ blockedOnThreadWait: true,
955
+ }),
956
+ ).toBe("input");
957
expect(
958
resolveSidebarThreadStatus({
959
...idle,
960
hasPendingApprovals: true,
961
hasPendingUserInput: true,
962
+ blockedOnThreadWait: true,
963
runtime,
964
}),
965
).toBe("approval");
@@ -960,6 +971,7 @@ describe("resolveSidebarThreadStatus", () => {
971
resolveSidebarThreadStatus({
972
...idle,
973
runtime: { ...runtime, status: "starting" as const },
974
+ blockedOnThreadWait: true,
975
}),
976
).toBe("working");
977
});
@@ -1283,6 +1295,7 @@ describe("resolveThreadStatusPill", () => {
1295
...baseThread,
1296
hasPendingApprovals: true,
1297
hasPendingUserInput: true,
1298
+ blockedOnThreadWait: true,
1299
},
1300
}),
1301
).toMatchObject({ label: "Pending Approval", pulse: false });
@@ -1294,6 +1307,7 @@ describe("resolveThreadStatusPill", () => {
1307
thread: {
1308
...baseThread,
1309
hasPendingUserInput: true,
1310
+ blockedOnThreadWait: true,
1311
},
1312
}),
1313
).toMatchObject({ label: "Awaiting Input", pulse: false });
@@ -1307,6 +1321,22 @@ describe("resolveThreadStatusPill", () => {
1321
).toMatchObject({ label: "Working", pulse: true });
1322
});
1323
1324
+ it("shows an active thread wait without a pulse and resumes Working when it ends", () => {
1325
+ const blocked = { ...baseThread, blockedOnThreadWait: true };
1326
+ expect(resolveSidebarThreadStatus(blocked)).toBe("waiting");
1327
+ expect(resolveThreadStatusPill({ thread: blocked })).toMatchObject({
1328
+ label: "Waiting",
1329
+ pulse: false,
1330
+ });
1331
+
1332
+ const resumed = { ...blocked, blockedOnThreadWait: false };
1333
+ expect(resolveSidebarThreadStatus(resumed)).toBe("working");
1334
+ expect(resolveThreadStatusPill({ thread: resumed })).toMatchObject({
1335
+ label: "Working",
1336
+ pulse: true,
1337
+ });
1338
+ });
1339
+
1340
it("shows waiting for an idle thread with pending background tasks", () => {
1341
expect(
1342
resolveThreadStatusPill({
apps/web/src/components/Sidebar.logic.ts
+17
-3
@@ -626,6 +626,7 @@ type ThreadStatusInput = Pick<
626
> & {
627
lastVisitedAt?: string | null | undefined;
628
pendingBackgroundTasks?: SidebarThreadSummary["pendingBackgroundTasks"] | undefined;
629
+ blockedOnThreadWait?: boolean | undefined;
630
};
631
632
export interface ThreadJumpHintVisibilityController {
@@ -902,7 +903,11 @@ export function shouldRecedeSidebarThread(input: {
903
904
type SidebarThreadStatusInput = Pick<
905
SidebarThreadSummary,
905
- "hasPendingApprovals" | "hasPendingUserInput" | "pendingSubagentRequest" | "runtime"
906
+ | "hasPendingApprovals"
907
+ | "hasPendingUserInput"
908
+ | "pendingSubagentRequest"
909
+ | "runtime"
910
+ | "blockedOnThreadWait"
911
>;
912
913
export function resolveSidebarThreadStatus(thread: SidebarThreadStatusInput): SidebarThreadStatus {
@@ -912,6 +917,9 @@ export function resolveSidebarThreadStatus(thread: SidebarThreadStatusInput): Si
917
if (thread.hasPendingUserInput || thread.pendingSubagentRequest === "user_input") {
918
return "input";
919
}
920
+ if (thread.runtime?.status === "running" && thread.blockedOnThreadWait === true) {
921
+ return "waiting";
922
+ }
923
if (
924
thread.runtime !== null &&
925
["preparing", "queued", "starting", "running", "waiting"].includes(thread.runtime.status)
@@ -1104,7 +1112,10 @@ export function resolveThreadStatusPill(input: {
1112
};
1113
}
1114
1107
- if (thread.runtime?.status === "running" || thread.runtime?.status === "waiting") {
1115
+ if (
1116
+ (thread.runtime?.status === "running" && thread.blockedOnThreadWait !== true) ||
1117
+ thread.runtime?.status === "waiting"
1118
+ ) {
1119
return {
1120
label: "Working",
1121
colorClass: "text-sky-600 dark:text-sky-300/80",
@@ -1126,7 +1137,10 @@ export function resolveThreadStatusPill(input: {
1137
};
1138
}
1139
1129
- if (backgroundWorkHoldsCompletion(thread.pendingBackgroundTasks ?? [])) {
1140
+ if (
1141
+ (thread.runtime?.status === "running" && thread.blockedOnThreadWait === true) ||
1142
+ backgroundWorkHoldsCompletion(thread.pendingBackgroundTasks ?? [])
1143
+ ) {
1144
return {
1145
label: "Waiting",
1146
colorClass: "text-sidebar-muted-foreground",
packages/client-runtime/src/state/models.ts
+2
@@ -103,6 +103,7 @@ export interface EnvironmentThreadShell {
103
readonly activeProviderThreadId: OrchestrationV2ThreadShell["activeProviderThreadId"];
104
readonly latestRun: ThreadRunSummary | null;
105
readonly runtime: ThreadRuntimeSummary | null;
106
+ readonly blockedOnThreadWait?: boolean;
107
readonly latestUserMessageAt: string | null;
108
readonly latestUserAuthoredMessageAt?: string | null;
109
readonly hasPendingApprovals: boolean;
@@ -248,6 +249,7 @@ export function presentThreadShell(
249
activeProviderThreadId: thread.activeProviderThreadId,
250
latestRun,
251
runtime,
252
+ blockedOnThreadWait: thread.blockedOnThreadWait ?? false,
253
latestUserMessageAt: nullableIso(thread.latestUserMessageAt),
254
...(thread.latestUserAuthoredMessageAt === undefined
255
? {}
packages/client-runtime/src/t3ToolSummary.ts
+1
-1
@@ -59,7 +59,7 @@ function readResult(value: unknown, depth = 0): ToolResult {
59
60
function readInput(value: unknown): Record<string, unknown> | undefined {
61
const input = readResult(value).data;
62
- // Cursor retains its MCP args envelope; other adapters retain the arguments directly.
62
+ // Historical Cursor items retain the MCP args envelope.
63
return input && typeof input.toolName === "string" ? asRecord(input.args) : input;
64
}
65