Repository navigation
Let PR line selections stack in the composer, like thread diff selections #16658
Replies: 1 comment
|
My use case that needs keeping multiple line reference chips in a single prompt: go through the diff, add questions on specific lines in the diff. My t3 is set up to steer by default, so if I keep sending more comments as the previous ones get processed, they get injected in the middle of agent working on a previous items and sometimes it confuses/derails it. Supplying all references in a single prompt works much better. What's worse, silently stripping line references also results in agent confusion as my comments are missing important context, and sometimes get misinterpreted or applied to a wrong part of the source code. I could configure my prompts to queue, but it has other downsides -- steering by default tend to work better for me in most of the cases. IMO, if a user commented on specific source lines, that information must be preserved in the prompt, even (or especially) if the user did it more than once. The bot triage in #14637 (comment) does not make whole lot of sense to me. It sounds as if it considered "that's how it's implemented now" to be "that's the only true way to do things". @juliusmarminge would you consider reopening #14637 ? |
Uh oh!
There was an error while loading. Please reload this page.
Problem
In a pull request's Code tab, selecting lines, typing a question, and clicking Add to agent puts the question and a line chip in the composer. Doing it again before sending removes the first question and its chip. You can only hold one selection at a time. To ask about several spots in one message, you have to send after each one or edit every question so it counts as your own text.
Selecting lines in a thread's own diff works differently.
AnnotatableCodeViewadds each one withaddReviewComment, so they stack. The PR Code tab builds its chip with the samebuildDiffReviewComment("the gesture is the same one", per the comment inPullRequestCodeTab.tsx). But it goes through the handoff path (writeTaskToComposer→handoffPrompt/handoffReviewComments), which replaces whatever an earlier handoff left. So the same gesture behaves differently depending on which diff you're in.Why replacement exists, and why it doesn't fit here
Handoff replacement was added so that Ask followed by Explain doesn't stack into a question nobody wrote, and so a question about one PR doesn't carry another PR's context. Both reasons hold for whole-PR handoffs. Neither applies to two line questions on the same PR: the user wrote both, and both are about that PR.
Proposal
When the incoming handoff is a line selection from the same PR, add to the composer instead of replacing:
pull-request-selection:chips whosesectionIdmatches the PR, and add the new one.Everything else stays as it is. Ask, Explain, and Fix findings still replace what earlier handoffs left, selections included. A selection from a different PR still clears the previous PR's chips.
The change would stay inside the PR panel's handoff merge rule and its tests: "replaces what the last one left, chips included" gains a same-PR selection case. No contract, server, or mobile changes.
All reactions