Repository navigation
refactor(relay): API-served relay endpoint, and deploy relay2 with production - #6204
Conversation
📝 WalkthroughWalkthroughThe production workflow adds a ChangesRelay2 production deployment
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
57d2169 to
b832d52
Compare
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
Greptile SummaryAdds Relay2 to the production deployment workflow and verifies after deployment that its public health endpoint serves protocol version 2.
Confidence Score: 5/5The PR appears safe to merge, with the deployment target and expected health response consistent with Relay2’s current configuration and endpoint contract. The new job follows the existing Cloudflare deployment pattern, deploys the pinned Relay2 workspace tooling, and validates the documented Worker URL and protocol response with bounded retries.
|
| Filename | Overview |
|---|---|
| .github/workflows/deploy-production.yml | Adds a production Relay2 deployment job with pinned actions, frozen dependency installation, Wrangler deployment, and bounded post-deployment health verification. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Production workflow starts] --> B[Checkout repository]
B --> C[Set up Bun and restore cache]
C --> D[Install frozen dependencies]
D --> E[Deploy Relay2 with Wrangler]
E --> F{Health response contains proto: 2?}
F -->|Yes| G[Deployment job succeeds]
F -->|No, attempts remain| H[Wait 10 seconds]
H --> F
F -->|No, after 12 attempts| I[Deployment job fails]
Reviews (1): Last reviewed commit: 57d2169 | Re-trigger Greptile
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/deploy-production.yml:
- Around line 503-508: Add a post-deployment health-check step after the “Deploy
Worker” step, reusing the bounded polling logic from deploy-electric-proxy to
query production’s /health endpoint for up to two minutes. Parse the response
and fail the workflow unless Relay2 reports proto: 2.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 1b6cb620-ee0e-49a1-9aa6-7b92c63919c4
📒 Files selected for processing (1)
.github/workflows/deploy-production.yml
| - name: Deploy Worker | ||
| working-directory: apps/relay2 | ||
| env: | ||
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | ||
| run: bunx wrangler deploy |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Add the required post-deployment health check.
Line 508 is the final step. It only confirms that Wrangler accepted the upload. It does not poll the production /health endpoint for up to two minutes or verify proto: 2. Add the same bounded health check used by deploy-electric-proxy, and fail the job unless Relay2 reports proto: 2.
🧰 Tools
🪛 zizmor (1.29.0)
[warning] 479-508: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block
(excessive-permissions)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/workflows/deploy-production.yml around lines 503 - 508, Add a
post-deployment health-check step after the “Deploy Worker” step, reusing the
bounded polling logic from deploy-electric-proxy to query production’s /health
endpoint for up to two minutes. Parse the response and fail the workflow unless
Relay2 reports proto: 2.
There was a problem hiding this comment.
1 issue found and verified against the latest diff
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name=".github/workflows/deploy-production.yml">
<violation number="1" location=".github/workflows/deploy-production.yml:482">
P2: Concurrent pushes can leave relay2 serving an older commit than the latest production run because this job has no deployment serialization. Add a job-level concurrency group with `cancel-in-progress: false` so relay2 deployments complete in commit order.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| deploy-relay2: | ||
| name: Deploy Relay2 to Cloudflare | ||
| runs-on: ubuntu-latest | ||
| environment: production |
There was a problem hiding this comment.
P2: Concurrent pushes can leave relay2 serving an older commit than the latest production run because this job has no deployment serialization. Add a job-level concurrency group with cancel-in-progress: false so relay2 deployments complete in commit order.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/deploy-production.yml, line 482:
<comment>Concurrent pushes can leave relay2 serving an older commit than the latest production run because this job has no deployment serialization. Add a job-level concurrency group with `cancel-in-progress: false` so relay2 deployments complete in commit order.</comment>
<file context>
@@ -476,6 +476,53 @@ jobs:
+ deploy-relay2:
+ name: Deploy Relay2 to Cloudflare
+ runs-on: ubuntu-latest
+ environment: production
+
+ steps:
</file context>
| environment: production | |
| environment: production | |
| concurrency: | |
| group: deploy-relay2 | |
| cancel-in-progress: false |
Two things relay2 needs that missed the #6165 merge.
1. The API decides which relay you're on
Tonight's rollout attempt exposed that relay config delivery — not the relay — is the fragile part. Three separate failures, all from evaluating the PostHog flag on the client:
getRelayUrl()silently returns the default when PostHog hasn't identified the user yet. A cold start usually loses that race, so the host locks onto the old relay and never re-checks — restarting the app just replays it. One machine sat on the wrong relay through three restarts with no error anywhere.Host is not online.host.relayEndpoint(jwtProcedure) resolves the flag server-side, once, and the host-service, renderer, and CLI all read that same answer. The host-service asks for itself after authenticating instead of trusting what spawned it, so there's no identification to race.env.RELAY_URLremains the fallback for an unreachable API.2. relay2 deploys with production
A
deploy-relay2job indeploy-production.yml, a copy ofdeploy-electric-proxyusing the same runner, cache, and Cloudflare secrets. Until this lands, relay2 deploys are manualwrangler deploy.https://claude.ai/code/session_01A2JifsfA63nWthegPwNt8G