fix(query_incidents): make the since/until time window optional#67
Merged
Conversation
"Find current open incidents" with no time window is a common, reasonable ask, but query_incidents hard-required both since and until and rejected it with "both since and until are required" (a failure mode the code itself flagged in a comment). Now: both omitted -> default to the last 30 days (under the backend's 31-day span cap); only `until` given -> still errors; a bare `since` keeps the existing "until defaults to now" behavior. The shared validateTimeWindow is unchanged, so query_changes is unaffected.
The per-tool since/until descriptions duplicated the whole shared date-format guidance just to prepend OPTIONAL, which would drift from SinceDescription/UntilDescription over time. The only tool-specific fact is the both-omitted 30-day default, so compose incidentSinceDescription from the shared SinceDescription + that one sentence, and revert until to the shared WithUntil() (it already documents its now default). Behavior is unchanged; the handler default is what actually fixes the bug.
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.
Why
In prod AI-SRE session
sess_f2NLHa2qUpTnUnJRJmSMp3the agent asked our official MCP for current severe incidents (severity + progress, no time window) andquery_incidentsrejected it withboth since and until are required— a failure mode the code itself flagged in a comment. "Find current open incidents" with no window is a common, reasonable ask and shouldn't error.What
DefaultIncidentWindow), comfortably under the backend's 31-day span cap.untilgiven (sinceomitted) → still errors, fast, without hitting the backend — a one-sided window is a real mistake, not something to paper over by inventing asince.since→ unchanged:untilkeeps defaulting to "now".validateTimeWindowis untouched, soquery_changesand other callers are unaffected. The per-tool description documents the 30-day default.Tests
TestQueryIncidentsDefaultsWindowWhenOmitted— the exact reported case (severity + progress, no window) now succeeds with a ~30d window insideMaxTimeWindow.TestQueryIncidentsOnlyUntilErrors— one-sided window still errors, no backend call.TestQueryIncidentsBareSinceDefaultsUntilToNow— baresincestill works.go build ./...clean; allQueryIncidentstests green.Companion PRs (same incident)
EOF(fix/envd-cwd-and-write-eof→main).fix/cloud-workspace-root→feat/ai-sre).