Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(companion): answer a drain wait on a later turn when the relay socket is closing
biocherry481ccf861780
diff --git a/companion/src/e2e/phone.ts b/companion/src/e2e/phone.tsindex 8a93a7f80d..fd451caccd 100644--- a/companion/src/e2e/phone.ts+++ b/companion/src/e2e/phone.ts@@ -38,7 +38,14 @@ export function webSocketTransport(socket: WebSocket): RecordTransport {// The built-in client has no drain event.onceDrained(listener) {const check = () => {- if (socket.readyState !== WebSocket.OPEN || socket.bufferedAmount <= SEND_BUFFER_HIGH / 4) listener();+ if (socket.readyState !== WebSocket.OPEN) {+ // A closing socket never drains. Answer on a later turn: calling back+ // synchronously lets the queued writer re-enter here and recurse until the+ // stack overflows, and the close event needs a turn to arrive too.+ setTimeout(listener, DRAIN_POLL_MS);+ return;+ }+ if (socket.bufferedAmount <= SEND_BUFFER_HIGH / 4) listener();else setTimeout(check, DRAIN_POLL_MS);};check();