fix(web): review comments in question answers reach the agent with their text and diff#28051

open5
main
fix/issue-28022
opened1d agobyJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 1d ago

Problem

While Claude waits on an AskUserQuestion prompt, a line comment added in the Diff panel puts a review-comment chip into the question's answer. On submit, the agent received only the bare link [notes.md L16](t3-context://v1/review-comment/…), with no comment text or diff, and asked the user to retype the comment. A normal message with the same chip carries the text and diff.

Reproduced on main (50c1c5dc53) in the web dev server on a fresh database, with Claude Opus 5.5:

  1. Ask Claude to create a file and then ask an AskUserQuestion.
  2. While the question waits, comment on a line in the Diff panel. The chip appears in the answer.
  3. Submit. The stored answer is exactly the bare link, and Claude says no comment text or diff came through.

Change

  • Send: onRespondToUserInput now also reads the records the thread's composer draft holds. The Diff panel stores the review comment there, not on the question's draft. projectPendingUserInputAnswer then runs the answer through the shared projectComposerContextForProvider, the same path a normal send uses, whenever the answer references a chip it can expand (review comment, terminal, preview annotation, environment).
  • Unchanged answers: thread chips stay readable thread links, as before. Image and file chips in an expanded answer become their plain label; the server still appends their Attached image "…": <path> lines. Answers with nothing to expand are byte-identical to main.
  • History: the stored answer is the text the agent got. getQuestionAnswerText, which web history, mobile history and the collapsed row summary share, now hides a generated <t3_context> block using stripComposerContextEnvelope, and keeps any attachment-path lines after it. It strips a block only if every entry's id has a matching marker in the text before it, so a block the user typed is left alone.

No contract, server or mobile-submission change.

Scope and approval

Fixes pingdotgg/t3code#28022

Triaged via the automated issue flow.

Verification

Tests:

  • apps/web/src/pendingUserInput.test.ts: "sends review comment chips with the comment text and diff" fails on main (Received: "See [plan.md L16](t3-context://v1/review-comment/…)") and passes now. Another test covers an image chip next to a review chip: the image keeps its label, gets no unavailable or kind="image" entry, and an image-only answer is unchanged.
  • packages/shared/src/composerContextReferences.test.ts: a generated block is stripped back to its body; a trailing Attached image line is kept; a user-typed block without matching markers is unchanged; plain text is unchanged.
  • vp run check:changed on the merged head passes: format, lint, knip, typecheck (33 packages), tests (44) and the React compiler check.

Real app (web dev server at localhost, Chromium preview, 1280×800, DPR 1, light theme, Claude Opus 5.5, fresh database, synthetic project and image):

RowBefore (main 50c1c5dc53)After (branch)
Chip in the pending answerBefore: notes.md L16 chip in the question answerAfter: image.md L16 chip and attached image in the question answer
What the agent receivedBefore: Claude reports only a bare link, no comment text or diffAfter: Claude repeats the comment text and the +line 16 hunk
History, comment only, collapsed / expandedn/a (main showed the raw link)After: collapsed history row shows the marker without the context block After: expanded history row shows question and marker only
History, comment and image, collapsed / expandedn/aAfter: collapsed history row with image, no context block After: expanded history keeps the Attached image line and thumbnail, no context block

Control, main: the same kind of chip sent as a normal message reached Claude with the text and diff.

Control: a normal message with a review comment carries the text and diff

Stored runtime-request answers, as written by each build:

text
1before (main): "[notes.md L16](t3-context://v1/review-comment/review-comment_file-comment-1793431779302-1)"
2after: "[Review comment: after.md L16; ref=review-comment_file-comment-1793432313989-1]\n\n<t3_context version=\"1\">\n<context kind=\"review-comment\" id=\"…\">\nfile: after.md\nrange: +16 (15-15)\nsection: Changes\ncomment:\n PURPLE-OTTER: rename this line to sixteen\ndiff:\n @@ -0,0 +16,1 @@\n +line 16\n</context>\n</t3_context>"
3after + image: same shape, followed by "\n\nAttached image \"synthetic.png\": \"…/attachments/….png\""

Before and after are separate runs of the same flow, and their text differs by design, so pixel diffs (Diff0/DiffT) would not mean anything here and are omitted. 05 was taken at 7b10c389ea; 07–11 at a608ec67f5, the head before the main merge.

Not checked:

  • Mobile history and its collapsed summary. They use the same shared getQuestionAnswerText, which is unit-tested, but I ran no native client.
  • Narrow web viewport and dark theme.
  • A file attachment, and an inline image or file chip pasted next to a review comment (unit-tested only).
  • Multi-question requests.
  • Recordings of expand/collapse.
  • Providers other than Claude: Codex, Cursor, OpenCode and Grok receive the same answer string.

Lead: Claude Opus 5.5 (Claude Code in T3 Code). Steps: Claude Opus 5.5 (red test, implementation, reviewer B) and GPT-6.1 Sol via Codex (reviewer A, proof audit).

🤖 Generated with Claude Code

Checks

24 successful · 9 skipped
All checks passed
77feb8d

Added 5 commits

  • Merge remote-tracking branch 'origin/main' into fix/issue-2802277feb8d
  • fix(web): question answers send review comment text and diff7b10c38
  • fix(web): keep attachment chips and hide the context envelope in question answers82d4b5b
  • fix(web): attachment chips in question answers stay labels, history hides only generated envelopesa608ec6
  • test(web): reproduce #28022 review comment chips in question answerse4e7758
Synced from GitHub

Approvability

Verdict: Approved at 77feb8d

Macroscope's review found this PR approvable — Question answers now deliver referenced review comments and diffs to the agent while keeping generated payloads out of work-log previews. The change reuses existing context serialization and limits delivery to references included in the answer.

You can add or adjust custom eligibility rules. Learn more.

Synced from GitHub

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ProviderMetricMain baselineThis PRImpactPR ceiling
CodexTotal thread wire5.0 KiB5.0 KiB+29 B (+0.6%)6.8 KiB✅
CodexThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
CodexLive turn WebSocket wire1.2 KiB1.2 KiB+29 B (+2.3%)2.0 KiB✅
CodexLive turn WebSocket decoded21.5 KiB21.6 KiB+41 B (+0.2%)24.4 KiB✅
CodexLive turn messages12+1 (+100.0%)8✅
ClaudeTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiB✅
ClaudeThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiB✅
ClaudeLive turn WebSocket wire1.2 KiB1.2 KiB0 B (0.0%)2.0 KiB✅
ClaudeLive turn WebSocket decoded21.9 KiB21.9 KiB0 B (0.0%)24.4 KiB✅
ClaudeLive turn messages110 (0.0%)8✅

Baseline: b47d71d · PR result: 77feb8d · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

Synced from GitHub

Review in Change Stack →

No actionable comments were generated in the recent review.

External image Recent review info
External image Run configuration
External image Commits

Reviewing files that changed from the base of the PR and between b47d71da28a4a24f93fff1675722693fe4d9a15d and 77feb8d8cde86ddd9184769ab3ba0289a19b73a4.

External image Files selected for processing: 6
  • apps/web/src/components/chat/usePendingThreadRequests.ts
  • apps/web/src/pendingUserInput.test.ts
  • apps/web/src/pendingUserInput.ts
  • packages/client-runtime/src/work-log/userInput.ts
  • packages/shared/src/composerContextReferences.test.ts
  • packages/shared/src/composerContextReferences.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

Walkthrough

Pending-question answers now include composer draft context records during projection. The work-log answer reader strips valid generated context envelopes from string answers. Tests cover review-comment text and diff, image labels, and envelope preservation rules.

Changes: Pending question context

Layer / File(s)Summary
Project composer context into answers
apps/web/src/components/chat/usePendingThreadRequests.ts, apps/web/src/pendingUserInput.ts, apps/web/src/pendingUserInput.test.ts
Pending-question submission combines composer draft records with question thread contexts. Projection includes resolved non-attachment context and retains attachment labels. Tests cover review-comment and image references.
Strip generated context envelopes
packages/shared/src/composerContextReferences.ts, packages/client-runtime/src/work-log/userInput.ts, packages/shared/src/composerContextReferences.test.ts
A shared helper strips valid generated context envelopes. getQuestionAnswerText applies it to string answers. Tests cover envelope boundaries and unchanged text.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested labels: bugfix, size:M

Suggested reviewers: t3dotgg, maria-rcks

Merge Risk: External image Low · up to 77feb

In a narrow case, a prefilled answer may be changed before it reaches the agent. This is non-blocking with owner awareness.

Pre-merge checks: Passed 4
Check nameStatusExplanation
Title checkPassedThe title names the main change: review comments placed in pending question answers now reach the agent with their text and diff. The changeset matches this. It projects composer context records (revi…
Description checkPassedThe description follows the template's main sections: Problem, Change, Scope and approval, and Verification. The Problem section gives the observed behavior, reproduction steps, and environment. The C…
Linked Issues checkPassedIssue #28022 requires pending AskUserQuestion answers with review-comment chips to reach the agent with comment text and diff. usePendingThreadRequests now reads records from the thread composer d…
Out of Scope Changes checkPassedThe changed files support the linked fix. They prepare pending answers, project review-comment and attachment references, add regression tests, and remove generated provider envelopes from shared hist…
Full details: Title check

Explanation

The title names the main change: review comments placed in pending question answers now reach the agent with their text and diff. The changeset matches this. It projects composer context records (review comments and other expandable chips) into pending user-input answers, and it strips the generated context envelope in history display. The title is a conventional commit with a scope and is specific enough for a teammate scanning history. It is 86 characters, slightly long, but still clear.

Full details: Description check

Explanation

The description follows the template's main sections: Problem, Change, Scope and approval, and Verification. The Problem section gives the observed behavior, reproduction steps, and environment. The Change section explains the send path and history path and why the changes stay within the same fix. Scope and approval links issue #28022 and says it was triaged through the automated issue flow. Verification lists focused tests, a repo check run, and real-app before and after evidence. It also lists what was not checked. The description is mostly complete. The template asks for a maintainer approval link or discussion for scope, and the author cites only an automated triage flow, so that point could be clearer. This gap is minor, so the check passes.

Full details: Linked Issues check

Explanation

Issue #28022 requires pending AskUserQuestion answers with review-comment chips to reach the agent with comment text and diff. usePendingThreadRequests now reads records from the thread composer draft. projectPendingUserInputAnswer resolves review-comment records through projectComposerContextForProvider. The new regression test checks that the projected answer contains the comment text and diff and no bare t3-context:// link. The history change removes generated envelopes while preserving attachment lines. The linked coding requirements are implemented and tested.

Full details: Out of Scope Changes check

Explanation

The changed files support the linked fix. They prepare pending answers, project review-comment and attachment references, add regression tests, and remove generated provider envelopes from shared history text. The image/file handling preserves existing attachment behavior when the new projection runs. No unrelated feature, server contract, or mobile-submission change is demonstrated.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts