Skip to content

Wait for TCP-ready PostgreSQL before demo fleet smoke - #828

Open
justin808 wants to merge 1 commit into
masterfrom
jg-codex/fleet-smoke-postgres-tcp
Open

justin808 wants to merge 1 commit into
masterfrom
jg-codex/fleet-smoke-postgres-tcp

Conversation

@justin808

@justin808 justin808 commented Sep 15, 2026

Copy link
Copy Markdown
Member

🤖 Codex

Current walkthrough: COMMENT review

Problem and change

On PR #827's demo-fleet smoke run, the install step saw PostgreSQL accept one pg_isready check, then immediately saw “no response” and exited 2. The check used the container's Unix socket. The official PostgreSQL image starts a socket-only temporary server during first-time initialization before replacing it with the final TCP server, so the check can finish during that handoff.

Both readiness checks now use pg_isready -h 127.0.0.1. TCP becomes available only when the final server is ready, which matches the Rails smoke command's database connection.

Verification

  • Ran the pinned PostgreSQL image locally and observed socket readiness while TCP was still unavailable, followed by final TCP readiness. This reproduces the mechanism; hosted CI is the fix verification.
  • .agents/bin/validate passed (59 Ruby files, no offenses).
  • bin/conductor-exec bin/test-cpflow-github-flow --offline passed, including workflow parsing and actionlint.
  • git diff --check passed.
  • Exact-head hosted demo-fleet smoke passed on 61a58c98f3ead1c2d8583a60d37b20c3b726489b. All PR checks passed. The original failing run passed on a same-SHA rerun, confirming the startup race was intermittent.

Native usage is PARTIAL. 261 responses. Scope: latest turn only per source; earlier turns excluded.
External reviewer/tool-model usage: UNKNOWN.

Native usage

61a58c9 / implementation
SHARED source interval: 2026-09-15T08:07:13.022Z through 2026-09-15T08:54:39.322Z. Snapshot through the last observed response.
Source selection: host context.
Codex source versions: 0.154.0-alpha.6.2.

Provider Configured model Routed model Effort Input Cached input Output Reasoning output Cache writes Native total
openai gpt-5.6-sol UNKNOWN medium 38526646 38304384 70886 32951 0 38597532

@github-actions

Copy link
Copy Markdown

No description provided.

@github-actions

Copy link
Copy Markdown

🚀 Quick Review App Commands

Welcome! Here are the commands you can use in this PR:
They require the repository to have cpflow review apps configured, including the CPLN_TOKEN_STAGING secret.

+review-app-deploy

Deploy your PR branch for testing.

+review-app-delete

Remove the review app when done.

+review-app-help

Show detailed instructions, environment setup, and configuration options.

Comment +review-app-help for full setup details.

@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 99785d79-95c5-4ba2-9487-ef4ac9d3ac5e

📥 Commits

Reviewing files that changed from the base of the PR and between f760670 and 61a58c9.

📒 Files selected for processing (1)
  • .github/workflows/demo-fleet-smoke.yml

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


Walkthrough

Changes

PostgreSQL readiness probe

Layer / File(s) Summary
Use localhost TCP for readiness checks
.github/workflows/demo-fleet-smoke.yml
Both pg_isready calls now pass -h 127.0.0.1. The retry loop and final readiness check keep their existing control flow.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 61a58

The readiness check now waits for the final PostgreSQL server over localhost TCP, matching the smoke test connection and leaving no material merge risk.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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 0…
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: waiting for TCP-ready PostgreSQL before the demo fleet smoke test.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jg-codex/fleet-smoke-postgres-tcp

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-15T08:40:13.044819Z 61a58c9 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@claude

claude Bot commented Sep 15, 2026

Copy link
Copy Markdown

Review

Small, well-scoped fix. Summary of changes:

  • Both pg_isready readiness checks in demo-fleet-smoke.yml now pass -h 127.0.0.1, forcing a TCP connection instead of the container's Unix socket.

Why this is correct: the official postgres image runs a socket-only temporary server during first-time DB initialization before starting the final TCP-listening server (per docker-entrypoint.sh). The old check (pg_isready -U rails -d rails_test with no -h) defaults to the Unix socket and can report "ready" against that temporary server, racing ahead of the actual server the subsequent Rails DATABASE_URL=postgres://...@127.0.0.1:5432/... connection needs. Forcing -h 127.0.0.1 in the readiness loop makes the check match what the smoke test actually depends on.

Assessment:

  • Change is minimal, targeted, and doesn't touch unrelated logic (retry loop structure, timeouts, trap/cleanup) — good restraint.
  • Confirmed only one pg_isready usage in .github/workflows/, so there's no other spot needing the same fix for consistency.
  • No security concerns — this only affects a CI-local ephemeral Postgres container with a test password used exclusively in the smoke job.
  • No functional/style issues found. The described local repro (socket ready before TCP) plausibly explains the flake from the PR Fix tutorial review-app release and renderer startup #827 run.

Looks good to merge pending the pending hosted "exact-head" smoke run mentioned in the PR description.

@greptile-apps

greptile-apps Bot commented Sep 15, 2026

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

The PR appears safe to merge because the readiness checks now wait for the PostgreSQL TCP server used by the smoke test.

Summary

This PR updates PostgreSQL readiness checks in the demo-fleet smoke workflow to wait for the final TCP server instead of the temporary initialization server’s Unix socket.

  • Adds -h 127.0.0.1 to both pg_isready invocations.
  • Preserves the existing container-state checks, retry count, and final readiness assertion.
  • Aligns the readiness protocol with the TCP connection used by the Rails smoke commands.

Reviews (1) · Last reviewed commit: "Wait for the final PostgreSQL server bef..."

@justin808 justin808 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Codex — walkthrough for commit 61a58c98f3ead1c2d8583a60d37b20c3b726489b

The fleet smoke install step now waits for PostgreSQL over TCP. The old Unix-socket check could pass against the image's temporary initialization server; PR #827's failing run recorded an accepting check followed immediately by “no response.” Both checks now use the same TCP path Rails uses.

I reproduced the socket-only initialization with the pinned image locally. The exact-head demo-fleet smoke run and all PR checks passed. Claude, Greptile, and CodeRabbit reported no blocking findings. The change may wait slightly longer on a fresh database, within the existing 30-attempt bound; reverting this commit restores the prior check if needed.

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