diff --git a/ui/src/components/TaskChatThread.test.tsx b/ui/src/components/TaskChatThread.test.tsx index 8c8e6041e26..e7b6728c56f 100644 --- a/ui/src/components/TaskChatThread.test.tsx +++ b/ui/src/components/TaskChatThread.test.tsx @@ -4218,6 +4218,14 @@ describe.each([true, false])("Unanswered question history (conversationMode=%s)" expect(pendingIndicator()).toBeNull(); }); + it("links a review request's own document so the person can open what it asks them to review", () => { + const review = { ...planReviewInteraction(), id: "draft-review", title: "Review draft", payload: { version: 1, prompt: "Review the unpublished draft.", + target: { type: "issue_document", key: "draft", revisionId: "draft-revision-1" } } } as IssueThreadInteraction; + render(); + const link = takeover()?.querySelector('a[href="#document-draft"]'); + expect(link?.textContent).toContain("draft"); + }); + it("keeps unrelated approvals and accepted plan history when a plan changes", () => { planState.data = planDocument({ latestRevisionId: "revision-4", latestRevisionNumber: 4, updatedAt: new Date("2026-08-23T10:03:00Z") }); const review = { ...planReviewInteraction(), payload: { version: 1, prompt: "Review another task", target: { type: "issue_document", issueId: "other-task", key: "plan", revisionId: "revision-3" } } } as IssueThreadInteraction; diff --git a/ui/src/components/task-chat/TaskChatCompactInteractionCard.tsx b/ui/src/components/task-chat/TaskChatCompactInteractionCard.tsx index 818da0ad1d3..bbfc6742d85 100644 --- a/ui/src/components/task-chat/TaskChatCompactInteractionCard.tsx +++ b/ui/src/components/task-chat/TaskChatCompactInteractionCard.tsx @@ -306,7 +306,13 @@ function CompactTarget({ if (!target || !label) return null; const href = target.type === "issue_attachment" ? `/api/attachments/${encodeURIComponent(target.attachmentId)}/content` - : target.href ? normalizeRequestConfirmationTargetHref(target.href) : null; + : target.href ? normalizeRequestConfirmationTargetHref(target.href) + // A document on this chat opens in its document panel, like a reply's + // `#document-` link, so the person can read what they are asked to review. + // Plan reviews keep their header chip; their plan preview opens the plan. + : target.type === "issue_document" && target.key !== "plan" && (target.issueId ?? interaction.issueId) === interaction.issueId + ? `#document-${encodeURIComponent(target.key)}` + : null; if (href) { return (