maxpool 1.24.17 → 1.24.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/server.js +30 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maxpool",
3
- "version": "1.24.17",
3
+ "version": "1.24.18",
4
4
  "description": "Multi-account Claude Code proxy with adaptive, rate-aware load balancing across Claude accounts",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/server.js CHANGED
@@ -163,7 +163,14 @@ export function createProxyServer(accountManager, config, hooks = {}) {
163
163
  // upstream-bound request headers elsewhere.
164
164
  const workerStamp = String(process.pid);
165
165
 
166
- const server = http.createServer(async (req, res) => {
166
+ // REQUEST-ARRIVAL TIMEOUTS (2026-10-11 outage). Node's defaults (300s request
167
+ // timeout, 30s checking interval) are what fired live — but they must be in the
168
+ // constructor to be settable at all (property assignment after listen is a no-op
169
+ // in Node 20, measured), so they are read here, env-tunable, never mutated later.
170
+ const server = http.createServer({
171
+ requestTimeout: Math.max(1_000, Number(process.env.MAXPOOL_REQUEST_TIMEOUT_MS) || 300_000),
172
+ connectionsCheckingInterval: Math.max(100, Number(process.env.MAXPOOL_CONNECTIONS_CHECK_MS) || 30_000),
173
+ }, async (req, res) => {
167
174
  try {
168
175
  // Disable Nagle on the client socket: flush each SSE event immediately instead
169
176
  // of coalescing small writes into bursts. Smooths streaming cadence toward the
@@ -343,6 +350,28 @@ export function createProxyServer(accountManager, config, hooks = {}) {
343
350
  // this releasing worker.
344
351
  server.maxpoolBeginDrain = () => { draining = true; };
345
352
 
353
+ // STALLED-UPLOAD ANSWER (2026-10-11 outage). When a request body never finishes
354
+ // arriving, Node's requestTimeout fires and its default handler writes a BODY-LESS
355
+ // `408 Request Timeout`, which Claude Code surfaces as the opaque "API Error: 408
356
+ // status code (no body)" (1,711 of them overnight, while the Mac's network stack
357
+ // was starved). Answer with the standard Anthropic error envelope instead, naming
358
+ // the actual cause, so the user sees a real message and the CLI treats it like any
359
+ // other retryable API error. Every other client error keeps Node's own handling.
360
+ server.on('clientError', (err, socket) => {
361
+ if (err?.code === 'ERR_HTTP_REQUEST_TIMEOUT' && socket.writable && !socket._httpMessage?.headersSent) {
362
+ const body = JSON.stringify({
363
+ type: 'error',
364
+ error: {
365
+ type: 'request_timeout',
366
+ message: 'Maxpool did not receive the full request in time (the upload stalled — usually a network problem on this machine). Retrying should work once the network recovers.',
367
+ },
368
+ });
369
+ socket.end(`HTTP/1.1 408 Request Timeout\r\nContent-Type: application/json\r\nContent-Length: ${Buffer.byteLength(body)}\r\nConnection: close\r\n\r\n${body}`);
370
+ return;
371
+ }
372
+ socket.destroy(err);
373
+ });
374
+
346
375
  return server;
347
376
  }
348
377