Skip to content

Commit 96bde05

Browse files
authored
docs(server): explain why HTTP API PTY handler has no early-frame buffer (#26464)
1 parent dcb8ed8 commit 96bde05

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

  • packages/opencode/src/server/routes/instance/httpapi/handlers

packages/opencode/src/server/routes/instance/httpapi/handlers/pty.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@ export const ptyConnectRoute = HttpRouter.use((router) =>
153153
return HttpServerResponse.empty()
154154
}
155155

156+
// No `pending[]`-style early-frame buffer (the legacy Hono handler had one).
157+
// `request.upgrade` returns a Socket without running the WS handshake; the
158+
// handshake fires inside `socket.runRaw` below, AFTER `pty.connect` resolves
159+
// and the message callback is registered. The client therefore can't fire
160+
// `open` and start sending until the listener is already wired. Don't move
161+
// `runRaw` ahead of `pty.connect` without re-introducing a buffer.
156162
yield* socket
157163
.runRaw((message) => handlePtyInput(handler, message))
158164
.pipe(

0 commit comments

Comments
 (0)