Skip to content

feat(guards): time-of-day Parakeet floor applied by the guard itself - #23601

Merged
Git-on-my-level merged 3 commits into
mainfrom
lane/guardfix3-floors
Oct 25, 2026
Merged

Git-on-my-level merged 3 commits into
mainfrom
lane/guardfix3-floors

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

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)

0-1 2-4 5-9 10-11 12-13 14-17 18-19 20-21 22-23
10 10 8 10 12 11 10 9 8

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)

  • 12-13Z = 12: floor 10 degraded both midday windows - Sunday 12:05-13:50Z p95 34.5-55.5s measured, over30 up to 6.1, including today's decisive TRIP (34.5s on 109.9 texts) that correctly rolled 10->12.
  • 22-23Z = 8: Saturday 22:30-22:45Z ran 8 actual replicas at 558-701 first texts/h with p95 12.4-13.6s (decisive CLEAN).
  • 14-17Z = 11, 18-19Z = 10, 10-11Z = 10: Saturday 14-15Z held 10 actual replicas at 521-692/h with p95 14-20s (decisive CLEAN); untested higher.
  • 5-9Z = 8, 0-4Z = 10: overnight/early quiet; hourly session counts are NOT a capacity predictor (8 pods carried 700/h at 22Z while 10 pods failed at 440/h at 13Z - the concurrent-session mix differs by hour), so quiet hours with no decisive adverse evidence get the proven-8 shape with mid margin where only floor-12 data exists.
  • Coverage caveat: GMP's mirror of the listen metrics is frozen (all-zero increases), so the trace is 10-23 15:45Z..now plus each reading's weekly same-hour baseline (10-17/18 demand). Not the full 7 days; the table is per-hour empirical from the days observed.

Mechanics

  • floorSchedule.enabled renders the reviewed 24-entry table into the guard's existing script ConfigMap as floors.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 reason batch.enabled=false in prod) accepts the upgrade. Prod overlay enables it; dev renders nothing.
  • The guard applies the hour's floor on the first reading after each hour rollover with the same atomic test-the-whole-spec JSON patch as the rollback, under the same dryRun kill switch. It defers (deferred_guard_rollback) 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: 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.
  • Review r1 P1 fix: readings while the HPA is parked above the cap now advance the arming clock (the floor is excluded from the identity), and a scheduled lower defers (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.sh with BACKEND_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.yml dispatch on main after merge, lead-approved. No floor change below 12 happens before that dispatch (the ruling's deadline).

Failure-Class: none

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.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-25T14:58:06.223906Z 3894f74 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 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':

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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.
@Git-on-my-level
Git-on-my-level merged commit aadcbae into main Oct 25, 2026
56 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/guardfix3-floors branch October 25, 2026 17:36
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.

1 participant