@devries-cameron20 / t3code Mirror · read-only / commits / b859968cab
Fork 0

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 21, 22:15 UTC

fix(web): a pending approval is announced once, not once per queued message (#25866)

Julius Marminge committed Nov 11, 2026 at 15:20 UTC b859968cabd38023d30cd3a7b1a5b3603355b725
3 files changed +18 -7
apps/web/src/components/ThreadNotificationCoordinator.badge.browser.test.ts
+10 -3
@@ -243,12 +243,19 @@ it.each(["hasPendingApprovals", "hasPendingUserInput"] as const)(
243 );
244
245 it.each(["hasPendingApprovals", "hasPendingUserInput"] as const)(
246 - "notifies again when a new %s request replaces the pending one in the same run",
246 + "notifies once per %s request, not again as queued runs start behind it",
247 async (flag) => {
248 await using app = setup();
249 app.start();
250 - state.shells.set("one", shell({ [flag]: true, pendingRequestId: "request-1" }));
251 - state.shells.set("one", shell({ [flag]: true, pendingRequestId: "request-2" }));
250 + const waiting = (turnId: string, pendingRequestId: string) =>
251 + shell({
252 + [flag]: true,
253 + pendingRequestId,
254 + latestTurn: { turnId, state: "running", completedAt: null },
255 + });
256 + state.shells.set("one", waiting("turn-1", "request-1"));
257 + state.shells.set("one", waiting("turn-2", "request-1"));
258 + state.shells.set("one", waiting("turn-2", "request-2"));
259 const title = flag === "hasPendingApprovals" ? "Approval needed" : "Input needed";
260 expect(TestNotification.sent.map(({ title }) => title)).toEqual([title, title]);
261 },
apps/web/src/components/ThreadNotificationCoordinator.logic.ts
+1 -1
@@ -1,7 +1,7 @@
1 export type ThreadNotificationKind = "input" | "completion";
2
3 export interface ThreadNotificationObservation {
4 - /** Run, status and request key while the thread needs attention, otherwise null. */
4 + /** Status and request key, or status and run without a request, while the thread needs attention. */
5 readonly attention: string | null;
6 /** The pending request's id, when it has one; null whenever attention is. */
7 readonly requestId: string | null;
apps/web/src/components/ThreadNotificationCoordinator.tsx
+7 -3
@@ -261,9 +261,13 @@ export function startThreadNotifications(
261 status === "failed" ||
262 status === "limited";
263 const requestId = needsAttention ? resolveBackgroundThreadRequest(thread).requestId : null;
264 - const attention = needsAttention
265 - ? `${thread.latestRun?.runId ?? ""}:${status}:${requestId ?? ""}`
266 - : null;
264 + // Queued messages become the latest run while a request stays pending, so a request
265 + // with an id is keyed by that id alone and announces once.
266 + const attention = !needsAttention
267 + ? null
268 + : requestId !== null
269 + ? `${status}:${requestId}`
270 + : `${thread.latestRun?.runId ?? ""}:${status}`;
271 const completed = status === "ready" && thread.latestRun?.status === "completed";
272 const settled = completed && !monitorHoldsWakeCompletion(rawThread);
273 const parsedCompletedAt = Date.parse(thread.latestRun?.completedAt ?? "");