maxpool 1.5.72 → 1.5.74

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.5.72",
3
+ "version": "1.5.74",
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",
@@ -1191,6 +1191,17 @@ export class AccountManager {
1191
1191
  * body signal only — never the session-sticky policy — and fails CLOSED on any
1192
1192
  * body we couldn't fully scan (non-JSON / parse error → bodyThinkingScanned unset). */
1193
1193
  _migrationSafeForRequest(requestInfo = {}) {
1194
+ // A same-PROVIDER migration (GLM→GLM, Kimi→Kimi) is always safe: the thinking
1195
+ // format is identical on both sides, so there is no cross-format replay risk.
1196
+ // The body-scanning gate below exists for Anthropic cross-account migration
1197
+ // (where a signed thinking block replayed to a different account can 400). It
1198
+ // was blocking provider rebalancing entirely — a GLM session bound to an account
1199
+ // at 92% weekly stayed there forever because bodyThinkingScanned was never set
1200
+ // on provider-origin requests (no Anthropic thinking blocks to scan).
1201
+ const boundName = this._sessionBinding(requestInfo.sessionKey)?.currentName;
1202
+ const boundAcct = boundName ? this.accounts.find(a => a.name === boundName) : null;
1203
+ if (boundAcct?.type === 'provider') return true;
1204
+
1194
1205
  // Fail closed on any body we couldn't fully scan (non-JSON / parse error).
1195
1206
  if (requestInfo.bodyThinkingScanned !== true) return false;
1196
1207
  // An Anthropic-incompatible (provider-pinned) session's only possible cross is
package/src/server.js CHANGED
@@ -1043,7 +1043,18 @@ async function forwardRequest(
1043
1043
  // self-heals instead of poisoning the session into a 400 loop. Signatures are
1044
1044
  // portable in practice (verified 2026-07-02); this only fires if Anthropic
1045
1045
  // ever account-binds them.
1046
- if (lease.migratedFromName && requestInfo.sessionKey
1046
+ // ONLY for a Claude→Claude migration. When the issuer is a PROVIDER, reverting
1047
+ // there is not a repair — the provider happily serves the request, but the
1048
+ // transcript keeps its provider-authored thinking blocks, so the very next turn
1049
+ // that routes back to Claude 400s on the SAME block. Measured 2026-08-09: the
1050
+ // same coordinate (messages.5.content.23) failed 4 times in 2 minutes, each one
1051
+ // "reverting to issuer glm max@gomokka.com" and never repairing anything.
1052
+ // The correct repair for a provider-authored block is the strip below.
1053
+ const issuer = lease.migratedFromName
1054
+ ? accountManager.accounts?.find(a => a.name === lease.migratedFromName)
1055
+ : null;
1056
+ const issuerIsClaude = issuer && issuer.type !== 'provider';
1057
+ if (lease.migratedFromName && issuerIsClaude && requestInfo.sessionKey
1047
1058
  && canRetryBufferedBody && retryCount + 1 < maxAttempts && !res.headersSent) {
1048
1059
  accountManager.revertSessionBinding(requestInfo.sessionKey, lease.migratedFromName);
1049
1060
  excludedIndexes.add(account.index);