fix(selfhost): add start_period to postgres and pgbouncer healthchecks#3920
Conversation
Every failed pg_isready probe counted toward retries from the first check with no grace period, unlike every other service with a genuine cold-start delay in this file. A slow pgvector initdb (first pull, slow disk) could plausibly exceed 5 retries at 10s, marking postgres unhealthy and failing every service_healthy depends_on gate downstream. Closes #3898
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review result - approve/merge recommendedReview updated: 2026-07-07 06:44:05 UTC
✅ Suggested Action - Approve/Merge
Review summary Nits — 6 non-blocking
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3920 +/- ##
=======================================
Coverage 93.58% 93.58%
=======================================
Files 358 358
Lines 34342 34342
Branches 12570 12570
=======================================
Hits 32138 32138
Misses 1580 1580
Partials 624 624 🚀 New features to boost your workflow:
|
Summary
postgresnorpgbouncer's healthcheck had astart_period, unlike every other service indocker-compose.ymlwith a genuine cold-start delay (qdrant, ollama, browserless, rees, reporting-exporter, tempo, and the coregittensoryapp itself — whose comment explicitly says its 60sstart_period"tolerates the Postgres cold start").retriesfrom the very first check unlessstart_periodis set. A genuinely coldpgvector/pgvector:pg16initdb(first pull, slow disk, low-memory VPS, creating the pgvector extension) can plausibly exceed postgres's 5 retries at a 10s interval (~50s) with no grace period — once Docker marks itunhealthy, every downstreamdepends_on: condition: service_healthygate (gittensory,pgbouncer,postgres-exporter) fails startup outright instead of tolerating a slow-but-successful cold start.start_period: 20sto postgres andstart_period: 15sto pgbouncer (which starts fast once postgres is already confirmed healthy), matching the pattern used elsewhere in this file.Found via a fresh performance/scalability/accuracy hardening audit of the self-host ORB stack. Tracked under #1667.
Scope
docker-compose.yml—start_periodforpostgresandpgbouncerhealthcheckstest/unit/selfhost-compose-db-health.test.ts— cover bothValidation
npm run typechecknpx vitest run test/unit/selfhost-compose-db-health.test.ts— 4/4 passinggit diff --checkcleanSafety
src/**lines, no secrets. Purely additive grace period — doesn't change steady-state healthcheck behavior once a service is actually healthy.Closes #3898