Skip to content

feat(stack): proxy lazy Realtime WebSockets - #6044

Closed
jgoux wants to merge 6 commits into
lazy-stack/03-http-proxyfrom
lazy-stack/04-realtime-websocket
Closed

feat(stack): proxy lazy Realtime WebSockets#6044
jgoux wants to merge 6 commits into
lazy-stack/03-http-proxyfrom
lazy-stack/04-realtime-websocket

Conversation

@jgoux

@jgoux jgoux commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Stack layer 4 of 7, based on #6043.

Extends the lazy proxy boundary to Realtime:

  • handles the public WebSocket upgrade route in Node.js and Bun
  • activates Realtime before connecting upstream
  • preserves tenant host, subprotocols, text frames, binary frames, and close/error propagation
  • translates opaque public API keys to the configured internal JWTs
  • returns distinct activation and upstream connection failures

@jgoux
jgoux force-pushed the lazy-stack/03-http-proxy branch from 65c35b5 to 9f9ea46 Compare August 4, 2026 07:43
@jgoux
jgoux force-pushed the lazy-stack/04-realtime-websocket branch from c0631bd to 37acb4b Compare August 4, 2026 07:43
@jgoux
jgoux marked this pull request as ready for review August 4, 2026 07:50
@jgoux
jgoux requested a review from a team as a code owner August 4, 2026 07:50

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 37acb4bee1

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/stack/src/ApiProxy.ts
Comment thread packages/stack/src/ProxyWebSocket.bun.ts Outdated
Comment thread packages/stack/src/ApiProxy.ts Outdated
@jgoux
jgoux force-pushed the lazy-stack/04-realtime-websocket branch from 37acb4b to 8e31b5c Compare August 4, 2026 08:04
@jgoux
jgoux force-pushed the lazy-stack/03-http-proxy branch from 9f9ea46 to ee5c7e6 Compare August 4, 2026 08:04
@jgoux
jgoux force-pushed the lazy-stack/04-realtime-websocket branch from 8e31b5c to 0398257 Compare August 4, 2026 08:48
@jgoux
jgoux force-pushed the lazy-stack/03-http-proxy branch from ee5c7e6 to 50d42df Compare August 4, 2026 08:48

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 03982570e4

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/stack/src/ApiProxy.ts Outdated
Comment thread packages/stack/src/createStack.ts
@jgoux
jgoux force-pushed the lazy-stack/04-realtime-websocket branch from 0398257 to c18d586 Compare August 4, 2026 09:32
@jgoux
jgoux force-pushed the lazy-stack/03-http-proxy branch from 50d42df to 7f1da24 Compare August 4, 2026 09:32

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c18d5863b8

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/stack/src/ProxyWebSocket.node.ts Outdated
Comment thread packages/stack/docs/architecture.md
Comment thread packages/stack/src/ApiProxy.ts
@jgoux
jgoux force-pushed the lazy-stack/04-realtime-websocket branch from c18d586 to 5fbe0b5 Compare August 4, 2026 09:41
@jgoux
jgoux force-pushed the lazy-stack/03-http-proxy branch from 7f1da24 to b7d9850 Compare August 4, 2026 09:41
@jgoux
jgoux force-pushed the lazy-stack/04-realtime-websocket branch from 5fbe0b5 to 1b41b91 Compare August 4, 2026 10:20
@jgoux
jgoux force-pushed the lazy-stack/03-http-proxy branch from b7d9850 to 0b23678 Compare August 4, 2026 10:20

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1b41b91b6d

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/stack/src/ApiProxy.ts Outdated
@jgoux
jgoux force-pushed the lazy-stack/04-realtime-websocket branch from 1b41b91 to 2d2fccd Compare August 4, 2026 10:37
@jgoux
jgoux force-pushed the lazy-stack/03-http-proxy branch from 0b23678 to f0b757c Compare August 4, 2026 10:37

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2d2fccdecc

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/stack/src/ApiProxy.ts Outdated
Comment thread packages/stack/src/ApiProxy.ts Outdated
Comment thread packages/stack/src/ApiProxy.ts Outdated
@jgoux
jgoux force-pushed the lazy-stack/03-http-proxy branch from f0b757c to 508bb5e Compare August 4, 2026 11:07
@jgoux
jgoux force-pushed the lazy-stack/04-realtime-websocket branch from 2d2fccd to 3be802b Compare August 4, 2026 11:07
@jgoux
jgoux force-pushed the lazy-stack/03-http-proxy branch from 508bb5e to b0d8c1d Compare August 4, 2026 11:25
@jgoux
jgoux force-pushed the lazy-stack/04-realtime-websocket branch from 3be802b to 2fde245 Compare August 4, 2026 11:25

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2fde245e62

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/stack/src/ProxyWebSocket.node.ts Outdated
@jgoux
jgoux force-pushed the lazy-stack/04-realtime-websocket branch from 2fde245 to fb5979f Compare August 4, 2026 11:34
@jgoux
jgoux force-pushed the lazy-stack/03-http-proxy branch from b0d8c1d to f601c2d Compare August 4, 2026 11:34

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fb5979f62e

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/stack/src/ApiProxy.ts Outdated
@jgoux
jgoux force-pushed the lazy-stack/03-http-proxy branch from f601c2d to b130301 Compare August 4, 2026 11:46
@jgoux
jgoux force-pushed the lazy-stack/04-realtime-websocket branch from fb5979f to 414d65e Compare August 4, 2026 11:46
@jgoux
jgoux force-pushed the lazy-stack/03-http-proxy branch from b130301 to e56d367 Compare August 4, 2026 12:03
@jgoux
jgoux force-pushed the lazy-stack/04-realtime-websocket branch from 414d65e to 3428039 Compare August 4, 2026 12:03

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3428039f96

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/stack/src/ApiProxy.ts Outdated
@jgoux
jgoux force-pushed the lazy-stack/03-http-proxy branch from e56d367 to d3b1451 Compare August 4, 2026 12:12
@jgoux
jgoux force-pushed the lazy-stack/04-realtime-websocket branch from 3428039 to 7304cfa Compare August 4, 2026 12:12

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7304cfa5c1

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/stack/src/ApiProxy.ts
@jgoux
jgoux force-pushed the lazy-stack/03-http-proxy branch from d3b1451 to c168d30 Compare August 4, 2026 12:48
@jgoux
jgoux force-pushed the lazy-stack/04-realtime-websocket branch from 7304cfa to a4277ce Compare August 4, 2026 12:48

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a4277ce765

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/stack/src/ApiProxy.ts Outdated
@jgoux
jgoux force-pushed the lazy-stack/04-realtime-websocket branch from a4277ce to 7e4eede Compare August 4, 2026 12:58

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7e4eeded25

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/stack/src/ApiProxy.ts
@jgoux
jgoux force-pushed the lazy-stack/03-http-proxy branch from d6a0dbe to c4c3caf Compare August 4, 2026 13:20
@jgoux
jgoux force-pushed the lazy-stack/04-realtime-websocket branch from 7e4eede to 78e2903 Compare August 4, 2026 13:20
@jgoux
jgoux force-pushed the lazy-stack/04-realtime-websocket branch from 78e2903 to ac2d69a Compare August 4, 2026 14:06
@jgoux
jgoux force-pushed the lazy-stack/03-http-proxy branch from c4c3caf to 98a18a7 Compare August 4, 2026 14:06
Comment thread packages/stack/src/ApiProxy.ts

jgoux commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #6070 in the simplified replacement stack #6069#6070#6071. The custom Realtime WebSocket bridge was intentionally deleted; Realtime now starts eagerly and owns its native WebSocket boundary. Every remaining review thread has been answered and resolved. Closing this PR so review continues on the replacement.

@jgoux jgoux closed this Aug 5, 2026
pull Bot pushed a commit to oogalieboogalie/cli that referenced this pull request Aug 5, 2026
Consolidates the complete lazy-stack v2 implementation and its
architecture hardening into one reviewable change.

The implementation replaces the earlier user-space coordination
protocols with explicit ownership boundaries and operating-system
primitives:

- centralizes Docker and native artifact policy in one service catalog
- publishes complete native caches through private staging directories
and atomic rename
- models lifecycle intent directly on each service as inactive, running,
or explicitly stopped
- activates HTTP services at the existing proxy boundary while keeping
direct-listener services eager
- reserves real TCP ports until each service reaches its spawn boundary
- gives foreground and detached stacks the same allocation, readiness,
and lifecycle behavior
- enables lazy startup for CLI-managed local stacks while preserving
eager startup as the package default

The hardening pass makes each service's stable state stream the single
lifecycle coordination primitive, removes generation-specific waiter and
relaunch machinery, keeps healthy requests off the global lifecycle
lock, starts independent eager roots concurrently, recovers incomplete
artifact-cache destinations, and makes service port mappings exhaustive.

This keeps the simpler v2 architecture while closing the highest-impact
concurrency, recovery, and shutdown races identified during review.
Realtime remains eager because the HTTP proxy does not bridge its
WebSocket traffic, and concurrent artifact downloaders may duplicate
work while still publishing through an atomic winner.

Supersedes supabase#6041
Supersedes supabase#6042
Supersedes supabase#6043
Supersedes supabase#6044
Supersedes supabase#6045
Supersedes supabase#6046
Supersedes supabase#6047
Supersedes supabase#6069
Supersedes supabase#6070
Supersedes supabase#6071
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