Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(issues): jump from the header agent chip to the run's block (MUL-8180) (#9451)
Jiayuan Zhang8c3ceb361047
diff --git a/packages/views/issues/components/comment-card.tsx b/packages/views/issues/components/comment-card.tsxindex 0e00962746..1202d3280a 100644--- a/packages/views/issues/components/comment-card.tsx+++ b/packages/views/issues/components/comment-card.tsx@@ -952,13 +952,15 @@ function ReplyToQuote({ entry, onJump }: { entry: TimelineEntry; onJump?: (comme}/** A run without a persisted reply still belongs to the agent, never its trigger author. */-export function AgentRunComment({ run, standalone = false, commentProps, entering = false, replyTo }: {+export function AgentRunComment({ run, standalone = false, commentProps, entering = false, replyTo, highlightedId }: {run: CommentRun;standalone?: boolean;entering?: boolean;commentProps?: CommentCardProps;/** The input this run answers, shown when the thread no longer places the two together. */replyTo?: ReactNode;+ /** The flashed jump target: the slot's comment id, or the run's task id until it has one. */+ highlightedId?: string | null;}) {const viewState = useInlineCommentRunState();const replyEntry = commentProps?.entry;@@ -977,11 +979,13 @@ export function AgentRunComment({ run, standalone = false, commentProps, enterin// The notice keeps its deep-link target and highlight in the run's slot.const slotEntry = reply ?? notice;const motionRef = useRunCommentMotion(entering, reply?.id, run.task.status);+ const highlighted = (highlightedId ?? commentProps?.highlightedCommentId) === (slotEntry?.id ?? run.task.id);return (<div ref={motionRef} data-run-slot-id={run.task.id}data-run-comment-id={!reply ? run.task.id : undefined}id={!standalone && slotEntry ? `comment-${slotEntry.id}` : undefined}- className={cn(standalone ? !reply && "rounded-xl border bg-card" : "border-t border-border/50", !reply && "py-1.5", slotEntry && commentProps?.highlightedCommentId === slotEntry.id && highlightedCommentBackgroundClass)}>+ className={cn("transition-colors duration-700", standalone ? !reply && "rounded-xl border" : "border-t border-border/50", !reply && "py-1.5",+ highlighted ? highlightedCommentBackgroundClass : standalone && !reply && "bg-card")}>{commentProps && reply ? standalone ? (<CommentCard {...commentProps} runs={commentProps.runs ?? [run]} runViewState={viewState} />) : (@@ -1086,6 +1090,7 @@ function CommentCardImpl({// posts one.const renderThreadRow = (row: TimelineEntry | ThreadRunSlot) => "run" in row ? (<AgentRunComment key={row.run.task.id} run={row.run} entering={enteringRunIds?.has(row.run.task.id)}+ highlightedId={highlightedCommentId}replyTo={row.replyTo && <ReplyToQuote entry={row.replyTo} onJump={onJumpToComment} />}commentProps={row.reply ? {issueId, entry: row.reply, replies: [], currentUserId, canModerate, onReply, onEdit, onDelete,diff --git a/packages/views/issues/components/execution-log-section.test.tsx b/packages/views/issues/components/execution-log-section.test.tsxindex c6ee0299e3..d6acebc828 100644--- a/packages/views/issues/components/execution-log-section.test.tsx+++ b/packages/views/issues/components/execution-log-section.test.tsx@@ -92,6 +92,18 @@ describe("ActiveTaskRow", () => {expect(screen.getByText("View transcript")).toBeInTheDocument();expect(mockState.taskMessagesOptions).not.toHaveBeenCalled();});++ it("makes the trigger a jump button only when given a jump handler", () => {+ const onJump = vi.fn();+ const { rerender } = renderWithI18n(<ActiveTaskRow task={makeTask({})} issueId="issue-1" />);+ expect(screen.queryByRole("button", { name: /Go to run/ })).not.toBeInTheDocument();++ rerender(<ActiveTaskRow task={makeTask({})} issueId="issue-1" onJump={onJump} />);+ const jump = screen.getByRole("button", { name: /Go to run/ });+ expect(jump).toHaveTextContent("Started from comment");+ fireEvent.click(jump);+ expect(onJump).toHaveBeenCalledOnce();+ });});describe("TaskCommentCoverage", () => {diff --git a/packages/views/issues/components/execution-log-section.tsx b/packages/views/issues/components/execution-log-section.tsxindex b686c7b55a..be3626e630 100644--- a/packages/views/issues/components/execution-log-section.tsx+++ b/packages/views/issues/components/execution-log-section.tsx@@ -519,10 +519,13 @@ export function ActiveTaskRow({task,issueId,onTranscriptOpenChange,+ onJump,}: {task: AgentTask;issueId: string;onTranscriptOpenChange?: (open: boolean, fromKeyboard?: boolean) => void;+ /** Turns the trigger into a button that takes the reader to this run's block. */+ onJump?: () => void;}) {const { t } = useT("issues");const [cancelling, setCancelling] = useState(false);@@ -575,14 +578,29 @@ export function ActiveTaskRow({// anyway would only ever be exercised by hand-written fixtures, which is a// test that asserts a scenario production cannot produce. Restore it in the// same change that adds incremental reporting + cache invalidation.+ const triggerText = task.wakeup_id ? (+ <WakeupRunLabel task={task} fallback={trigger} render={(label) => <TriggerText text={label} />} />+ ) : (+ <TriggerText text={trigger} />+ );return (<RowShell task={task}>- {task.wakeup_id ? (- <WakeupRunLabel task={task} fallback={trigger} render={(label) => <TriggerText text={label} />} />+ {onJump ? (+ <button+ type="button"+ onClick={onJump}+ className="flex min-w-0 flex-1 cursor-pointer items-center gap-2 self-stretch rounded-xs text-left outline-none focus-visible:ring-2 focus-visible:ring-ring"+ >+ {triggerText}+ <TaskCommentCoverage task={task} />+ <span className="sr-only">{t(($) => $.execution_log.jump_to_run)}</span>+ </button>) : (- <TriggerText text={trigger} />+ <>+ {triggerText}+ <TaskCommentCoverage task={task} />+ </>)}- <TaskCommentCoverage task={task} /><RowStatus title={label}>{task.status === "running" ? (<>diff --git a/packages/views/issues/components/issue-agent-header-chip.test.tsx b/packages/views/issues/components/issue-agent-header-chip.test.tsxindex 2716d3d0bd..b85c18a79c 100644--- a/packages/views/issues/components/issue-agent-header-chip.test.tsx+++ b/packages/views/issues/components/issue-agent-header-chip.test.tsx@@ -79,13 +79,20 @@ vi.mock("./execution-log-section", () => ({ActiveTaskRow: ({task,onTranscriptOpenChange,+ onJump,}: {task: AgentTask;transcriptOpen?: boolean;onTranscriptOpenChange?: (open: boolean) => void;+ onJump?: () => void;}) => (<div data-testid="active-task-row"><span>{task.id}</span>+ {onJump && (+ <button type="button" aria-label={`jump to ${task.id}`} onClick={onJump}>+ Jump+ </button>+ )}<buttontype="button"aria-label={`open transcript ${task.id}`}@@ -245,6 +252,24 @@ describe("IssueAgentHeaderChip", () => {expect(mockState.taskMessagesOptions).not.toHaveBeenCalled();});+ it("hands the clicked row's task to the jump handler", () => {+ mockState.tasks = [makeTask({ id: "task-1" }), makeTask({ id: "task-2", status: "queued" })];+ const onJumpToRun = vi.fn();++ renderWithI18n(<IssueAgentHeaderChip issueId="issue-1" onJumpToRun={onJumpToRun} />);+ fireEvent.click(screen.getByRole("button", { name: "jump to task-2" }));++ expect(onJumpToRun).toHaveBeenCalledExactlyOnceWith("task-2");+ });++ it("leaves rows without a jump target when the host has no timeline", () => {+ mockState.tasks = [makeTask({ id: "task-1" })];++ renderWithI18n(<IssueAgentHeaderChip issueId="issue-1" />);++ expect(screen.queryByRole("button", { name: "jump to task-1" })).not.toBeInTheDocument();+ });+it("keeps the live transcript open after the clicked task row disappears from the active list", async () => {const qc = newClient();mockState.tasks = [makeTask({ id: LIVE_TASK_ID })];diff --git a/packages/views/issues/components/issue-agent-header-chip.tsx b/packages/views/issues/components/issue-agent-header-chip.tsxindex f2398238c2..d82e276cc7 100644--- a/packages/views/issues/components/issue-agent-header-chip.tsx+++ b/packages/views/issues/components/issue-agent-header-chip.tsx@@ -40,14 +40,17 @@ import { compareActiveIssueTasks } from "./active-task-order";// Hovering the chip opens a compact Popover card with the same active rows as// the right panel (click / keyboard still toggle it for touch and a11y). Those// rows show necessary status/time and task entry actions, but do not render-// event counts or prefetch task messages for a count.+// event counts or prefetch task messages for a count. Clicking a row's trigger+// closes the card and takes the reader to that run's block in the timeline.interface IssueAgentHeaderChipProps {issueId: string;+ onJumpToRun?: (taskId: string) => void;}export const IssueAgentHeaderChip = memo(function IssueAgentHeaderChip({issueId,+ onJumpToRun,}: IssueAgentHeaderChipProps) {const { t } = useT("issues");// Same query options as ExecutionLogSection so both observe one cache entry.@@ -99,6 +102,7 @@ export const IssueAgentHeaderChip = memo(function IssueAgentHeaderChip({issueId={issueId}running={running}queued={queued}+ onJumpToRun={onJumpToRun}onTranscriptOpenChange={(task, open, fromKeyboard) => {setOpenedTranscript(open ? { task, fromKeyboard } : null);}}@@ -126,6 +130,7 @@ interface ActiveChipProps {issueId: string;running: AgentTask[];queued: AgentTask[];+ onJumpToRun?: (taskId: string) => void;onTranscriptOpenChange: (task: AgentTask,open: boolean,@@ -137,10 +142,12 @@ function ActiveChip({issueId,running,queued,+ onJumpToRun,onTranscriptOpenChange,}: ActiveChipProps) {const { t } = useT("issues");const { getActorName } = useActorName();+ const [open, setOpen] = useState(false);const activeTasks = [...running, ...queued];const agentIds = [...new Set(activeTasks.map((task) => task.agent_id))];@@ -166,7 +173,7 @@ function ActiveChip({return (<div className="flex items-center gap-1">- <Popover>+ <Popover open={open} onOpenChange={setOpen}>{/* Hover opens the card so the live activity reads as a glanceablestatus surface, not a click target. In Base UI the hover configlives on the Trigger (a popover can have multiple triggers), not@@ -227,6 +234,14 @@ function ActiveChip({key={task.id}task={task}issueId={issueId}+ onJump={+ onJumpToRun+ ? () => {+ setOpen(false);+ onJumpToRun(task.id);+ }+ : undefined+ }onTranscriptOpenChange={(open, fromKeyboard) => {onTranscriptOpenChange(task, open, fromKeyboard === true);}}diff --git a/packages/views/issues/components/issue-detail.test.tsx b/packages/views/issues/components/issue-detail.test.tsxindex a7ab019460..14414e6393 100644--- a/packages/views/issues/components/issue-detail.test.tsx+++ b/packages/views/issues/components/issue-detail.test.tsx@@ -1676,6 +1676,28 @@ describe("IssueDetail (shared)", () => {expect(container.querySelectorAll(`[data-run-id="${task.id}"]`)).toHaveLength(1);});+ it("jumps from a header chip row to the run's block in its thread", async () => {+ const root = mockTimeline[0]!;+ const task: AgentTask = {+ id: "4a2e8d1c-7f9b-4e2a-9c1d-123456789abc", agent_id: "agent-1", runtime_id: "runtime-1", issue_id: "issue-1",+ status: "running", priority: 0, created_at: "2026-01-16T00:00:00Z",+ started_at: "2026-01-16T00:00:00Z", dispatched_at: null, completed_at: null, result: null, error: null,+ trigger_comment_id: root.id, delivered_comment_ids: [root.id],+ };+ mockApiObj.listTimeline.mockResolvedValue([root]);+ mockApiObj.listTasksByIssue.mockResolvedValue([task]);+ const { container } = renderIssueDetail();+ await waitFor(() => expect(container.querySelector(`[data-run-slot-id="${task.id}"]`)).not.toBeNull());+ const block = container.querySelector(`[data-run-slot-id="${task.id}"]`)!;+ expect(block.className).not.toContain(highlightedCommentBackgroundClass);++ fireEvent.click(screen.getByRole("button", { name: "Claude Agent is working" }));+ fireEvent.click(await screen.findByRole("button", { name: /Go to run/ }));++ expect(scrollToIndexSpy).toHaveBeenLastCalledWith({ index: expect.any(Number), align: "start", offset: -16 });+ await waitFor(() => expect(block.className).toContain(highlightedCommentBackgroundClass));+ });+describe("a run's failure notice (MUL-7692)", () => {const failedRun = (overrides: Partial<AgentTask> = {}): AgentTask => ({id: "4a2e8d1c-7f9b-4e2a-9c1d-123456789abc", agent_id: "agent-1", runtime_id: "runtime-1", issue_id: "issue-1",diff --git a/packages/views/issues/components/issue-detail.tsx b/packages/views/issues/components/issue-detail.tsxindex ba9fea2aa3..c0348f46ac 100644--- a/packages/views/issues/components/issue-detail.tsx+++ b/packages/views/issues/components/issue-detail.tsx@@ -2013,6 +2013,81 @@ export function IssueDetail({ issueId, onDelete, onDone, defaultSidebarOpen = trreplyToRoot.has(commentId) ? jumpToReply(commentId) : jumpToThread(commentId),[replyToRoot, jumpToReply, jumpToThread],);+ // Header chip jump to a run's block. A run is either its own top-level row+ // or a slot inside the thread it answers, so find that row, undo whatever+ // folds the thread, scroll the row into place, then let the effect below+ // align the block itself once it mounts.+ const [pendingRunJump, setPendingRunJump] = useState<{ taskId: string; rootId: string; flashId: string } | null>(null);+ const jumpToRun = useCallback(+ (taskId: string) => {+ let index = items.findIndex((it) => it.kind === "run" && it.run.task.id === taskId);+ let run = index >= 0 ? (items[index] as Extract<TimelineItem, { kind: "run" }>).run : undefined;+ if (!run) {+ for (const [rootId, runs] of commentRuns) {+ run = runs.find((candidate) => candidate.task.id === taskId);+ if (run) {+ index = items.findIndex((it) => it.id === rootId);+ break;+ }+ }+ }+ const rootItem = items[index];+ if (!run || !rootItem) return;+ const root = rootItem.kind !== "activity-group" ? rootItem.entry : undefined;+ const headsThread = run.hasReply && run.commentId === rootItem.id;+ if (root && !headsThread) {+ const collapse = useCommentCollapseStore.getState();+ if (collapse.isCollapsed(id, root.id)) collapse.toggle(id, root.id);+ }+ if (+ root && !expandedResolved.has(root.id) &&+ deriveThreadResolution(root, timelineView.threadReplies.get(root.id) ?? EMPTY_REPLIES).kind !== "none"+ ) {+ toggleResolvedExpand(root.id, true);+ }+ if (!isFlatTimeline) virtuosoRef.current?.scrollToIndex({ index, align: "start", offset: -16 });+ setPendingRunJump({ taskId, rootId: rootItem.id, flashId: run.hasReply && run.commentId ? run.commentId : taskId });+ },+ [id, items, commentRuns, expandedResolved, timelineView.threadReplies, toggleResolvedExpand, isFlatTimeline],+ );+ // Same frame-by-frame landing as a reply jump. A run that has replied may+ // only show as a log button in its comment's header, so align that comment.+ useEffect(() => {+ const container = scrollContainerEl;+ if (!pendingRunJump || !container) return;+ const { taskId, rootId, flashId } = pendingRunJump;+ let rafId = 0;+ let frames = 0;+ let last = -1;+ const align = () => {+ const el = container.querySelector<HTMLElement>(`[data-run-slot-id="${taskId}"]`)+ ?? container.querySelector<HTMLElement>(`[data-run-id="${taskId}"]`)?.closest<HTMLElement>("[id^='comment-']");+ if (!el) {+ if (++frames < 60) rafId = requestAnimationFrame(align);+ else setPendingRunJump(null);+ return;+ }+ const stickyBar = document+ .getElementById(`comment-${rootId}`)+ ?.querySelector<HTMLElement>("[data-thread-sticky-bar]");+ const c = container.getBoundingClientRect();+ const e = el.getBoundingClientRect();+ const target = Math.max(+ 0,+ container.scrollTop + (e.top - c.top) - 16 - (stickyBar && !el.contains(stickyBar) ? stickyBar.offsetHeight : 0),+ );+ container.scrollTop = target;+ if (Math.abs(target - last) > 1 && ++frames < 90) {+ last = target;+ rafId = requestAnimationFrame(align);+ return;+ }+ flashJumpTarget(flashId);+ setPendingRunJump(null);+ };+ rafId = requestAnimationFrame(align);+ return () => cancelAnimationFrame(rafId);+ }, [pendingRunJump, scrollContainerEl, flashJumpTarget]);const {reactions: issueReactions,@@ -3016,6 +3091,7 @@ export function IssueDetail({ issueId, onDelete, onDone, defaultSidebarOpen = tr{reply?.resolved_at && !expandedResolved.has(reply.id) ? <ResolvedThreadBarentry={reply} replies={timelineView.threadReplies.get(reply.id) ?? EMPTY_REPLIES}onExpand={() => toggleResolvedExpand(reply.id, true)} /> : <AgentRunComment run={item.run} entering={enteringRunIds.has(item.run.task.id)} standalone+ highlightedId={highlightedId}commentProps={reply ? {issueId: id, entry: reply, replies: timelineView.threadReplies.get(reply.id) ?? EMPTY_REPLIES,currentUserId: user?.id, canModerate: canModerateComments, onReply: submitReply,@@ -3159,7 +3235,7 @@ export function IssueDetail({ issueId, onDelete, onDone, defaultSidebarOpen = tr{/* Live "agent is working" chip, leftmost in the right cluster soit never overlaps the title (which truncates to make room).It self-hides when no agent is active. */}- <IssueAgentHeaderChip issueId={id} />+ <IssueAgentHeaderChip issueId={id} onJumpToRun={jumpToRun} /><IssueWakeupHeaderChip issueId={id} onOpen={openWakeups} />{onDone && !issueBehavesAsAny(issue, ["done", "closed"]) && (<Tooltip>diff --git a/packages/views/locales/en/issues.json b/packages/views/locales/en/issues.jsonindex 0dd60e85b9..8048e05ba2 100644--- a/packages/views/locales/en/issues.json+++ b/packages/views/locales/en/issues.json@@ -725,6 +725,7 @@"retry_failed": "Failed to retry run","retry_blocked": "Not retried — you don't have permission to use this agent","transcript_tooltip": "View transcript",+ "jump_to_run": "Go to run","cancel_failed": "Failed to cancel run","trigger_retry": "Retry","trigger_retry_attempt": "Retry #{{attempt}}",diff --git a/packages/views/locales/fr/issues.json b/packages/views/locales/fr/issues.jsonindex 4a5ff9eede..1ecb7037f4 100644--- a/packages/views/locales/fr/issues.json+++ b/packages/views/locales/fr/issues.json@@ -725,6 +725,7 @@"retry_failed": "Échec de la relance de l'exécution","retry_blocked": "Non relancée — vous n'avez pas la permission d'utiliser cet agent","transcript_tooltip": "Voir la transcription",+ "jump_to_run": "Aller à l'exécution","cancel_failed": "Échec de l'annulation de l'exécution","trigger_retry": "Relance","trigger_retry_attempt": "Relance n° {{attempt}}",diff --git a/packages/views/locales/ja/issues.json b/packages/views/locales/ja/issues.jsonindex 7024b8c079..9a06593429 100644--- a/packages/views/locales/ja/issues.json+++ b/packages/views/locales/ja/issues.json@@ -697,6 +697,7 @@"retry_failed": "実行を再試行できませんでした","retry_blocked": "再試行されませんでした — このエージェントを使用する権限がありません","transcript_tooltip": "トランスクリプトを表示",+ "jump_to_run": "実行に移動","cancel_failed": "実行をキャンセルできませんでした","trigger_retry": "再試行","trigger_retry_attempt": "再試行 #{{attempt}}",diff --git a/packages/views/locales/ko/issues.json b/packages/views/locales/ko/issues.jsonindex 662f0f3451..b9d5482447 100644--- a/packages/views/locales/ko/issues.json+++ b/packages/views/locales/ko/issues.json@@ -697,6 +697,7 @@"retry_failed": "실행을 다시 시도하지 못했습니다","retry_blocked": "다시 시도되지 않음 — 이 에이전트를 사용할 권한이 없습니다","transcript_tooltip": "트랜스크립트 보기",+ "jump_to_run": "실행으로 이동","cancel_failed": "실행을 취소하지 못했습니다","trigger_retry": "다시 시도","trigger_retry_attempt": "{{attempt}}번째 다시 시도",diff --git a/packages/views/locales/zh-Hans/issues.json b/packages/views/locales/zh-Hans/issues.jsonindex 63c2c30ca7..19e41906cd 100644--- a/packages/views/locales/zh-Hans/issues.json+++ b/packages/views/locales/zh-Hans/issues.json@@ -697,6 +697,7 @@"retry_failed": "重试运行失败","retry_blocked": "未重试——你没有该智能体的使用权限","transcript_tooltip": "查看记录",+ "jump_to_run": "跳转到运行","cancel_failed": "取消运行失败","trigger_retry": "重试","trigger_retry_attempt": "重试 #{{attempt}}",