Skip to content

feat(protocol): a website extra brings the WebSocket library a site's server needs - #947

Open
earakely-scale wants to merge 2 commits into
mainfrom
edgararakelyan/website-websockets
Open

earakely-scale wants to merge 2 commits into
mainfrom
edgararakelyan/website-websockets

Conversation

@earakely-scale

@earakely-scale earakely-scale commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

Why

WebsiteEnvironment.serve() runs the site with uvicorn. Without a WebSocket library, uvicorn serves a WebSocket upgrade as a plain GET. The site answers 404, and the page sees the socket close with code 1006. A site whose image installs only uvicorn (as serve()'s old ImportError suggested) or the protocol's base package can't answer a page's WebSocket, and nothing says why.

What

  • agentenv-framework-protocol[website]: a new extra with uvicorn and websockets, the same floors as the app and computer extras.
  • serve()'s ImportError names the extra, and its docstring says what the extra brings.
  • The protocol README gets a "Running a website" section: install the extra in the site's image.
  • uv.lock gains only the extra's entries (re-locked with the uv CI pins, 0.13.1).

Tests

New test_gateway_relays_a_website_environments_websocket (slow tier, gateway_test.py):

  • It deploys a WebsiteEnvironment site from tst/data/socket_website. The site's mounted Starlette app answers /socket, and its image installs this checkout's protocol package with [website].
  • Through the gateway's /website/sockets/socket route, it checks that the site's two opening messages arrive on connect and that a ping is answered with pong.

Run on a Linux host with Docker and the local registry:

  • As committed: 1 passed in 403.22s.
  • With the image's install changed to the base package plus uvicorn>=0.30 (no websockets): it fails with websockets.exceptions.InvalidStatus: server rejected WebSocket connection: HTTP 404. The test catches exactly this case.

Docs

The docs site's website-environment page should say to install agentenv-framework-protocol[website] in a site's image when the site serves itself with serve(). A page that opens a WebSocket needs it.

🤖 Generated with Claude Code

Confidence Score: 5/5 · The PR appears safe to merge.RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge.

Summary

Adds a website extra with uvicorn and websockets, updates install guidance, and adds a gateway WebSocket test.

  • Website servers can now answer browser WebSockets through the gateway.

Reviews (2) · Last reviewed commit: "test(gateway): name the WebSocket test's..." · Reviewed by Greptile

… server needs

WebsiteEnvironment.serve() runs uvicorn, and uvicorn without a WebSocket
library serves a WebSocket upgrade as a plain GET, which the site answers
404; the page sees the socket close with 1006. The new website extra
installs uvicorn with websockets, serve()'s ImportError names it, and the
protocol README says to install it in a site's image.

A gateway test deploys a site whose mounted app answers a WebSocket, built
with the extra, and checks its opening messages and a ping through
/website/<name>/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale
earakely-scale requested a review from a team as a code owner November 28, 2026 21:26
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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