Repository navigation
harden: add in-cluster Parakeet rollback and batch safety observations - #23441
Conversation
…d CronJob Port the approved atomic HPA rollback with a persisted full-window clock and blind counter; expose explicit partial batch coverage without Cloud Run IAM. Deploy independently of serving charts and verify ConfigMap logging provenance. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The enforced pre-push typecheck inherits seven unnecessary-isinstance errors from main. Describe the supported None input in turn-ref annotations, and use the dict config directly after owner() has already validated it. Keep tool RunnableConfig injection annotations and all fail-closed owner/ref checks. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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: b249a24ef9
ℹ️ 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".
| prometheusUrl: http://dev-omi-kube-prometheus-s-prometheus.dev-omi-monitoring.svc:9090 | ||
| dryRun: true | ||
| batch: | ||
| monitoringRelease: dev-omi-kube-prometheus-stack |
There was a problem hiding this comment.
Point the dev guard at the actual Prometheus release
The development monitoring stack is installed as dev-kube-prometheus-stack, whose Prometheus service is dev-kube-prometheus-stack-prometheus (also used by backend/charts/monitoring/prometheus-adapter/dev_omi_prometheus_adapter.yaml), not the dev-omi-* names configured here. Consequently every dev Prometheus request resolves to a nonexistent service, while the mismatched monitoringRelease label prevents the real Prometheus instance from selecting this PodMonitor, so development guard runs remain BLIND and cannot validate the rollout before production.
Useful? React with 👍 / 👎.
💰 Payout Details
|
Resolve dev Prometheus and PodMonitor labels from the established dev stack rather than assuming the production release prefix. Assert both environments' rendered references against adapter and Parakeet values, and select this suite when those dependencies change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5568ba1ee3
ℹ️ 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".
| 'no_text_deadline': inc( | ||
| 'omi_stt_window_session_outcome_total', | ||
| '{job="backend-listen-metrics",outcome="no_text",reason="first_text_deadline"}', | ||
| ), |
There was a problem hiding this comment.
Initialize the deadline-error series before requiring its presence
When no session has hit a first-text deadline since the listen processes started, this query returns no series rather than zero. WINDOW_SESSION_OUTCOME in backend/utils/stt/live_metrics.py has no preinitialized label children, and parakeet_window.py creates this particular child only when recording that failure. Consequently, otherwise healthy traffic produces missing_or_nonfinite_no_text_deadline on every reading and automatically rolls back after the 15-minute warmup. Initialize the bounded error-counter child in the exporter, or distinguish its legitimate absence from unavailable telemetry using independently verified scrape health.
Useful? React with 👍 / 👎.
| deployment['metadata'].get('generation'), | ||
| [c['image'] for c in deployment['spec']['template']['spec']['containers']], |
There was a problem hiding this comment.
Exclude ordinary autoscaling from the arming identity
When the Parakeet HPA changes the Deployment's replica count, Kubernetes also increments the Deployment generation, so including that generation here resets the full arming window during ordinary autoscaling even though the HPA policy and serving image are unchanged. Every such reset suppresses existing latency, scheduling, and readiness trips for another 15 minutes; repeated scaling can keep the guard in WARMUP throughout a degraded period. Identify serving changes through the pod template or another rollout-specific identity instead of the Deployment generation that also tracks replica changes.
Useful? React with 👍 / 👎.
Deployment generation changes on replica writes as well as rollouts. Exclude it from the tuning-state identity so autoscaling and scheduling shortfalls cannot perpetually restart warmup. Retain HPA spec/generation and image resets, and cover a desired-replica increase with the original 15-minute deadline. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve the two incidental typing-prerequisite conflicts using main's #23440 implementation. The final guard PR diff no longer changes retrieval behavior. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Luna P1 on #23441: source_sha pinned the chart files but not the workflow definition, so a prod dispatch from an unmerged branch could run modified auth/Helm steps. Gate the prod deploy job on refs/heads/main. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Production Parakeet rollback currently depends on the P77 laptop process surviving. Add an independent Kubernetes CronJob that can perform only the pre-approved drift-checked HPA rollback, plus a batch observer that clearly reports incomplete coverage.
Behavior and deployment
step_fast.build(old,12,True)patch/drift assertions. JSON Patch tests the entire observed/spec; sets min=12 and restoresparakeet_request_latency_p99Value=3. No serving Deployment writes.Lead dispatch after merge: workflow
gcp_incluster_guards.yml(Deploy In-cluster Safety Guards) onmain, inputsenvironment=prod,source_sha=<full merged SHA>,dry_run=false,enabled=true. Dev:environment=development, same merged SHA; workflow forces dry-run. This installs onlyprod-omi-incluster-guardsinprod-omi-backend; it never invokes the Parakeet rollout workflow. Kill switch: same dispatch withdry_run=true; remove resources withenabled=false. Inspect scheduled readings and full-window arming before retiring the P77 owner.After this exact head is merged, the lead can dispatch:
Explicit v1 blockers / lead and David asks
Batch is partial. No Prometheus metric exists for new projection obligations >15m, pinned-object custody loss or VAD-proven speech loss. Those are recorded as unavailable, never clean. Retain the P90 guard until the missing signals are implemented and verified. Queue age includes historical/deep obligations, so it is alert-only and never rolls back admission.
Alert delivery needs activation verification. Existing monitoring disables Alertmanager; Grafana owns pages. This chart emits structured JSON, failed Jobs and state annotations but cannot assert a page is delivered. The runbook includes a bounded-age failed-Job query; lead must wire/verify the Grafana route before unattended reliance. Verify live backend -> monitoring TCP/9090 network policy too; the committed policy selects only listen-edge pods.
Future Cloud Run rollback requires David's specific access approval.
batch.cloudRunRollbackEnabled=falseis reserved and fails rendering if enabled in v1; no Cloud Run read or write path exists. Proposed GSA[email protected]; on it bindroles/iam.workloadIdentityUsertoserviceAccount:based-hardware.svc.id.goog[prod-omi-backend/prod-omi-incluster-guards], then annotate only that KSA withiam.gke.io/gcp-service-account=<GSA>. Bind customprojects/based-hardware/roles/omiBatchAdmissionGuard(run.services.get,run.services.update,run.revisions.get) to the GSA on eachus-central1servicebackend,backend-sync,backend-sync-backfill,backend-integration; grantrun.operations.getvia a separate project-scoped custom role, androles/iam.serviceAccountUseronly on each actual runtime SA if required for actAs. Reads need Cloud Run IAM too. Separate metadata-read approval is needed for Firestore/GCS if the missing P90 signals are not exported first. None of these access changes is made by this PR. A follow-up must verify every traffic-serving revision, preserve unrelated config/custody/recovery, set onlyBATCH_PIPELINE_PERCENT=0, and honor the P90 fresh-state clocks.CI timing blocker: on final head
4d712a5b8a22eae0395774b5ac2428d0a1c7327e, backend shard 1 completed its assertions but failed its wall-time gate: 722s versus 720s. All other checks passed. Evidence: failed shard. No duration budget or check was weakened. A prior head also exceeded by one second and passed a failed-only rerun; this final-head timing failure remains open.The proposed identity bindings apply Google's GKE impersonation procedure and Cloud Run IAM permissions; the actual project/service bindings remain an approval-gated proposal.
Why isn't this a shared primitive instead? This is the reusable in-cluster implementation of the existing P77 process, removing laptop liveness from the rollback boundary; it does not add another developer checklist. The real instance is the 2026-10-23 P77 workloadOnly floor ramp protected by
guard_fast.py/step_fast.py. Related merged autoscaling incident: #21673 (GPU metrics were scoped to unrelated workloads). The original drift assertions protect that autoscaling boundary; we do not silently rewrite its metrics on unexpected drift.Verification
All commands run through
/Users/david/workspace/omi-workspace/bin/omi-heavy run -- ...with ambient Google/Firebase/Kubernetes credential paths unset for tests. No kubectl/helm/gcloud cluster calls, deployment, workload env reads, or production API requests were made.cd backend && .venv/bin/python -m pytest tests/unit/test_incluster_guards.py tests/unit/test_logging_entrypoint_guard.py tests/unit/test_backend_unit_selector_output.py -q— 186 passed (1.02s); production one-shot path with fake APIs, ± thresholds, low samples, blind persistence, arming resets, drift refusal, frozen P77 patch equivalence, Prometheus failures, dev/prod Helm rendering and exact RBAC/CPU placement. Monitor URLs and release labels are checked against the existing adapter and Parakeet values, including the distinct dev stack name.actionlint .github/workflows/gcp_incluster_guards.yml— passed.python3 .github/scripts/check-deployment-concurrency.py— passed (31 persistent writers).python3 .github/scripts/check_ci_budget.py --refresh— reviewed: manual-only guard deploy, zero PR runs, 5m p50, Backend infrastructure owner.make preflightwithOMI_PR_BODY_FILE=/tmp/incluster-guards-pr-body.md— 44 checks passed in 191.21s, including the mounted-script logging inventory. The normal pre-push gate also passed: 44 manifest checks (180.20s), full backend typing with 0 errors, runtime source closure, selected unit tests, and the remaining bounded hooks. Full typing reports 0 errors.Product invariants affected
Failure-Class: none
🤖 Generated with Claude Code