Repository navigation
fix(mcp-core): align search_issues period with query time windows - #2905
Open
37chengshan wants to merge 2 commits into
Open
37chengshan wants to merge 2 commits into
37chengshan wants to merge 2 commits into
Conversation
Co-Authored-By: Gemini <noreply@google.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
@37chengshan is attempting to deploy a commit to the Sentry Team on Vercel. A member of the Team first needs to authorize it. |
…iod-window # Conflicts: # packages/mcp-core/src/tools/catalog/search-issues.test.ts # packages/mcp-core/src/tools/catalog/search-issues.ts
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.
Summary
Aligns
search_issues'sstatsPeriod(period) with time-window filters present in translated or explicit issue queries (such aslastSeen:-90d,firstSeen:-60d,timestamp:-45d,event.timestamp:...,activeSince:...,age:..., and ISO-8601 timestamps) when the caller has not explicitly suppliedperiod.Closes #2843
Root Cause
search_issuesdeclaredperiodwith.default("30d")ininputSchema. Because@modelcontextprotocol/serverandprepareToolParamsapply schema defaults before invokinghandler, omittedperiodarrived as"30d", making it indistinguishable from an explicitperiod: "30d"argument."TypeError in my-service, any status, last 90 days"intoerror_type:TypeError my-service lastSeen:-90d,handlerstill forwardedstatsPeriod=30dto/api/0/organizations/{org}/issues/. Sentry intersectsstatsPeriod([now - 30d, now]) withquery, silently dropping issues whose activity fell between 30 and 90 days ago while reportingexecutedSearch.queryas... lastSeen:-90d.Changes
packages/mcp-core/src/tools/catalog/search-issues.ts:inputSchema.period.optional()(matchingsearch_events,search_errors,search_issue_events, etc.) while keeping(default: 30d)documented in the parameter description and applying the"30d"default inhandler.periodand any truncation/cap warning viaresolveIssueSearchPeriod(...)after query translation and boolean rewriting, surfacing warnings through the existingnotes: string[]field without alteringsearchIssuesOutputSchema(preserving closed-schema compatibility for cachedtools/listclients per Closed outputSchemas make every added output field break clients holding an older tools/list #2293).packages/mcp-core/src/tools/support/search-issues/period.ts:@sentry/search-syntax(lastSeen,firstSeen,age,timestamp,event.timestamp,activeSince) for both relative durations (-90d,>-60d,+60d,<-90d,-12w, etc.) and absolute ISO-8601 dates/timestamps, ignoring quoted free-text literals and negated filters.periodis omitted: default to"30d"(or Seer'sstatsPeriodrounded up to a supportedSEARCH_ISSUES_PERIOD_VALUESbucket), widen up to"90d"when the query requests a wider window, never shrink below"30d"for shorter query filters (e.g.lastSeen:-7d), and add a clear cap note innotesif the requested window exceeds"90d".periodis explicitly provided by the caller: always preserve the caller'speriod, and add an actionable note innoteswhenqueryor Seer'sstatsPeriodrequests a wider window thanperiodallows.packages/mcp-core/src/toolDefinitions.json:periodas optional.packages/mcp-core/src/tools/support/search-issues/period.test.tscovering period ceiling buckets, relative/absolute time extraction, older-than activity bounds, quoted/negated non-matches, 30d/31d/90d/>90d boundaries, and explicit vs. omittedperiod.packages/mcp-core/src/tools/catalog/search-issues.test.tscovering agent translation, direct syntax, Seerstats_period, explicit shorterperiodwarnings, >90d cap notes, and omittedperiodvs. explicitperiod: "30d"acrossInMemoryTransport.Test Plan
vitest run src/tools/support/search-issues/period.test.ts src/tools/catalog/search-issues.test.ts src/server.metadata.test.ts src/server.test.ts@sentry/mcp-coretest suite (vitest run),tsc --noEmit,oxlint,oxfmt --check,ast-grep, andvalidate-skills