Repository navigation
fix(agent): a snapshot whose set returned an error is reported as the one served, and a removed cluster's record is kept by time as well as by builds (#1549, #1551, #1550, #1563) - #1608
Merged
Conversation
… one served, and the record of a removed cluster is kept by time as well as by builds (#1549, #1551, #1550, #1563) generateSnapshot treated an error from SetSnapshot as "not set". The pinned go-control-plane (v0.14.0) stores the snapshot first and can fail only afterwards, while answering the watches that were open, so the snapshot is served. The published pin gauge, its WARN and counter, and the outbound and inbound identity-binding lines now run whatever SetSnapshot returned. The error is logged under its own message and returned with its own text. The acknowledged pin state kept the record of an entry that left the snapshot for three builds. It is now also kept for one minute from the first build without the entry, however many builds run, for at most 1,024 such records. Docs: two alert annotations no longer read "1 mesh cluster entries", and the statements that CI does not run the rule tests are removed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
There was a problem hiding this comment.
🟡 Changes recommended
Binding reports can describe the wrong snapshot, and answer paths can bypass the new memory cap.
2 open findings
What changed in this PR
Fixes snapshot reporting after SetSnapshot errors, extends removed-cluster ACK tracking by time, and updates observability documentation.
Changes:
- Reports installed snapshots even when open-watch delivery fails.
- Adds a capped one-minute retention window for removed cluster records.
- Corrects alert annotations and promtool documentation.
| File | Description |
|---|---|
agent/internal/xds/cache/snapshot.go |
Handles post-install watch errors. |
agent/internal/xds/cache/ackedpins.go |
Adds time-based record retention. |
agent/internal/xds/cache/ackedpins_test.go |
Tests snapshot errors and retention. |
docs/runbook.md |
Documents updated behavior. |
docs/observability/README.md |
Corrects rule-test instructions. |
docs/observability/agent-pin-alerts.yml |
Improves alert wording and test notes. |
docs/observability/agent-pin-alerts_test.yml |
Updates expected annotations. |
docs/observability/registrar-alerts.yml |
Corrects promtool CI documentation. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…say what the binding logs read (review round 1) An answer that released a record inside goneAge kept it by age whatever the number of such records, until the next build. Every path that can leave a record with only its age to keep it now asks the same question the build asks. The comment in generateSnapshot said the report after SetSnapshot describes the snapshot the cache serves. That holds for the pin report; the two binding logs read the cache's maps when they run, on the error path as on the other. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
This was referenced Oct 9, 2026
…d 2) The comment on maxAgedRecords and the runbook said an answer drops a released record "while there are that many". byAgeLocked keeps a record by age with exactly maxAgedRecords such records and stops above that; both say so now. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
…into fix/acked-pin-followups
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.


Closes #1549
Closes #1551
Closes #1550
Closes #1563
Four follow-ups to #1528, based on
77f9e8b7.#1549: a snapshot whose set returned an error is the one served
Checked in the module source (
go-control-planev0.14.0,pkg/cache/v3/simple.go):SetSnapshotstores the snapshot as its first step. It can return an error only after that, from answering the watches that were open:respondandrespondDeltareturncontext.Canceledwhen the contextSetSnapshotwas called with ends before the watch's channel takes the response. Its other error, building the version map, cannot happen for a snapshot whose mapfillVersionMapalready built (ConstructVersionMapreturns at once on a non-nil map).generateSnapshotreturned on that error before the report of the snapshot. Now, whateverSetSnapshotreturned:logIdentityBindings,logInboundIdentityBindingsandreportClusterPins(the published gauge, its WARN and its counter) run, with the version of the installed snapshot. The pin report is of the build's own read of the cluster map. The two binding logs read the cache's maps when they run, on this path as after aSetSnapshotthat returned nil, so a change a mutator made since the build read them is named under this version; aSetSnapshotthat waits on a watch makes that window longer (review round 1, not changed here).snapshot installed, but an open watch was not answered from it, and is still returned, assnapshot <v> is installed, but an open watch was not answered from it: …instead offailed to set snapshot: …. Callers, theGeneratedmetric and the span see an error as before.Before, the skipped lines and the gauge were made up for by the next build, under that build's version.
Not changed: an open watch that was not answered stays open. It is answered by a later
SetSnapshotunless its stream replaces or cancels it first.#1551: the record of a removed cluster is kept by time as well as by builds
The record of an entry that left the snapshot was dropped by the third build without it. The step it has to cover, from go-control-plane building a response to the stream writing it, is a wait in the stream's channel, and the number of builds in that wait depends on how fast the node changes.
The record is now kept while either fewer than three builds without the entry have run (
goneBuilds, unchanged) or less than one minute has passed since the first of them (goneAge). It is dropped by the first build after both, or by a later answer about that cluster.maxAgedRecords). A build that finds more keeps none of them by age, and they fall back to the build bound for that build; an answer that releases a record while there are more than 1,024 of them, that one counted, does not keep it by age either (review round 1). The bound is inclusive: with exactly 1,024 the age bound applies (review round 2). So at most 1,024 records are kept by age alone at any time. They stay until the first build, or answer about them, after the minute has passed.ackedPins.now, nil istime.Now); the tests move it by hand.The new bound. The ACK of a cluster is still not counted when its response is written after the record was dropped: later than three builds without the entry and later than one minute after the first of them, or earlier than the minute when more than 1,024 such records were being kept. As before, the proxy's next opening statement names such a cluster. go-control-plane still has no "a response was built" hook, so this is a bound and not a guarantee.
Not changed: the same step for a cluster that is rebuilt instead of removed is still bounded by a count (
offeredVersions, three versions).#1550, #1563: docs
AetherMeshClusterUnpinnedandAetherMeshClusterPinPendingdescriptions) are reworded so that the number is not the subject of a sentence. The four expected annotations inagent-pin-alerts_test.ymlfollow.agent-pin-alerts.yml,registrar-alerts.ymland the README no longer say this repository has no promtool or that CI does not run the rule test. They name//:observability_rules_test. Forregistrar-alerts.ymlthe comment says what that target does for it:promtool check rules, and no unit test here. In the README I found one such statement (and a barepromtoolcommand beside it), not the two the issue mentions.docs/runbook.md: the two points above, in "The unpinned-cluster signal".Contract
The external-harness contract does not change (
versionstays 2, no entry edited).agent.snapshot_tls_clusterspromises "every series is written on every snapshot, zeros included". agent: a SetSnapshot error is treated as "not set" although the snapshot is installed and served #1549 is a bug fix inside that promise: a snapshot that is installed and served had no write.agent.xds_acked_tls_clusterspromises that each cluster is counted at the version the proxy last acknowledged. agent: the acknowledged-pin gauge misses a cluster whose response waits more than two builds between being built and being written #1551 narrows a case in which the agent fell short of that; no series is written or absent under a condition the entry does not already state.Red, then green
Seen failing before the fix, with only the new names added so that the test compiles:
TestASnapshotWhoseSetReturnedAnErrorIsReportedAsTheOneServed: the published gauge still showed the previous snapshot (0 unpinned, expected 1), and no line named the unpinned cluster. The test stops there, so the binding-line assertions were first seen failing in the mutation run below.TestAckedPinGaugeCountsAClusterWhoseResponseWaitedManyBuildsToBeWritten: 0 unpinned where the proxy had accepted one.TestAckedPinsKeepAGoneClusterForAWhile(three of its cases) andTestAckedPinsKeptByAgeAreCapped("at the cap").Mutations, one at a time, each caught and reverted:
TestASnapshotWhoseSetReturnedAnError…(the last also byTestAckedPinsKnowASnapshotWhoseSetReturnedAnError)TestAckedPinsKeepAGoneClusterForAWhile(the second also by nine others)…ForAWhile,…WaitedManyBuildsToBeWrittenTestAckedPinsKeptByAgeAreCapped…ForAWhile(the last two survived at first; two cases were added for them)With the change:
//agent/internal/...,//:observability_rules_testand//test/harnesscontract/...pass;--config=race --build_tests_onlypasses on//agent/internal/xds/cache:all; the new and changed tests pass 50 runs; lint withfail_on_violationon the package andmake format-checkare clean.Review round 1
Two threads on
f631e73d, answered in679b8aad, both resolved.goneAge, was kept by age whatever the number of such records. The three answer paths now ask what the build asks (byAgeLocked).TestAckedPinsKeptByAgeAreCappedWithoutABuildcovers each path; four more mutations (each path ignoring the cap, the build not recording its count), caught and reverted.listener.go. The comment ingenerateSnapshotclaimed more than that and is corrected.Review round 2
Two threads on
679b8aad, one point, answered in the head commit: the comment onmaxAgedRecordsand the runbook said an answer drops a released record "while there are that many", which read as "at 1,024". The cap is inclusive (byAgeLockedis<=, and "at the cap" keeps all 1,024); both now say "more than 1,024, the released one counted". No code change.origin/mainis merged in.Tests of #1528 whose setup changed
The window is now two bounds, so tests that built past it move the clock too. No assertion was removed.
buildPastTheGoneWindowmoves the acknowledged state's clock on bygoneAgebefore its builds.TestAckedPinsAreBoundedByTheClusters,TestAckedPinsKeepAGoneClusterForAFewBuilds,TestAckedPinsStatedClustersWithNoRecord: a hand-moved clock, builds onegoneAgeapart, same assertions.TestAckedPinGaugeKeepsAClusterWhoseRemovalWasRejected: its last assertion (the record is gone once the removal is accepted) now builds past the window first.Not verified
agent/internal/xds/ack/tracker.gois not touched.🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr