maxpool 1.10.1 → 1.10.2

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 +34 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maxpool",
3
- "version": "1.10.1",
3
+ "version": "1.10.2",
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
@@ -1991,7 +1991,23 @@ function stripRejectedBlockClass(body, errorBody) {
1991
1991
  // and keeping the original would resend the exact body that just 400'd. Except
1992
1992
  // messages[0], which must survive as a `user` turn (see the same guard above).
1993
1993
  if (kept.length === 0) {
1994
- if (messages.length === 0) { messages.push({ ...msg, content: [{ type: 'text', text: '(content removed)' }] }); }
1994
+ // messages[0] must survive AS A USER TURN — Anthropic requires the first message
1995
+ // to be `user`, and preserving the original role (what this did until
1996
+ // 2026-08-24) left a system-first transcript system-first: the guard silently
1997
+ // not doing the one thing it exists for.
1998
+ if (messages.length === 0) {
1999
+ messages.push({ role: 'user', content: [{ type: 'text', text: '(content removed)' }] });
2000
+ continue;
2001
+ }
2002
+ // A SYSTEM turn is never dropped. Every other role can go — the turn carried
2003
+ // nothing but a poisoned block, and a gap is harmless. A system is an
2004
+ // INSTRUCTION channel: deleting it changes how the session behaves with no
2005
+ // signal to anyone, which is worse than the loud 400 the repair is fixing.
2006
+ // Keep the turn as a placeholder so its position and presence survive.
2007
+ if (msg?.role === 'system') {
2008
+ messages.push({ ...msg, content: [{ type: 'text', text: '(content removed)' }] });
2009
+ continue;
2010
+ }
1995
2011
  continue;
1996
2012
  }
1997
2013
  messages.push({ ...msg, content: kept });
@@ -2169,7 +2185,23 @@ function stripForeignThinkingBlocks(body) {
2169
2185
  // Reachable only since the role gate was removed — before that, non-assistant
2170
2186
  // turns were never dropped at all.
2171
2187
  if (kept.length === 0) {
2172
- if (messages.length === 0) { messages.push({ ...msg, content: [{ type: 'text', text: '(content removed)' }] }); }
2188
+ // messages[0] must survive AS A USER TURN — Anthropic requires the first message
2189
+ // to be `user`, and preserving the original role (what this did until
2190
+ // 2026-08-24) left a system-first transcript system-first: the guard silently
2191
+ // not doing the one thing it exists for.
2192
+ if (messages.length === 0) {
2193
+ messages.push({ role: 'user', content: [{ type: 'text', text: '(content removed)' }] });
2194
+ continue;
2195
+ }
2196
+ // A SYSTEM turn is never dropped. Every other role can go — the turn carried
2197
+ // nothing but a poisoned block, and a gap is harmless. A system is an
2198
+ // INSTRUCTION channel: deleting it changes how the session behaves with no
2199
+ // signal to anyone, which is worse than the loud 400 the repair is fixing.
2200
+ // Keep the turn as a placeholder so its position and presence survive.
2201
+ if (msg?.role === 'system') {
2202
+ messages.push({ ...msg, content: [{ type: 'text', text: '(content removed)' }] });
2203
+ continue;
2204
+ }
2173
2205
  continue;
2174
2206
  }
2175
2207
  messages.push({ ...msg, content: kept });