Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
docs(proxy): correct the disconnected-waiter and size-refusal comments
Alfredo Lopez84a2fa8591ac
diff --git a/codex-llm-proxy/test/streamGate.handoff.test.ts b/codex-llm-proxy/test/streamGate.handoff.test.tsindex 00b0566d7..02187e89e 100644--- a/codex-llm-proxy/test/streamGate.handoff.test.ts+++ b/codex-llm-proxy/test/streamGate.handoff.test.ts@@ -807,9 +807,11 @@ describe('visual stream-gate handoff', () => {// Once the unread body exceeds the request's buffer, Node stops reading the// socket, so a queued client's disconnect is not seen and `aborted` never// fires. The place is held until the grant or the admission deadline. At the- // grant Node reads the bytes that already reached the server; here that is- // the whole body, so the dead client's request runs through the handler,- // which frees the slot. This pins that bound.+ // grant the parser reads the bytes that already reached the server. Usually+ // that is only part of the body, so raw-body fails with `request.aborted`+ // and the parser's error callback frees the slot; if the whole body arrived+ // before the disconnect, the request runs through the handler, which frees+ // it. Either way the slot is freed only at the grant; this pins that bound.it('holds the queue place of a disconnected large-body waiter until its grant', async () => {const maxBodyBytes = smallCaps()const acquire = vi.spyOn(visualStreamGate, 'acquire')diff --git a/grok-llm-proxy/src/grokTransport.ts b/grok-llm-proxy/src/grokTransport.tsindex aacff2ccc..b59799d98 100644--- a/grok-llm-proxy/src/grokTransport.ts+++ b/grok-llm-proxy/src/grokTransport.ts@@ -149,9 +149,10 @@ export async function streamGrokCompletion(): Promise<StreamGrokCompletionResult> {const parsed = parseGrokCompletionRequest(input.request)if (!parsed.ok) {- // A byte budget (image, total, non-image share) is a size refusal; every- // other contract failure is a malformed request. Both codes stay literal- // for the contract-freeze scanner.+ // A `size` refusal (a byte budget, or the container, member or element+ // bound) is payload_too_large; every other contract failure, including the+ // image, message and tool-call counts, is invalid_request. Both codes stay+ // literal for the contract-freeze scanner.if (parsed.kind === 'size') throw new GrokTransportError('payload_too_large', parsed.message)throw new GrokTransportError('invalid_request', parsed.message)}diff --git a/grok-llm-proxy/src/server.ts b/grok-llm-proxy/src/server.tsindex c60a64901..adb791755 100644--- a/grok-llm-proxy/src/server.ts+++ b/grok-llm-proxy/src/server.ts@@ -936,9 +936,8 @@ const ATTEMPT_ERROR_STATUS: Record<string, number> = {// The upstream's refusal of a prompt over the model's context window, at the// upstream's own status class (R10).context_length_exceeded: 400,- // A V2 request over one of its byte budgets (image, total or non-image- // share), refused by the contract before redeem, or a body over the proxy's- // own caps.+ // A contract `size` refusal before redeem (a byte budget, or the container,+ // member or element bound), or a body over the proxy's own caps.payload_too_large: 413,Unauthorized: 401,origin_denied: 403,diff --git a/grok-llm-proxy/test/streamGate.handoff.test.ts b/grok-llm-proxy/test/streamGate.handoff.test.tsindex 1d07d805e..42de3eeed 100644--- a/grok-llm-proxy/test/streamGate.handoff.test.ts+++ b/grok-llm-proxy/test/streamGate.handoff.test.ts@@ -785,9 +785,11 @@ describe('grok visual stream-gate handoff', () => {// Once the unread body exceeds the request's buffer, Node stops reading the// socket, so a queued client's disconnect is not seen and `aborted` never// fires. The place is held until the grant or the admission deadline. At the- // grant Node reads the bytes that already reached the server; here that is- // the whole body, so the dead client's request runs through the handler,- // which frees the slot. This pins that bound.+ // grant the parser reads the bytes that already reached the server. Usually+ // that is only part of the body, so raw-body fails with `request.aborted`+ // and the parser's error callback frees the slot; if the whole body arrived+ // before the disconnect, the request runs through the handler, which frees+ // it. Either way the slot is freed only at the grant; this pins that bound.it('holds the queue place of a disconnected large-body waiter until its grant', async () => {const maxBodyBytes = smallCaps()const acquire = vi.spyOn(visualStreamGate, 'acquire')