Skip to content

fix(agent): a listener ACK wait is for the version the agent publishes, and a proxy that states that version resolves it from the opening exchange (#1511) - #1559

Closed
bpalermo wants to merge 12 commits into
mainfrom
fix/1511-opening-exchange-resolves-listener-waits
Closed

bpalermo wants to merge 12 commits into
mainfrom
fix/1511-opening-exchange-resolves-listener-waits

Conversation

@bpalermo

@bpalermo bpalermo commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

Closes #1511

The problem

After an agent restart the proxy already holds every pod listener. It states them in the initial_resource_versions of its first Listener request, go-control-plane finds them at the version it publishes and sends nothing for them, so nothing ever acknowledges them by name. For such a listener:

  • Tracker.WaitListenerPresent ran to the caller's deadline (the CNI server's 2 s ACK wait on a pod ADD that is retried, or a pod re-added, after the restart);
  • Tracker.WaitListenerAbsent returned at once, because the new agent knew of no listener to wait for.

The change

Two things, the second forced by review of the first.

  1. The tracker keeps what the first request of a type on a stream states, and reads the first response of that type against it. A stated name that response neither adds nor removes is recorded as held, at the version stated, when the proxy ACKs the response.
  2. Presence is for a version, not for a name. The tracker records the version with every name: the one an acknowledged response carried, or the one the proxy stated. WaitListenerPresent is answered only when that is the version the agent publishes at the moment the wait looks. The node agent wires this with SetPublishedVersion(ack.SnapshotVersions(snapshotCache, node)), which reads the same per-resource version map go-control-plane computes its responses from.

Why the second: a pod's listeners are named after the pod (outbound_http_<pod>, inbound_<pod>). A same-named replacement publishes other content under a name the proxy already holds, so "the proxy stated this name" says nothing about the replacement. The same was already true on main of "the proxy once acknowledged this name" on an agent that did not restart; this change closes that too.

A rejection is read the same way: a NACK fails WaitListenerPresent only when the rejected version is the one published when the wait looks, so a predecessor's rejection or a rejected removal does not fail a replacement's wait (second Copilot round; four mutations of that rule killed). The removal wait is failed by any rejection, as before.

A tracker nobody gave a published version to (the edge agent, tests) keys presence by name as on main and reads no statement at all.

Functions touched in agent/internal/xds/ack/tracker.go: resourceState, inflightResponse, Tracker (fields), NewTracker, wait, onDeltaResponse, onDeltaRequest, onDeltaStreamClosed; new PublishedVersion, SnapshotVersions, SetPublishedVersion, atPublishedVersion, rejectedLocked, acknowledgedLocked (the two halves of onDeltaRequest, split for the complexity lint), noteRequestLocked, opensWildcard, statedHeld. One line in agent/internal/cmd/root.go wires it. No change to the CNI server or to the cache's production code.

Merged over #1528

main (with #1528, the per-cluster acknowledged-pin gauge) is merged into this branch; the function list above is from before that merge. The tracker now has one opening-statement bookkeeping, #1528's streamTypeState per (stream, type), with one field added:

Functions that changed in the merge, against main:

Function Change
resourceState + nackVersion, nackSentAt, nackAt, version, sentAt, stream, unconfirmed
streamTypeState + compared
inflightResponse + held, sentAt (versions come from #1528's added []Resource)
Tracker + clock, published
keepLocked computes held on the opening response; ticks clock and stamps sentAt
noteOpeningRequestLocked → noteRequestLocked called for every request; sets compared, clears it on a second request before the first response; what it keeps as stated is unchanged
onDeltaRequest calls noteRequestLocked first; passes the stream to resolveLocked
resolveLocked dispatches to rejectedLocked / acknowledgedLocked; nackLocked is gone (folded into rejectedLocked)
onDeltaStreamClosed forgets the version of what the stream left unanswered, wakes waiters, then tells the DeliveryObserver (still outside the lock)
wait version-aware presence and rejection, unanswered check
new PublishedVersion, SnapshotVersions, SetPublishedVersion, unansweredLocked, nackFails, answers, isClosed, atPublishedVersion, opensWildcard, statedHeld, rejectedLocked, acknowledgedLocked, unansweredForgottenLocked

Invariants the merged tracker keeps:

  1. A statement is the initial_resource_versions of the first nonce-less request of a (stream, type); it moves to the first response of the pair and is released with it, or with the stream.
  2. held = stated − added − removed of that response, with the stated versions; computed only if compared and a published version is wired; applied only on that response's ACK.
  3. Every kept response takes a tick of clock when it is sent (sentAt), so no two share one. Nothing else ticks the clock.
  4. An ACK's writes (added, removed, held) apply only if the response was sent after the one whose ACK is on record for the name (sentAt order, whatever order the answers arrive in). A recorded ACK clears a rejection only if its response was sent after the rejection arrived (nackAt). held never clears a rejection of the version it states.
  5. A rejection is always recorded, except over the rejection of a response sent later (nackSentAt). It keeps present and version.
  6. An ACK's write records the stream that made it and when its response was sent.
  7. Present = present, no unanswered response adding or removing the name on the writing stream, and version is the published one (no published version wired: any version).
  8. A rejection fails a presence wait only for the published version; the removal wait is by name and failed by any rejection.
  9. A closing stream blanks the version of what it wrote and left unanswered at another version, and wakes waiters.
  10. The published version is read only from a waiter's goroutine, never under t.mu or from a stream callback; observers are called only with t.mu released.
  11. A wait answers (success or rejection) only from a state that did not change while it read the published version; otherwise it looks again.
  12. A listener not known present whose add a closing stream left unanswered becomes present, at no version and unconfirmed: the removal wait waits, no presence wait is answered. Like the blanked version of invariant 9, it is ordered as an answer would be: it does not replace what the answer to a response sent later says, and it takes the unanswered response's sentAt (fifth and sixth Copilot rounds).
  13. A kept response wakes the waits when it is filed, as an answer and a stream close do, so invariant 11 covers a response entering flight.

Known limit, not fixed (fifth Copilot round; answered in its thread): the clock ticks in go-control-plane's response callback, on the stream's goroutine, after the cache computed the response. It orders two streams' responses by when they were written. If the older stream's goroutine is held up between taking its response and running the callback for longer than the other stream takes to be written to, answered and written to again, the order inverts and the older answer is recorded over the newer: a wait then runs to its deadline until the listener is next sent (never one answered early). Ordering by the snapshot needs the cache to give the tracker an order. The cleaner fix is state per stream instead of one per name, which removes every cross-generation rule above; that is a change of the tracker's model and its own review.

One assumption stated in the code: a request that carries a nonce before anything was seen of its type on the stream is not kept (as on main, and as #1528's tests require for a request that arrives after its stream closed). A proxy that follows the protocol cannot send one.

Mutation spot-check of the merged file (all killed): a statement resolving waits with no published version; the sequence rule dropped; the AckObserver called under the lock (the suite deadlocks); the DeliveryObserver called under the lock on close (new test); a second request leaving the statement comparable; every statement comparable; sentSeq not recorded; the unanswered response not forgotten on close; the statement not released at the first response; an older rejection replacing a newer one; the statement no longer handed to the observer (#1528's tests).

What is guaranteed, and what is inferred

Measured:

  1. The pinned proxy opens the Listener type as a wildcard subscription (resource_names_subscribe empty, nothing unsubscribed) and states every listener it holds at the version it was sent. //agent/test/mtlspool, TestReconnectingProxyStatesTheListenersItHolds.
  2. go-control-plane v0.14.0 seeds a type's subscription from the first request of the type on a stream and from no other, and computes the first wildcard response by comparing every snapshot resource with the stated version: differs or not stated → added, stated but not in the snapshot → removed. So, for a plain wildcard opening request, stated ∧ not added ∧ not removed means stated at the version of the snapshot the response was computed from. Held to the real server in stated_server_test.go.
  3. After a listener update the proxy rejected, it states the version it had before. TestReconnectingProxyStatesNoListenerVersionItWasNotSent.
  4. The version on the wire is the version the tracker reads as published, for the agent's own cache (TestAckTrackerReadsThePublishedListenerVersionFromTheCache) and against the pinned proxy (a replacement published under a held name is answered only by the ACK of the response that carries it).

Inferred from that: the proxy holds the listener at the stated version and accepted it. That is what the ACK of a response carrying the listener says, and no more.

What is not concluded:

  • that the listener has finished warming or serves. The CNI plugin's in-netns readiness probe remains the data-plane proof.
  • anything about a version other than the stated one. The snapshot moves on after the opening response is computed; the wait compares the recorded version with what is published when it looks.
  • anything when the opening response is rejected, for a subscription by name, for a first request that unsubscribes from anything (go-control-plane forgets the stated version of such a name), or when a second request of the type arrives before the first response.
  • anything from a statement whose stream closed before its ACK.

The state is per name, for the node

As on main, the tracker keeps one state per resource name, not one per stream: during a hot restart two proxy generations write it. Three rules order their answers (second review):

  • Answers are ordered by when their responses were sent (a clock that ticks on every send), not by when they arrive: a response sent later was computed from a newer snapshot. An acknowledgement (what a response added or removed, or what the proxy stated) is recorded only when its response was sent after the one whose acknowledgement is on record. (Fourth Copilot round: ordering by a counter of answers let a newer response that was answered second be discarded.) A draining generation's late ACK of an older version, or of an add, does not replace the newer version, or the removal, that the generation taking over acknowledged meanwhile. On main it did (the removal case), and the first version-keyed revision made the version case a regression: the wait then ran to its deadline for ever.
  • A rejection is always recorded (of two, the one of the response sent last), and fails the wait for the version it rejected until a proxy acknowledges a response sent after it arrived. A statement never clears a rejection of the very version it states.
  • The state is what a proxy acknowledged, not what it was last sent. The wait is not answered while the stream that wrote the state has an unanswered response adding or removing the listener, even at the published version (the agent went back to it); a stream that closes with such a response unanswered leaves the listener present at no known version, until the proxy states what it holds. Only the writing stream counts, so a draining generation that is slow to answer does not hold up the ADDs of a hot restart.

One rejection is kept per name; an older one does not replace a newer one (third Copilot round), and when rejections of two versions arrive in publication order only the later is on record.

Known limits of one state per name, stated in the code and the runbook: an answer may be one generation's (either's ACK resolves, either's NACK fails); and if a draining generation rejects a version the new one accepted and then exits, the wait for that version fails with the stale rejection until the listener is sent again.

The cases the review found

All four failed on the first version of this change; the tests are kept in stated_review_test.go.

Case Fix
A same-named replacement published after the opening ACK was answered at once presence by published version
Content republished between the opening response and its ACK presence by published version
A hot-restart parent's late opening ACK undid a removal the child had acknowledged, for good a statement does not overwrite newer state
First request subscribe ["*"], unsubscribe [L], stating L any unsubscribe on the first request: read nothing

Behaviour changes to know about

  • A pod ADD whose listener content differs from what the proxy holds under that name now waits for the acknowledgement of that content, on every agent, restarted or not.
  • A pod DEL after an agent restart now waits (bounded by the same 2 s) for the proxy to acknowledge the removal of a listener the proxy stated. That holds from the moment the proxy has ACKed its opening Listener response. A DEL that arrives earlier, while no proxy is connected or while the opening exchange is in flight, still returns at once: the removal wait is keyed by name and reads a listener it knows nothing of as absent. This change shortens that window; it does not close it.
  • aether_agent_xds_ack_wait_failures_total: {wait="present",reason="timeout"} stops counting listeners that were there all along and starts counting replacements the proxy did not acknowledge in time; {wait="absent",reason="timeout"} can count removals that went uncounted. docs/runbook.md says so.

Tests

Seen red: the six positive tests of the first version against the unchanged tracker; TestReconnectingProxyStatesTheListenersItHolds on the pinned proxy (30 s at the wait); the four review tests on the first version of this change.

Mutations of tracker.go, each against //agent/internal/xds/ack:ack_test:

Mutation Result
presence keyed by name again killed (also by the cache test)
an unpublished name counts as present killed
the removal wait made version-aware killed
held overwrites state written after the response was sent killed
held clears a rejection of the version it states killed
a NACK / an acknowledged add / an acknowledged removal does not advance the sequence (three mutations) killed
the response does not record when it was sent; the sequence never advances killed
held, an acknowledged add, or a NACK records no version (three mutations) killed
only an unsubscribe from * disqualifies the first request killed
statements read without a published version killed
SnapshotVersions reports an unversioned resource as published killed
held never applied; a second request before the first response replaces the statement; a closed stream's statements kept killed
statedHeld ignores added, or ignores removed survive, equivalent: an ACK writes the added and removed names first, and a statement does not overwrite what the same ACK just wrote

Run: bazel test --config=race on //agent/internal/xds/ack, //agent/internal/xds/cache, //agent/internal/xds/server, //agent/internal/cni/server, //agent/internal/cmd, //agent/test/mtlspool; ack_test and the pinned-proxy listener tests 50 times each; lint on the touched packages; make format-check.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

…lves its ACK wait from the opening exchange (#1511)

After an agent restart the proxy already holds every pod listener, so
go-control-plane sends nothing for them on the new stream and nothing
acknowledges them by name. WaitListenerPresent ran to its deadline for each,
and WaitListenerAbsent returned at once because the new agent knew of no
listener to wait for.

The ACK tracker now keeps the names the first request of a type on a stream
states in initial_resource_versions, and reads the first response of that type
against them: a stated name the response neither adds nor removes was stated
at exactly the version the snapshot publishes. Those names are marked present
when the proxy ACKs that response.

Nothing is concluded unless the request opens a wildcard subscription, it is
the only request of the type before the first response, and the response is
acknowledged on the same stream. A listener stated at another version is sent
and resolved only by the proxy's answer to it; a rejected opening response
resolves nothing.

Measured on the pinned proxy in //agent/test/mtlspool (lds_reconnect_test.go)
and against the real go-control-plane server in the ack package.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
Copilot AI balanced review requested due to automatic review settings October 9, 2026 17:55
@bpalermo bpalermo added enhancement New feature or request minor Low impact; fix opportunistically proxy Envoy data plane and the hot-restart supervisor labels Oct 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A DEL racing the opening ACK can still bypass the listener-removal wait.

1 open finding
What changed in this PR

Updates ACK tracking so listeners retained across agent restarts can be recognized through the opening delta-xDS exchange.

Changes:

  • Tracks resources stated in opening requests and marks them present after ACK.
  • Adds unit, server, and pinned-proxy reconnect tests.
  • Documents changed ACK-wait metrics behavior.
File Description
agent/​internal/​xds/​ack/​tracker.go Implements opening-exchange tracking.
agent/​internal/​xds/​ack/​stated_test.go Tests tracker semantics and edge cases.
agent/​internal/​xds/​ack/​stated_server_test.go Tests against the delta server and cache.
agent/​internal/​xds/​ack/​opening_test.go Extends stream-cleanup coverage.
agent/​internal/​xds/​ack/​BUILD.bazel Registers new tests and dependencies.
agent/​test/​mtlspool/​lds_reconnect_test.go Verifies behavior with the pinned proxy.
agent/​test/​mtlspool/​BUILD.bazel Adds the reconnect test source.
docs/​runbook.md Documents restart and metric behavior.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread agent/internal/xds/ack/tracker.go Resolved
… absent until the opening response is acknowledged (#1511)

Review: a DEL that arrives before the proxy has acknowledged its opening
Listener response, or before any proxy has connected, is still not waited
for. State that limit on WaitListenerAbsent and in the runbook, and hold it in
the test instead of implying the wait is unconditional.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
Copilot AI balanced review requested due to automatic review settings October 9, 2026 18:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The protocol-specific fix is narrowly scoped, carefully bounded, and comprehensively tested.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

…ot for the name (#1511)

Review of the first version of this change proved four cases where reading
the opening exchange by the listener's name answered a wait wrongly. A pod's
listeners are named after the pod, so a same-named replacement publishes other
content under a name the proxy already holds, and "the proxy stated this name"
(or, before this change, "the proxy once acknowledged this name") said nothing
about the replacement.

The tracker now records the version with the name: the version an
acknowledged response carried, or the version the proxy stated. With a
PublishedVersion (SetPublishedVersion, which the node agent wires to its
snapshot cache through SnapshotVersions), WaitListenerPresent is answered only
when that is the version published when the wait looks. Without one the
tracker keys presence by name as before and reads no statement at all.

- A replacement published after the opening ACK, or between the opening
  response and its ACK, waits for the ACK of the response that carries it.
  The same holds on an agent that did not restart.
- What a proxy stated never overwrites what any proxy acknowledged or
  rejected after the opening response was sent (a per-tracker sequence), nor
  a rejection of the very version it states. A hot-restart parent's late
  opening ACK no longer undoes a removal the child acknowledged.
- A first request that unsubscribes from anything is not read:
  go-control-plane forgets the stated version of a name it unsubscribes from.

The review's tests are kept (stated_review_test.go). The removal wait is
unchanged: it is keyed by name and reads a listener it knows nothing of as
absent.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
Copilot AI balanced review requested due to automatic review settings October 9, 2026 19:16
@bpalermo bpalermo changed the title fix(agent): a listener the proxy states at the published version resolves its ACK wait from the opening exchange (#1511) fix(agent): a listener ACK wait is for the version the agent publishes, and a proxy that states that version resolves it from the opening exchange (#1511) Oct 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A stale NACK from an older listener version can prematurely fail the wait for a same-named replacement.

1 open finding

🧠 Review effort: Balanced

Comment thread agent/internal/xds/ack/tracker.go Resolved
…it rejected (#1511)

Review: presence had become version-aware and the NACK check had not. A
rejected listener followed by a same-named replacement failed the
replacement's wait at once with the predecessor's error, and a rejected
removal failed a wait for the listener to be present.

With a PublishedVersion, a NACK fails WaitListenerPresent only when the
rejected version is the one published when the wait looks. The removal wait,
and a tracker with no PublishedVersion, are failed by any rejection as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
Copilot AI balanced review requested due to automatic review settings October 9, 2026 19:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The implementation addresses the reported stale-name behavior with comprehensive coverage of versioning, reconnects, NACKs, and concurrent streams.

1 open finding

🧠 Review effort: Balanced

…swered response makes the acknowledged version unknown (#1511)

Second review of the version-keyed listener wait. The tracker keeps one state
per name, and two proxy generations write it during a hot restart.

- An acknowledgement (added, removed, or what the proxy stated) is recorded
  only when nothing was written to the name after the response it answers
  was sent. A draining generation's late ACK of an older version erased the
  newer version the generation taking over had acknowledged, and nothing
  corrected it: every later wait for the name ran to its deadline, where main
  returned at once. The same rule keeps an older add from undoing an
  acknowledged removal (which main did too) and an older removal from undoing
  a newer add. A rejection is still always recorded.
- The state is what a proxy acknowledged, not what it was last sent. A wait
  is not answered while the stream that wrote the state has an unanswered
  response adding or removing the listener, even at the published version
  (the agent went back to it). A stream that closes with such a response
  unanswered leaves the listener present at no known version.

The review's tests are kept (stated_review2_test.go,
cache/ackpublished_race_test.go).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
Copilot AI balanced review requested due to automatic review settings October 9, 2026 20:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A later stale-version NACK can overwrite and hide an unresolved rejection of the currently published version.

1 open finding
1 resolved since last review

🧠 Review effort: Balanced

Comment thread agent/internal/xds/ack/tracker.go Resolved
…stener ACK state (#1511)

Review: one rejection is kept per name, and during a hot restart the draining
generation's NACK of an older version replaced the new generation's NACK of
the published one. The wait then ran to its deadline instead of failing with
the proxy's error. A rejection is still recorded whatever was acknowledged
since its response was sent; it is only not recorded over a rejection newer
than that response.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
Copilot AI balanced review requested due to automatic review settings October 9, 2026 20:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The concurrent, cross-generation ACK state machine is extensively tested but remains sufficiently intricate to warrant final human review.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

bpalermo and others added 2 commits October 9, 2026 18:25
…ange-resolves-listener-waits

# Conflicts:
#	agent/internal/cmd/root.go
#	agent/internal/xds/ack/opening_test.go
#	agent/internal/xds/ack/tracker.go
#	agent/internal/xds/cache/BUILD.bazel
…e the tracker's lock; comments after the merge of #1528 (#1511)

The merge commit before this one resolves the ACK tracker to one
opening-statement bookkeeping (streamTypeState): the statement goes to the
AckObserver as #1528 has it, and resolves a listener wait only when the
first response is the name-by-name comparison of it (compared) and a
published version is wired.

A stream close now also wakes waiters before it tells the DeliveryObserver;
the new test holds that the observer still runs with the lock released.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
Copilot AI balanced review requested due to automatic review settings October 9, 2026 21:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Concurrent stream responses can still discard a newer ACK or NACK, and wait evaluation can combine inconsistent state snapshots.

2 open findings

🧠 Review effort: Balanced

Comment thread agent/internal/xds/ack/tracker.go Resolved
Comment thread agent/internal/xds/ack/tracker.go Resolved
bpalermo and others added 2 commits October 9, 2026 19:10
… their responses were sent, and a wait reads state and published version together (#1511)

Review of the merged ACK tracker.

- The order between two answers was taken from a counter that advanced only
  when a response was answered, so two responses sent to two proxy
  generations before either answered carried the same value. The one sent
  the newer version, answering second, was discarded: presence stayed on the
  older version, or the rejection of the published version was dropped.
  Every kept response now takes a tick of a clock when it is sent. An
  acknowledgement is recorded when its response was sent after the one on
  record; of two rejections the one of the response sent last is kept; an
  acknowledgement clears a rejection when its response was sent after the
  rejection arrived.
- The wait reads the state under the tracker's lock and the published
  version outside it. If the state changed in between, the pair was never
  true together: the wait looks again instead of answering from it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
Copilot AI balanced review requested due to automatic review settings October 9, 2026 22:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Cross-stream response ordering and unanswered re-add handling can still leave stale listener state.

2 open findings
2 resolved since last review

🧠 Review effort: Balanced

Comment thread agent/internal/xds/ack/tracker.go Resolved
Comment thread agent/internal/xds/ack/tracker.go Resolved
…held for the removal wait (#1511)

Review: a stream that closed with the add of a listener unanswered left the
listener absent when that stream had acknowledged its removal before, or
when nothing was known of it. The proxy may have applied the add before the
answer was lost, and a pod DEL then skipped its removal wait.

Such a listener is now present at no version and marked unconfirmed: the
removal wait waits for its acknowledgement and no presence wait is answered
by it, with or without a published version. Another generation's
acknowledged removal stands, and an unanswered removal makes nothing present.

Also states, where the tracker's clock is declared, what it orders: when
responses were written to their streams, which is the order the cache
computed them in unless a stream's goroutine is held up in between.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
Copilot AI balanced review requested due to automatic review settings October 9, 2026 22:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

In-flight notification and cross-stream ordering gaps can still produce incorrect listener wait results.

2 open findings
2 resolved since last review

🧠 Review effort: Balanced

Comment thread agent/internal/xds/ack/tracker.go Resolved
Comment thread agent/internal/xds/ack/tracker.go Resolved
…what a closing stream leaves uncertain is ordered like an answer (#1511)

Review of the two rules added last.

- A wait rechecks its state only when the tracker's broadcast channel
  closed, and filing a response in flight did not close it. A response sent
  between the wait's two reads was missed. It now wakes the waits.
- A closing stream's unanswered response was kept from overriding state by
  comparing which stream wrote it. It is ordered like an answer now, by when
  the response was sent, and the uncertainty takes that place in the order:
  another generation's later answer stands, an earlier one does not hide the
  add that may have been applied, and an older ACK arriving late does not
  settle it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
Copilot AI balanced review requested due to automatic review settings October 9, 2026 23:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A concurrent snapshot update can make one wait combine two published versions and return a stale NACK.

1 open finding
2 resolved since last review

🧠 Review effort: Balanced

Comment on lines +390 to +391
failed := st.nackFails(wantPresent, published, typeURL, name)
answered := st.answers(wantPresent, unanswered, published, typeURL, name)
@bpalermo

Copy link
Copy Markdown
Owner Author

Superseded by #1624 (a per-stream ACK tracker), closed on the owner's decision. The branch is kept so #1624 can take its tests.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request minor Low impact; fix opportunistically proxy Envoy data plane and the hot-restart supervisor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

agent: listener waits matched by initial_resource_versions run to their deadline though the opening exchange could resolve them

2 participants