maxpool 1.24.18 → 1.24.20

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maxpool",
3
- "version": "1.24.18",
3
+ "version": "1.24.20",
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",
@@ -87,17 +87,20 @@ export class RestartController {
87
87
  // Without the `pending` guard a second call (e.g. auto-apply firing while a manual
88
88
  // restart is draining) would orphan the first _drainTimer and re-log.
89
89
  if (this.restarting || this.pending) return;
90
- this.pauseAdmission();
91
- if (this.upstreamRequests.size === 0) {
90
+ // Seamless handoff → do not pre-drain AND do not pause admission. The old worker
91
+ // keeps serving everything it already holds after the baton passes — including
92
+ // requests WAITING in its queue. Pausing admission made the routing oracle report
93
+ // "no route will ever recover", so every queued waiter gave up at once: the
94
+ // v1.24.18 auto-update dropped 24 sessions that had waited 3-13 min (2026-10-11).
95
+ if (this.isSeamless()) {
96
+ if (this.upstreamRequests.size > 0) {
97
+ this.log(`[Maxpool] Restarting now — ${this.upstreamRequests.size} in-flight request(s) finish on the current version; new requests go to the updated one.`);
98
+ }
92
99
  this._restart();
93
100
  return;
94
101
  }
95
-
96
- // Seamless handoff → do not pre-drain (see isSeamless above). The in-flight
97
- // requests finish on the OLD worker after the baton passes; holding admission
98
- // here would only 503 the rest of the fleet for nothing.
99
- if (this.isSeamless()) {
100
- this.log(`[Maxpool] Restarting now — ${this.upstreamRequests.size} in-flight request(s) finish on the current version; new requests go to the updated one.`);
102
+ this.pauseAdmission();
103
+ if (this.upstreamRequests.size === 0) {
101
104
  this._restart();
102
105
  return;
103
106
  }
package/src/server.js CHANGED
@@ -507,7 +507,19 @@ async function forwardRequest(
507
507
  ctx.account = '(none available)';
508
508
  const retryPlan = accountManager.nextRetryForRequest?.(requestInfo, new Set()) || {};
509
509
  const willRecoverSoon = Number.isFinite(retryPlan.retryAfterMs);
510
- const retryAfter = willRecoverSoon ? Math.max(1, Math.ceil(retryPlan.retryAfterMs / 1000)) : 60;
510
+ // CLI-RETRIABLE CAP (2026-10-11 "bricked sessions"). The real soonest reset can
511
+ // be hours out; sending `retry-after: 10800` makes Claude Code's SDK treat the
512
+ // 429 as terminal (binary-verified 2.1.296: a plain rate_limit 429 whose
513
+ // retry-after exceeds 60s + 25% headroom aborts with tengu_api_retry_after_too_long
514
+ // — it neither sleeps nor retries; the turn dies and the session looks dead).
515
+ // The pool has ALREADY decided not to hold this request, so the honest and
516
+ // useful header is "retry soon": every SDK retries ≤60s values with backoff,
517
+ // and the pool answers again immediately with a fresh estimate. The body text
518
+ // still carries the real wait.
519
+ const RETRY_AFTER_RETRIABLE_S = 60;
520
+ const retryAfter = willRecoverSoon
521
+ ? Math.min(Math.max(1, Math.ceil(retryPlan.retryAfterMs / 1000)), RETRY_AFTER_RETRIABLE_S)
522
+ : 60;
511
523
  // Surface the routing decision (logs go to the TUI; this is the only record
512
524
  // of WHY a request was rejected rather than queued).
513
525
  console.log(`[Maxpool] No route for request — returning 429 (cause: ${retryPlan.cause || 'unavailable'}, recovers-soon: ${willRecoverSoon})`);