maxpool 1.17.0 → 1.19.0
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 +45 -17
package/package.json
CHANGED
package/src/account-manager.js
CHANGED
|
@@ -170,16 +170,18 @@ const DEFAULT_SCHEDULER = {
|
|
|
170
170
|
// account sat at ~17% of fleet traffic (measured 2026-08-25) while four Claude
|
|
171
171
|
// accounts ran at weekly 1.0.
|
|
172
172
|
//
|
|
173
|
-
// The discount is a MULTIPLIER on
|
|
174
|
-
// bonus would drive an idle account's total NEGATIVE
|
|
175
|
-
//
|
|
176
|
-
//
|
|
177
|
-
//
|
|
178
|
-
// (
|
|
179
|
-
//
|
|
180
|
-
//
|
|
181
|
-
//
|
|
182
|
-
//
|
|
173
|
+
// The discount is a MULTIPLIER on the BALANCING terms — never a flat bonus. A flat
|
|
174
|
+
// bonus would drive an idle account's total NEGATIVE, below the entire band structure
|
|
175
|
+
// that reserveFloorCost:5 / criticalPressureCost:21 assume is non-negative. A
|
|
176
|
+
// multiplier in [0,1] cannot: it only ever REMOVES cost that is already there.
|
|
177
|
+
// Term set as of 2026-08-29 (v1.19.0): utilization + pace (original, 2026-08-25),
|
|
178
|
+
// spread (v1.18.0), and the in-flight terms — linear concurrency + capPenalty
|
|
179
|
+
// (v1.19.0). The in-flight extension exists because live requests run 18-27s at
|
|
180
|
+
// weight 10-50, making in-flight the marginal price of traffic: measured
|
|
181
|
+
// 2026-08-28, spread-only left the unlimited account at parity (0.24x share),
|
|
182
|
+
// defeating the owner's approved outcome. Reserve/critical/ramp/failure costs stay
|
|
183
|
+
// undiscounted, as do the hard gates (safetyMaxActivePerAccount, usage cap,
|
|
184
|
+
// cooldowns) — those are the anti-dogpile backstops, not price signals.
|
|
183
185
|
fastRefillDiscount: 0.6, // 0 = off (full cost), 0.6 = discount up to 60% of the two balancing terms
|
|
184
186
|
fastRefillFadeUtil: 0.65, // discount reaches 0 at this session utilization (weeklySoftThreshold)
|
|
185
187
|
recoveryRampWeight: 4, // decaying penalty applied to a just-recovered account
|
|
@@ -2542,11 +2544,20 @@ export class AccountManager {
|
|
|
2542
2544
|
const now = ctx?.now ?? Date.now();
|
|
2543
2545
|
const reqWeight = Math.max(1, requestInfo.weight || 1);
|
|
2544
2546
|
const inflight = account.activeWeight + reqWeight;
|
|
2547
|
+
const refillMult = this._fastRefillMultiplier(account);
|
|
2545
2548
|
|
|
2546
2549
|
// DOMINANT term: in-flight concurrency. Short-term throttling is driven by
|
|
2547
2550
|
// how many requests pile on one account, so least-loaded-first spread is
|
|
2548
2551
|
// the primary objective.
|
|
2549
|
-
|
|
2552
|
+
// FAST-REFILL (2026-08-29 extension): in the LIVE regime this term (plus the
|
|
2553
|
+
// capPenalty below) is what actually sets the equilibrium share — requests
|
|
2554
|
+
// run 18-27s at weight 10-50, so in-flight dwarfs every balancing term.
|
|
2555
|
+
// Measured 2026-08-28 post-v1.18.0: a spread-only discount left the
|
|
2556
|
+
// unlimited account at parity (12 of 56 GLM switches, share 0.24x). The
|
|
2557
|
+
// linear term is BALANCING (it shares load), so it carries the discount;
|
|
2558
|
+
// the steep past-D floor, the hard request gate, cooldowns and failure
|
|
2559
|
+
// backoff are the anti-dogpile machinery and are handled below.
|
|
2560
|
+
const concurrency = inflight * this.scheduler.concurrencyWeight * refillMult;
|
|
2550
2561
|
|
|
2551
2562
|
// Steep soft cap past depth D — the throttle safety floor. No single
|
|
2552
2563
|
// account absorbs a deep concurrent burst no matter how "cheap" it looks. A
|
|
@@ -2560,15 +2571,21 @@ export class AccountManager {
|
|
|
2560
2571
|
const concTarget = (weeklyState === 'reserve' || (weeklyState === 'critical' && criticalUnlock))
|
|
2561
2572
|
? this.scheduler.reserveConcurrencyTarget
|
|
2562
2573
|
: this.scheduler.perAccountConcurrencyTarget;
|
|
2574
|
+
// FAST-REFILL (2026-08-29): carries the discount for the same reason as the
|
|
2575
|
+
// linear term — at live weights every account sits past D, so the marginal
|
|
2576
|
+
// in-flight price IS capPenalty; discounting one without the other changes
|
|
2577
|
+
// nothing. The floor stays STEEP in absolute terms (≥ capPenaltyWeight*mult
|
|
2578
|
+
// per unit, still >2x the largest balancing term at the max discount) and
|
|
2579
|
+
// the hard per-account request gate (safetyMaxActivePerAccount), cooldowns
|
|
2580
|
+
// and failurePenalty remain undiscounted backstops.
|
|
2563
2581
|
const capPenalty = this.scheduler.capPenaltyWeight
|
|
2564
|
-
* Math.max(0, inflight - concTarget);
|
|
2582
|
+
* Math.max(0, inflight - concTarget) * refillMult;
|
|
2565
2583
|
|
|
2566
2584
|
// Burn-pace COST only (demoted from the old dominant scarcity×6 term): a
|
|
2567
2585
|
// soft de-preference of accounts burning ahead of an even pace. Never a bench.
|
|
2568
|
-
// FAST-REFILL DISCOUNT: applied to the pace and utilization terms
|
|
2569
|
-
//
|
|
2570
|
-
//
|
|
2571
|
-
const refillMult = this._fastRefillMultiplier(account);
|
|
2586
|
+
// FAST-REFILL DISCOUNT: applied to the pace and utilization terms for an
|
|
2587
|
+
// account whose only cap is a fast-refilling session window — see the
|
|
2588
|
+
// DEFAULT_SCHEDULER block for the full rationale (refillMult computed above).
|
|
2572
2589
|
const paceCost = this._accountScarcity(account, now) * this.scheduler.paceCostWeight * refillMult;
|
|
2573
2590
|
|
|
2574
2591
|
// RAW utilization cost — direct, not pace-adjusted. The pace cost above discounts
|
|
@@ -2592,7 +2609,18 @@ export class AccountManager {
|
|
|
2592
2609
|
const fleetRecentWeight = ctx?.fleetRecentWeight ?? 0;
|
|
2593
2610
|
const recentWeight = this._loadSummary(account, this.scheduler.spreadWindowMs, now).weight;
|
|
2594
2611
|
const share = fleetRecentWeight > 0 ? recentWeight / fleetRecentWeight : 0;
|
|
2595
|
-
|
|
2612
|
+
// SPREAD also carries the fast-refill discount (2026-08-29, owner option 1). The
|
|
2613
|
+
// spread term is the equaliser that pulls every account back to fleet parity — at
|
|
2614
|
+
// converged equal share it is ~10x larger than the utilization+pace gap the
|
|
2615
|
+
// discount bought before (measured: spread 1.500 vs 0.152 on the real fleet), so
|
|
2616
|
+
// without this the unlimited account's preference washes out to ~52/48 and a
|
|
2617
|
+
// weekly-limited sibling burns to 100% while the fast window's capacity expires
|
|
2618
|
+
// unused every 5h. Discounted, the equilibrium share of a weeklyAbsent account is
|
|
2619
|
+
// ~mult/(1-disc*(1-share)) of a sibling's — at the default 0.6 discount roughly
|
|
2620
|
+
// 2.3x early in its window, fading to parity at the same ses 0.65 the multiplier
|
|
2621
|
+
// already uses. A multiplier of 1 makes every discounted term byte-identical to
|
|
2622
|
+
// pre-2026-08-25 behaviour; reserve/critical/ramp/failure are never discounted.
|
|
2623
|
+
const spread = share * this.scheduler.spreadShareWeight * refillMult;
|
|
2596
2624
|
|
|
2597
2625
|
const ramp = this._recoveryRamp(account, now);
|
|
2598
2626
|
const reserveCost = this._reserveCost(account, now, weeklyState);
|