Fix load governor startup refusal and drill issues from the first dev run
Foundation / checks (deploy) (push) Successful in 3m24s
Foundation / checks (ecs) (push) Successful in 2m0s
Foundation / checks (client) (push) Successful in 12m24s
Foundation / checks (network) (push) Successful in 13m35s
Foundation / checks (tsan) (push) Successful in 7m58s
Foundation / checks (checks) (push) Successful in 32m32s
Foundation / checks (postgres) (push) Successful in 45m25s
Foundation / postgres-tools (push) Successful in 17s
Foundation / image (push) Successful in 2m32s
Foundation / server-image (push) Successful in 4m15s

ADR-0097. The first evolution-dev load drill (image 6c96629e) did not
measure capacity: the governor refused six seconds after the restart with
no session (p95 over a window of only startup ticks), and the bots spent
their grants retrying every 2 s. Reference numbers with one session: tick
work p95 4.0 ms with 33 ms spikes, session layer p95 0.68 ms.

- The governor acts on work only over a full 40-tick window; tick debt
  still counts at once.
- evo-load backs off 10 s after a load refusal and, in bundle mode,
  reuses the grant the region refused before using it.
- The drill waits for a calm load-report before the bots start, takes the
  drill pod's whole log before restoring (the live follow died), and
  confirms the restore against a pod other than the drill pod.

Refreshes the dev session window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-08 11:01:02 -04:00
co-authored by Claude Opus 5.5
parent 9b868b3ae2
commit d173f076ea
7 changed files with 120 additions and 21 deletions
+23 -12
View File
@@ -15,9 +15,10 @@
#
# Steps: refuse unless the session window outlasts the drill; enable synthetic inputs on
# evo-region (the drill-time override of ADR-0073, never committed) and wait for the new
# pod to be Ready; follow its log with timestamps (the server prints `m10 load-report`
# every 10 s); run evo-load through the public route; then restore REGION_INPUTS to the Git
# value (also on failure) so Argo returns to Synced. The report matches each step's hold
# pod to be Ready and for a calm `m10 load-report` (the server prints one every 10 s; the
# governor acts on a full 40-tick window); run evo-load through the public route; take the
# drill pod's whole log with timestamps; then restore REGION_INPUTS to the Git value (also
# on failure) and wait for a Ready pod other than the drill pod, so Argo returns to Synced. The report matches each step's hold
# (evo-load's hold_utc) with the server's reports in it and prints, per step, the client
# verdict and the server's worst tick work, session work, governor state and tick debt.
# Stage and World0 are never touched: the namespace is fixed.
@@ -55,7 +56,7 @@ command -v "$tool" > /dev/null || [ -x "$tool" ] || { echo "evo-load not found (
selector=app.kubernetes.io/name=evo-region
work="$(mktemp -d)"
chmod 700 "$work"
follow_pid=""
drill_pod=""
say() { echo "$(date -u +%H:%M:%S) $*"; }
fail() { say "FAIL $*"; exit 1; }
env_of() {
@@ -77,12 +78,14 @@ ready_pod() { # Waits up to $2 seconds for a Ready pod other than $1.
}
restore() {
set +e
[ -n "$follow_pid" ] && kill "$follow_pid" 2> /dev/null
say "restoring the Git configuration of evo-region (REGION_INPUTS empty)"
local current
current="$("${k[@]}" get pods -n "$ns" -l "$selector" -o jsonpath='{.items[0].metadata.name}' 2> /dev/null)"
"${k[@]}" set env -n "$ns" deployment/evo-region REGION_INPUTS= > /dev/null
ready_pod "$current" 240 > /dev/null && say "restored: evo-region Ready" || say "WARN evo-region not Ready after restore"
# Ready means a pod other than the drill's, i.e. the restored configuration.
ready_pod "${drill_pod:-none}" 240 > /dev/null && say "restored: evo-region Ready" ||
say "WARN evo-region not Ready after restore"
[ "$("${k[@]}" get deployment -n "$ns" evo-region \
-o jsonpath='{.spec.template.spec.containers[0].env[?(@.name=="REGION_INPUTS")].value}')" = "" ] ||
say "WARN REGION_INPUTS is not empty after restore"
say "drill files kept in $work"
}
@@ -108,10 +111,16 @@ before="$("${k[@]}" get pods -n "$ns" -l "$selector" -o jsonpath='{.items[0].met
say "enabling synthetic inputs in $ns (drill-time override, restored on exit)"
"${k[@]}" set env -n "$ns" deployment/evo-region REGION_INPUTS=development-v1 > /dev/null
pod="$(ready_pod "$before" 240)" || fail "no Ready evo-region pod with synthetic inputs"
"${k[@]}" logs -n "$ns" -f --timestamps "$pod" > "$work/server.log" 2> /dev/null &
follow_pid=$!
sleep 5
grep -q "ready 1" "$work/server.log" || say "WARN no 'ready 1' in the server log yet"
drill_pod="$pod"
# Warm up: wait for a full governor window and a calm report (refusing=0 shed=0).
calm=""
for _ in $(seq 1 60); do
sleep 3
last="$("${k[@]}" logs -n "$ns" --since=15s "$pod" 2> /dev/null | grep "m10 load-report" | tail -1)"
case "$last" in *"refusing=0 shed=0"*) calm=1; break ;; esac
done
[ -n "$calm" ] || fail "the region did not report calm within 3 minutes of starting: $last"
say "region calm: $last"
say "running evo-load against $connect"
set +e
"$tool" --connect "$connect" --server-name "$server_name" --ca "$tokens/dev-ca.pem" \
@@ -121,6 +130,8 @@ set +e
load_exit=$?
set -e
sleep 12 # One more server report after the last hold.
"${k[@]}" logs -n "$ns" --timestamps "$pod" > "$work/server.log" 2> /dev/null ||
say "WARN could not read the drill pod's log"
grep -E "^load (step|response_ms|outcome_ms|snapshots|starved|verdict|result)" "$work/load.log" || true
[ "$load_exit" = 0 ] || say "WARN evo-load exited $load_exit (see $work/load.log)"
"$py" - "$work/load.log" "$work/server.log" <<'PY'