Skip to content

fix(seer): Parse widget conditions into structured filters for LLM context#112445

Closed
Mihir-Mavalankar wants to merge 2 commits intomasterfrom
mihir-mavalankar/fix/structured-llm-conditions
Closed

fix(seer): Parse widget conditions into structured filters for LLM context#112445
Mihir-Mavalankar wants to merge 2 commits intomasterfrom
mihir-mavalankar/fix/structured-llm-conditions

Conversation

@Mihir-Mavalankar
Copy link
Copy Markdown
Contributor

@Mihir-Mavalankar Mihir-Mavalankar commented Apr 8, 2026

  • The raw Sentry search syntax in widget conditions (e.g. span.name:Containsqueue.task.taskworker) was passed directly into the LLM context tree. The Seer Explorer agent couldn't distinguish operators from values, causing it to misinterpret filters and make broken tool calls that returned no results.

+Add getSearchFiltersForLLM() in widgetLLMContext.tsx that wraps parseSearch to convert raw conditions into structured {field, op, value} objects with human-readable operators (via OP_LABELS) and negation support. Falls back to the raw string if parsing fails.

  Before:
  "conditions": "span.description:Contains[task1,task2] span.name:Containsqueue.task.taskworker !trigger_path:Containsold_seer_automation"

  After:
  "conditions": [
    {"field": "span.description", "op": "contains", "value": "[task1,task2]"},
    {"field": "span.name", "op": "contains", "value": "queue.task.taskworker"},
    {"field": "trigger_path", "op": "NOT contains", "value": "old_seer_automation"}
  ]

The raw Sentry search syntax (e.g. Containsqueue.task.taskworker) was
passed directly to the LLM context, causing the Seer agent to
misinterpret operators as literal values and make broken tool calls.
Parse conditions via parseSearch and map operators through OP_LABELS
so the LLM sees structured {field, op, value} objects instead.

Co-Authored-By: Claude Opus 4.6 <noreply@example.com>
@Mihir-Mavalankar Mihir-Mavalankar self-assigned this Apr 8, 2026
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 8, 2026
@Mihir-Mavalankar Mihir-Mavalankar force-pushed the mihir-mavalankar/fix/structured-llm-conditions branch from 6a11101 to 207d714 Compare April 8, 2026 16:26
Verify parsing of an actual dashboard widget conditions string with
Contains IN list, single Contains, and negated Contains filters.

Co-Authored-By: Claude Opus 4.6 <noreply@example.com>
@Mihir-Mavalankar Mihir-Mavalankar force-pushed the mihir-mavalankar/fix/structured-llm-conditions branch from 207d714 to 602b5c0 Compare April 8, 2026 17:14
@Mihir-Mavalankar Mihir-Mavalankar marked this pull request as ready for review April 8, 2026 17:14
@Mihir-Mavalankar Mihir-Mavalankar requested a review from a team as a code owner April 8, 2026 17:14
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 602b5c0. Configure here.

field: f.key.text,
op: `${f.negated ? 'NOT ' : ''}${OP_LABELS[f.operator] ?? f.operator}`,
value: f.value.text,
}));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filter parsing drops query logic

High Severity

getSearchFiltersForLLM keeps only Token.FILTER entries and discards non-filter tokens. Queries containing OR, parentheses, or mixed free text lose their original semantics when converted into conditions, so the LLM context can represent a different query than the widget actually runs.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 602b5c0. Configure here.

@Mihir-Mavalankar Mihir-Mavalankar marked this pull request as draft April 8, 2026 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant