feat(agents): Add agent dropdown to the page#107108
Conversation
static/app/views/insights/pages/agents/hooks/useAgentFilter.tsx
Outdated
Show resolved
Hide resolved
…gents-dropdown-to-agents-page
…gents-dropdown-to-agents-page
obostjancic
left a comment
There was a problem hiding this comment.
Looks ok, but I think we could inline this agent filter in the useCombinedQuery hook so that the other components on this page (like widgets) are not aware how the query is constructed, they just use the query passed to them.
|
Another point: Trace table allows users to add the agent to the filter, currently that appends to the search bar but i would expect it to update the agent selector instead. |
65ed359 to
587a8a6
Compare
587a8a6 to
f8956d3
Compare
I’ve updated the code so it now updates the dropdown instead of the search bar 😉 This is how it looks: Screen.Recording.2026-01-30.at.06.52.44.mov |
Yes, it was like that before. However, based on the Sentry feedback and your thumbs up on that feedback, I’ve updated the code accordingly. I’ve now dropped that commit. In my opinion, since the URL parameters are cleared when navigating away from the page, it’s fine to keep the current behavior. |
static/app/views/insights/pages/conversations/hooks/useConversations.tsx
Outdated
Show resolved
Hide resolved
…ations.tsx Co-authored-by: Ogi <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| ...location.query, | ||
| agent: isAgentInUrl | ||
| ? agentFilters.filter(urlAgent => urlAgent !== agent) | ||
| : [...agentFilters, agent], |
There was a problem hiding this comment.
Empty array passed instead of null when removing agents
Medium Severity
When clicking to remove the last selected agent from the filter, agentFilters.filter(urlAgent => urlAgent !== agent) returns an empty array [] which is passed directly to the Link's query. The AgentSelector component explicitly handles this case by setting null when the array is empty (values.length > 0 ? values : null), which cleanly removes the parameter from the URL. This inconsistency could cause unexpected URL serialization behavior with an empty array instead of removing the agent parameter entirely.
| ? `${SpanFields.GEN_AI_AGENT_NAME}:[${agentFilters.map(a => `"${a}"`).join(',')}]` | ||
| : ''; | ||
| const combinedQuery = useCombinedQuery(agentQuery) || undefined; | ||
| const combinedQuery = useCombinedQuery(); |
There was a problem hiding this comment.
Missing fallback to undefined for empty query string
Medium Severity
The old code used useCombinedQuery(agentQuery) || undefined to convert empty strings to undefined, ensuring the query parameter is omitted from the API request when empty. The new code removes this pattern, causing query: '' to be sent to the API instead. This differs from other similar pages in the codebase that use the || undefined pattern and could cause different API behavior.
There was a problem hiding this comment.
its ok. I guess , it doesn't matter if it is empty or undefined


Preview:
Screen.Recording.2026-01-27.at.22.43.56.mov
closes https://linear.app/getsentry/issue/TET-1793/add-agent-dropdown-to-agent-insights