Repository navigation
fix(search-events): stop silent full-text downgrades - #1252
Merged
Merged
Conversation
Stop accepting agent rewrites that turn structured field:value filters into message/log.body matches. Keep the original filter so validation fails honestly instead of returning lucky/wrong results. Still allow real attribute renames and non-semantic repairs. Co-Authored-By: David Cramer <david@sentry.io>
Slim the guard to the tweet failure mode only: structured field dropped and value survives under message/log.body. Keep validation repair renames working. Co-Authored-By: David Cramer <david@sentry.io>
Collapse the dual-prompt try/fail/retry loop. Give the agent a validateSearch tool and one shared prompt. Handler keeps a single final validation gate and still rejects structured-to-message downgrades. Co-Authored-By: David Cramer <david@sentry.io>
Make semantic-downgrade detection quote-aware so literal message:/log.body: text inside quoted values is not treated as a full-text filter rewrite.
Compare structured filters by key+value cardinality so dropping one of several identical keys into message/log.body still counts as a semantic downgrade.
dcramer
marked this pull request as ready for review
August 15, 2026 02:53
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 68df4d4. Configure here.
Quoted multi-word values were truncated at the first space, so later words could be rewritten into message/log.body without detection.
Bare substring comparison treated unrelated full-text as a downgrade (e.g. id:1 vs message:"error 401"). Require whole-token overlap instead.
dcramer
requested changes
Aug 15, 2026
dcramer
left a comment
Member
There was a problem hiding this comment.
i want some evals that show search-events behavior as expected. it should be fairly light weight, use the msw stuff for the sentry api and really assert on outputs and inputs
Drop agent prompt assertions and document that policy. Cover the structured-to-full-text false-success path with MSW-backed input/output checks and light agent evals for expected query shape.
Contributor
Author
|
Addressed in 99bf5c6. MSW I/O coverage (handler tests)
Light agent evals
Policy
|
dcramer
approved these changes
Aug 16, 2026
This branch was previously 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.

Clean up
search_eventsagent orchestration and block the silent false-success path.Failure mode
Structured filter gets rewritten to full-text:
logs+conv_id:ZYGC-86ZR→message:"*ZYGC-86ZR*"That looked correct by luck when the id also appeared in log text.
Architecture cleanup
Before: agent rewrite prompt → external validate → different repair prompt → retry up to 3x.
After:
validateSearchtool inside the agent loopGuard
Still reject structured →
message/log.bodydowngrades. Keep original filter so validation fails honestly. Real attribute renames still work.Tests
pnpm --filter @sentry/mcp-core exec vitest run src/tools/catalog/search-events.test.ts src/tools/support/search-events/utils.test.ts(87 passed).Requested by David Cramer.
--
View Junior Session [Sentry]