@devries-cameron20 / t3code-1 / commits / b2259d3c6c
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): show working state while provider sessions start (#23590)

Co-authored-by: maria-rcks <maria@kuuro.net> Co-authored-by: Julius Marminge <julius0216@outlook.com>

Victor committed Nov 14, 2026 at 02:24 UTC b2259d3c6ca71e59cea0c9cc0b9e8d8a90a027f9
3 files changed +47 -2
apps/web/src/components/ChatView.logic.test.ts
+24
@@ -4,6 +4,7 @@ import {
4 buildExpiredTerminalContextToastCopy,
5 mergeDirectPreviewAnnotation,
6 planComposerTurn,
7 + deriveTimelineWorking,
8 snapshotComposerSend,
9 withMessageContext,
10 deriveAvailableRevertTurnCounts,
@@ -45,6 +46,7 @@ import { appAtomRegistry } from "../rpc/atomRegistry";
46 import { environmentThreadDetails } from "../state/threads";
47
48 import type { Thread } from "../types";
49 +import { derivePhase } from "../session-logic";
50 import { makeThreadFixture, makeThreadProjectionFixture } from "../test-fixtures";
51 import {
52 getAntigravitySendBlockReason,
@@ -1129,6 +1131,28 @@ describe("snapshotComposerSend", () => {
1131 });
1132 });
1133
1134 +describe("deriveTimelineWorking", () => {
1135 + it.each(["preparing", "starting", "queued"] as const)(
1136 + "restores activity from a persisted %s session without a local send",
1137 + (status) => {
1138 + const state = {
1139 + phase: derivePhase({ ...readySession, status }),
1140 + isSendBusy: false,
1141 + isCompacting: false,
1142 + runlessWorkStartedAt: null,
1143 + };
1144 + expect(deriveTimelineWorking(state)).toBe(true);
1145 + expect(deriveTimelineWorking({ ...state, phase: "ready" })).toBe(false);
1146 + expect(
1147 + deriveTimelineWorking({
1148 + ...state,
1149 + phase: derivePhase({ ...readySession, status: "failed" }),
1150 + }),
1151 + ).toBe(false);
1152 + },
1153 + );
1154 +});
1155 +
1156 describe("planComposerTurn", () => {
1157 const base = {
1158 messageText: "hello",
apps/web/src/components/ChatView.logic.ts
+16
@@ -1294,6 +1294,22 @@ export function snapshotComposerSend(contents: ComposerSendContents) {
1294
1295 export type ComposerSendSnapshot = ReturnType<typeof snapshotComposerSend>;
1296
1297 +/** Derived from the persisted run phase, so a starting run still reads as work after a reload. */
1298 +export function deriveTimelineWorking(input: {
1299 + readonly phase: SessionPhase;
1300 + readonly isSendBusy: boolean;
1301 + readonly isCompacting: boolean;
1302 + readonly runlessWorkStartedAt: string | null;
1303 +}): boolean {
1304 + return (
1305 + input.phase === "connecting" ||
1306 + input.phase === "running" ||
1307 + input.isSendBusy ||
1308 + input.isCompacting ||
1309 + input.runlessWorkStartedAt !== null
1310 + );
1311 +}
1312 +
1313 /** How a composer send dispatches: where it runs and whether it waits behind other work. */
1314 export function planComposerTurn(input: {
1315 readonly messageText: string;
apps/web/src/components/ChatView.tsx
+7 -2
@@ -350,6 +350,7 @@ import {
350 import {
351 buildLocalDraftThread,
352 deriveCommittedServerUserMessageIds,
353 + deriveTimelineWorking,
354 dismissBranchMismatchForSession,
355 shouldRenderPreviewMiniPlayer,
356 deriveLockedProvider,
@@ -1495,8 +1496,12 @@ export default function ChatView(props: ChatViewProps) {
1496 run: serverProjection?.runs.find((run) => run.id === activeRuntime?.activeRunId),
1497 messages: serverProjection?.messages,
1498 });
1498 - const isWorking =
1499 - phase === "running" || isSendBusy || isCompacting || runlessWorkStartedAt !== null;
1499 + const isWorking = deriveTimelineWorking({
1500 + phase,
1501 + isSendBusy,
1502 + isCompacting,
1503 + runlessWorkStartedAt,
1504 + });
1505 const activeContextWindow = deriveLatestContextWindowSnapshot(
1506 serverVisibleTurnItems ?? [],
1507 activeThreadLiveTokenUsage,