[Bug]: Add to agent silently discards an earlier unsent PR diff question
Before submitting
- [x] I searched existing issues and did not find a duplicate.
- [x] I included enough detail to reproduce or investigate the problem.
Area
apps/web
Steps to reproduce
- In a thread linked to a PR, open its Code tab.
- Select a diff line, enter a question, and click Add to agent. Do not send the composer.
- Repeat on a different line with a second question.
- Inspect the composer.
Expected behavior
I expected Add to agent to keep both unsent questions and their line citations.
Actual behavior
After the second action, only its line citation remains. The first unedited question is also replaced. The public [composer handoff](https://github.com/pingdotgg/t3code/blob/451afcb22d93f06cb24f9bc16703404564952553/apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx#L1074-L1100) uses [replacement logic](https://github.com/pingdotgg/t3code/blob/451afcb22d93f06cb24f9bc16703404564952553/apps/web/src/components/pullRequest/pullRequestDetail.logic.ts#L659-L721), and its [test](https://github.com/pingdotgg/t3code/blob/451afcb22d93f06cb24f9bc16703404564952553/apps/web/src/components/pullRequest/pullRequestDetail.logic.test.ts#L1209-L1215) expects the earlier citation to be removed.
Impact
Cosmetic issue
Version or commit
No response
Environment
No response
Logs or stack traces
Screenshots, recordings, or supporting files
No response
Workaround
No response
[!NOTE] Grok responding on behalf of Julius.
Triage
Thanks for the precise repro and the code links, @yesiamdaniel. What you're seeing is how the composer handoff currently works by design, not a dropped draft.
Add to agent uses the same composer handoff as Ask, Explain, and Fix findings, and each new handoff replaces whatever the previous one left behind. This was added because chaining Ask and then Explain used to stack both into a question nobody had actually written. So an unedited handoff sentence gets taken back, and chips whose ids start with pull-request- are removed, which includes pull-request-selection: line citations. Anything you typed or edited in the composer stays, and the new handoff prompt is added below it. Chips you attached yourself also stay.
handoffPrompt and handoffReviewComments implement this, and the test "replaces what the last one left, chips included" checks that an earlier pull-request-selection: chip is removed. With two unsent line questions, only the second question and its citation remain. The first question is replaced because it still exactly matches the last handoff sentence.
Keeping both unsent questions and both citations would mean changing that behavior, so I've relabeled this as an enhancement. Ideas is the best place to make the case for it. For now, you can either send the first question before adding the second, or edit the first one slightly so it counts as your own text and stays in the composer.