Skip to content

Commit a12cbfe

Browse files
t3dotggclaude
andcommitted
fix(web): todo updates show where the agent wrote them; the goal only moves
- An agent's todo list is no longer a line at the end of the timeline. Each update is a quiet row in the work log where it was written (Tasks 2/5 · current step), and opens to every step. The composer-era task plan selection is deleted. - The goal keeps main's text, usage and actions; this change only moves it to the end of the timeline, so the goal PRs own its content. - The timeline follows growth at its end (a new queued message, a new status line) when the reader was at the end, and an empty queue no longer hides the empty-thread placeholder. - Status lines share the Snoozed line's muted weight and fade in; a details button no longer makes its line taller; a subagent waiting on you gets the info color; Scroll to end says "Subagent waiting". Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent da4dbba commit a12cbfe

12 files changed

Lines changed: 121 additions & 618 deletions

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

Lines changed: 11 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,6 @@ import { useActiveThreadRef } from "../hooks/useActiveThreadRef";
128128
import { composerRequiresModifier } from "../composer-logic";
129129
import {
130130
derivePhase,
131-
deriveActivePlanState,
132-
selectComposerTasksPlan,
133131
deriveActiveWorkStartedAt,
134132
deriveCanInterruptRunningThread,
135133
findLatestProposedPlan,
@@ -993,30 +991,6 @@ export default function ChatView(props: ChatViewProps) {
993991
);
994992

995993
const latestRunSettled = isLatestRunSettled(activeLatestRun, activeRuntime);
996-
const activePlan = deriveActivePlanState(serverProjection, activeActivityRun?.runId);
997-
const activeActivityRunSettled = isLatestRunSettled(activeActivityRun, activeRuntime);
998-
const composerTasksPlan = selectComposerTasksPlan(
999-
serverProjection,
1000-
activePlan,
1001-
activeActivityRun?.runId ?? null,
1002-
activeActivityRunSettled,
1003-
);
1004-
const activeComposerTasksProgress = (() => {
1005-
if (!composerTasksPlan) return null;
1006-
const live = !activeActivityRunSettled && composerTasksPlan.runId === activeActivityRun?.runId;
1007-
const totalSteps = composerTasksPlan.steps.length;
1008-
if (totalSteps === 0) return null;
1009-
const completedSteps = composerTasksPlan.steps.filter(
1010-
(step) => step.status === "completed",
1011-
).length;
1012-
const step =
1013-
composerTasksPlan.steps.find((candidate) => candidate.status === "inProgress")?.step ??
1014-
composerTasksPlan.steps.find((candidate) => candidate.status === "pending")?.step ??
1015-
composerTasksPlan.steps.at(-1)!.step;
1016-
return { step, completedSteps, totalSteps, live };
1017-
})();
1018-
const activeComposerTaskSteps =
1019-
activeComposerTasksProgress && composerTasksPlan ? composerTasksPlan.steps : null;
1020994
const activeThreadEnvironmentId = activeThread?.environmentId;
1021995
const activeThreadProjectId = activeThread?.projectId;
1022996
const activeProjectRef =
@@ -2014,6 +1988,7 @@ export default function ChatView(props: ChatViewProps) {
20141988
onTimelineAnchorReadyStable,
20151989
onTimelineAnchorSizeChangedStable,
20161990
onToolOutputCollapsedAtEndStable,
1991+
onTimelineFooterGrowStable,
20171992
onIsAtEndChangeStable,
20181993
anchorNewTurn,
20191994
} = useTimelineFollow({
@@ -2967,22 +2942,22 @@ export default function ChatView(props: ChatViewProps) {
29672942
};
29682943
const onExpandTimelineImageStable = useStableCallback(onExpandTimelineImage);
29692944
const shownThreadSyncPhase = activeEnvironmentUnavailable ? null : delayedThreadSyncPhase;
2970-
const threadNowTasks =
2971-
activeComposerTasksProgress && activeComposerTaskSteps
2972-
? { progress: activeComposerTasksProgress, steps: activeComposerTaskSteps }
2973-
: null;
29742945
const hasThreadNow =
29752946
childInputNow !== null ||
29762947
backgroundWorkNow !== null ||
29772948
goalNow !== null ||
2978-
shownThreadSyncPhase !== null ||
2979-
threadNowTasks !== null;
2949+
shownThreadSyncPhase !== null;
29802950
const queuedRunCount = serverProjection
29812951
? deriveThreadQueueWorkflowState(serverProjection).queuedRuns.length
29822952
: 0;
2953+
// The queue control is mounted for every server thread; it only belongs in the footer, and keeps
2954+
// the empty-thread placeholder away, while something is queued.
2955+
const hasQueuedTurns =
2956+
queuedRunCount > 0 ||
2957+
optimisticUserMessages.some((message) => message.inputIntent === "queued_turn");
29832958
const scrollToEndSummary =
29842959
[
2985-
childInputNow === null ? null : "Needs input",
2960+
childInputNow === null ? null : "Subagent waiting",
29862961
queuedRunCount === 0 ? null : `${queuedRunCount} queued`,
29872962
]
29882963
.filter((part) => part !== null)
@@ -2994,7 +2969,7 @@ export default function ChatView(props: ChatViewProps) {
29942969
!hasThreadNow &&
29952970
threadStatusLine === null &&
29962971
pendingGuestMessageCount === 0 &&
2997-
queuedRunsControl === null ? null : (
2972+
!hasQueuedTurns ? null : (
29982973
<>
29992974
{pendingHandoff === null ? null : (
30002975
<div className="chat-content-lane">
@@ -3010,7 +2985,6 @@ export default function ChatView(props: ChatViewProps) {
30102985
key={routeThreadKey}
30112986
attention={childInputNow}
30122987
work={backgroundWorkNow}
3013-
tasks={threadNowTasks}
30142988
syncPhase={shownThreadSyncPhase}
30152989
goal={goalNow}
30162990
/>
@@ -3022,7 +2996,7 @@ export default function ChatView(props: ChatViewProps) {
30222996
onFileOpen={openFileAttachmentStable}
30232997
/>
30242998
) : null}
3025-
{queuedRunsControl}
2999+
{hasQueuedTurns ? queuedRunsControl : null}
30263000
</>
30273001
);
30283002

@@ -3386,6 +3360,7 @@ export default function ChatView(props: ChatViewProps) {
33863360
onIsAtEndChange={onIsAtEndChangeStable}
33873361
onContentOverflowChange={setTimelineOverflows}
33883362
onToolOutputCollapsedAtEnd={onToolOutputCollapsedAtEndStable}
3363+
onFooterGrow={onTimelineFooterGrowStable}
33893364
onManualNavigation={cancelTimelineLiveFollowForUserNavigationStable}
33903365
cancelPositionRestoreRef={cancelPositionRestoreRef}
33913366
hideEmptyPlaceholder={isDraftHeroState || threadDetailLoading}

‎apps/web/src/components/chat/MessagesTimeline.tsx‎

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,28 @@ const TIMELINE_LIST_FADE_HEADER = (
138138
);
139139
function TimelineListFooter({
140140
composerInset,
141+
onGrow,
141142
children,
142143
}: {
143144
readonly composerInset: number;
145+
readonly onGrow: (() => void) | undefined;
144146
readonly children?: ReactNode;
145147
}) {
148+
const contentRef = useRef<HTMLDivElement>(null);
149+
// oxlint-disable-next-line t3code/react-effect-budget -- reports growth of the footer's content, which the list does not follow
150+
useLayoutEffect(() => {
151+
const content = contentRef.current;
152+
if (!content || !onGrow) return;
153+
let height = content.offsetHeight;
154+
return observeResize(content, () => {
155+
const next = content.offsetHeight;
156+
if (next > height) onGrow();
157+
height = next;
158+
});
159+
}, [onGrow]);
146160
return (
147161
<div>
148-
{children}
162+
<div ref={contentRef}>{children}</div>
149163
<div aria-hidden style={{ height: composerInset }} />
150164
<div aria-hidden className="h-3 sm:h-4" />
151165
</div>
@@ -257,6 +271,8 @@ interface MessagesTimelineProps {
257271
liveFollowEnabled: boolean;
258272
onContentOverflowChange?: (overflows: boolean) => void;
259273
onToolOutputCollapsedAtEnd?: () => void;
274+
/** The footer's content grew, such as a new queued turn or an opened task list. */
275+
onFooterGrow?: () => void;
260276
onManualNavigation: () => void;
261277
findOpen?: boolean;
262278
cancelPositionRestoreRef?: React.RefObject<(() => void) | null> | undefined;
@@ -356,6 +372,7 @@ const ConversationTimeline = memo(function ConversationTimeline({
356372
onContentOverflowChange,
357373
liveFollowEnabled,
358374
onToolOutputCollapsedAtEnd,
375+
onFooterGrow,
359376
onManualNavigation,
360377
cancelPositionRestoreRef,
361378
hideEmptyPlaceholder = false,
@@ -723,7 +740,10 @@ const ConversationTimeline = memo(function ConversationTimeline({
723740
shouldRestorePosition: shouldRestoreVisibleContentPosition,
724741
};
725742
const timelineListFooter = (
726-
<TimelineListFooter composerInset={anchoredEndSpace ? 0 : contentInsetEndAdjustment}>
743+
<TimelineListFooter
744+
composerInset={anchoredEndSpace ? 0 : contentInsetEndAdjustment}
745+
onGrow={onFooterGrow}
746+
>
727747
{footer}
728748
</TimelineListFooter>
729749
);

‎apps/web/src/components/chat/ThreadActivityBanners.tsx‎

Lines changed: 30 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { GitBranchIcon, MessageCircleIcon, ShieldQuestionIcon, TargetIcon } from
1313
import { Fragment } from "react";
1414
import { cn } from "~/lib/utils";
1515
import { Button, InlineButton } from "../ui/button";
16-
import { Popover, PopoverPopup, PopoverTrigger } from "../ui/popover";
1716
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
1817
import type { ComposerBannerStackItem } from "./ComposerBannerStack";
1918
import type { ThreadNowItem } from "./ThreadNow";
@@ -29,7 +28,12 @@ export function childInputNowItem(input: {
2928
if (!first || input.parentAwaitingUser) return null;
3029
return {
3130
id: `child-input:${first.id}`,
32-
icon: first.hasPendingApprovals ? <ShieldQuestionIcon /> : <MessageCircleIcon />,
31+
// The only line at the end of the timeline that needs you gets the info color.
32+
icon: first.hasPendingApprovals ? (
33+
<ShieldQuestionIcon className="text-info-foreground" />
34+
) : (
35+
<MessageCircleIcon className="text-info-foreground" />
36+
),
3337
title: childThreadInputsTitle(childThreadInputs),
3438
description: childThreadInputs.map((child, index) => (
3539
<Fragment key={child.id}>
@@ -59,57 +63,34 @@ export function goalNowItem(input: {
5963
}): ThreadNowItem {
6064
const { isWorking, onSendCommand } = input;
6165
const presentation = presentProviderGoal(input.goal, isWorking);
62-
// The token count opens the full usage, unless the full usage is all there is.
63-
const usage =
64-
presentation.usage === null ? null : presentation.tokens === null ||
65-
presentation.tokens === presentation.usage ? (
66-
<span className="whitespace-nowrap tabular-nums">{presentation.usage}</span>
67-
) : (
68-
<Popover>
69-
<PopoverTrigger
70-
openOnHover
71-
render={<InlineButton tone="muted" />}
72-
aria-label={`Goal usage: ${presentation.usage}`}
73-
>
74-
<span className="font-normal tabular-nums">{presentation.tokens}</span>
75-
</PopoverTrigger>
76-
<PopoverPopup tooltipStyle side="top">
77-
{presentation.usage}
78-
</PopoverPopup>
79-
</Popover>
80-
);
8166
return {
8267
id: `goal:${input.threadId}`,
8368
icon: <TargetIcon />,
84-
title: presentation.title,
69+
title:
70+
presentation.usage === null
71+
? presentation.title
72+
: `${presentation.title} · ${presentation.usage}`,
8573
description: presentation.objective,
86-
actions:
87-
usage === null && isWorking ? undefined : (
88-
<>
89-
{usage}
90-
{isWorking ? null : (
91-
<>
92-
{usage === null ? null : <span aria-hidden>·</span>}
93-
{presentation.canResume ? (
94-
<>
95-
<InlineButton
96-
onClick={() => void onSendCommand("/goal resume", "Failed to resume goal.")}
97-
>
98-
Resume
99-
</InlineButton>
100-
<span aria-hidden>·</span>
101-
</>
102-
) : null}
103-
<InlineButton
104-
tone="muted"
105-
onClick={() => void onSendCommand("/goal clear", "Failed to clear goal.")}
106-
>
107-
Clear
108-
</InlineButton>
109-
</>
110-
)}
111-
</>
112-
),
74+
actions: isWorking ? undefined : (
75+
<>
76+
{presentation.canResume ? (
77+
<>
78+
<InlineButton
79+
onClick={() => void onSendCommand("/goal resume", "Failed to resume goal.")}
80+
>
81+
Resume
82+
</InlineButton>
83+
<span aria-hidden>·</span>
84+
</>
85+
) : null}
86+
<InlineButton
87+
tone="muted"
88+
onClick={() => void onSendCommand("/goal clear", "Failed to clear goal.")}
89+
>
90+
Clear
91+
</InlineButton>
92+
</>
93+
),
11394
};
11495
}
11596

0 commit comments

Comments
 (0)