fix(search): Prevent Ask AI from doubling pasted query text#116050
Conversation
When the entire search query is free text (e.g. pasted natural language), the initialSeerQuery builder would fall back to the unfiltered query after filtering removed all tokens, then also append the inputValue — producing the query text twice. Add a !inputValue guard to the fallback branch so it only fires when no free-text filtering occurred, matching the fix already present in issueList/issueListSeerComboBox.tsx. Fixes AIML-2875 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📊 Type Coverage Diff✅ No new type safety issues introduced. Coverage: 93.62% |
Screen.Recording.2026-05-21.at.1.30.48.PM.mov |
JoshuaKGoldberg
left a comment
There was a problem hiding this comment.
Thanks for the quick fix! 🥔
The existing code looks like something that's ripe for a post-release cleanup (lots of duplication, not so many tests) but ACK that that's not something introduced in this PR.
| } else if (queryDetails?.queryToUse) { | ||
| } else if (!inputValue && queryDetails?.queryToUse) { | ||
| initialSeerQuery = queryDetails.queryToUse; | ||
| } |
There was a problem hiding this comment.
matching the fix already present in
issueList/issueListSeerComboBox.tsx
[Refactor] [Testing] So this area of code is duplicated in now 5 separate components, none of which have attached unit tests in this PR? IMO this level of duplication is not good for product health/quality. Looking through the views/explore/*/*TabSeerComboBox.tsx components, there's a heck of a lot of nearly-identical code.
I don't want to block a small fix to this existing code, but I'd strongly recommend deduplicating these 5 components as a followup.
Summary
initialSeerQuerybuilder filters it out, falls back to the unfiltered query, then appendsinputValueagain!inputValueguard to the fallback branch in 4 strategy wrappers (Logs, Spans, Metrics, Discover Issues), matching the fix already present inissueList/issueListSeerComboBox.tsxFixes AIML-2875
Test plan
askSeerComboBox.spec.tsxtests passbrowser.name:Firefox+ paste "show me errors") → Ask AI showsbrowser.name:Firefox show me errors