[Bug]: Adding a second pull request comment or finding to the composer removes the first one's chip#24960

opened17d agobyTTonybynMp4

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Open a pull request in the pull request panel while a thread composer is open beside it.
  2. In the Code tab, select some lines, write a comment, and click Add to agent. A chip for the selection appears in the composer.
  3. Optionally type some text of your own in the composer.
  4. Select other lines, write another comment, and click Add to agent again.

The same happens with Fix in a thread on review findings when you attach several of them to one composer.

Expected behavior

Each add appends its text and chips to the draft. Chips and text from earlier adds stay, and the pull request chip appears once.

Actual behavior

Each add replaces the previous one:

  • With an untouched draft, the previous comment's text and chip are replaced entirely.
  • If the draft was edited (even just a new line), the edit and the earlier text stay, but the earlier chip is removed and the new comment is appended. The text then refers to a chip that no longer exists.
  • Each add brings its own pull request chip, so #93 shows up twice.

In the recording, nuifiure and the .oxlintrc.json L20 to L26 chip are already in the draft. After a second Add to agent, the .oxlintrc.json chip is gone and sdfbiusfbiu App.tsx 152 to 158 #93 is appended under nuifiure #93.

writeTaskToComposer in apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx treats every review comment whose ID starts with pull-request- as part of the previous handoff. It strips those chips (stripPullRequestHandoffReferences, handoffReviewComments), and handoffPrompt drops the previous handoff text when the prompt still ends with it. Add to agent selections (pull-request-selection:*) and findings (pull-request-finding:*) both go through this path. Comments from the regular diff panel use addReviewComment and append as expected.

Impact

Minor bug or occasional failure

Version or commit

main @ 40ec16a9b6

Environment

Linux, T3 Code nightly desktop

Screenshots, recordings, or supporting files

https://github.com/user-attachments/assets/a237785d-946a-416e-b053-93846d770fdf

Synced from GitHub

I have a fix ready on TonybynMp4/t3code@fix/composer-append-findings. Each handoff from the PR panel (fixing a finding, or Add to agent on a diff selection) now appends its text and chips and keeps everything already in the draft. The PR reference chip is added once, not once per handoff.

The replace behaviour was deliberate in #4849, so I'll wait for a maintainer to confirm that appending is the behaviour you want before I open a PR.

Synced from GitHub

Reproduced on 0.1.4-nightly.20261028.3824 (commit eb751fa), T3 Code Desktop on Windows connected to a server in WSL2 (Linux x64).

Steps: in the PR panel Code tab, add a comment on lines and click Add to agent. Repeat on other lines. Only the last comment keeps its line chip. The earlier comments lose their chips, so the message has no indication of where they were placed.

The code on this build matches the analysis above: handoffReviewComments (pullRequestDetail.logic.ts:865) filters out every existing pull-request-* chip, and the selection chip IDs are pull-request-selection:* (PullRequestCodeTab.tsx:785). main is unchanged as of 2026-10-28. Note that #14637 reported the same thing and is closed, but the behaviour persists.

+1 for append behaviour: a user who adds several comments on purpose expects all of them to reach the agent with their locations.

Comment drafted by Claude Opus 5.5 (Claude Code) through T3 Code triage.

Synced from GitHub

I'm hitting this too, and it isn't limited to two notes on one PR. When reviewing a stack, I go through each PR, select lines in the Code tab, and click Add to agent, intending to send one message covering the whole stack. Each new note removes the previous one's line citation (and the previous PR's context chip), so the agent gets my text but no longer knows which PR, file, or lines it refers to. Building one cross-PR review message is not possible right now.

This doesn't look like intended behavior to me. The replace-on-handoff rule makes sense for one-shot actions like Ask and Explain, but Add to agent notes are content the user wrote and shouldn't be swept up with them.

#25136 looks like the right fix, and since it scopes attachment IDs to the PR URL it should cover the stacked case too. Would be great to see it land.

This comment was written by Claude (Opus 5.5) in Claude Code at my request; I reviewed it before posting.