Repository navigation
fix(mcp): Keep an explicit OR from becoming AND in search_issues - #2845
Closed
sentry-junior[bot] wants to merge 2 commits into
Closed
sentry-junior[bot] wants to merge 2 commits into
sentry-junior[bot] wants to merge 2 commits into
Conversation
A structured search_issues query with an OR that isn't a same-key in-list went to the repair agent as written. The agent can only write in-lists, so it dropped the OR and the parentheses and ANDed the terms, and the search matched nothing. Rewrite or reject that OR before the agent sees it, as no-agent mode already does: a same-key OR becomes an in-list, and any other OR fails with a UserInputError. Fixes #2844
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
The grammar reads a lowercase "or" as the operator, so a mixed query such as "errors or warnings is:unresolved" was rejected before the agent could translate its prose. Count only an uppercase OR.
Contributor
Author
|
Heads up: this PR and #2846 both fix the same bug in #2844 (an explicit @getsentry/ocpo could you pick one? If #2846 is the direction, this one can be closed. via automation |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A structured
search_issuesquery with anORthat isn't a same-key in-list, such asenvironment:prod ("Authentication required" OR "Session unavailable"), goes to the repair agent as written. The agent prompt saysORand parentheses must be rewritten, but the only forms it knows are same-key in-lists andstatus:/substatus:. So it drops theORand the parentheses, the terms get ANDed, and the search matches nothing with no note about the change.rewriteIssueQueryonly sees the agent's output, which no longer has anOR.What changes
search_issuesrunsrewriteIssueQueryon a structured query that has anORbefore Seer or the agent sees it, as no-agent mode already does:level:error OR level:warning) becomes an in-list, and the agent getslevel:[error,warning]. The result note says so.UserInputErrorthat suggests in-lists or separate searches. No API or agent call is made.@sentry/toolkit-core/search-queryexportshasBooleanOr(query). It uses the shared grammar, so anORinside a quoted value doesn't count.Scope
The check only runs when
looksLikeSentrySearchSyntaxis true. Natural-language queries, including a lowercase "or" in prose (the grammar matchesORcase-insensitively), still go to Seer or the agent unchanged. A query made only of quoted phrases joined byOR, with nofield:valuefilter, isn't covered. Open question: should that case be rejected too?Fixes #2844
via automation
evt_905b9c478746fd9deeb853f85ad7441b· Run IDdispatch_0449b5ce4149eeb0e866727b5cbb3fab.--
View Session [Sentry]