diff --git a/ui/src/api/heartbeats.ts b/ui/src/api/heartbeats.ts index c5567489843..9153bc4503a 100644 --- a/ui/src/api/heartbeats.ts +++ b/ui/src/api/heartbeats.ts @@ -36,6 +36,8 @@ export interface ActiveRunForIssue { lastUsefulActionAt?: string | Date | null; nextAction?: string | null; outputSilence?: HeartbeatRun["outputSilence"]; + currentStatusMessage?: string | null; + currentStatusUpdatedAt?: string | Date | null; } export interface LiveRunForIssue { @@ -60,6 +62,8 @@ export interface LiveRunForIssue { lastUsefulActionAt?: string | null; nextAction?: string | null; outputSilence?: HeartbeatRun["outputSilence"]; + currentStatusMessage?: string | null; + currentStatusUpdatedAt?: string | null; } export interface WatchdogDecisionInput { diff --git a/ui/src/components/IssueChatThread.test.tsx b/ui/src/components/IssueChatThread.test.tsx index 914f45645f3..3c934ba264a 100644 --- a/ui/src/components/IssueChatThread.test.tsx +++ b/ui/src/components/IssueChatThread.test.tsx @@ -3318,6 +3318,48 @@ describe("IssueChatThread", () => { }); }); + it("renders ephemeral active-run status below the working indicator", () => { + const root = createRoot(container); + + act(() => { + root.render( + + {}} + enableLiveTranscriptPolling={false} + /> + , + ); + }); + + expect(container.textContent).toContain("Working..."); + expect(container.textContent).toContain("Syncing git worktree to sandbox"); + expect(container.querySelector('[title="Syncing git worktree to sandbox"]')).not.toBeNull(); + + act(() => { + root.unmount(); + }); + }); + it("folds chain-of-thought when the same message transitions from running to complete", () => { expect(resolveAssistantMessageFoldedState({ messageId: "message-1", diff --git a/ui/src/components/IssueChatThread.tsx b/ui/src/components/IssueChatThread.tsx index ccccf325a28..f4887e2ba07 100644 --- a/ui/src/components/IssueChatThread.tsx +++ b/ui/src/components/IssueChatThread.tsx @@ -874,6 +874,8 @@ function IssueChatChainOfThought({ const rawSegments = Array.isArray(custom.chainOfThoughtSegments) ? (custom.chainOfThoughtSegments as SegmentTiming[]) : []; + const currentStatusMessage = + typeof custom.currentStatusMessage === "string" ? custom.currentStatusMessage.trim() : ""; const segmentTiming = myIndex >= 0 ? rawSegments[myIndex] ?? null : null; const isActive = isCoTSegmentActive({ isMessageRunning, @@ -908,33 +910,45 @@ function IssueChatChainOfThought({
{expanded && hasContent ? ( @@ -1579,6 +1593,8 @@ function IssueChatAssistantMessage({ ? custom.notices.filter((notice): notice is string => typeof notice === "string" && notice.length > 0) : []; const waitingText = typeof custom.waitingText === "string" ? custom.waitingText : ""; + const currentStatusMessage = + typeof custom.currentStatusMessage === "string" ? custom.currentStatusMessage.trim() : ""; const isRunning = message.role === "assistant" && message.status?.type === "running"; const runHref = runId && runAgentId ? `/agents/${runAgentId}/runs/${runId}` : null; const canStopRun = Boolean(runId) && (isRunActive || runStatus === "queued" || runStatus === "running"); @@ -1855,15 +1871,25 @@ function IssueChatAssistantMessage({
{message.content.length === 0 && waitingText ? ( -
- - {agentIcon ? ( - - ) : ( - - )} - {waitingText} - +
+
+ + {agentIcon ? ( + + ) : ( + + )} + {waitingText} + +
+ {isRunning && currentStatusMessage ? ( +
+ {currentStatusMessage} +
+ ) : null}
) : null} {notices.length > 0 ? ( @@ -4178,6 +4204,8 @@ export function IssueChatThread({ adapterType: activeRun.adapterType, logBytes: activeRun.logBytes, lastOutputBytes: activeRun.lastOutputBytes, + currentStatusMessage: activeRun.currentStatusMessage ?? null, + currentStatusUpdatedAt: toIsoString(activeRun.currentStatusUpdatedAt), }); } return [...deduped.values()].sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime()); diff --git a/ui/src/lib/issue-chat-messages.test.ts b/ui/src/lib/issue-chat-messages.test.ts index 8d1147edacd..de7849a8253 100644 --- a/ui/src/lib/issue-chat-messages.test.ts +++ b/ui/src/lib/issue-chat-messages.test.ts @@ -13,7 +13,7 @@ import type { SuggestTasksInteraction, } from "./issue-thread-interactions"; import type { IssueTimelineEvent } from "./issue-timeline-events"; -import type { LiveRunForIssue } from "../api/heartbeats"; +import type { ActiveRunForIssue, LiveRunForIssue } from "../api/heartbeats"; function createAgent(id: string, name: string): Agent { return { @@ -640,6 +640,46 @@ describe("buildIssueChatMessages", () => { }); }); + it("preserves ephemeral active-run status metadata for rendering", () => { + const activeRun: ActiveRunForIssue = { + id: "run-active-1", + status: "running", + invocationSource: "manual", + triggerDetail: null, + startedAt: "2026-04-06T12:03:00.000Z", + finishedAt: null, + createdAt: "2026-04-06T12:03:00.000Z", + agentId: "agent-1", + agentName: "CodexCoder", + adapterType: "codex_local", + currentStatusMessage: "Syncing git worktree to sandbox", + currentStatusUpdatedAt: "2026-04-06T12:03:05.000Z", + }; + + const messages = buildIssueChatMessages({ + comments: [], + timelineEvents: [], + linkedRuns: [], + liveRuns: [], + activeRun, + currentUserId: "user-1", + }); + + expect(messages).toHaveLength(1); + expect(messages[0]).toMatchObject({ + role: "assistant", + status: { type: "running" }, + metadata: { + custom: { + kind: "live-run", + runId: "run-active-1", + currentStatusMessage: "Syncing git worktree to sandbox", + currentStatusUpdatedAt: "2026-04-06T12:03:05.000Z", + }, + }, + }); + }); + it("places request confirmations after later same-run handoff status and comment", () => { const messages = buildIssueChatMessages({ comments: [ diff --git a/ui/src/lib/issue-chat-messages.ts b/ui/src/lib/issue-chat-messages.ts index 4993cd709ed..3a3dcfe9e65 100644 --- a/ui/src/lib/issue-chat-messages.ts +++ b/ui/src/lib/issue-chat-messages.ts @@ -857,6 +857,10 @@ function normalizeLiveRuns( agentName: activeRun.agentName, adapterType: activeRun.adapterType, issueId, + currentStatusMessage: activeRun.currentStatusMessage ?? null, + currentStatusUpdatedAt: activeRun.currentStatusUpdatedAt + ? toDate(activeRun.currentStatusUpdatedAt).toISOString() + : null, }); } return [...deduped.values()].sort((a, b) => toTimestamp(a.createdAt) - toTimestamp(b.createdAt)); @@ -895,6 +899,8 @@ function createLiveRunMessage(args: { waitingText, chainOfThoughtLabel: runDurationLabel(run), chainOfThoughtSegments: segments, + currentStatusMessage: run.currentStatusMessage ?? null, + currentStatusUpdatedAt: run.currentStatusUpdatedAt ?? null, }), }; return message;