From 800dab1c648231ede90641b76ed6b25a6e8c350f Mon Sep 17 00:00:00 2001 From: Devin Foley Date: Wed, 24 Jun 2026 23:17:55 -0700 Subject: [PATCH] Render sandbox runtime status in issue threads (#8594) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - The issue thread is where operators watch active agent work and decide whether a run is healthy. > - Backend runtime-progress plumbing can expose a concise current status, but users only benefit if the issue UI renders it in context. > - The UI should show that current status as part of the active run surface without turning it into durable transcript content. > - This pull request adds the issue-thread rendering and message formatting needed for sandbox runtime status. > - The benefit is that active sandbox setup phases are visible from the normal issue detail view. ## Linked Issues or Issue Description Refs #248 No exact public GitHub issue was found for this UI rendering work. The underlying problem is that active sandboxed runs can have backend progress state without any concise issue-thread display, leaving users to infer whether setup is still moving. This PR adds the UI layer on top of the runtime-status API branch. GitHub search performed for related or duplicate work: `sandbox runtime status`, `sandbox restore index`, and `runtime progress`. No direct duplicate PR was found. ## What Changed - Included current runtime status in the heartbeat API client shape. - Rendered active run status text in the issue chat thread when available. - Updated issue-chat message formatting helpers for runtime status display. - Added focused component and formatting tests for the new active-run status behavior. ## Verification - Local PII scan before push: high-confidence secret patterns, internal issue links, local user paths, and private URL patterns checked across all three split diffs; no real secrets or internal links found. - `git diff --check feat/sandbox-runtime-status..feat/sandbox-status-ui` - `pnpm exec vitest run ui/src/components/IssueChatThread.test.tsx ui/src/lib/issue-chat-messages.test.ts` — 2 files, 91 tests passed. - `pnpm run typecheck` passed on `feat/sandbox-status-ui`. - `pnpm run build` passed on `feat/sandbox-status-ui`; Vite reported existing CSS `::highlight` and chunk-size warnings. - Visual evidence (desktop + mobile) is attached to the tracking issue rather than committed to the repo. ## Risks - This PR is stacked on the runtime-status API branch and depends on that response/event shape. - The status line is intentionally concise; long or sensitive status content should continue to be bounded/redacted by the backend. - The visual change is limited to active issue-thread runs with current runtime status data. > For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and discuss it in `#dev` before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See `CONTRIBUTING.md`. ## Model Used OpenAI GPT-5 via Codex coding agent, with shell/tool execution in a local worktree. Exact context-window metadata is not exposed by the runtime. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip CTO Co-authored-by: Paperclip CTO --- ui/src/api/heartbeats.ts | 4 + ui/src/components/IssueChatThread.test.tsx | 42 ++++++++++ ui/src/components/IssueChatThread.tsx | 92 ++++++++++++++-------- ui/src/lib/issue-chat-messages.test.ts | 42 +++++++++- ui/src/lib/issue-chat-messages.ts | 6 ++ 5 files changed, 153 insertions(+), 33 deletions(-) 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;