Repository navigation
Conversation
The smoke tests of publish-release-images and release-tooling-validation waited for PostgreSQL with pg_isready over the Unix socket. The postgres image runs a temporary server during its own setup that listens on the Unix socket only, so the wait could pass against it and the fail-closed check after it could then land in the restart window and fail the job with "PG not ready" (#501). Both jobs now call pg_isready with -h 127.0.0.1. The temporary server does not listen on TCP, so the check answers only when the real server is up. scripts/test-pg-readiness-race.sh starts one postgres container, asks it both ways, back to back, from before it is up, and keeps asking for fifteen seconds after the TCP check first answered. It asserts one thing: once the TCP check has answered accepting, it answers accepting in every later probe. A check that had answered against a temporary server would stop answering when that server stops. How often the socket form answered accepting while the TCP form did not is reported and not judged, because it depends on timing; a socket "no" beside a TCP "yes" means nothing, since the real server can start between the two probes. The new CI job pg-readiness-check runs the test. Signed-off-by: Alajmah <55954113+Alajmah@users.noreply.github.com>
Codex Review Summary: ✅ CompletedThis 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.
🤖 AI Code Review — ✅ Approved
Confidence: high · Findings: 2
AI judgment: APPROVE · Evidence: COMPLETE · Authority: advisory
Evidence complete · 2/2 changed files accounted for
Other findings (2)
- [medium] Same socket-vs-TCP race likely remains in the docker-build-app service health-cmd
⚠️ unverified - [low] Regression test conflates docker exec failures with server flickers
🔮 Devil's Advocate (2 turns): 2 upheld
GitWire AI Review Gate (bundle-driven v2) · Structured schema · Scope-validated · Devil's Advocate · AI recommendation — maintainers and repository policy retain authority
Finding details (not annotatable inline)
-
[MEDIUM] Same socket-vs-TCP race likely remains in the docker-build-app service health-cmd (
.github/workflows/ci.yml)The PR fixes the two explicit wait loops, but the description confirms the postgres service container's
--health-cmdindocker-build-appis deliberately left on the old form. The stated rationale ('a Docker health check is asked again until it passes, so it does not depend on one answer') does not actually cover the failure mode: the very first passing probe marks the service healthy and the job's steps start immediately. If that first pass lands against the temporary init-only server, the app starts inside the restart window — exactly the #499/#501 flake this PR fixes elsewhere. Docker's retry logic only helps before the first success, not after it. Suggest applying the same-h 127.0.0.1change to the--health-cmd(or verifying it already uses TCP) so the fix covers every readiness check in the workflow. Lowered to P2 since that line is not visible in the diff and the impact there depends on whether the app retries its first DB connection.
| while :; do | ||
| probes=$((probes + 1)) | ||
| s=0; docker exec "$NAME" pg_isready -U gitwire -d gitops_hub >/dev/null 2>&1 && s=1 | ||
| t=0; docker exec "$NAME" pg_isready -h 127.0.0.1 -U gitwire -d gitops_hub >/dev/null 2>&1 && t=1 |
There was a problem hiding this comment.
[LOW] Regression test conflates docker exec failures with server flickers
In the probe loop, any non-zero result from docker exec ... pg_isready is counted as 'not accepting'. After the first TCP accept, a transient docker-level error (daemon hiccup, exec failure with exit 125/126/127) would be indistinguishable from the server stopping: it increments tcp_flickers and exits 1, failing CI even though PostgreSQL behaved correctly and the assertion's premise was never violated. Suggest distinguishing docker/invocation errors from pg_isready results (0 = accepting, 1 = rejecting, 2 = no response), e.g. by only counting flickers when pg_isready itself reported 'no response' rather than an exec error, or by re-probing once before recording a flicker. Unlikely on a fresh GitHub runner, hence P3.
|
The review of 2026-11-23 accepted the approach of this pull request and asked for one more gate: the service health-cmd of That third gate is closed on a new branch, built on this pull request's head: the health-cmd uses This pull request is closed as superseded, unmerged. Its branch and its record stay. |
…509) * fix(ci): wait for PostgreSQL over TCP in the release smoke tests The smoke tests of publish-release-images and release-tooling-validation waited for PostgreSQL with pg_isready over the Unix socket. The postgres image runs a temporary server during its own setup that listens on the Unix socket only, so the wait could pass against it and the fail-closed check after it could then land in the restart window and fail the job with "PG not ready" (#501). Both jobs now call pg_isready with -h 127.0.0.1. The temporary server does not listen on TCP, so the check answers only when the real server is up. scripts/test-pg-readiness-race.sh starts one postgres container, asks it both ways, back to back, from before it is up, and keeps asking for fifteen seconds after the TCP check first answered. It asserts one thing: once the TCP check has answered accepting, it answers accepting in every later probe. A check that had answered against a temporary server would stop answering when that server stops. How often the socket form answered accepting while the TCP form did not is reported and not judged, because it depends on timing; a socket "no" beside a TCP "yes" means nothing, since the real server can start between the two probes. The new CI job pg-readiness-check runs the test. Signed-off-by: Alajmah <55954113+Alajmah@users.noreply.github.com> * fix(ci): the docker-build-app health check also waits for PostgreSQL over TCP Third gate of #501, after #506. The service container of docker-build-app used --health-cmd with pg_isready over the Unix socket, which can pass against the postgres image's temporary setup server. A health check is asked again until it passes, so the service is eventually reported healthy; but a first pass against the temporary server can mark the service healthy while the real server is still coming up, and the job's steps start on that. The health-cmd now uses -h 127.0.0.1, like the wait loop and the fail-closed check of the two smoke jobs since #506. scripts/check-pg-readiness-tcp.sh is a static gate: every pg_isready in the workflow has to use -h 127.0.0.1, in the health-cmd, in the two smoke jobs, and in this job's own step names. It fails on the master workflow and passes here, and the pg-readiness-check job runs it after the race test. Signed-off-by: Alajmah <55954113+Alajmah@users.noreply.github.com> --------- Signed-off-by: Alajmah <55954113+Alajmah@users.noreply.github.com>
Status
The fix of #501, as the review asked: a small change and an independent regression test. This supersedes #505, whose regression test had a defect that two reviews found. Created for review. The merge needs the maintainer's approval.
What failed
The smoke tests of
publish-release-imagesandrelease-tooling-validationwaited for PostgreSQL withpg_isreadyover the Unix socket. The postgres image runs a temporary server during its own setup that listens on the Unix socket only. So the wait could pass against that server, and the fail-closed check after it could land in the restart window and fail the job. Seen once, on #499:PG not ready, after a step of five seconds.The change
Both jobs now call
pg_isreadywith-h 127.0.0.1. The temporary server does not listen on TCP, so the check answers only when the real server is up..github/workflows/ci.yml, jobpublish-release-images-h 127.0.0.1.github/workflows/ci.yml, jobrelease-tooling-validationscripts/test-pg-readiness-race.sh.github/workflows/ci.yml, jobpg-readiness-checkThe
--health-cmdof the service container indocker-build-appis left as it is. A Docker health check is asked again until it passes, so it does not depend on one answer.What was wrong in #505, and what the test asserts now
#505's test failed when the TCP check answered accepting in a probe whose socket check, run just before, had not. That can happen in a normal start: the real server comes up between the two probes. The reviews on #505 were right, and that criterion is gone.
The test now asserts one thing: once the TCP check has answered accepting, it answers accepting in every later probe. It keeps probing for fifteen seconds after the first accept. A check that had answered against a temporary server stops answering when that server stops, and that fails the test.
How often the socket form answered accepting while the TCP form did not is printed and not judged. It depends on timing. A socket "no" beside a TCP "yes" is not counted as anything.
Verification
Manual CI run on this branch, commit
ce3a275: https://github.com/Octo-Lex/GitWire/actions/runs/45130729269. All 17 jobs passed, the new one included;publish-release-imagesis skipped on a manual run by design.pg-readiness-check, onepostgres:16-alpinecontainer:The logic was also checked offline against four recorded probe sequences: the run seen in CI, a real server starting between the two probes, a start without any race window, and a check that had answered against a temporary TCP server. The first three pass and the last fails.
The two smoke tests on the TCP check:
release-tooling-validationpassed on the first attempt.Not covered