Repository navigation
feat(guards): time-of-day Parakeet floor applied by the guard itself - #23601
Conversation
Lead ruling 2026-10-25 14:08Z: replace the flat floor with hourly floors derived from measured demand, keeping first_p95 under the guard threshold with headroom, with the guard still able to raise the floor. Derivation (10-23..10-25 guard trace, decisive samples only - count >= 100, p95 interpolated inside the histogram): floor 10 degraded across Sunday 12:05-13:50Z (p95 34.5-55.5s measured, over30 up to 6.1) -> 12 at 12-13Z; Saturday 22:30Z ran 8 actual replicas at 701 first texts/h with p95 12.4s -> 8 evening/overnight; Saturday 14-15Z held 10 actual replicas at 521-692/h with p95 14-20s -> 10-11 midday. Hourly session counts alone do not predict capacity (8 pods carried 700/h at 22Z while 10 pods failed at 440/h at 13Z), so the table is per-hour empirical, not a rate model. Projected ~$4.2k/mo vs ~$5.1k/mo flat 12 at the measured $0.583448/pod-hour, realized only when parakeet-pool nodes deschedule (p77 PLAN caveat). Mechanics: floorSchedule.enabled renders the reviewed 24-entry table into the guard's existing script ConfigMap as floors.json - its presence is the only switch, and no new objects are created, so the prod deployer's name-scoped RBAC (which refuses new object names, the reason batch.enabled is false there) accepts the upgrade. The guard patches spec.minReplicas on the first reading after each hour rollover using the same atomic test-the-whole-spec patch as the rollback, under the same dry-run kill switch. The schedule defers while a guard rollback is in force and never runs in the same reading as a rollback. Arming identity now excludes spec.minReplicas and the HPA generation: scheduled floor writes also bump the generation, and resetting the window on every hourly change would leave the guard in perpetual WARMUP, unable to raise the floor. Other spec changes and image changes still reset arming. Chart 0.2.2 -> 0.3.0.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bad966d6ab
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if not dry_run: | ||
| client.kube(client.path('hpa'), patch) | ||
| log('parakeet_rollback', result='dry_run' if dry_run else 'applied') | ||
| elif hpa is not None and verdict != 'BLIND': |
There was a problem hiding this comment.
Check reading health before allowing scheduled floor reductions
At the production schedule's 14:00 UTC transition from floor 12 to 11, workload_only() returns false for the existing floor, so run() assigns NOOP even when evaluate(values) reports missing telemetry or decisive regression trips. This condition then permits the schedule to lower capacity despite those unsafe readings. Reproducing with floor 12, no latency metric, and completely unavailable Parakeet samples still writes floor 11 and exits successfully. The floor-12 path also clears arming state, delaying any subsequent rollback through a fresh warmup. Gate scheduled reductions on the actual reading's health rather than merely excluding the BLIND verdict; safe upward floor changes can remain independent.
Useful? React with 👍 / 👎.
…rmup Review r1 P1: after an operator clears a rollback while minReplicas is still 12, workload_only() is false, the reading is NOOP, and no arming time accrues. A scheduled lower (e.g. to 8 at 22:00Z) then started a fresh 15-minute warmup on the next reading, during which a demand spike could degrade first-text latency without a rollback. Two changes: - Readings taken while the HPA is parked above the cap (or rolled back) now advance the arming clock: decide runs the identity/advance path for non-workload specs too. The floor is excluded from the identity, so time elapsed at floor 12 counts when the schedule drops. - apply_floor_schedule defers a LOWER (deferred_guard_not_armed) unless the persisted state matches the current spec identity and the arming window has elapsed; raises apply immediately. The higher floor holds until the guard can actually defend the lower one. Without a schedule installed, the non-workload path keeps its historical minimal form (no deployment/events reads), preserving the development NOOP guarantee. Deployment/events are only read when guarding or scheduling, and a schedule failure fails the Job (exit 2) without touching the HPA.
Review r2 P1: with the schedule enabled and the HPA parked at 12, missing or stale metrics leave the reading blind, but the parked NOOP advance passes blind=False, so the arming window elapsed and the scheduled lower proceeded on an armed-but-unmeasuring guard. Capacity stayed reduced until three post-drop blind runs accumulated toward a rollback. A lower now defers (deferred_guard_blind) unless the current reading is usable: not blind and not carrying an unmeasured regression-shaped first_p95. The higher floor holds until the guard can actually measure the fleet it is handing capacity back from. Raises still apply immediately.
What (lead ruling 2026-10-25 14:08Z)
Time-of-day Parakeet floor: hourly floors derived from measured demand that keep first_p95 under the guard threshold with headroom, with the safety guard still able to raise any hour to 12. Replaces the flat-floor question after the (correct) 13:50Z rollback to 12.
The hourly table (UTC)
232 pod-hours/day vs 288 flat-12 (80.6%). At the measured $0.583448/pod-hour (p77 billing-derived): ~$4,225/mo vs ~$5,113/mo flat 12, ~$888/mo (17%) - realized only when parakeet-pool nodes actually deschedule (p77 PLAN caveat; HPA min alone guarantees nothing).
Derivation (10-23..10-25 trace, decisive samples only: count >= 100, p95 inside the histogram)
Mechanics
floorSchedule.enabledrenders the reviewed 24-entry table into the guard's existing script ConfigMap asfloors.json; the file's presence is the schedule's only switch. No new RBAC objects - the prod deployer's name-scoped RBAC (which refuses new object names; the reasonbatch.enabled=falsein prod) accepts the upgrade. Prod overlay enables it; dev renders nothing.dryRunkill switch. It defers (deferred_guard_rollback) while a guard rollback is in force and never runs in the same reading as a rollback.spec.minReplicasand the HPA generation: hourly floor writes bump the generation, and resetting the arming window on every change would leave the guard in perpetual WARMUP, unable to raise the floor. Other spec changes and image changes still reset arming.deferred_guard_not_armed) unless the guard is armed under the current identity - so a drop can never land on a fresh 15-minute warmup during which a spike could not roll back. Raises apply immediately; the higher floor holds while deferred.Tests
backend/test.shwithBACKEND_UNIT_TEST_FILE_LIST=tests/unit/test_incluster_guards.py: 252 passed locally (+6: schedule applied/idles-at-target, never-shadows-rollback + deferral, dry-run + cap refusals, render-only-when-enabled with bad-table refusal, table shape, and the r1-P1 armed-drop chain; arming test updated: floor/generation changes no longer reset). Chart 0.2.2 -> 0.3.0.Deploy:
gcp_incluster_guards.ymldispatch on main after merge, lead-approved. No floor change below 12 happens before that dispatch (the ruling's deadline).Failure-Class: none