Repository navigation
feat(mcp): show compressed revision state transitions in search_timelines - #1201
Merged
Merged
Conversation
kyasbal
requested review from
K53,
RyuSA,
jyane,
kkuchima and
renamoo
as code owners
October 30, 2026 04:34
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a mechanism to summarize and compress revision state transitions for timeline tree nodes within a specified time window. It adds a new RevisionStateSummary utility that deduplicates consecutive identical states, folds tandem repeat cycles (such as container crash loops), and truncates long sequences using middle elision while preserving omitted distinct states. These summaries are integrated into the MCP timeline search tool and formatted for output. Comprehensive unit tests have been added to verify the folding, truncation, and integration logic. I have no feedback to provide as there are no review comments.
Merged
via the queue into
GoogleCloudPlatform:main
with commit Oct 30, 2026
7fae18f
17 checks passed
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.
Background
Previously, the MCP
search_timelinestool only reported raw revision counts (rev=N) and event severity totals per timeline node. Because revision state labels were only visible throughget_resource_revisions, troubleshooting agents could not tell from the timeline tree whetherrev=33meant benign metadata updates, readiness flapping, or an active crash loop without issuing follow-up RPCs for each candidate timeline.Approach
Append a compressed revision state transition summary (
states="...") to each timeline node insearch_timelineswhen the timeline carries styled revision states within the queried[startTime, endTime]window:startTimealongside revisions occurring up toendTime, skip revisions without styled state labels, and collapse consecutive revisions whose human-readable state label is unchanged.(State A -> State B -> ...) xN, selecting candidates that maximize saved display slots while preferring shorter primitive periods. This keeps common multi-step Kubernetes loops (such as 3–6 step container crash loops and endpoint readiness flapping) readable in a single line....[omitted: State X, State Y (+K more)], surfacing up to 5 distinct states that do not already appear in the prefix or suffix so transient intermediate failures remain visible.core/v1#pod, namespace headers) and event-only timelines omit thestatesattribute entirely.Validated against 3 real GKE cluster inspections (9,110 timeline nodes; 8,218 stateful timelines), 8,217 of 8,218 stateful timelines (99.99%) fit within the 14-slot budget after cycle folding without requiring middle elision.
UI / Output Changes
Sample
search_timelinestree output on a GKE inspection: