Skip to content

Structured searches that skip the agent report the whole period instead of the query's timestamp window #2465

Open

Description

@sentry-junior

Reports: 1 (MCP-SERVER-GTP)

When search_logs / search_errors / search_traces get a structured query with an explicit dataset, fields and sort, the handler skips the embedded agent and sends only statsPeriod (packages/mcp-core/src/tools/support/search-events/search.ts:1016 on main @ fc117c37: timeParams = { statsPeriod: params.period ?? "14d" }). If the query itself names an absolute window with timestamp:>= / timestamp:<, Sentry still applies those bounds, so the rows are right. But the executed search reports statsPeriod: "7d" with start/end null ("Time range: Last 7d").

The same window through the agent path reports start/end, because the agent moves the bounds into timeRange. So samples and aggregates over one window describe it two ways, and an automated caller can't confirm which window an aggregate covered.

Evidence (MCP-SERVER-GTP, opencode, server 0.42.0)

  • Sample call, agent path: the final /events/ request sent the query's timestamp:>=…Z timestamp:<…Z bounds and start/end set to the same 15-minute window.
  • Aggregate call about 3 minutes later, with explicit fields and sort=-count(message): no agent spans. The /events/ request kept the same timestamp: bounds in query but sent statsPeriod=7d and no start/end.

Fix: on the no-agent path, narrow the period to the query's top-level timestamp: bounds, the same way the agent path narrows it to the agent's range (#2146). Draft PR to follow.

via automation evt_905b9c478746fd9deeb853f85ad7441b · Run ID dispatch_b2d88ec2d0f24acdeb3743666e8717ab.

--

View Session [Sentry]

Activity

  1. linear-code commented on Nov 22, 2026

    @linear-code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions