[Alerting V2] Agent Builder: get_rule_events tool for episode attachments - #288638
Merged
ana-davydova merged 11 commits intoSep 15, 2026
Merged
Conversation
Contributor
PR size reminderThis PR has 820 added lines of reviewable code, which is above the 500-line guideline for Nightshift PRs. Large PRs get significantly less review engagement and take longer to merge. Consider splitting this into smaller, focused PRs before requesting review. |
elastic-vault-github-plugin-prod
Bot
requested a review
from a team
as a code owner
September 2, 2026 12:58
ana-davydova
marked this pull request as draft
September 2, 2026 13:00
ana-davydova
marked this pull request as ready for review
September 2, 2026 14:26
…ns parsed JSON arrays, tests covered, start/end pair is a Zod .refine()
dmlemeshko
approved these changes
Sep 3, 2026
dmlemeshko
left a comment
Contributor
There was a problem hiding this comment.
src/platform/test/tsconfig.json changes lgtm
Contributor
💛 Build succeeded, but was flaky
Failed CI Steps
Metrics [docs]Async chunks
History
|
miguelmartin-elastic
approved these changes
Sep 15, 2026
miguelmartin-elastic
left a comment
Contributor
There was a problem hiding this comment.
LGTM! Thanks for addressing the comments
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
Adds an attachment-scoped
get_rule_eventstool so Agent Builder can fetch.rule-eventsrows for an attached platform alert episode (breaches, recoveries, timing) without stuffing the full timeline into the snapshot.Fetch path:
get_rule_events→EpisodesClient.getEvents→ sharedbuildEpisodeEventsQuery(same query as the episode details timeline).platform.alerting.get_rule_events.{attachmentId}start/end(together) to narrow@timestamp, optionalstatusfor lifecycle (inactive|pending|active|recovering){ events, count, truncated }—datais kept and parsed to an object; at most 100 rows (LIMIT 101, return 100);truncatedis true only when more than 100 rows exist@timestamp,episode.id,episode.status,rule.id,group_hash,severity,source,data(sourceadded to the shared KEEP; no evaluationstatus/type)Closes elastic/rna-program#938 (parent elastic/rna-program#712).
Test plan
episode_events_query,episodes_client,get_rule_events,episode_attachment_typeget_rule_eventsis listed next torefresh_episodeandget_rule{}and confirm events for that episode (oldest first), with objectdataandtruncated: falsewhen under 100 rowsstart/endtogether and confirm the window is applied; passing only one returns an errorstatus: "active"(notepisode.status) and confirm the lifecycle filter is appliedget()failures logAGENT_BUILDER_EPISODE_LOOKUP_FAILEDseparately fromGET_RULE_EVENTS_FAILED