Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apps/web/src/components/ChatView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,11 @@ export default function ChatView(props: ChatViewProps) {
recovery: activeThreadShell?.limitRecovery,
snoozedUntil: activeThreadShell?.snoozedUntil,
});
// The run whose limit rows client-runtime hides (deriveUsageLimitNoticeRows).
const usageLimitRunId =
serverRuntime?.status === "failed" && serverRuntime.lastErrorClass === "usage_limit"
? (serverLatestRun?.runId ?? null)
: null;
const timelineThreadError =
limitRecoveryRun !== null && visibleThreadError === serverRuntime?.lastError
? null
Expand Down Expand Up @@ -3644,6 +3649,7 @@ export default function ChatView(props: ChatViewProps) {
listRef={legendListRef}
runs={serverProjection?.runs ?? []}
latestRun={activeActivityRun}
usageLimitRunId={usageLimitRunId}
announcedRun={announcedRun(activeActivityRun, serverProjection?.runs ?? [])}
detailBehindShell={isDetailBehindShell(
activeLatestRun,
Expand Down
24 changes: 23 additions & 1 deletion apps/web/src/components/chat/MessagesTimeline.logic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4744,7 +4744,29 @@ describe("failed turn transcript", () => {
);
expect(work.at(-1)?.detail).toBe("The provider stopped this turn.\nRetry later.");
expect(work.at(-1)?.createdAt).toBe("2026-09-20T12:00:00.000Z");
if (isLatest) return;
if (isLatest) {
// The recovery notice hides the failure row; the run's work stays grouped.
const noticeRows = deriveMessagesTimelineRows({
timelineEntries: deriveTimelineEntriesFromVisibleTurnItems({
visibleTurnItems: items.filter((row) => row.item.type !== "error"),
optimisticMessages: [],
}),
latestRun: {
runId,
status: "failed",
startedAt: DateTime.formatIso(at),
completedAt: DateTime.formatIso(at),
},
usageLimitRunId: runId,
isWorking: false,
turnDiffSummaries: [],
supportsConversationRollback: false,
});
expect(noticeRows.find((row) => row.kind === "work-toggle")).toEqual(
expect.objectContaining({ hiddenCount: 3, expanded: false }),
);
return;
}
const entriesWithoutTools = deriveTimelineEntriesFromVisibleTurnItems({
visibleTurnItems: items.filter((row) => row.item.type !== "command_execution"),
optimisticMessages: [],
Expand Down
11 changes: 9 additions & 2 deletions apps/web/src/components/chat/MessagesTimeline.logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1056,8 +1056,9 @@ function failedTimelineRunIds(
function itemizedFailedRunIds(
entries: ReadonlyArray<TimelineEntry>,
failedRunIds: ReadonlySet<RunId>,
usageLimitRunId: RunId | null,
) {
const usageLimited = new Set<RunId>();
const usageLimited = new Set<RunId>(usageLimitRunId ? [usageLimitRunId] : []);
const otherFailures = new Set<RunId>();
for (const entry of entries) {
const item = timelineEntryFailedItem(entry);
Expand Down Expand Up @@ -1612,6 +1613,8 @@ export function deriveMessagesTimelineRows(
timelineEntries: ReadonlyArray<TimelineEntry>;
pendingApprovalRequestIds?: ReadonlySet<RuntimeRequestId>;
latestRun?: TimelineLatestRun | null;
/** The usage-limited run whose failure row the recovery notice replaces. */
usageLimitRunId?: RunId | null;
runningRunId?: RunId | null;
expandedRunIds?: ReadonlySet<RunId>;
expandedAttemptIds?: ReadonlySet<RunAttemptId>;
Expand Down Expand Up @@ -1663,7 +1666,11 @@ export function deriveMessagesTimelineRows(
const nextRows: MessagesTimelineRow[] = [];
const terminalAssistantMessageIds = deriveTerminalAssistantMessageIds(timelineEntries);
const failedRunIds = failedTimelineRunIds(timelineEntries, input.latestRun ?? null);
const itemizedRunIds = itemizedFailedRunIds(timelineEntries, failedRunIds);
const itemizedRunIds = itemizedFailedRunIds(
timelineEntries,
failedRunIds,
input.usageLimitRunId ?? null,
);
const liveSubagentEntryIds = liveSubagentCardEntryIds(timelineEntries);
const retainedAssistantReplyIds = retainedAssistantReplyEntryIds(timelineEntries);
const supersededFoldsByAnchorEntryId = deriveSupersededAttemptFolds(
Expand Down
3 changes: 3 additions & 0 deletions apps/web/src/components/chat/MessagesTimeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ interface MessagesTimelineProps {
listRef: React.RefObject<LegendListRef | null>;
timelineEntries: ReadonlyArray<TimelineEntry>;
latestRun: TimelineLatestRun | null;
usageLimitRunId?: RunId | null;
/** The run the screen reader announcer follows; see announcedRun. */
announcedRun?: { readonly runId: RunId; readonly status: TimelineLatestRun["status"] } | null;
/** See isDetailBehindShell. */
Expand Down Expand Up @@ -381,6 +382,7 @@ const ConversationTimeline = memo(function ConversationTimeline({
activeFindMatch = null,
findNavigationId = 0,
latestRun,
usageLimitRunId = null,
announcedRun = null,
detailBehindShell = false,
runningRunId = null,
Expand Down Expand Up @@ -748,6 +750,7 @@ const ConversationTimeline = memo(function ConversationTimeline({
timelineEntries,
pendingApprovalRequestIds,
latestRun,
usageLimitRunId,
runningRunId,
expandedRunIds: visibleExpandedRunIds,
expandedAttemptIds: visibleExpandedAttemptIds,
Expand Down
Loading