Repository navigation
fix(quic): the fetch-window prune never removes a twin a live stream holds — agent-only restarts no longer drop live twins an hour later (#1073) - #1076
Merged
Conversation
…holds — agent-only restarts no longer drop live twins an hour later (#1073) After a proxy restart every quic: twin reaches the new generation through the wildcard, with no on-demand fetch and no subscription, and carries its traffic that way. An agent-only roll then re-states those twins on the fresh stream as held-only, and the fetch-window prune ("no on-demand fetch since agent start") removed every one of them one window later: ~200 x 503 NC per burst fleet-wide on the #979 proving soak, and an Envoy SIGBUS on one node (#1074). A pair is now kept on any evidence of use, ever: a live stream's on-demand subscription (the ledger), or a confirmation -- fetched, re-subscribed, or its twin re-stated as HELD on a fresh stream while the agent serves it (ConfirmHeldQUICTwins). The confirmation is persisted (ObservedQUICPair.demand_confirmed), so a node reboot, where the fresh proxy uses twins it never fetches, does not prune them either. The window still drains pairs no generation vouched for (the #1032 fan-out, pre-#1073 pairs the proxy neither holds nor fetches). Closes #1073 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
This was referenced Sep 30, 2026
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.
Mechanism
The fetch-window prune (
--east-west-quic-pair-fetch-window, 1 h, #1033) removed every persisted pair that had "no on-demand fetch since agent start" and no live subscription. That treated "not fetched" as "not used", which is wrong for a twin the proxy already holds.quic:twin through the wildcard CDS subscription. It never fetches them and holds no ODCDS subscription for them, and carries traffic on them that way.initial_resource_versions). The agent serves them because the pairs are persisted, but it never marks them fetched or subscribed.pruned persisted east-west QUIC pairs with no on-demand fetch since agent startand CDS-removed twins that were still carrying traffic:503 NCper burst fleet-wide;QuicConnection::OnCanWriteon w01 (proxy SIGBUS (use-after-free) in QuicConnection::OnCanWrite when CDS removes a QUIC twin cluster with a live client connection (proving soak w01, 03:25:59Z) #1074).#1071's ledger was not the gap:
Subscribedalready exempted re-subscribed twins. The held-only ones are what got pruned.Fix: what "in use" means
The agent cannot see traffic. It makes no admin calls, and a held twin is never fetched again. The costs of getting it wrong are asymmetric:
So a pair is kept on any evidence of use, ever:
Ledger.Subscribed, unchanged).SnapshotCache.ConfirmHeldQUICTwins, called fromrestateTwins). A re-stated twin counts as observed at that moment.ObservedQUICPair.demand_confirmed = 4. This is an additive field and the store stays protojson. It covers a node reboot: the fresh proxy holds nothing and uses the twins without ever fetching them, and the pairs still survive the window.I chose sticky confirmation over a per-stream "held" set. The proxy keeps every twin the agent serves, so a pair re-stated as held once is held by every later generation too. A per-stream holding set would only lose that fact across a hot restart, or when an agent roll is followed by a proxy roll.
The window still drains what no generation vouched for:
A pair pruned wrongly re-fetches on its next request and comes back confirmed, so that can happen at most once per pair.
Invariants kept:
Log line changes:
pruned persisted east-west QUIC pairs with no evidence of use: never fetched, subscribed or held by the proxy ….confirmed east-west QUIC pairs the proxy holds without an on-demand subscription: never pruned by the fetch window count=N held_served=S.Tests
cache/quic_held_prune_test.go:TestQUICHeldTwinsSurviveTheFetchWindowAfterAgentRestart(the QUIC twins: one hour after an agent roll, the fetch-window prune removes twins still carrying traffic → ~200 × 503 NC fleet-wide (proving soak rev-979, 23:37Z) #1073 shape):demand_confirmedpersisted;TestQUICFetchWindowPrunesOnlyPairsWithNoEvidenceOfUse(mixed case):TestQUICHeldTwinOfAnUnknownPairConfirmsNothing.server/quic_held_prune_test.go:TestOnDemandObserver_AgentRestartKeepsHeldTwinsPastTheFetchWindowruns the real observer and cache through go-control-plane's delta server, starting from a pre-QUIC twins: one hour after an agent roll, the fetch-window prune removes twins still carrying traffic → ~200 × 503 NC fleet-wide (proving soak rev-979, 23:37Z) #1073 store. It checks that:removed_resources;Existing tests: none deleted.
TestQUICDemandPrunesPersistedPairsNotFetchedWithinTheWindowandTestQUICDemandFetchWindowZeroDisablesThePrunenow stripdemand_confirmedfrom their store, to model the #1032/pre-#1073 state they were written for. Their assertions are unchanged.Run locally, all green:
bazel test //agent/internal/xds/... //test/mtlspool:all //test/envoy_validate:allbazel test --config=race //agent/internal/xds/cache:all //agent/internal/xds/server:all //agent/internal/xds/quicdemand:allbazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //...make format-checkDocs
docs/runbook.md: the post-start prune section, the QUIC twins: one hour after an agent roll, the fetch-window prune removes twins still carrying traffic → ~200 × 503 NC fleet-wide (proving soak rev-979, 23:37Z) #1073 mechanism, and the new and renamed log lines.docs/configuration.md, the flag help, and proposal 038: the new evidence-of-use rule.e2e/soak/README.md: new gate 5 (QUIC twins: one hour after an agent roll, the fetch-window prune removes twins still carrying traffic → ~200 × 503 NC fleet-wide (proving soak rev-979, 23:37Z) #1073). It requires:503 NCoutside first use in the hour after each agent roll (T0+132, T0+360).It includes a non-vacuity check (
held_served > 0) and the red reading (feat(038): east-west QUIC is unconditional — the proving allow-list is gone #979 proving soak, 23:37Z and 03:25Z).No
charts/change.Closes #1073
🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr