Skip to content

fix(mcp): Accept open-ended time ranges in search_issue_events - #2261

Merged
joshuarli merged 1 commit into
mainfrom
fix/search-issue-events-open-ended-time-range
Nov 14, 2026
Merged

joshuarli merged 1 commit into
mainfrom
fix/search-issue-events-open-ended-time-range

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

search_issue_events fails on open-ended "since X" windows such as timestamp:>=2026-11-12T06:39:00Z or "since November 12 2026 at 06:39 UTC". It returns "The AI was unable to process your query"; search_errors handles the same window fine.

Why it fails

The embedded agent's output schema (tools/support/search-issue-events/agent.ts) is stricter than its prompt:

  1. An absolute timeRange requires both start and end. A "since X" request has no natural end, and the agent doesn't know the current time.
  2. timeRange is required, but the prompt says to omit it for the default window.

If the model returns {start} only, or omits timeRange, the AI SDK raises NoObjectGeneratedError ("response did not match schema"). rescueFromText can't repair that, so the tool returns the "unable to process" error (internal/agents/callEmbeddedAgent.ts:226). Production logs show this exact error with finishReason: stop for these queries. Which of the two shapes the model produced is inferred, since the traces weren't sampled.

Change

  • In an absolute timeRange, end is optional. When it's missing, the handler runs the search until now.
  • timeRange defaults to null, meaning the default 14d window.
  • The prompt has open-ended examples and says "null" instead of "omit".

Existing outputs, whether full {start, end} or {statsPeriod}, behave as before.

Related but separate: #1215 / #1228 (caller-supplied start/end for search_events and search_issues) and #2139 / #2146 (dropped absolute bounds in runSearchEvents). Longer term, #1896 removes the embedded search agents.

via @joshuarli.

--

View Session [Sentry]

"Since X" and timestamp:>=X requests have a start but no end. The
search_issue_events agent schema required both start and end, and
required timeRange even though its prompt said to omit it for the
default window. Model outputs in either shape failed schema validation
and surfaced as "The AI was unable to process your query".

Make end optional (the handler runs the search until now) and default
timeRange to null. Update the prompt so "since" examples set only start.
@vercel

vercel Bot commented Nov 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Nov 14, 2026 1:03am UTC

Request Review

@sentry-junior
sentry-junior Bot marked this pull request as ready for review November 14, 2026 01:16
@sentry-junior
sentry-junior Bot requested a review from joshuarli November 14, 2026 01:17
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 14, 2026
@joshuarli
joshuarli merged commit f8464f8 into main Nov 14, 2026
35 checks passed
@joshuarli
joshuarli deleted the fix/search-issue-events-open-ended-time-range branch November 14, 2026 01:21

This branch was successfully deployed

1 active and 1 inactive deployments
Actions — ab2ea88b Deployed Nov 14, 2026 by sentry-junior[bot] via eval #1906
Preview — ab2ea88b Deployed Nov 13, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant