fix(mobile): show Working timer, Monitoring and Done in the thread list like desktop #13349
ClosedPESHian(GitHub profile, opens in a new tab)wants to merge 3 commits into
main fromrefs/pull/13349/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/mobile/src/features/threads/ThreadRouteScreen.tsx lines 350 to 356OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -336,3 +339,18 @@336339 } = useThreadSelection();337340 const selectedThreadDetailState = props.selectedThreadDetailState;338341 const selectedThreadDetail = Option.getOrNull(selectedThreadDetailState.data);342+ // Opening a thread stamps a visit so the list's Done label clears, and so a completion that343+ // lands after the reader leaves still signals. See resolveThreadVisitStamp for what is stamped.344+ const markThreadVisited = useMarkThreadVisited();345+ const visitedThreadKey =346+ selectedThread === null347+ ? null348+ : scopedThreadKey(selectedThread.environmentId, selectedThread.id);349+ const visitedCompletedAt = selectedThread?.latestTurn?.completedAt ?? null;350+ useEffect(() => {351+ if (visitedThreadKey === null) return;352+ markThreadVisited(353+ visitedThreadKey,354+ resolveThreadVisitStamp(visitedCompletedAt, new Date().toISOString()),355+ );356+ }, [markThreadVisited, visitedThreadKey, visitedCompletedAt]);apps/web/src/components/ChatView.tsx line 2115OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -2106,11 +2107,9 @@21062107 const activeRunningTurnId =21072108 (activeThread?.session?.status === "running" ? activeThread.session.activeTurnId : null) ??21082109 (activeLatestTurn?.state === "running" ? activeLatestTurn.turnId : null);2109- // Reading a finished thread clears the sidebar's Done badge. The visit is2110- // stamped at the turn's completion time — not now/updatedAt — so it clears2111- // exactly the completion the user is looking at: a wake or completion that2112- // lands later still gets its signal (markThreadVisited never moves the2113- // timestamp backwards).2110+ // Opening a thread stamps a visit so the sidebar's Done badge clears, and so2111+ // a completion that lands after the user leaves still signals. See2112+ // resolveThreadVisitStamp for what is stamped; markThreadVisited never moves2113+ // the timestamp backwards.21142114 useEffect(() => {2115- const completedAt = serverThread?.latestTurn?.completedAt;2116- if (!serverThread?.id || !completedAt) return;2115+ if (!serverThread?.id) return;
- packages/client-runtime/src/state/threadStatus.ts lines 69 to 73Resolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -0,0 +52,21 @@52+ const completedAt = Date.parse(thread.latestTurn.completedAt);53+ if (Number.isNaN(completedAt)) return false;54+ if (!lastVisitedAt) return false;55+56+ const lastVisitedAtMs = Date.parse(lastVisitedAt);57+ if (Number.isNaN(lastVisitedAtMs)) return true;58+ return completedAt > lastVisitedAtMs;59+}60+61+/**62+ * What a visit stamps: the latest completion when there is one, so the label clears exactly the63+ * completion the reader saw and a later completion still signals. With no completion yet (a64+ * fresh thread, or its first turn still running) the stamp is the visit time, so a thread the65+ * reader started and walked away from still lights up when its first turn finishes.66+ */67+export function resolveThreadVisitStamp(68+ latestTurnCompletedAt: string | null | undefined,69+ visitedAt: string,70+): string {71+ return latestTurnCompletedAt ?? visitedAt;72+}
juliusmarminge added labelsmacroscope-review
juliusmarminge closed this
Sign in to join this conversation.





macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed