#2917

feat(gateway): realtime calls run in phaseo-realtime, so gateway deploys stop ending them

OpenDanielButler1wants to merge intofrom

https://entire.com/gh/phaseoteam/-/trails/148/changes/Phaseo/148

IMPORTANT

Merge only after phaseo-realtime exists. First run the Realtime relay deploy workflow with initial=true; the realtime-maintenance skill covers the first deploy. Merging first would make the gateway deploy fail, because the binding would point at a Worker that doesn't exist.

What changed

  • phaseo-gateway (wrangler.toml) and phaseo-jobs (wrangler.jobs.toml) bind REALTIME_RELAY with script_name = "phaseo-realtime". Relay connections and reconciliation calls now go to the relay Worker added in #3367.
  • phaseo-gateway still exports its old RealtimeRelayDurableObject class and keeps its migration, so nothing is deleted. Removing it later is a destructive migration that needs explicit approval.
  • A config test checks both bindings. A changeset is included.

Why

Every merge to main deploys phaseo-gateway, and a deploy restarts the Durable Objects it hosts, which ends every live realtime call. #3367 added phaseo-realtime, which deploys only in maintenance windows. In a test with throwaway Workers, redeploying a Worker that forwards a WebSocket to a Durable Object in another Worker didn't cut the connection over 9+ minutes. Redeploying the Durable Object's own Worker cut it about 4 minutes later. This PR is the switch that puts live calls behind that protection.

How

  • Binding only: clients still connect through api.phaseo.app, and the gateway's relay route forwards to the binding as before, so SDKs and URLs don't change.
  • Fresh namespace: the new Worker's namespace has no state, and none is needed. No realtime session has run in production since 2026-09-11.
  • Calls in progress: any call in the gateway's old namespace ends when this deploy lands, like any gateway deploy today. The skill says to check the live-session count first.

Before and after

BeforeAfter
Merge to main (gateway deploy)Ends every live realtime callDoesn't end calls; only phaseo-realtime deploys, in announced windows, do
Relay URLapi.phaseo.app/v1/{realtime,live}/sessions/{id}/relaySame

Verification

  • wrangler deploy --dry-run (gateway): env.REALTIME_RELAY (RealtimeRelayDurableObject, defined in phaseo-realtime). Same for pnpm run build:jobs.
  • vitest run src/realtime-worker-config.test.ts: 4 passed. With main's wrangler.toml restored, the new binding test fails (1 failed, 3 passed).
  • Not verified yet: a connection through production after the switch. Once deployed, I'll run the skill's relay probe, which expects 401 realtime session not found or token invalid from the relay.

Model: Claude Opus 5.5 (effort unknown) · Harness: Claude Code in T3 Code

🤖 Generated with Claude Code

Activity

6
vercel[bot]1d ago

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated
phaseo ReadyPreviewOct 29, 2026 2:06pm UTC

coderabbitai[bot]1d ago

WARNING

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 52 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 79902dc4-94d2-4dbf-87fd-79f4671faf60
Commits

Reviewing files that changed from the base of the PR and between 21bd0b5cf3d4ff95789f7c10eba12b3c843daa3a and 83c1a4b7a2b3451a8abcc90205c6449bf78fd316.

Files selected for processing: 4
  • .changeset/realtime-relay-binding.md
  • apps/api/src/realtime-worker-config.test.ts
  • apps/api/wrangler.jobs.toml
  • apps/api/wrangler.toml
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

github-actions[bot]1d ago

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None
chatgpt-codex-connector[bot]1d ago

Codex Review Summary

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

ReviewStatusCommitReview trigger
📝 Code Review✅ Completed 2026-10-29T14:20:20.837900Z83c1a4bDraft marked ready
ℹ️ 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.