Repository navigation
Alert on API request storms; stop fleet /v1/health probe - #21299
Conversation
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: cd45841f63
ℹ️ 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".
| "mimeType": "text/markdown" | ||
| }, | ||
| "enabled": true, | ||
| "combiner": "AND", |
There was a problem hiding this comment.
Collapse the thresholds into a single alert condition
When the sustained 409 ratio and volume floor are both met in the production policy provisioned by gcp_backend.yml, this AND policy has two qualifying time series. Cloud Monitoring documents that for a multi-condition policy using “All conditions are met,” it creates an alert and sends a notification for each qualifying time series, so one request storm can produce two incidents/pages through the same channels rather than the single page described by the runbook. Express the ratio and volume test as one query-based condition, or otherwise account for the duplicate notifications. Cloud Monitoring multi-condition behavior
Useful? React with 👍 / 👎.
| STORM_POLICIES="$(python3 "$DEPLOY_WORKFLOW_ROOT/.github/scripts/ensure_request_storm_alerts.py" \ | ||
| --project "$PROJECT_ID" \ | ||
| --notification-channels "$ALERT_CHANNELS")" |
There was a problem hiding this comment.
Provision storm alerts independently of the route alert
If ensure_backend_route_5xx_alert.py exits nonzero for a route-specific problem such as log-metric propagation or policy-shape drift, the step's set -e stops execution before this new command runs. Because the workflow marks the whole step continue-on-error, the deployment then completes while neither request-storm policy is provisioned, leaving the monitoring added by this change absent until a later successful production deploy. Run the two reconcilers independently and report their statuses separately.
Useful? React with 👍 / 👎.
| if not start <= time < end: | ||
| continue |
There was a problem hiding this comment.
Carry dwell state across replay window boundaries
When a threshold-violating run starts before start and continues into the selected or predefined window, these skipped samples discard the policy's existing dwell state. first_fire therefore reports a fire one full duration late, or none for a shorter window, even though the live Monitoring condition could already be met at the boundary. This affects both arbitrary --start/--end measurements and the adjacent baseline/incident/post-fix tables; include a duration-sized lookback or seed the state from earlier points before restricting reported timestamps.
Useful? React with 👍 / 👎.
…tion The spine C3 conversation test constructs CaptureProvider before Env.init, so eagerly reading Env.apiBaseUrl threw LateInitializationError. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Change
The October 7 mobile sync poll storm returned sustained edge 429s and duplicate-upload
409s without paging. Stop production API health probes, add deploy-managed 429
and 409-share alerts, and sample mobile 429s through existing AnalyticsManager /
PostHog with allowlisted templates and a five-minute process-local event limit.
Production internet detection accepts either Cloudflare or Apple captive.apple.com HEAD success.
Non-production profiles and capture qualification use only their configured backend
health probe, so public internet cannot mask a failed private fixture. An accidental
api.omi.me override never reintroduces the periodic production API probe.
The edge alert is above 2,000/min for 30 minutes (2.08x observed baseline peak).
The sync policy uses the same five-minute ALIGN_SUM counts as the replay: 409 share
above 10% AND total count above 100, both for one hour. Read-before-write
reconciliation preserves condition identities when adding the volume floor and
does no write on unchanged deploys.
UI-Evidence: none
Failure-Class: none
Line-Count-Exception: app/lib/backend/http/shared.dart | 1241 -> 1244 | Add the shared 429 observer import and observe both dedicated multipart attempts; telemetry implementation remains in its own bounded module.
Product invariants affected
No UI strings changed, so no l10n edits are needed. A user-facing mobile changelog
fragment covers the offline-detection behavior. Backend routes and Cloud Armor
are unchanged.
Threshold replay
Exactly 21 days of refreshed ro-prod aggregate Monitoring REST history:
Sep 21 04:00–Oct 12 04:00 UTC. No production policy was mutated.
The >100-request floor is below the baseline median of 217/five minutes; all
incident/post-fix buckets clear it. The first-alert hour has 1,269–2,111 requests
per bucket, so the floor does not delay incident detection.
The first-alert values are five-minute sampled eligibility estimates. Monitoring
slides alignment windows at evaluator time; the revised 300s ratio policy and
replay share the same sums, with no reconstructed rolling-hour statistic.
Unsampled intra-bucket dips or ingestion/evaluator delay can shift live timing.
The 10% 409 threshold cannot page October 7: that day's share was only 0.93%.
Edge throttling meets the October 7 evening detection objective. Post-fix fleet
edge traffic still contains old-build storms; healthy post-adoption behavior
has not been observed.
See backend/docs/runbooks/request-storm-alerts.md for the complete thresholds,
measurement approach, volume-floor semantics, policy documentation, package
source verification and telemetry exclusions. Raw auth/token, dedicated
audio-download/custom-STT clients and WebSocket handshakes remain outside the
shared HTTP telemetry hook, including official-host raw requests.
Verification
From app/:
flutter test test/unit/connectivity_probe_test.dart test/unit/api_edge_throttle_telemetry_test.dart test/services/capture/capture_coordinator_test.dart test/unit/env_test.dart: 111 passed.From app/:
flutter test test/unit/batch_recording_phone_test.dart test/unit/batch_recording_test.dart: 30 passed.From app/:
bash scripts/analyze_ratchet.sh: passed; baseline unchanged.python3 .github/scripts/test_ensure_request_storm_alerts.py: 12 passed.python3 .github/scripts/test_ensure_monitoring_metric_alert_policy.py: 4 passed.python3 .github/scripts/test_ensure_backend_route_5xx_alert.py: 36 passed.python3 .github/scripts/test_ensure_firestore_missing_index_alert.py: 8 passed.bash backend/scripts/measure-request-storm-alerts.sh 2026-09-21T04:00:00Z 2026-10-12T04:00:00Z /tmp/omi-storm-alerts/history-round2: read-only 21-day REST history query succeeded.python3 .github/scripts/replay_request_storm_alerts.py --edge /tmp/omi-storm-alerts/history-round2/edge.json --sync /tmp/omi-storm-alerts/history-round2/sync.json: reproduced the updated table.scripts/pr-preflight --suggest --lane local: required metadata captured above.OMI_PR_BODY_FILE=/tmp/omi-storm-alerts/PR_NOTES.md make preflight: 43 checks passed in 88.15s.scripts/pr-preflight --pr-body-file /tmp/omi-storm-alerts/PR_NOTES.md: 43 checks passed on committed HEAD b150297 (143.88s).actionlint .github/workflows/gcp_backend.yml: passed.The six connectivity tests invoke the real internet_connection_checker_plus
2.7.2 through a mocked HTTP client, verify HEAD and exactly-200 success, prove
any-host success, and feed all failed probes into the production capture
reducer, which selects batch phase/session/start effects. An Apple captive.apple.com
unauthenticated HEAD returned 200 from this validation machine; geographic
reachability inside China, physical-device capture, live analytics, actual
Monitoring incident timing, production policy application and notifications
were not verified. Full mobile/backend suites were not rerun in round 2.
Follow-up to #21206.
🤖 Generated with Claude Code