instar 1.3.590 → 1.3.592
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/dist/commands/server.d.ts.map +1 -1
- package/dist/commands/server.js +39 -12
- package/dist/commands/server.js.map +1 -1
- package/dist/core/OwnershipApplier.d.ts +10 -1
- package/dist/core/OwnershipApplier.d.ts.map +1 -1
- package/dist/core/OwnershipApplier.js +11 -1
- package/dist/core/OwnershipApplier.js.map +1 -1
- package/dist/core/QuotaAwareScheduler.d.ts +25 -0
- package/dist/core/QuotaAwareScheduler.d.ts.map +1 -1
- package/dist/core/QuotaAwareScheduler.js +36 -0
- package/dist/core/QuotaAwareScheduler.js.map +1 -1
- package/dist/core/ownershipApplierWiring.d.ts +44 -0
- package/dist/core/ownershipApplierWiring.d.ts.map +1 -0
- package/dist/core/ownershipApplierWiring.js +20 -0
- package/dist/core/ownershipApplierWiring.js.map +1 -0
- package/dist/monitoring/QuotaTracker.d.ts +56 -0
- package/dist/monitoring/QuotaTracker.d.ts.map +1 -1
- package/dist/monitoring/QuotaTracker.js +112 -4
- package/dist/monitoring/QuotaTracker.js.map +1 -1
- package/dist/scaffold/templates.d.ts.map +1 -1
- package/dist/scaffold/templates.js +2 -1
- package/dist/scaffold/templates.js.map +1 -1
- package/package.json +1 -1
- package/src/data/builtin-manifest.json +2 -2
- package/src/scaffold/templates.ts +2 -1
- package/upgrades/1.3.591.md +34 -0
- package/upgrades/1.3.592.md +40 -0
- package/upgrades/side-effects/ownership-applier-meshself-ordering-fix.md +52 -0
- package/upgrades/side-effects/pool-aware-quota-throttle.md +123 -0
|
@@ -51,7 +51,14 @@ export interface OwnershipApplierDeps {
|
|
|
51
51
|
/** The SAME durable store the SessionOwnershipRegistry reads — so a materialized
|
|
52
52
|
* record is immediately visible to owner-resolution / routing. */
|
|
53
53
|
store: SessionOwnershipStore;
|
|
54
|
-
|
|
54
|
+
/**
|
|
55
|
+
* This machine's mesh id — used ONLY for the SELF-vs-peer log label, never for
|
|
56
|
+
* materialization (every placement is adopted regardless of owner). Accepts a
|
|
57
|
+
* **late-bound getter** so a caller can wire the applier before `_meshSelfId` is
|
|
58
|
+
* resolved without capturing a stale `null` (the boot-ordering hazard this fix closes);
|
|
59
|
+
* a plain string still works for callers/tests that already have the id.
|
|
60
|
+
*/
|
|
61
|
+
selfMachineId: string | (() => string | null | undefined);
|
|
55
62
|
/** Max placement entries to scan per tick (bounded cost). Default 1000. */
|
|
56
63
|
scanLimit?: number;
|
|
57
64
|
logger?: (msg: string) => void;
|
|
@@ -68,6 +75,8 @@ export declare class OwnershipApplier {
|
|
|
68
75
|
constructor(deps: OwnershipApplierDeps);
|
|
69
76
|
private now;
|
|
70
77
|
private log;
|
|
78
|
+
/** Resolve the (possibly late-bound) self machine id at tick time, for the log label only. */
|
|
79
|
+
private resolveSelf;
|
|
71
80
|
/**
|
|
72
81
|
* One pass: adopt the highest-epoch placement per topic into the local store.
|
|
73
82
|
* Returns counts for observability. Never throws — a read/parse failure degrades
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OwnershipApplier.d.ts","sourceRoot":"","sources":["../../src/core/OwnershipApplier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAE3E,uFAAuF;AACvF,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,IAAI,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG;QAC9D,OAAO,EAAE,KAAK,CAAC;YAAE,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM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4D;IAC5D,QAAQ,EAAE,MAAM,CAAC;IACjB,iFAAiF;IACjF,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAuB;gBAE7B,IAAI,EAAE,oBAAoB;IAItC,OAAO,CAAC,GAAG;IAIX,OAAO,CAAC,GAAG;IAIX,8FAA8F;IAC9F,OAAO,CAAC,WAAW;IAKnB;;;;OAIG;IACH,IAAI,IAAI,oBAAoB;CAuD7B"}
|
|
@@ -40,6 +40,11 @@ export class OwnershipApplier {
|
|
|
40
40
|
log(m) {
|
|
41
41
|
this.d.logger?.(`[ownership-applier] ${m}`);
|
|
42
42
|
}
|
|
43
|
+
/** Resolve the (possibly late-bound) self machine id at tick time, for the log label only. */
|
|
44
|
+
resolveSelf() {
|
|
45
|
+
const s = this.d.selfMachineId;
|
|
46
|
+
return typeof s === 'function' ? s() : s;
|
|
47
|
+
}
|
|
43
48
|
/**
|
|
44
49
|
* One pass: adopt the highest-epoch placement per topic into the local store.
|
|
45
50
|
* Returns counts for observability. Never throws — a read/parse failure degrades
|
|
@@ -85,8 +90,13 @@ export class OwnershipApplier {
|
|
|
85
90
|
const r = this.d.store.casWrite(rec);
|
|
86
91
|
if (r.ok) {
|
|
87
92
|
materialized++;
|
|
93
|
+
const self = this.resolveSelf();
|
|
88
94
|
this.log(`materialized topic ${sessionKey} → owner ${best.owner} @epoch ${best.epoch}` +
|
|
89
|
-
(best.owner ===
|
|
95
|
+
(self && best.owner === self
|
|
96
|
+
? ' (SELF — this machine now serves it)'
|
|
97
|
+
: self
|
|
98
|
+
? ' (peer — route forwards there)'
|
|
99
|
+
: ''));
|
|
90
100
|
}
|
|
91
101
|
}
|
|
92
102
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OwnershipApplier.js","sourceRoot":"","sources":["../../src/core/OwnershipApplier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;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E,QAAQ;oBAChB,0EAA0E;oBAC1E,4CAA4C;oBAC5C,KAAK,EAAE,WAAW,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,EAAE;oBAC5C,SAAS,EAAE,GAAG;oBACd,SAAS,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE;iBACvC,CAAC;gBACF,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;gBACrC,IAAI,CAAC,CAAC,EAAE,EAAE,CAAC;oBACT,YAAY,EAAE,CAAC;oBACf,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;oBAChC,IAAI,CAAC,GAAG,CACN,sBAAsB,UAAU,YAAY,IAAI,CAAC,KAAK,WAAW,IAAI,CAAC,KAAK,EAAE;wBAC3E,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI;4BAC1B,CAAC,CAAC,sCAAsC;4BACxC,CAAC,CAAC,IAAI;gCACJ,CAAC,CAAC,gCAAgC;gCAClC,CAAC,CAAC,EAAE,CAAC,CACZ,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,8EAA8E;YAC9E,iFAAiF;YACjF,IAAI,CAAC,GAAG,CAAC,gBAAgB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC/E,CAAC;QACD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;IACpC,CAAC;CACF"}
|
|
@@ -45,6 +45,31 @@ export declare function scoreAccount(a: SubscriptionAccount, nowMs: number): num
|
|
|
45
45
|
* the account that just hit its limit.
|
|
46
46
|
*/
|
|
47
47
|
export declare function selectAccount(accounts: SubscriptionAccount[], opts?: SelectionOptions, excludeId?: string): SubscriptionAccount | null;
|
|
48
|
+
/**
|
|
49
|
+
* Pool-headroom summary for the QUOTA THROTTLE (`QuotaTracker` provider). This is
|
|
50
|
+
* DISTINCT from `selectAccount`, which picks WHERE to place a session for
|
|
51
|
+
* use-it-or-lose-it (it favors the soonest-to-reset account, which may be highly
|
|
52
|
+
* used). The throttle asks a different question — "is there capacity for this work
|
|
53
|
+
* ANYWHERE in the pool?" — so it must gate on the MOST-HEADROOM eligible account,
|
|
54
|
+
* not the drain-first winner. (Live proof against the real pool, 2026-06-16: with a
|
|
55
|
+
* fresh 0% reserve alongside an 85% drain-first account, gating on the drain-first
|
|
56
|
+
* account wrongly shed all non-critical work — overriding codex round-2 minor #2's
|
|
57
|
+
* "accepted as marginal" with real evidence that it materially under-delivered.)
|
|
58
|
+
*
|
|
59
|
+
* Crucially it shares the EXACT eligibility predicate `selectAccount` uses
|
|
60
|
+
* (`isEligibleStatus` + binding utilization below the soft threshold), so
|
|
61
|
+
* `placeable` here ⟺ `selectAccount(...) !== null` — the never-loop invariant
|
|
62
|
+
* holds (the throttle never allows when placement can place nothing). Percentages
|
|
63
|
+
* are clamped to [0,100]; `degraded:true` when the best account has no trustworthy
|
|
64
|
+
* live reading, so the throttle applies its bounded degraded cap instead of a
|
|
65
|
+
* phantom "0% fresh".
|
|
66
|
+
*/
|
|
67
|
+
export declare function poolHeadroom(accounts: SubscriptionAccount[], opts?: SelectionOptions): {
|
|
68
|
+
placeable: boolean;
|
|
69
|
+
weeklyPercent: number | null;
|
|
70
|
+
fiveHourPercent: number | null;
|
|
71
|
+
degraded: boolean;
|
|
72
|
+
};
|
|
48
73
|
/** Is this account at/over the soft pressure threshold on its binding window? */
|
|
49
74
|
export declare function accountAtPressure(a: SubscriptionAccount, softThresholdPct?: number): boolean;
|
|
50
75
|
/** Injected session-restart-with-resume (wraps SessionRefresh in prod). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuotaAwareScheduler.d.ts","sourceRoot":"","sources":["../../src/core/QuotaAwareSc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CAAC;CAClE;AAED,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA4B;gBACpC,GAAG,EAAE,yBAAyB;IAI1C,qEAAqE;IACrE,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,mBAAmB,GAAG,IAAI;IAO1D;;;;;;OAMG;IACG,eAAe,CAAC,IAAI,EAAE;QAC1B,WAAW,EAAE,MAAM,CAAC;QACpB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,KAAK,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC,UAAU,CAAC;CA+BxB"}
|
|
@@ -94,6 +94,42 @@ export function selectAccount(accounts, opts = {}, excludeId) {
|
|
|
94
94
|
.map((a) => ({ a, s: scoreAccount(a, nowMs) }))
|
|
95
95
|
.sort((x, y) => y.s - x.s)[0].a;
|
|
96
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Pool-headroom summary for the QUOTA THROTTLE (`QuotaTracker` provider). This is
|
|
99
|
+
* DISTINCT from `selectAccount`, which picks WHERE to place a session for
|
|
100
|
+
* use-it-or-lose-it (it favors the soonest-to-reset account, which may be highly
|
|
101
|
+
* used). The throttle asks a different question — "is there capacity for this work
|
|
102
|
+
* ANYWHERE in the pool?" — so it must gate on the MOST-HEADROOM eligible account,
|
|
103
|
+
* not the drain-first winner. (Live proof against the real pool, 2026-06-16: with a
|
|
104
|
+
* fresh 0% reserve alongside an 85% drain-first account, gating on the drain-first
|
|
105
|
+
* account wrongly shed all non-critical work — overriding codex round-2 minor #2's
|
|
106
|
+
* "accepted as marginal" with real evidence that it materially under-delivered.)
|
|
107
|
+
*
|
|
108
|
+
* Crucially it shares the EXACT eligibility predicate `selectAccount` uses
|
|
109
|
+
* (`isEligibleStatus` + binding utilization below the soft threshold), so
|
|
110
|
+
* `placeable` here ⟺ `selectAccount(...) !== null` — the never-loop invariant
|
|
111
|
+
* holds (the throttle never allows when placement can place nothing). Percentages
|
|
112
|
+
* are clamped to [0,100]; `degraded:true` when the best account has no trustworthy
|
|
113
|
+
* live reading, so the throttle applies its bounded degraded cap instead of a
|
|
114
|
+
* phantom "0% fresh".
|
|
115
|
+
*/
|
|
116
|
+
export function poolHeadroom(accounts, opts = {}) {
|
|
117
|
+
const soft = opts.softThresholdPct ?? DEFAULT_SOFT_THRESHOLD;
|
|
118
|
+
const eligible = accounts.filter((a) => isEligibleStatus(a) && bindingUtilization(a.lastQuota) < soft);
|
|
119
|
+
if (eligible.length === 0) {
|
|
120
|
+
return { placeable: false, weeklyPercent: null, fiveHourPercent: null, degraded: false };
|
|
121
|
+
}
|
|
122
|
+
let best = eligible[0];
|
|
123
|
+
for (const a of eligible) {
|
|
124
|
+
if (bindingUtilization(a.lastQuota) < bindingUtilization(best.lastQuota))
|
|
125
|
+
best = a;
|
|
126
|
+
}
|
|
127
|
+
const clamp = (v) => typeof v === 'number' && isFinite(v) ? Math.max(0, Math.min(100, v)) : null;
|
|
128
|
+
const weeklyPercent = clamp(best.lastQuota?.sevenDay?.utilizationPct);
|
|
129
|
+
const fiveHourPercent = clamp(best.lastQuota?.fiveHour?.utilizationPct);
|
|
130
|
+
const degraded = weeklyPercent === null && fiveHourPercent === null;
|
|
131
|
+
return { placeable: true, weeklyPercent, fiveHourPercent, degraded };
|
|
132
|
+
}
|
|
97
133
|
/** Is this account at/over the soft pressure threshold on its binding window? */
|
|
98
134
|
export function accountAtPressure(a, softThresholdPct = DEFAULT_SOFT_THRESHOLD) {
|
|
99
135
|
return bindingUtilization(a.lastQuota) >= softThresholdPct;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuotaAwareScheduler.js","sourceRoot":"","sources":["../../src/core/QuotaAwareScheduler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAgBH,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAElC,uDAAuD;AACvD,SAAS,gBAAgB,CAAC,CAAsB;IAC9C,OAAO,CAAC,CAAC,MAAM,KAAK,QA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KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,uBAAuB,EAAE,CAAC;QAChF,CAAC;QACD,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC;YAClC,WAAW;YACX,MAAM,EAAE,eAAe,kBAAkB,MAAM,IAAI,CAAC,EAAE,EAAE;YACxD,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,SAAS,EAAE,IAAI,CAAC,EAAE;SACnB,CAAC,CAAC;QACH,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CACnB,yBAAyB,WAAW,aAAa,IAAI,CAAC,EAAE,6BAA6B,CACtF,CAAC;YACF,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC;QAC5E,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAClB,yBAAyB,WAAW,gBAAgB,IAAI,CAAC,EAAE,SAAS,kBAAkB,yCAAyC,CAChI,CAAC;QACF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,qBAAqB,EAAE,CAAC;IAChF,CAAC;CACF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ownershipApplierWiring — the testable construction factory for the transfer-fix §7.2
|
|
3
|
+
* OwnershipApplier (spec: docs/specs/ownership-applier-meshself-ordering-fix.md).
|
|
4
|
+
*
|
|
5
|
+
* Why this exists: the applier's construction CONDITION used to live inline in
|
|
6
|
+
* `server.ts` as `if (durableOwnershipStore && _meshSelfId)`. That guard read
|
|
7
|
+
* `_meshSelfId` ~650 lines BEFORE the boot sequence assigns it, so it was always
|
|
8
|
+
* `null` at the check → the applier was never constructed or ticked, on either machine,
|
|
9
|
+
* and a transferred seat never materialized on the destination. The inline condition was
|
|
10
|
+
* also untestable, which is precisely how the ordering bug shipped.
|
|
11
|
+
*
|
|
12
|
+
* The fix (Structure > Willpower): gate construction on the durable store ALONE — the
|
|
13
|
+
* genuinely relevant condition (applying replicated placements is a durable-store concern;
|
|
14
|
+
* the in-memory store has no cross-machine replication to apply) — and pass `selfMachineId`
|
|
15
|
+
* as a LATE-BOUND getter so the (label-only) self id resolves at tick time instead of being
|
|
16
|
+
* captured as a stale `null` at construction. This makes the wiring order-independent and
|
|
17
|
+
* unit-testable without booting the whole server.
|
|
18
|
+
*/
|
|
19
|
+
import type { PlacementReader } from './OwnershipApplier.js';
|
|
20
|
+
import { OwnershipApplier } from './OwnershipApplier.js';
|
|
21
|
+
import type { SessionOwnershipStore } from './SessionOwnershipRegistry.js';
|
|
22
|
+
export interface OwnershipApplierWiringDeps {
|
|
23
|
+
/** The durable per-session store, or null when the in-memory store is in use. */
|
|
24
|
+
durableOwnershipStore: SessionOwnershipStore | null;
|
|
25
|
+
/** Reads replicated + own placement entries (CoherenceJournalReader). */
|
|
26
|
+
reader: PlacementReader;
|
|
27
|
+
/**
|
|
28
|
+
* Late-bound resolver for this machine's mesh id. May legitimately return null/undefined
|
|
29
|
+
* at construction time (before the boot sequence assigns it); it is used ONLY for the
|
|
30
|
+
* SELF-vs-peer log label, never for materialization.
|
|
31
|
+
*/
|
|
32
|
+
getSelfMachineId: () => string | null | undefined;
|
|
33
|
+
scanLimit?: number;
|
|
34
|
+
logger?: (msg: string) => void;
|
|
35
|
+
now?: () => number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Build the OwnershipApplier when (and only when) the durable ownership store is active.
|
|
39
|
+
* Returns `null` for the in-memory store (nothing to apply). NEVER gates on the self id —
|
|
40
|
+
* that was the boot-ordering bug. The caller schedules the boot tick + interval on a
|
|
41
|
+
* non-null result.
|
|
42
|
+
*/
|
|
43
|
+
export declare function wireOwnershipApplier(deps: OwnershipApplierWiringDeps): OwnershipApplier | null;
|
|
44
|
+
//# sourceMappingURL=ownershipApplierWiring.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ownershipApplierWiring.d.ts","sourceRoot":"","sources":["../../src/core/ownershipApplierWiring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAE3E,MAAM,WAAW,0BAA0B;IACzC,iFAAiF;IACjF,qBAAqB,EAAE,qBAAqB,GAAG,IAAI,CAAC;IACpD,yEAAyE;IACzE,MAAM,EAAE,eAAe,CAAC;IACxB;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,0BAA0B,GAAG,gBAAgB,GAAG,IAAI,CAU9F"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { OwnershipApplier } from './OwnershipApplier.js';
|
|
2
|
+
/**
|
|
3
|
+
* Build the OwnershipApplier when (and only when) the durable ownership store is active.
|
|
4
|
+
* Returns `null` for the in-memory store (nothing to apply). NEVER gates on the self id —
|
|
5
|
+
* that was the boot-ordering bug. The caller schedules the boot tick + interval on a
|
|
6
|
+
* non-null result.
|
|
7
|
+
*/
|
|
8
|
+
export function wireOwnershipApplier(deps) {
|
|
9
|
+
if (!deps.durableOwnershipStore)
|
|
10
|
+
return null;
|
|
11
|
+
return new OwnershipApplier({
|
|
12
|
+
reader: deps.reader,
|
|
13
|
+
store: deps.durableOwnershipStore,
|
|
14
|
+
selfMachineId: deps.getSelfMachineId, // getter — resolved per-tick, never captured stale
|
|
15
|
+
scanLimit: deps.scanLimit,
|
|
16
|
+
logger: deps.logger,
|
|
17
|
+
now: deps.now,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=ownershipApplierWiring.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ownershipApplierWiring.js","sourceRoot":"","sources":["../../src/core/ownershipApplierWiring.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAmBzD;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAgC;IACnE,IAAI,CAAC,IAAI,CAAC,qBAAqB;QAAE,OAAO,IAAI,CAAC;IAC7C,OAAO,IAAI,gBAAgB,CAAC;QAC1B,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,KAAK,EAAE,IAAI,CAAC,qBAAqB;QACjC,aAAa,EAAE,IAAI,CAAC,gBAAgB,EAAE,mDAAmD;QACzF,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,GAAG,EAAE,IAAI,CAAC,GAAG;KACd,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -12,6 +12,32 @@
|
|
|
12
12
|
* - JobScheduler calls canRunJob before spawning sessions
|
|
13
13
|
*/
|
|
14
14
|
import type { QuotaState, JobPriority, JobSchedulerConfig } from '../core/types.js';
|
|
15
|
+
/**
|
|
16
|
+
* Live pool-placeability signal for the POOL-AWARE quota throttle. Returned by an
|
|
17
|
+
* injected provider (wired in server.ts) that asks the placement layer's OWN
|
|
18
|
+
* `selectAccount` "is there a placeable account, and what is its headroom?". The
|
|
19
|
+
* throttle uses placement's exact eligibility predicate by construction, so a
|
|
20
|
+
* throttle "allow" always corresponds to a real account the pool can place on —
|
|
21
|
+
* closing the band where the brake could allow work that placement couldn't land
|
|
22
|
+
* (the respawn-loop gap). Spec: docs/specs/POOL-AWARE-QUOTA-THROTTLE-SPEC.md.
|
|
23
|
+
*/
|
|
24
|
+
export interface PoolQuota {
|
|
25
|
+
/** True iff placement's selectAccount returned a placeable account. */
|
|
26
|
+
placeable: boolean;
|
|
27
|
+
/** Best placeable account's weekly utilization (0-100), or null if unknown. */
|
|
28
|
+
weeklyPercent?: number | null;
|
|
29
|
+
/** Best placeable account's 5-hour utilization (0-100), or null if unknown. */
|
|
30
|
+
fiveHourPercent?: number | null;
|
|
31
|
+
/**
|
|
32
|
+
* True when the pool has a placeable account by STATUS but no trustworthy live
|
|
33
|
+
* quota reading for it (e.g. a freshly-enrolled or just-after-an-outage pool
|
|
34
|
+
* whose per-account snapshots are missing/stale). The throttle then applies the
|
|
35
|
+
* SAME bounded degraded-mode cap as the file path (shed low, allow medium+)
|
|
36
|
+
* rather than trusting a phantom "0% fresh" reading. Closes the round-2 finding
|
|
37
|
+
* that the pool path had no staleness/provenance guard.
|
|
38
|
+
*/
|
|
39
|
+
degraded?: boolean;
|
|
40
|
+
}
|
|
15
41
|
export interface QuotaTrackerConfig {
|
|
16
42
|
/** Path to the quota state JSON file */
|
|
17
43
|
quotaFile: string;
|
|
@@ -26,7 +52,21 @@ export declare class QuotaTracker {
|
|
|
26
52
|
private lastRead;
|
|
27
53
|
private readCooldownMs;
|
|
28
54
|
private warnedNoFile;
|
|
55
|
+
/**
|
|
56
|
+
* Optional live pool-placeability provider (wired post-construction in
|
|
57
|
+
* server.ts for multi-account agents). When set, the throttle reasons over the
|
|
58
|
+
* pool's real placeability instead of a single account's usage. Unset on solo
|
|
59
|
+
* agents → the legacy single-account path runs unchanged.
|
|
60
|
+
*/
|
|
61
|
+
private poolQuotaProvider?;
|
|
29
62
|
constructor(config: QuotaTrackerConfig);
|
|
63
|
+
/**
|
|
64
|
+
* Inject (or clear) the live pool-placeability provider. Wired in server.ts to
|
|
65
|
+
* `() => selectAccount(subscriptionPool.list(), …)` so the throttle shares
|
|
66
|
+
* placement's exact eligibility. Pass `undefined` to revert to single-account
|
|
67
|
+
* gating.
|
|
68
|
+
*/
|
|
69
|
+
setPoolQuotaProvider(fn: (() => PoolQuota | null) | undefined): void;
|
|
30
70
|
/**
|
|
31
71
|
* Read the current quota state from the file.
|
|
32
72
|
* Returns null if file doesn't exist or is corrupted.
|
|
@@ -57,6 +97,22 @@ export declare class QuotaTracker {
|
|
|
57
97
|
allowed: boolean;
|
|
58
98
|
reason: string;
|
|
59
99
|
};
|
|
100
|
+
/**
|
|
101
|
+
* Bounded degraded-mode decision, shared by the file path (non-authoritative
|
|
102
|
+
* estimate) and the pool path (placeable account with no trustworthy reading).
|
|
103
|
+
* We don't KNOW the real usage, so: honor a genuine authoritative 5-hour wall,
|
|
104
|
+
* then shed the lowest-priority work and allow medium+ — a conservative cap, not
|
|
105
|
+
* an unbounded fail-open and not a whole-agent stall. Spec §4.
|
|
106
|
+
*/
|
|
107
|
+
private boundedDegradedDecision;
|
|
108
|
+
/**
|
|
109
|
+
* Evaluate ONE account's (weekly, 5-hour) usage against the configured
|
|
110
|
+
* thresholds for a given priority. Extracted so the pool-aware path can score
|
|
111
|
+
* each account independently and pick the best-available one. The single-account
|
|
112
|
+
* (legacy) path calls this directly with the one account's numbers, preserving
|
|
113
|
+
* the exact prior behavior for agents that don't run a multi-account pool.
|
|
114
|
+
*/
|
|
115
|
+
private evaluateAccountQuota;
|
|
60
116
|
/**
|
|
61
117
|
* Write a quota state to the file (for collector scripts or manual updates).
|
|
62
118
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuotaTracker.d.ts","sourceRoot":"","sources":["../../src/monitoring/QuotaTracker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAGpF,MAAM,WAAW,kBAAkB;IACjC,wCAAw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ini-cli agent — pure log spam that drowns real signal).
|
|
27
27
|
// Re-armed when the file reappears so a later disappearance warns once more.
|
|
28
28
|
warnedNoFile = false;
|
|
29
|
+
/**
|
|
30
|
+
* Optional live pool-placeability provider (wired post-construction in
|
|
31
|
+
* server.ts for multi-account agents). When set, the throttle reasons over the
|
|
32
|
+
* pool's real placeability instead of a single account's usage. Unset on solo
|
|
33
|
+
* agents → the legacy single-account path runs unchanged.
|
|
34
|
+
*/
|
|
35
|
+
poolQuotaProvider;
|
|
29
36
|
constructor(config) {
|
|
30
37
|
this.config = config;
|
|
31
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Inject (or clear) the live pool-placeability provider. Wired in server.ts to
|
|
41
|
+
* `() => selectAccount(subscriptionPool.list(), …)` so the throttle shares
|
|
42
|
+
* placement's exact eligibility. Pass `undefined` to revert to single-account
|
|
43
|
+
* gating.
|
|
44
|
+
*/
|
|
45
|
+
setPoolQuotaProvider(fn) {
|
|
46
|
+
this.poolQuotaProvider = fn;
|
|
47
|
+
}
|
|
32
48
|
/**
|
|
33
49
|
* Read the current quota state from the file.
|
|
34
50
|
* Returns null if file doesn't exist or is corrupted.
|
|
@@ -93,11 +109,104 @@ export class QuotaTracker {
|
|
|
93
109
|
* Checks both weekly AND 5-hour rate limits.
|
|
94
110
|
*/
|
|
95
111
|
shouldSpawnSession(priority) {
|
|
112
|
+
// POOL-AWARE PATH (the robustness fix): when a live pool-placeability provider
|
|
113
|
+
// is wired (multi-account agent), the brake reflects POOL placeability — shared
|
|
114
|
+
// BY CONSTRUCTION with the placement layer. The provider asks placement's OWN
|
|
115
|
+
// selectAccount "is there a placeable account, and what's its headroom?", so a
|
|
116
|
+
// throttle "allow" always corresponds to an account the pool can actually place
|
|
117
|
+
// on. This both (a) fixes the account-blind throttle that stopped the WHOLE
|
|
118
|
+
// agent on one maxed account while fresh accounts sat idle, and (b) closes the
|
|
119
|
+
// band where the old design allowed work placement couldn't land → respawn loop
|
|
120
|
+
// (selectAccount's soft threshold is stricter than the shutdown threshold).
|
|
121
|
+
// Live, status-aware data — no stale snapshot. Spec: docs/specs/POOL-AWARE-QUOTA-THROTTLE-SPEC.md.
|
|
122
|
+
if (this.poolQuotaProvider) {
|
|
123
|
+
let pool = null;
|
|
124
|
+
try {
|
|
125
|
+
pool = this.poolQuotaProvider();
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
// @silent-fallback-ok: a provider throw deliberately falls through to the
|
|
129
|
+
// conservative file-based quota logic below (fail-safe — the throttle still
|
|
130
|
+
// gates, never silently allows). This is a hot path (every spawn gate), so
|
|
131
|
+
// reporting per-call would spam; the fallthrough IS the intended degraded
|
|
132
|
+
// behavior, not a swallowed error.
|
|
133
|
+
pool = null;
|
|
134
|
+
}
|
|
135
|
+
if (pool) {
|
|
136
|
+
if (!pool.placeable) {
|
|
137
|
+
// NOTE: "placeable" is evaluated at DECISION time. A later placement that
|
|
138
|
+
// finds the last account just got consumed is a NORMAL, non-looping
|
|
139
|
+
// outcome (the caller backs off / retries), not the old respawn loop —
|
|
140
|
+
// that loop came from the throttle and placement DISAGREEING, which can no
|
|
141
|
+
// longer happen now that the throttle asks placement's own predicate.
|
|
142
|
+
return { allowed: false, reason: 'No placeable account in the pool — every account is at/over capacity' };
|
|
143
|
+
}
|
|
144
|
+
// DATA-QUALITY GUARD: if the pool has a placeable account by STATUS but no
|
|
145
|
+
// trustworthy live reading for it (degraded flag, or a non-finite/implausible
|
|
146
|
+
// percent), do NOT trust a phantom "0% fresh" — apply the SAME bounded
|
|
147
|
+
// degraded-mode cap as the file path. (Closes the round-2 finding: the pool
|
|
148
|
+
// path otherwise inherited selectAccount's unclamped, staleness-blind view.)
|
|
149
|
+
const weekly = pool.weeklyPercent;
|
|
150
|
+
const weeklyTrustworthy = typeof weekly === 'number' && isFinite(weekly) && weekly >= 0 && weekly <= 100;
|
|
151
|
+
if (pool.degraded || (weekly !== null && weekly !== undefined && !weeklyTrustworthy)) {
|
|
152
|
+
return this.boundedDegradedDecision(pool.fiveHourPercent ?? undefined, priority, 'pool quota reading is missing/untrustworthy');
|
|
153
|
+
}
|
|
154
|
+
// selectAccount already vouched for placeability; gate the best placeable
|
|
155
|
+
// account's effective usage (weekly + 5h, both checked in evaluateAccountQuota)
|
|
156
|
+
// by priority so load-shedding still applies. An allow here is guaranteed
|
|
157
|
+
// placeable. A null percent means "unknown but placeable" → treated as 0.
|
|
158
|
+
const r = this.evaluateAccountQuota(weekly ?? 0, pool.fiveHourPercent ?? undefined, priority);
|
|
159
|
+
return r.allowed
|
|
160
|
+
? { allowed: true, reason: `Pool headroom — best placeable account at ${Math.round(weekly ?? 0)}% weekly` }
|
|
161
|
+
: r;
|
|
162
|
+
}
|
|
163
|
+
// provider threw / returned null → fall through to the file-based logic below.
|
|
164
|
+
}
|
|
96
165
|
const state = this.getState();
|
|
97
166
|
if (!state)
|
|
98
167
|
return { allowed: true, reason: 'No quota data — fail open' };
|
|
168
|
+
// DEGRADED-DATA HARDENING (bounded): a non-authoritative estimate (JSONL
|
|
169
|
+
// token-counting) or an implausible >100% value must NOT slam the brake on the
|
|
170
|
+
// whole agent (the 2026-06-15 incident: a claude-jsonl 186% estimate stopped
|
|
171
|
+
// everything). But because we genuinely do not KNOW the real usage, fail-open is
|
|
172
|
+
// BOUNDED — we shed the lowest-priority work and still honor a genuine
|
|
173
|
+
// authoritative 5-hour wall. An AUTHORITATIVE source (anthropic-oauth) is never
|
|
174
|
+
// treated as degraded, so a real wall still stops. Spec §3.
|
|
175
|
+
const authoritative = state.source === 'anthropic-oauth';
|
|
176
|
+
const degraded = !authoritative &&
|
|
177
|
+
(state.source === 'claude-jsonl' || (typeof state.usagePercent === 'number' && state.usagePercent > 100));
|
|
178
|
+
if (degraded) {
|
|
179
|
+
return this.boundedDegradedDecision(state.fiveHourPercent, priority, 'quota data is a non-authoritative estimate');
|
|
180
|
+
}
|
|
181
|
+
// SINGLE-ACCOUNT PATH (legacy, unchanged): gate on the one account's usage.
|
|
182
|
+
return this.evaluateAccountQuota(state.usagePercent, state.fiveHourPercent, priority);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Bounded degraded-mode decision, shared by the file path (non-authoritative
|
|
186
|
+
* estimate) and the pool path (placeable account with no trustworthy reading).
|
|
187
|
+
* We don't KNOW the real usage, so: honor a genuine authoritative 5-hour wall,
|
|
188
|
+
* then shed the lowest-priority work and allow medium+ — a conservative cap, not
|
|
189
|
+
* an unbounded fail-open and not a whole-agent stall. Spec §4.
|
|
190
|
+
*/
|
|
191
|
+
boundedDegradedDecision(fiveHourPercent, priority, reasonContext) {
|
|
192
|
+
if (typeof fiveHourPercent === 'number' && isFinite(fiveHourPercent) && fiveHourPercent >= 95) {
|
|
193
|
+
return { allowed: false, reason: `5-hour rate limit at ${fiveHourPercent}% — sessions will fail immediately` };
|
|
194
|
+
}
|
|
195
|
+
if (priority === 'low') {
|
|
196
|
+
return { allowed: false, reason: `${reasonContext} — shedding low-priority work (degraded mode)` };
|
|
197
|
+
}
|
|
198
|
+
return { allowed: true, reason: `${reasonContext} — running medium+ priority in degraded mode (low-priority shed)` };
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Evaluate ONE account's (weekly, 5-hour) usage against the configured
|
|
202
|
+
* thresholds for a given priority. Extracted so the pool-aware path can score
|
|
203
|
+
* each account independently and pick the best-available one. The single-account
|
|
204
|
+
* (legacy) path calls this directly with the one account's numbers, preserving
|
|
205
|
+
* the exact prior behavior for agents that don't run a multi-account pool.
|
|
206
|
+
*/
|
|
207
|
+
evaluateAccountQuota(rawWeekly, rawFiveHour, priority) {
|
|
99
208
|
// Check 5-hour rate limit first — these cause immediate session failures
|
|
100
|
-
const fiveHour =
|
|
209
|
+
const fiveHour = rawFiveHour;
|
|
101
210
|
if (typeof fiveHour === 'number' && isFinite(fiveHour)) {
|
|
102
211
|
if (fiveHour >= 95) {
|
|
103
212
|
return { allowed: false, reason: `5-hour rate limit at ${fiveHour}% — sessions will fail immediately` };
|
|
@@ -107,11 +216,10 @@ export class QuotaTracker {
|
|
|
107
216
|
}
|
|
108
217
|
}
|
|
109
218
|
// Check weekly usage
|
|
110
|
-
|
|
111
|
-
if (typeof rawUsage !== 'number' || !isFinite(rawUsage)) {
|
|
219
|
+
if (typeof rawWeekly !== 'number' || !isFinite(rawWeekly)) {
|
|
112
220
|
return { allowed: true, reason: 'Invalid weekly data — fail open' };
|
|
113
221
|
}
|
|
114
|
-
const usage = Math.max(0, Math.min(100,
|
|
222
|
+
const usage = Math.max(0, Math.min(100, rawWeekly));
|
|
115
223
|
const { normal, elevated, critical, shutdown } = this.config.thresholds;
|
|
116
224
|
if (usage >= shutdown) {
|
|
117
225
|
return { allowed: false, reason: `Weekly quota at ${usage}% — all jobs stopped` };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuotaTracker.js","sourceRoot":"","sources":["../../src/monitoring/QuotaTracker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"QuotaTracker.js","sourceRoot":"","sources":["../../src/monitoring/QuotaTracker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAsC3D,MAAM,OAAO,YAAY;IACf,MAAM,CAAqB;IAC3B,WAAW,GAAsB,IAAI,CAAC;IACtC,QAAQ,GAAW,CAAC,CAAC;IACrB,cAAc,GAAG,IAAI,CAAC,CAAC,mCAAmC;IAClE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gBAChE,MAAM,EAAE,8BAA8B,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;gBACxF,MAAM,EAAE,6EAA6E;aACtF,CAAC,CAAC;YACH,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/scaffold/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AASH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,CAgG/D;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CA2E/F;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAiBvD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CA2B1D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,OAAO,EACpB,WAAW,GAAE,OAAe,EAC5B,WAAW,GAAE,OAAe,GAC3B,MAAM,
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/scaffold/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AASH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,CAgG/D;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CA2E/F;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAiBvD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CA2B1D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,OAAO,EACpB,WAAW,GAAE,OAAe,EAC5B,WAAW,GAAE,OAAe,GAC3B,MAAM,CAggDR;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,OAAO,EACpB,WAAW,GAAE,OAAe,GAC3B,MAAM,CA2TR"}
|
|
@@ -781,8 +781,9 @@ I declare owner/blockedOn at commitment creation; a later state change goes thro
|
|
|
781
781
|
- **Continuity guarantee** — a long session that hits its account's quota resumes on another eligible account (conversation preserved via \`--resume\`), never dies. Manual lever: \`POST /subscription-pool/swap\` \`{"sessionName":"...","exhaustedAccountId":"..."}\`. Auto-swap on rate-limit ships OFF (opt-in via \`subscriptionPool.autoSwapOnRateLimit\` — it moves a live session, real authority).
|
|
782
782
|
- **Pre-limit (proactive) swap** — beyond the reactive swap above, I can move a session OFF an account BEFORE it walls, at a lag-aware measured threshold (default 80% — the polled reading trails real usage, so the swap completes with margin). It also covers the UNTAGGED interactive session (resolves its account from the default login), so the session you talk to doesn't wedge at the wall. Opt-in via \`subscriptionPool.proactiveSwap.enabled\` (same authority as auto-swap, earlier trigger). Status: \`GET /subscription-pool/proactive-swap\`; run a pass now: \`POST /subscription-pool/proactive-swap/check\`.
|
|
783
783
|
- **Enroll a new account from your phone** — \`POST /subscription-pool/enroll\` \`{"id","label","provider","framework","configHome"}\` starts a login and returns a public code/URL (never a token); \`GET /subscription-pool/pending-logins\` is the surface; expired codes are auto-reissued. Mark done with \`POST /subscription-pool/enroll/:id/complete\`.
|
|
784
|
+
- **Pool-aware quota brake (the global load-shed is NOT account-blind)** — the global quota throttle (\`QuotaTracker.shouldSpawnSession\`) that decides "can I run work right now?" gates on the **best-available account's headroom across the whole pool**, NOT a single account. So one maxed account can NEVER stop the whole agent while another account still has room — the subscription pool just places the work on the account with the most headroom. A non-authoritative/implausible usage reading (a JSONL token-estimate, or any value >100%) **fails open** rather than slamming the brake on a guess. (A solo, single-account agent keeps the exact legacy single-account gating.) The collector folds every account's live usage into \`quota-state.json\` → \`accounts[]\` so the brake can see the whole pool.
|
|
784
785
|
- **Dashboard**: the **Subscriptions tab** shows live quota bars (5h + weekly + reset countdown), status, and the Pending Logins panel — share the dashboard URL + PIN.
|
|
785
|
-
- **When to use** (PROACTIVE): "how much quota is left across my accounts?" / "am I about to hit a limit?" → \`GET /subscription-pool\`; the user wants to add another subscription → drive the enrollment wizard (never ask them to paste a token); a long job is at risk of a quota wall → the continuity guarantee + \`/swap\` keep it alive. Single-account pools are a no-op.
|
|
786
|
+
- **When to use** (PROACTIVE): "how much quota is left across my accounts?" / "am I about to hit a limit?" → \`GET /subscription-pool\`; the user wants to add another subscription → drive the enrollment wizard (never ask them to paste a token); a long job is at risk of a quota wall → the continuity guarantee + \`/swap\` keep it alive. **"Why didn't the agent stall / get stuck with one account maxed out?"** → the pool-aware quota brake above: it only stops work when EVERY account in the pool is at capacity, so idle accounts get used instead of the agent halting. Single-account pools are a no-op.
|
|
786
787
|
|
|
787
788
|
**Live Credential Re-pointing (move a pool account's login between config-home "slots" without restarting — WS5.2)** — Beyond the subscription pool's session-MOVING, this MOVES the credential itself: it exchanges which pool account's OAuth login sits in which config-home "slot" via a staged keychain swap, so the sessions already reading that slot pick up the new account on their NEXT API call — no restart, no re-login, nothing on your screen. The unit shuffled is the CREDENTIAL (always a clean SWAP between two slots, never a copy — one home per credential), verified by identity after every move (quarantine-never-repair when the identity oracle can't confirm). **On a development agent it runs LIVE in dry-run** (the developmentAgent gate, \`subscriptionPool.credentialRepointing.enabled\` omitted → resolves live-on-dev / dark-fleet) — the \`/credentials/*\` levers return real data and the balancer runs its full decision loop, but the executor performs ZERO credential writes while \`dryRun\` holds (the write-safety canary; on the fleet every lever 503s). Actually MOVING a credential needs a deliberate \`dryRun:false\` — that decision is yours (gated behind running the §5 livetest battery first).
|
|
788
789
|
- **Which account is in which slot?** (Registry First — read it, never guess) \`curl -H "Authorization: Bearer $AUTH" http://localhost:${port}/credentials/locations\` → the ledger census (slot ↔ account, since, lastVerifiedAt, quarantine state, journal tail, mode).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/scaffold/templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,oFAAoF;AACpF,qFAAqF;AACrF,oFAAoF;AACpF,mFAAmF;AACnF,4BAA4B;AAC5B,OAAO,EAAE,4CAA4C,EAAE,MAAM,+BAA+B,CAAC;AAS7F;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,QAAuB;IACrD,OAAO,KAAK,QAAQ,CAAC,IAAI;;;;OAIpB,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI;;;;EAIpC,QAAQ,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;6BAsBO,QAAQ,CAAC,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+D7C,CAAC;AAEF,CAAC;AAED;;;;;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