Skip to content

fix(cloud): recalibrate the relay monitor's postgres-retry freeze to a measured bar - #18580

Merged
Jinwoo-H merged 1 commit into
mainfrom
relay-monitor-retries-bar
Sep 4, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
relay-monitor-retries-bar

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​11 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​5
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​30 $\color{#cf222e}{\Huge{\mathbf{−}}}$​7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​23

ELI5

Before any production cell roll, a 15-minute health check has to pass. One rule says "no more than 300 database lock retries per five minutes". The relay's shared lock is now busy enough that the healthy fleet does 400–1,500 retries per five minutes all day, so the check fails and nobody can roll the cells. The cell roll is the thing that makes the lock less busy (and stops a crash that drops ~800 desktops at a time). This PR sets the rule to a number the healthy fleet stays under, while the other rules keep catching real incidents.

What Changed

  • cloud/apps/relay-ops/src/incident-monitor.ts: relayPostgresRetries 300 → 2000 per five minutes, with the measurement basis in the comment.
  • cloud/apps/relay-ops/src/incident-monitor.test.ts: the "301 freezes with threshold 300" test becomes "1504 is green, 2001 freezes with threshold 2000". Reverting the constant to 300 fails it (checked).
  • cloud/docs/relay-incident-monitor.md: threshold table row and an implementation-log entry with the basis.

Only the monitor is affected. Terraform alerts do not use this signal (relay-observability.tf alerts on exhausted retries and pool pressure, not on postgres_retries).

Why

Follow-up to #18569, which recalibrated the exhausted-retry bar. The very next dry-runs froze on this one instead:

run mode result
33836470590 dry-run froze min 5: relay.postgres_retries 380
33837160275 dry-run froze min 13: director.concurrency 76.7 (six-cell crash storm, real)
33838698725 dry-run froze min 3: relay.postgres_retries 339, quiet window

Measured from the orca_relay_postgres_retries log metric (director + cells, summed per five minutes):

window p50 p90 p99 max > 300
2026-09-01 56 105 206 456 0%
2026-09-02 109 186 294 377 1%
2026-09-03 430 924 1320 1504 55%
2026-09-04 (to 05Z) 285 1012 1211 1211 44%

15-minute gate pass rate over the last 24 h by candidate bar: 300 → 22%, 1000 → 86%, 1500 → 99%, 2000 → 100%.

The 2026-08-23 lock incident on this same metric peaked at 1,510 in one window and 646 in the next, so retries alone no longer separate an incident from today's baseline. That role is carried by relayPostgresRetryExhausted (incident peak 467 vs bar 300, healthy max 184 in the last 72 h), directorConcurrency (caught the 04:46Z crash storm), and the pool bars.

Follow-up

Re-tighten after the same-cap roll puts the fleet on the 500 ms lock wait and the baseline is re-measured. Removing the global lock from per-connection paths is a separate PR.

…a measured bar

The global relay_cells FOR UPDATE lock made successful retries a
steady-state rate: fleet-wide p50 430 / p90 924 / p99 1320 / max 1504
per five minutes over the last 24 h, 55% of windows over the 300 bar,
only 22% of 15-minute gates clean. Three read-only dry-runs on
2026-09-04 froze on it, blocking the same-cap roll that carries #18521
and the beginProof crash guard to the 23 cells. 2000 clears every
measured healthy gate; the exhausted-retry, director concurrency, and
pool bars keep the incident discriminator role.
@pullfrog

pullfrog Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

This run was cancelled 🛑

The workflow was cancelled before completion. Please check the link below for details.

Pullfrog  | View workflow run | via Pullfrog | 𝕏

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: e478666c-bbeb-4dbc-980a-e736c79e304b

📥 Commits

Reviewing files that changed from the base of the PR and between 8854b5d and ae763a7.

📒 Files selected for processing (3)
  • cloud/apps/relay-ops/src/incident-monitor.test.ts
  • cloud/apps/relay-ops/src/incident-monitor.ts
  • cloud/docs/relay-incident-monitor.md

Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The relay PostgreSQL retry freeze threshold increases from 300 to 2,000 retries per five minutes. Incident-monitor comments describe retries above the threshold as a guard against unbounded growth. Tests verify green status at 1,504 retries and freeze status at 2,001 retries. The incident-monitor documentation updates the threshold table and records the recalibration data and rationale.

Merge Risk: ⚪ Minimal · up to ae763

The relay monitor now permits up to 2,000 PostgreSQL retries per five minutes before freezing, avoiding freezes during measured healthy activity while retaining the higher retry boundary and other incident checks. The change is ready to merge.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the change, rationale, measured data, scope, and follow-up. However, it omits several required template sections, including an explicit Linked Issue entry in the required form… Add all required template sections. Include the linked issue as Fixes #18569`` or the correct issue reference, state N/A with a reason for Visual Proof, document testing and CI status, complete applicable disclosure and checklist items, a…
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the relay monitor change and the recalibration of the PostgreSQL retry freeze threshold.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the change, rationale, measured data, scope, and follow-up. However, it omits several required template sections, including an explicit Linked Issue entry in the required format, Visual Proof or N/A, Testing, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist.

Resolution

Add all required template sections. Include the linked issue as Fixes #18569`` or the correct issue reference, state N/A with a reason for Visual Proof, document testing and CI status, complete applicable disclosure and checklist items, and address the remaining required sections.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Jinwoo-H
Jinwoo-H merged commit 79d5fb4 into main Sep 4, 2026
25 of 26 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…a measured bar (stablyai#18580)

The global relay_cells FOR UPDATE lock made successful retries a
steady-state rate: fleet-wide p50 430 / p90 924 / p99 1320 / max 1504
per five minutes over the last 24 h, 55% of windows over the 300 bar,
only 22% of 15-minute gates clean. Three read-only dry-runs on
2026-09-04 froze on it, blocking the same-cap roll that carries stablyai#18521
and the beginProof crash guard to the 23 cells. 2000 clears every
measured healthy gate; the exhausted-retry, director concurrency, and
pool bars keep the incident discriminator role.
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