The best way to control Claude Code, Codex and more from any computer or phone
fix(web): review comments in question answers reach the agent with their text (#34855)
Julius Marminge committed
Nov 11, 2026 at 23:39 UTC
101e5f99a28052f79261d48589b8976e3c483450
3 files changed
+51
-12
apps/web/src/components/chat/usePendingThreadRequests.ts
+9
-4
@@ -22,6 +22,7 @@ import { useShallow } from "zustand/react/shallow";
22
import { type DraftId, useComposerDraftStore } from "../../composerDraftStore";
23
import { useStableCallback } from "../../hooks/useStableCallback";
24
import { getUploadedAttachments, useAttachmentUploadStore } from "../../lib/attachmentUploadQueue";
25
+import { reviewCommentContextRecord } from "../../lib/composerContextRecords";
26
import {
27
buildPendingUserInputAnswers,
28
setPendingUserInputCustomAnswer,
@@ -287,6 +288,10 @@ export function usePendingThreadRequests(input: {
288
if (userInputResponsesInFlight.current.has(responseKey)) return;
289
const attachmentsByQuestionId = new Map<string, UserInputAttachments[string]>();
290
const providerAnswers = { ...answers };
291
+ // Diff comments land in the thread draft even when their chip is in an answer.
292
+ const reviewCommentRecords = (
293
+ useComposerDraftStore.getState().getComposerDraft(composerDraftTarget)?.reviewComments ?? []
294
+ ).map(reviewCommentContextRecord);
295
for (const question of pendingInput.questions) {
296
const target = questionAttachmentDraftId(
297
environmentId,
@@ -296,10 +301,10 @@ export function usePendingThreadRequests(input: {
301
);
302
if ((useQuestionAttachmentPreparation.getState().counts[target] ?? 0) > 0) return;
303
const draft = useComposerDraftStore.getState().getComposerDraft(target);
299
- providerAnswers[question.id] = projectPendingUserInputAnswer(
300
- answers[question.id],
301
- draft?.threadContexts ?? [],
302
- );
304
+ providerAnswers[question.id] = projectPendingUserInputAnswer(answers[question.id], [
305
+ ...(draft?.threadContexts ?? []),
306
+ ...reviewCommentRecords,
307
+ ]);
308
const attachments = draft ? [...draft.images, ...draft.files] : [];
309
if (attachments.length === 0) continue;
310
const uploaded = getUploadedAttachments({ environmentId, images: attachments });
apps/web/src/pendingUserInput.test.ts
+25
-1
@@ -1,7 +1,7 @@
1
import { EnvironmentId, ThreadId } from "@t3tools/contracts";
2
import { describe, expect, it } from "vite-plus/test";
3
import { formatInlineContextReference } from "./lib/composerContextReferences";
4
-import { threadContextReference } from "./lib/composerContextRecords";
4
+import { reviewCommentContextRecord, threadContextReference } from "./lib/composerContextRecords";
5
import { threadContextRecord } from "@t3tools/shared/composerContextReferences";
6
7
import {
@@ -27,6 +27,30 @@ describe("projectPendingUserInputAnswer", () => {
27
);
28
});
29
30
+ // regression: #28022 a review comment chip in an answer reached the agent as a bare link
31
+ it("sends review comment chips with the comment text and diff", () => {
32
+ const comment = reviewCommentContextRecord({
33
+ id: "file-comment-1",
34
+ sectionId: "branch",
35
+ sectionTitle: "Changes",
36
+ filePath: "notes.md",
37
+ startIndex: 2,
38
+ endIndex: 2,
39
+ rangeLabel: "+2",
40
+ text: "Rename this to line two updated",
41
+ diff: "@@ -0,0 +2,1 @@\n+line two changed",
42
+ fenceLanguage: "diff",
43
+ });
44
+ const answer = `See my note: ${formatInlineContextReference({
45
+ kind: "review-comment",
46
+ contextId: comment.contextId,
47
+ label: comment.label,
48
+ })}`;
49
+ const projected = projectPendingUserInputAnswer(answer, [comment]);
50
+ expect(projected).toContain("Rename this to line two updated");
51
+ expect(projected).toContain("+line two changed");
52
+ });
53
+
54
// regression: #18789 answers to pending questions lost exact text and option values
55
it("preserves option values and exact answer text", () => {
56
const options = [" first\t", "second"];
apps/web/src/pendingUserInput.ts
+17
-7
@@ -1,5 +1,12 @@
1
-import type { ThreadContextRecord, UserInputQuestion } from "@t3tools/contracts";
2
-import { replaceComposerContextReferences } from "@t3tools/shared/composerContextReferences";
1
+import type {
2
+ ReviewCommentContextRecord,
3
+ ThreadContextRecord,
4
+ UserInputQuestion,
5
+} from "@t3tools/contracts";
6
+import {
7
+ projectComposerContextForProvider,
8
+ replaceComposerContextReferences,
9
+} from "@t3tools/shared/composerContextReferences";
10
import { formatThreadLink } from "@t3tools/shared/threadLinks";
11
import {
12
buildPendingUserInputAnswers,
@@ -13,13 +20,16 @@ import { collectInlineContextIds } from "./lib/composerContextReferences";
20
21
export function projectPendingUserInputAnswer(
22
answer: unknown,
16
- threadContexts: ReadonlyArray<ThreadContextRecord>,
23
+ records: ReadonlyArray<ThreadContextRecord | ReviewCommentContextRecord>,
24
) {
18
- if (typeof answer !== "string" || threadContexts.length === 0) return answer;
19
- const recordsById = new Map(threadContexts.map((record) => [record.contextId, record]));
25
+ if (typeof answer !== "string" || records.length === 0) return answer;
26
+ const recordsById = new Map(records.map((record) => [record.contextId, record]));
27
return replaceComposerContextReferences(answer, (reference) => {
21
- const record = reference.kind === "thread" ? recordsById.get(reference.contextId) : undefined;
22
- return record ? formatThreadLink(record, reference.label) : reference.source;
28
+ const record = recordsById.get(reference.contextId);
29
+ if (record?.kind !== reference.kind) return reference.source;
30
+ return record.kind === "thread"
31
+ ? formatThreadLink(record, reference.label)
32
+ : projectComposerContextForProvider({ text: reference.source, records: [record] });
33
});
34
}
35