Repository navigation
fix(supervisor): derive the admin re-verify interval from the effective parent-shutdown-time (#666) - #675
Merged
Conversation
…ve parent-shutdown-time (#666) The proxy supervisor's epoch-identity re-verification rode a hard-coded 15s constant whose comment justified it against the CLI default --parent-shutdown-time of 60s. As deployed, the chart sets 15s, so the constant was silently EQUAL to the window it was supposed to sit inside: zero margin. A cross-pod takeover could go undiagnosed until at or after the draining hot-restart parent had already exited. Derive it instead: budget = min(ParentShutdownTime>0 ? ParentShutdownTime : inf, adminUnresponsiveDeadline()) interval = clamp(budget/3, floor 2*readyPollInterval, ceiling 15s) Deployed (15s/30s) -> 5s; CLI defaults (60s/30s) -> 10s. The divisor puts at least two full re-verifications inside the window at worst-case phase alignment. The floor keeps the two-tier prober from degenerating into an authoritative /server_info every other tick (#646); the ceiling is the value this used to be, so no deployment gets a longer blind window. The floor makes the derivation not unconditionally safe, so Run also logs the derived interval and its inputs at INFO and flags a lost margin at ERROR. It deliberately does not refuse to start: a lost diagnostic margin must never cost the node its data plane. A new test pins the chart against the derivation by reading charts/aether/values.yaml through the real effective path, so an edit to proxy.hotRestart that breaks the margin fails in CI rather than on a node. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
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.
What was wrong
agent/internal/proxy/hotrestart/adminprobe.gobounded the liveness watchdog's epoch-identity re-verification with a hard-coded constant:The 60s in that justification is the CLI default (
agent/internal/cmd/supervisor.go). The deployed value isproxy.hotRestart.parentShutdownTime: 15s(charts/aether/values.yaml). So on every node we actually run, the re-verify interval was equal to the window it was supposed to sit inside — margin zero.That window matters (proposal 001, lessons 3 and 6): a draining hot-restart parent keeps answering
LIVEat its old epoch over an already-accepted connection for the whole--parent-shutdown-time-s. Re-verification is what notices a cross-pod takeover. At margin zero the notice lands at, or after, the parent's exit — exactly when it is no longer useful.The derivation
ParentShutdownTime <= 0means "unset, not bounding" (that is what a bareConfig{}in the probe tests means).Why N = 3.
budget/NguaranteesN-1complete re-verifications inside the window at worst-case phase alignment. N=3 buys two, plus slack — the same "a third of the staleness budget" shape used in #649. N=2 would leave exactly one, i.e. no slack for a probe that lands late; N=4+ costs CPU for no additional guarantee.Cost is not a concern at 5s. Against the #646 baseline (1 authoritative probe/s ≈ 40-45% of supervisor CPU), 5s is 0.2/s ≈ 8-9% and 15s ≈ 3% — a ~5pp delta, roughly 0.005 fleet cores and about 6x smaller than #673's readiness re-exec. And a shorter interval cannot race the handoff: a re-verify mid-handoff returns
live=false, reachable=true, which isonNotLiveEpoch— readiness held, prober goes unverified and stays authoritative until LIVE. That is the diagnosis path; entering it sooner is the point. Nothing flips readiness or signals a child.Floor =
2 * readyPollInterval(2s). Below two watchdog ticks the two-tier prober degenerates into an authoritative/server_infoevery other tick and #646's entire saving is gone.Ceiling = 15s, the value this used to be hard-coded at. Inert in practice, but it states the other half of the intent and guarantees no deployment ends up with a longer blind window than before this PR.
AdminUnresponsiveDeadlineis included in theminbut not derived fromParentShutdownTime: they guard unrelated failure modes (AUD is the wedged-main-thread-after-LIVE watchdog; a reachable admin answering at another epoch never trips it).Why the assertion logs instead of failing
Because the floor exists, the derivation is not unconditionally safe:
parentShutdownTime: 3syields the 2s floor, which does not fit three times inside 3s.checkAdminReverifyMargin()catches exactly that residual case, andRunreports it — one INFO line with the derived interval and its inputs, one ERROR line when the margin is lost.It does not refuse to start. Refusing would trade a guaranteed node data-plane outage for a diagnostic margin, which inverts this package's prime directive (keep Envoy alive);
agent/internal/cmd/supervisor.goalready treats telemetry setup failures as never-fatal for the same reason. It would also break five existing tests that legitimately runParentShutdownTime: 1sagainst a stub Envoy.The chart pin
TestAdminReverifyMarginHoldsAgainstDeployedChartValuesreads the realcharts/aether/values.yaml, extractsproxy.hotRestart.{drainTime,parentShutdownTime,adminUnresponsiveDeadline}, and feeds them through the actual effective path (New(...).adminReverifyInterval(), so a change to either the defaulting or the derivation is caught too). It assertsinterval*3 <= pst,interval < pst,interval >= 2*readyPollInterval,pst > drainTime, andcheckAdminReverifyMargin() == nil.Mechanics:
data = ["//charts/aether:values.yaml"]on thego_test(hand-added; Gazelle does not managedata), plusexports_files(["values.yaml"])incharts/aether/BUILD.bazel. The test walks parent directories for the repo-relative path, so it works identically underbazel test(runfiles) andgo test, and itt.Fatals when the file is not found — it never skips, since silently skipping is precisely the failure this test exists to prevent.Verified as a real assertion, not a no-op: temporarily setting
parentShutdownTime: 5sin the chart fails the test withA future chart edit that lowers
parentShutdownTimebelow ~6s therefore fails in CI, naming the file, the key, and the arithmetic — instead of silently costing a node its takeover diagnosis.Deliberately left alone
The CLI default (60s) still diverges from the chart (15s). Both now derive correctly, so the divergence is no longer a correctness problem, and closing it either way is a behavioural change to rollout timing that belongs in its own PR: raising the chart value linearly slows every proxy roll (
gateReadinessIfSuccessorholds successor readiness forParentShutdownTime + 3s), and lowering the CLI default changes Envoy's actual parent-shutdown protocol for anyone not using the chart.parentShutdownTimestays at 15s — this PR changes only the comment there.Verification
Note for whoever merges second
This bumps
charts/aether/Chart.yaml0.91.3→0.91.4. Another PR in flight bumps to0.92.0; whichever of the two lands second will need a re-bump.Closes #666
🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr