Skip to content

The open-source app everyone uses to manage agents at work

fix(ui): reveal task history while retries wait to start (#13597)

Devin Foley45586170e139
diff --git a/ui/src/components/TaskChatThread.test.tsx b/ui/src/components/TaskChatThread.test.tsx
index fea9dc6e99..887f7926f4 100644
--- a/ui/src/components/TaskChatThread.test.tsx
+++ b/ui/src/components/TaskChatThread.test.tsx
@@ -20,10 +20,12 @@ import type { HeartbeatRunEvent } from "@paperclipai/shared";
const transcriptState = vi.hoisted(() => ({
transcriptByRun: new Map(),
isInitialHydrating: false,
+ hydratedRunIds: undefined as Set<string> | undefined,
}));
const nativeTranscriptState = vi.hoisted(() => ({
transcriptByRun: new Map(),
errorsByRun: new Map(),
+ hydratedRunIds: undefined as Set<string> | undefined,
}));
const transcriptHookRuns = vi.hoisted(() => ({
legacy: [] as unknown[][],
@@ -47,6 +49,7 @@ vi.mock("@/components/transcript/useLiveRunTranscripts", () => ({
return {
transcriptByRun: new Map(transcriptState.transcriptByRun),
isInitialHydrating: transcriptState.isInitialHydrating,
+ hydratedRunIds: transcriptState.hydratedRunIds,
};
},
}));
@@ -56,6 +59,7 @@ vi.mock("@/components/transcript/useNativeRunTranscripts", () => ({
return {
transcriptByRun: new Map(nativeTranscriptState.transcriptByRun),
errorsByRun: new Map(nativeTranscriptState.errorsByRun),
+ hydratedRunIds: nativeTranscriptState.hydratedRunIds,
};
},
}));
@@ -106,8 +110,10 @@ beforeEach(() => {
localStorage.clear();
transcriptState.transcriptByRun.clear();
transcriptState.isInitialHydrating = false;
+ transcriptState.hydratedRunIds = undefined;
nativeTranscriptState.transcriptByRun.clear();
nativeTranscriptState.errorsByRun.clear();
+ nativeTranscriptState.hydratedRunIds = undefined;
transcriptHookRuns.legacy.length = 0;
transcriptHookRuns.native.length = 0;
sidebarState.isMobile = false;
@@ -166,6 +172,80 @@ it("coordinates first reveal while keeping the composer and visible history moun
expect(container.querySelector('[data-testid="mock-editor"]')).toBe(composer);
});
+describe.each(["legacy", "native"] as const)("%s task history readiness", (runtimeMode) => {
+ const retryRun = {
+ runId: "scheduled-run",
+ runtimeMode,
+ status: "scheduled_retry",
+ agentId: "agent-1",
+ adapterType: runtimeMode === "native" ? "paperclip_runner" : "codex_local",
+ createdAt: "2026-08-25T18:00:00.000Z",
+ startedAt: null,
+ };
+
+ beforeEach(() => {
+ transcriptState.hydratedRunIds = new Set();
+ nativeTranscriptState.hydratedRunIds = new Set();
+ });
+
+ it("reveals comments while a scheduled retry has no transcript to hydrate", () => {
+ render(
+ <TaskChatThread
+ issueId="issue-1"
+ comments={createLongThreadComments()}
+ onAdd={async () => {}}
+ linkedRuns={[retryRun]}
+ />,
+ );
+
+ expect(container.querySelector('[aria-busy="false"]')).not.toBeNull();
+ expect(
+ container.querySelector('[data-testid="task-chat-history-loading"]'),
+ ).toBeNull();
+ expect(
+ container.querySelector('[data-thread-anchor="comment-1"]')?.closest("[inert]"),
+ ).toBeNull();
+ expect(container.textContent).toContain("Thread message 1");
+ });
+
+ it.each(["running", "succeeded"])(
+ "waits for a %s run to hydrate even when a scheduled retry is present",
+ async (status) => {
+ const props = {
+ issueId: "issue-1",
+ comments: createLongThreadComments(),
+ onAdd: async () => {},
+ linkedRuns: [
+ retryRun,
+ {
+ ...retryRun,
+ runId: "started-run",
+ status,
+ startedAt: "2026-08-25T18:00:00.000Z",
+ },
+ ],
+ };
+ render(<TaskChatThread {...props} />);
+ expect(container.querySelector('[aria-busy="true"]')).not.toBeNull();
+ expect(
+ container.querySelector('[data-testid="task-chat-history-loading"]'),
+ ).not.toBeNull();
+
+ transcriptState.hydratedRunIds = new Set(["started-run"]);
+ nativeTranscriptState.hydratedRunIds = new Set(["started-run"]);
+ render(<TaskChatThread {...props} />);
+ await act(async () => {
+ await new Promise((resolve) => requestAnimationFrame(resolve));
+ });
+
+ expect(container.querySelector('[aria-busy="false"]')).not.toBeNull();
+ expect(
+ container.querySelector('[data-testid="task-chat-history-loading"]'),
+ ).toBeNull();
+ },
+ );
+});
+
it("keeps an acknowledged optimistic bubble mounted with its canonical comment target", () => {
const comment = {
companyId: "company",
diff --git a/ui/src/components/TaskChatThread.tsx b/ui/src/components/TaskChatThread.tsx
index e87e7b87d4..2687e3638d 100644
--- a/ui/src/components/TaskChatThread.tsx
+++ b/ui/src/components/TaskChatThread.tsx
@@ -2684,6 +2684,8 @@ export function TaskChatThread(props: TaskChatThreadProps) {
initialHistoryPending ||
planLoading ||
initialRuns.some((run) => {
+ // A scheduled retry has not started and has no log to hydrate yet.
+ if (run.status === "scheduled_retry") return false;
if (
run.runtimeMode === "native" &&
(hydratedNativeRunIds