maxpool 1.8.4 → 1.8.5

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.8.4",
3
+ "version": "1.8.5",
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",
@@ -3066,7 +3066,13 @@ export class AccountManager {
3066
3066
  // window (>=5h) — the 60s epsilon separates it by three orders of magnitude.
3067
3067
  // Provider stamps (z.ai/Kimi probe) are absolute and never jitter.
3068
3068
  const nowMs = Date.now();
3069
- const boundary = nextResetAt <= nowMs ? nowMs : nextResetAt;
3069
+ // A close can never be dated in the FUTURE. An advance stamp legitimately points
3070
+ // at the NEW window's reset (a fresh 5h away) — that is evidence the OLD window
3071
+ // rolled, not the moment it rolled. Close at NOW (live 2026-08-23: a 3,658-token
3072
+ // cycle was recorded as endedAt 4.9h in the future; the invariant checker caught
3073
+ // it minutes later). `min` also floors the late-probe case (a stamp already
3074
+ // expired) — endedAt is always within [start, now].
3075
+ const boundary = Math.min(nextResetAt, nowMs);
3070
3076
  if (boundary - prevResetAt < WINDOW_ADVANCE_EPSILON_MS) return;
3071
3077
  this.capacity.closeCycle(accountName, window, boundary, { resetAt: prevResetAt });
3072
3078
  }