maxpool 1.24.73 → 1.24.75
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 +1 -1
- package/src/account-manager.js +14 -1
- package/src/index.js +1 -1
- package/src/server.js +4 -0
- package/src/tui.js +10 -3
package/package.json
CHANGED
package/src/account-manager.js
CHANGED
|
@@ -2340,6 +2340,13 @@ export class AccountManager {
|
|
|
2340
2340
|
if (switched) {
|
|
2341
2341
|
console.log(`[Maxpool] Switched to account "${best.name}"`);
|
|
2342
2342
|
}
|
|
2343
|
+
// Evidence for the next cache measurement: one line each time a KNOWN
|
|
2344
|
+
// conversation leaves its last account (bounded by moves, not by requests).
|
|
2345
|
+
const ckey = this._affinityKey(requestInfo);
|
|
2346
|
+
const lastName = ckey ? this.conversationLastAccount.get(ckey) : null;
|
|
2347
|
+
if (lastName && lastName !== best.name) {
|
|
2348
|
+
console.log(`[Maxpool] conversation moved: ${lastName} → ${best.name} (${requestInfo.bodyBytes ?? '?'}B)`);
|
|
2349
|
+
}
|
|
2343
2350
|
return best;
|
|
2344
2351
|
}
|
|
2345
2352
|
}
|
|
@@ -3205,6 +3212,12 @@ export class AccountManager {
|
|
|
3205
3212
|
if (base <= 0 || this.scheduler.routingMode === 'sticky') return 0;
|
|
3206
3213
|
const key = this._affinityKey(requestInfo);
|
|
3207
3214
|
if (!key || this.conversationLastAccount.get(key) !== account.name) return 0;
|
|
3215
|
+
// Scale with the CONVERSATION'S SIZE too: losing the cache costs the prefix a
|
|
3216
|
+
// hop re-writes, and requestInfo.bodyBytes ≈ prefix + this turn. Checkpoint
|
|
3217
|
+
// 2026-11-08 11:07Z: a flat 400 cut full re-writes only 18.9%→14.8% of turns —
|
|
3218
|
+
// the rest were 100K-500K-token conversations whose single in-flight turn
|
|
3219
|
+
// already outweighed it. 1x below 150KB, rising to 3x at 450KB+.
|
|
3220
|
+
const sizeMult = Math.min(3, Math.max(1, (requestInfo.bodyBytes || 0) / 150_000));
|
|
3208
3221
|
// No readable quota (Kimi's coding key is console-only) → nothing would ever
|
|
3209
3222
|
// release the hold before a 429; give such rows plain balancing (red-team r1).
|
|
3210
3223
|
if (account.type === 'provider' && account.quota?.providerQuotaSource === 'console-only') return 0;
|
|
@@ -3224,7 +3237,7 @@ export class AccountManager {
|
|
|
3224
3237
|
? this._fastRefillMultiplier(account, { capFloor: true }) : refillMult;
|
|
3225
3238
|
const unit = this.scheduler.concurrencyWeight * refillMult + this.scheduler.capPenaltyWeight * safetyMult;
|
|
3226
3239
|
const fullUnit = this.scheduler.concurrencyWeight + this.scheduler.capPenaltyWeight;
|
|
3227
|
-
return base * Math.min(1, unit / fullUnit);
|
|
3240
|
+
return base * sizeMult * Math.min(1, unit / fullUnit);
|
|
3228
3241
|
}
|
|
3229
3242
|
|
|
3230
3243
|
/**
|
package/src/index.js
CHANGED
|
@@ -1005,7 +1005,7 @@ async function serverWorkerCommand() {
|
|
|
1005
1005
|
// Headless (service / shared VM) pools have no TUI log buffer, so named-caller
|
|
1006
1006
|
// attribution would otherwise reach no log at all. Only named callers are
|
|
1007
1007
|
// logged here — a solo headless pool stays as quiet as before.
|
|
1008
|
-
appendEventLog(`[Maxpool] ${info.caller} · ${info.method} ${info.path} → ${info.account || '?'} (${info.status})`);
|
|
1008
|
+
appendEventLog(`[Maxpool] ${info.caller} · ${info.method} ${info.path} → ${info.account || '?'} (${info.status})${info.conversation ? ` [cv ${info.conversation.slice(0, 8)}]` : ''}`);
|
|
1009
1009
|
}
|
|
1010
1010
|
},
|
|
1011
1011
|
};
|
package/src/server.js
CHANGED
|
@@ -544,6 +544,10 @@ export function createProxyServer(accountManager, config, hooks = {}) {
|
|
|
544
544
|
method: req.method, path: req.url,
|
|
545
545
|
account: ctx.account, status: ctx.status,
|
|
546
546
|
caller: req.callerName || null,
|
|
547
|
+
// Join keys for cache analysis (2026-11-08): which conversation each turn
|
|
548
|
+
// belonged to, so a turn's account is exact instead of a timestamp guess.
|
|
549
|
+
conversation: requestInfo?.conversationHash || null,
|
|
550
|
+
sessionKey: headerValue(req.headers, 'x-maxpool-session') || null,
|
|
547
551
|
});
|
|
548
552
|
}
|
|
549
553
|
} catch (err) {
|
package/src/tui.js
CHANGED
|
@@ -562,7 +562,7 @@ export class TUI {
|
|
|
562
562
|
// ── server hooks ───────────────────────────────────
|
|
563
563
|
|
|
564
564
|
onRequestStart(id, info) {
|
|
565
|
-
this.active.set(id, { ...info, t: timestamp(), started: Date.now(), account: null, caller: info.caller || null });
|
|
565
|
+
this.active.set(id, { ...info, t: timestamp(), started: Date.now(), account: null, caller: info.caller || null, conversation: info.conversation || null });
|
|
566
566
|
this.render();
|
|
567
567
|
}
|
|
568
568
|
|
|
@@ -585,8 +585,15 @@ export class TUI {
|
|
|
585
585
|
// then `ps eww -p <pid> | grep x-maxpool-session` to find the terminal. Truthiness
|
|
586
586
|
// guard — a header-less request has sessionKey '' (server.js headerValue) → no tag.
|
|
587
587
|
const isProvider = this.am.accounts.find(a => a.name === acct)?.type === 'provider';
|
|
588
|
-
|
|
589
|
-
|
|
588
|
+
// Turn tags (2026-11-08): [sess <terminal>] on provider rows (unchanged), and
|
|
589
|
+
// [cv <conversation> <terminal>] on every row — the exact join a cache analysis
|
|
590
|
+
// needs between a transcript turn and the ACCOUNT that served it (previously
|
|
591
|
+
// only a timestamp window, too noisy to separate an account switch from cache
|
|
592
|
+
// expiry; peer audit 2026-11-08). Short: log stays scannable.
|
|
593
|
+
const provTag = (isProvider && r?.sessionKey) ? ` [sess ${String(r.sessionKey).slice(0, 8)}]` : '';
|
|
594
|
+
const cv = info.conversation || r?.conversation;
|
|
595
|
+
const cvTag = cv ? ` [cv ${cv.slice(0, 8)} ${String(info.sessionKey || r?.sessionKey || '').slice(0, 8)}]` : '';
|
|
596
|
+
this._addLog(`${who}${info.method} ${info.path} → ${acct} (${info.status}, ${dur}s)${provTag}${cvTag}`);
|
|
590
597
|
}
|
|
591
598
|
|
|
592
599
|
_addLog(msg) {
|