Skip to content

fix(supervisor): derive the admin re-verify interval from the effective parent-shutdown-time (#666) - #675

Merged
bpalermo merged 1 commit into
mainfrom
fix/666-derive-admin-reverify-interval
Sep 4, 2026
Merged

bpalermo merged 1 commit into
mainfrom
fix/666-derive-admin-reverify-interval

Conversation

@bpalermo

@bpalermo bpalermo commented Sep 4, 2026

Copy link
Copy Markdown
Owner

What was wrong

agent/internal/proxy/hotrestart/adminprobe.go bounded the liveness watchdog's epoch-identity re-verification with a hard-coded constant:

// Chosen below both ParentShutdownTime (60s ...) and defaultAdminUnresponsiveDeadline (30s).
const adminReverifyInterval = 15 * time.Second

The 60s in that justification is the CLI default (agent/internal/cmd/supervisor.go). The deployed value is proxy.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 LIVE at 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

budget   = min(ParentShutdownTime > 0 ? ParentShutdownTime : ∞, adminUnresponsiveDeadline())
interval = clamp(budget / adminReverifyDivisor, floor 2*readyPollInterval, ceiling 15s)
inputs (PST / AUD) derived interval
deployed 15s / 30s 5s
CLI defaults 60s / 30s 10s

ParentShutdownTime <= 0 means "unset, not bounding" (that is what a bare Config{} in the probe tests means).

Why N = 3. budget/N guarantees N-1 complete 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 is onNotLiveEpoch — 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_info every 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.

AdminUnresponsiveDeadline is included in the min but not derived from ParentShutdownTime: 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: 3s yields the 2s floor, which does not fit three times inside 3s. checkAdminReverifyMargin() catches exactly that residual case, and Run reports 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.go already treats telemetry setup failures as never-fatal for the same reason. It would also break five existing tests that legitimately run ParentShutdownTime: 1s against a stub Envoy.

The chart pin

TestAdminReverifyMarginHoldsAgainstDeployedChartValues reads the real charts/aether/values.yaml, extracts proxy.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 asserts interval*3 <= pst, interval < pst, interval >= 2*readyPollInterval, pst > drainTime, and checkAdminReverifyMargin() == nil.

Mechanics: data = ["//charts/aether:values.yaml"] on the go_test (hand-added; Gazelle does not manage data), plus exports_files(["values.yaml"]) in charts/aether/BUILD.bazel. The test walks parent directories for the repo-relative path, so it works identically under bazel test (runfiles) and go test, and it t.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: 5s in the chart fails the test with

"6s" is not less than or equal to "5s"
charts/aether/values.yaml: proxy.hotRestart.parentShutdownTime (5s) leaves no room for
3 re-verifications of 2s; the epoch-identity probe would not be diagnosed while the
draining parent lives

A future chart edit that lowers parentShutdownTime below ~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 (gateReadinessIfSuccessor holds successor readiness for ParentShutdownTime + 3s), and lowering the CLI default changes Envoy's actual parent-shutdown protocol for anyone not using the chart.

parentShutdownTime stays at 15s — this PR changes only the comment there.

Verification

make gazelle && make format
bazel test //agent/internal/proxy/hotrestart:hotrestart_test   PASSED (39.6s)
bazel test //charts/aether:all                                 2/2 PASSED (lint, template)
bazel build --config=lint //agent/internal/proxy/hotrestart/...  clean

Note for whoever merges second

This bumps charts/aether/Chart.yaml 0.91.3 → 0.91.4. Another PR in flight bumps to 0.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

…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
@bpalermo
bpalermo merged commit c4f0f01 into main Sep 4, 2026
16 checks passed
@bpalermo
bpalermo deleted the fix/666-derive-admin-reverify-interval branch September 4, 2026 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

adminReverifyInterval (15s) equals the deployed parentShutdownTime (15s), eroding the margin its comment claims

1 participant