maxpool 1.8.7 → 1.8.9

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.7",
3
+ "version": "1.8.9",
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",
@@ -3689,6 +3689,12 @@ export class AccountManager {
3689
3689
  // Running version + npm update state (set at startup by maybeCheckForUpdate).
3690
3690
  // null until the check resolves; `current` is known even offline.
3691
3691
  version: this.versionInfo || null,
3692
+ // The version whose CODE is EXECUTING. `version.current` is a package.json DISK
3693
+ // read, so after a self-install (or on an npm-link'd checkout) it reports the
3694
+ // newest INSTALLED build, not the running one — a post-deploy check keyed on it
3695
+ // verifies the wrong thing (measured 2026-08-23: reported 1.8.7 while executing
3696
+ // 1.8.6). This field is the one to assert on.
3697
+ runningVersion: this.runningVersion || null,
3692
3698
  currentAccount: this.accounts[this.currentIndex]?.name,
3693
3699
  switchThreshold: this.switchThreshold,
3694
3700
  routing: {
package/src/index.js CHANGED
@@ -33,7 +33,7 @@ import { loginOAuth, fetchProfile, refreshAccessToken, isTokenExpiringSoon, toke
33
33
  import { TUI } from './tui.js';
34
34
  import { RestartController } from './restart-controller.js';
35
35
  import { resolveAccounts } from './account-config.js';
36
- import { maybeCheckForUpdate, getCurrentVersion, markApplied, clearQuarantine } from './updater.js';
36
+ import { maybeCheckForUpdate, getCurrentVersion, markApplied, clearQuarantine, captureBootVersion } from './updater.js';
37
37
  import {
38
38
  runReloadBaton,
39
39
  RELOAD_SWAPPED, RELOAD_ROLLED_BACK,
@@ -577,6 +577,10 @@ async function serverWorkerCommand() {
577
577
 
578
578
  const threshold = config.switchThreshold || 0.90;
579
579
  const accountManager = new AccountManager(accounts, threshold, config.scheduler || {});
580
+ // The EXECUTING build: a disk read taken NOW, before any self-install can rewrite
581
+ // package.json. Fire-and-forget — the status endpoint reports null until it lands
582
+ // (milliseconds), never a wrong number.
583
+ captureBootVersion().then(v => { accountManager.runningVersion = v; }).catch(() => {});
580
584
  // (macOS) Keep the system awake ONLY while there is work in flight or queued, so a
581
585
  // long overnight streaming request survives Maintenance Sleep; the Mac sleeps
582
586
  // normally when idle. Disable via `preventSleep: false` in config.
package/src/updater.js CHANGED
@@ -85,6 +85,27 @@ let _lastAttemptedTarget = null;
85
85
  /** Test-only: reset the module's version-tracking state between cases. */
86
86
  export function __resetUpdaterState() { _bootVersion = undefined; _lastAttemptedTarget = null; }
87
87
 
88
+ /** The version whose CODE this process is EXECUTING (captured at boot, before any
89
+ * self-install can rewrite the disk). Everything user-facing that says "current"
90
+ * should use THIS — a disk read reports the newest INSTALLED version, which after a
91
+ * background self-install (or on an npm-link'd dev checkout whose package.json moves
92
+ * with every commit) is not what is running. Measured 2026-08-23: the status endpoint
93
+ * answered 1.8.7 for a process executing 1.8.6, and a post-deploy check keyed on that
94
+ * number verified the wrong build. */
95
+ export async function captureBootVersion() {
96
+ // Read the disk ONCE, at process start, BEFORE any self-install can rewrite it — that
97
+ // read IS the executing version. (_bootVersion is the same value; it is populated
98
+ // lazily by the first maybeCheckForUpdate, which is up to 30 minutes after boot, so
99
+ // reading it at construction returns null — the bug in the first version of this fix.)
100
+ if (_bootVersion === undefined) _bootVersion = await getCurrentVersion();
101
+ return _bootVersion ?? null;
102
+ }
103
+
104
+ /** The already-captured executing version; null before captureBootVersion(). */
105
+ export function getBootVersion() {
106
+ return _bootVersion ?? null;
107
+ }
108
+
88
109
  /** Mark a version as ATTEMPTED-to-apply. The caller calls this at the moment it triggers
89
110
  * the reload — BEFORE the reload — so a rolled-back target is quarantined (advance-only).
90
111
  * Kept as the caller's action (not a side effect of maybeCheckForUpdate) so a caller that