instar 1.3.166 → 1.3.168
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 -4
- package/dist/commands/server.js.map +1 -1
- package/dist/core/ForwardedTopicContext.d.ts +29 -0
- package/dist/core/ForwardedTopicContext.d.ts.map +1 -0
- package/dist/core/ForwardedTopicContext.js +46 -0
- package/dist/core/ForwardedTopicContext.js.map +1 -0
- package/dist/core/LlmCircuitBreaker.d.ts +8 -0
- package/dist/core/LlmCircuitBreaker.d.ts.map +1 -1
- package/dist/core/LlmCircuitBreaker.js +11 -0
- package/dist/core/LlmCircuitBreaker.js.map +1 -1
- package/dist/scheduler/MentorOnboardingRunner.d.ts.map +1 -1
- package/dist/scheduler/MentorOnboardingRunner.js +2 -0
- package/dist/scheduler/MentorOnboardingRunner.js.map +1 -1
- package/dist/scheduler/MentorOnboardingTick.d.ts +6 -1
- package/dist/scheduler/MentorOnboardingTick.d.ts.map +1 -1
- package/dist/scheduler/MentorOnboardingTick.js +5 -0
- package/dist/scheduler/MentorOnboardingTick.js.map +1 -1
- package/package.json +1 -1
- package/src/data/builtin-manifest.json +2 -2
- package/upgrades/1.3.168.md +64 -0
- package/upgrades/side-effects/mentor-llm-circuit-gate.md +39 -0
- package/upgrades/side-effects/moved-session-context-relay.md +94 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ForwardedTopicContext — build the prior-conversation context block for a session
|
|
3
|
+
* that has just been MOVED to this machine by the multi-machine session pool (§L4).
|
|
4
|
+
*
|
|
5
|
+
* Why this exists (bug #2): when a topic is moved to a standby, the standby spawns the
|
|
6
|
+
* session locally but its OWN message ledger for that topic is EMPTY (it never polled
|
|
7
|
+
* the topic) and its TopicMemory has no rows — so `spawnSessionForTopic` builds an
|
|
8
|
+
* empty context and the moved conversation starts with amnesia. The router (which DID
|
|
9
|
+
* hold the conversation) is the source of truth; the receiver fetches the recent
|
|
10
|
+
* history from it and formats it here into the same "Thread History" block the
|
|
11
|
+
* single-machine JSONL path produces, so the moved session continues the conversation
|
|
12
|
+
* instead of starting blank.
|
|
13
|
+
*
|
|
14
|
+
* Pure + caller-agnostic so it is unit-testable without a live two-machine setup.
|
|
15
|
+
*/
|
|
16
|
+
/** One historical message, matching TelegramAdapter.getTopicHistory()'s shape. */
|
|
17
|
+
export interface ForwardedHistoryMessage {
|
|
18
|
+
fromUser: boolean;
|
|
19
|
+
text?: string;
|
|
20
|
+
senderName?: string;
|
|
21
|
+
timestamp?: string | number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Format fetched router-side history into a Thread History context block, or '' when
|
|
25
|
+
* there is nothing to inject. Mirrors the single-machine JSONL formatting in
|
|
26
|
+
* spawnSessionForTopic so a moved session reads identically to a local one.
|
|
27
|
+
*/
|
|
28
|
+
export declare function formatForwardedTopicContext(messages: ForwardedHistoryMessage[] | null | undefined, topicName?: string): string;
|
|
29
|
+
//# sourceMappingURL=ForwardedTopicContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ForwardedTopicContext.d.ts","sourceRoot":"","sources":["../../src/core/ForwardedTopicContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,kFAAkF;AAClF,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,uBAAuB,EAAE,GAAG,IAAI,GAAG,SAAS,EACtD,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAqBR"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ForwardedTopicContext — build the prior-conversation context block for a session
|
|
3
|
+
* that has just been MOVED to this machine by the multi-machine session pool (§L4).
|
|
4
|
+
*
|
|
5
|
+
* Why this exists (bug #2): when a topic is moved to a standby, the standby spawns the
|
|
6
|
+
* session locally but its OWN message ledger for that topic is EMPTY (it never polled
|
|
7
|
+
* the topic) and its TopicMemory has no rows — so `spawnSessionForTopic` builds an
|
|
8
|
+
* empty context and the moved conversation starts with amnesia. The router (which DID
|
|
9
|
+
* hold the conversation) is the source of truth; the receiver fetches the recent
|
|
10
|
+
* history from it and formats it here into the same "Thread History" block the
|
|
11
|
+
* single-machine JSONL path produces, so the moved session continues the conversation
|
|
12
|
+
* instead of starting blank.
|
|
13
|
+
*
|
|
14
|
+
* Pure + caller-agnostic so it is unit-testable without a live two-machine setup.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Format fetched router-side history into a Thread History context block, or '' when
|
|
18
|
+
* there is nothing to inject. Mirrors the single-machine JSONL formatting in
|
|
19
|
+
* spawnSessionForTopic so a moved session reads identically to a local one.
|
|
20
|
+
*/
|
|
21
|
+
export function formatForwardedTopicContext(messages, topicName) {
|
|
22
|
+
if (!Array.isArray(messages) || messages.length === 0)
|
|
23
|
+
return '';
|
|
24
|
+
const lines = [];
|
|
25
|
+
lines.push(`--- Thread History (last ${messages.length} messages, relayed from the previous machine) ---`);
|
|
26
|
+
lines.push(`IMPORTANT: Read this history carefully before taking any action.`);
|
|
27
|
+
lines.push(`Your task is to continue THIS conversation, not start something new.`);
|
|
28
|
+
if (topicName)
|
|
29
|
+
lines.push(`Topic: ${topicName}`);
|
|
30
|
+
lines.push('');
|
|
31
|
+
for (const m of messages) {
|
|
32
|
+
const sender = m.fromUser ? (m.senderName || 'User') : 'Agent';
|
|
33
|
+
let ts = '??:??';
|
|
34
|
+
if (m.timestamp != null) {
|
|
35
|
+
const d = new Date(m.timestamp);
|
|
36
|
+
if (!Number.isNaN(d.getTime()))
|
|
37
|
+
ts = d.toISOString().slice(11, 19);
|
|
38
|
+
}
|
|
39
|
+
const text = (m.text || '').slice(0, 2000);
|
|
40
|
+
lines.push(`[${ts}] ${sender}: ${text}`);
|
|
41
|
+
}
|
|
42
|
+
lines.push('');
|
|
43
|
+
lines.push('--- End Thread History ---');
|
|
44
|
+
return lines.join('\n');
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=ForwardedTopicContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ForwardedTopicContext.js","sourceRoot":"","sources":["../../src/core/ForwardedTopicContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAUH;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CACzC,QAAsD,EACtD,SAAkB;IAElB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACjE,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,CAAC,IAAI,CAAC,4BAA4B,QAAQ,CAAC,MAAM,mDAAmD,CAAC,CAAC;IAC3G,KAAK,CAAC,IAAI,CAAC,kEAAkE,CAAC,CAAC;IAC/E,KAAK,CAAC,IAAI,CAAC,sEAAsE,CAAC,CAAC;IACnF,IAAI,SAAS;QAAE,KAAK,CAAC,IAAI,CAAC,UAAU,SAAS,EAAE,CAAC,CAAC;IACjD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;QAC/D,IAAI,EAAE,GAAG,OAAO,CAAC;QACjB,IAAI,CAAC,CAAC,SAAS,IAAI,IAAI,EAAE,CAAC;YACxB,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YAChC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;gBAAE,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QACrE,CAAC;QACD,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QAC3C,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,MAAM,KAAK,IAAI,EAAE,CAAC,CAAC;IAC3C,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;IACzC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -131,6 +131,14 @@ export declare function configureLlmCircuitBreaker(opts: {
|
|
|
131
131
|
openMs?: number;
|
|
132
132
|
enabled?: boolean;
|
|
133
133
|
}): void;
|
|
134
|
+
/**
|
|
135
|
+
* Read-only convenience: is the shared LLM circuit currently AVAILABLE for new
|
|
136
|
+
* LLM-backed work? True when the breaker is disabled, or its state is 'closed'.
|
|
137
|
+
* False when 'open' or 'half-open' (the provider is rate-limited / probing).
|
|
138
|
+
* Non-mutating — unlike the admission check, it does NOT consume a half-open
|
|
139
|
+
* probe slot, so callers can use it as a pure gate (e.g. the mentor tick backing
|
|
140
|
+
* off rather than re-tripping the circuit). */
|
|
141
|
+
export declare function llmCircuitAvailable(): boolean;
|
|
134
142
|
/** Test-only: drop the singleton so a fresh one is built next access. */
|
|
135
143
|
export declare function __resetLlmCircuitBreakerSingleton(): void;
|
|
136
144
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LlmCircuitBreaker.d.ts","sourceRoot":"","sources":["../../src/core/LlmCircuitB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
229
229
|
export function configureLlmCircuitBreaker(opts) {
|
|
230
230
|
getLlmCircuitBreaker().configure(opts);
|
|
231
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* Read-only convenience: is the shared LLM circuit currently AVAILABLE for new
|
|
234
|
+
* LLM-backed work? True when the breaker is disabled, or its state is 'closed'.
|
|
235
|
+
* False when 'open' or 'half-open' (the provider is rate-limited / probing).
|
|
236
|
+
* Non-mutating — unlike the admission check, it does NOT consume a half-open
|
|
237
|
+
* probe slot, so callers can use it as a pure gate (e.g. the mentor tick backing
|
|
238
|
+
* off rather than re-tripping the circuit). */
|
|
239
|
+
export function llmCircuitAvailable() {
|
|
240
|
+
const s = getLlmCircuitBreaker().status();
|
|
241
|
+
return !s.enabled || s.state === 'closed';
|
|
242
|
+
}
|
|
232
243
|
/** Test-only: drop the singleton so a fresh one is built next access. */
|
|
233
244
|
export function __resetLlmCircuitBreakerSingleton() {
|
|
234
245
|
_singleton = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LlmCircuitBreaker.js","sourceRoot":"","sources":["../../src/core/LlmCircuitBreaker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,6HAA6H;AAC7H,MAAM,OAAO,cAAe,SAAQ,KAAK;IAED;IAD7B,WAAW,GAAG,IAAa,CAAC;IACrC,YAAY,OAAe,EAAW,aAAuB;QAC3D,KAAK,CAAC,OAAO,CAAC,CAAC;QADqB,kBAAa,GAAb,aAAa,CAAU;QAE3D,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AAED,wHAAwH;AACxH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAEvB;IADZ,WAAW,GAAG,IAAa,CAAC;IACrC,YAAqB,YAAoB;QACvC,KAAK,CACH,wFAAwF,IAAI,CAAC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,CAC1H,CAAC;QAHiB,iBAAY,GAAZ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,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC;AAED;;;;;;+CAM+C;AAC/C,MAAM,UAAU,mBAAmB;IACjC,MAAM,CAAC,GAAG,oBAAoB,EAAE,CAAC,MAAM,EAAE,CAAC;IAC1C,OAAO,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,KAAK,KAAK,QAAQ,CAAC;AAC5C,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,iCAAiC;IAC/C,UAAU,GAAG,IAAI,CAAC;AACpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MentorOnboardingRunner.d.ts","sourceRoot":"","sources":["../../src/scheduler/MentorOnboardingRunner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAiB,KAAK,gBAAgB,EAAmB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"MentorOnboardingRunner.d.ts","sourceRoot":"","sources":["../../src/scheduler/MentorOnboardingRunner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAiB,KAAK,gBAAgB,EAAmB,MAAM,2BAA2B,CAAC;AAElG,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAEhH;;;;;;;;;GASG;AACH,MAAM,WAAW,yBAAyB;IACxC,8EAA8E;IAC9E,OAAO,EAAE,OAAO,CAAC;IACjB;uEACmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd;2EACuE;IACvE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;wEACoE;IACpE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;iFAC6E;IAC7E,YAAY,CAAC,EAAE,MAAM,CAAC;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I;QACR,OAAO,EAAE,OAAO,CAAC;QACjB,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;QAC3B,eAAe,EAAE,MAAM,CAAC;QACxB,QAAQ,EAAE,OAAO,CAAC;QAClB,UAAU,EAAE,CAAC,eAAe,GAAG;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE,CAAC,GAAG,IAAI,CAAC;KACvD;IAWD;;;;;;OAMG;IACH,SAAS,IAAI;QAAE,QAAQ,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;IAoCnD;gFAC4E;IACtE,IAAI,IAAI,OAAO,CAAC,eAAe,CAAC;IA2BtC;;;;;;;;OAQG;YACW,cAAc;CA8B7B"}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* Ships dormant: `mentor.enabled=false` / `mentor.mode='off'` by default (§16).
|
|
14
14
|
*/
|
|
15
15
|
import { runMentorTick } from './MentorOnboardingTick.js';
|
|
16
|
+
import { llmCircuitAvailable } from '../core/LlmCircuitBreaker.js';
|
|
16
17
|
import { runAutonomousGuardian, } from './MentorAutonomousGuardian.js';
|
|
17
18
|
/**
|
|
18
19
|
* The Telegram topic the mentor exchange flows through. Prefers a dedicated
|
|
@@ -115,6 +116,7 @@ export class MentorOnboardingRunner {
|
|
|
115
116
|
// Safe window = mentee at rest AND the min-interval floor elapsed (§12 Q3).
|
|
116
117
|
safeWindowOpen: !this.services.isMenteeBusy() && this.services.minIntervalElapsed(),
|
|
117
118
|
budgetOk: this.services.budgetOk(),
|
|
119
|
+
llmAvailable: llmCircuitAvailable(),
|
|
118
120
|
spawnStageA: this.services.spawnStageA,
|
|
119
121
|
runStageBForensics: () => this.services.runStageBForensics(framework),
|
|
120
122
|
capture: this.services.capture,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MentorOnboardingRunner.js","sourceRoot":"","sources":["../../src/scheduler/MentorOnboardingRunner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;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C,iBAAiB,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE;YACvE,gBAAgB,EACd,IAAI,CAAC,QAAQ,CAAC,gBAAgB;gBAC9B,CAAC,KAAK,IAAI,EAAE;oBACV,MAAM,IAAI,KAAK,CACb,kGAAkG,CACnG,CAAC;gBACJ,CAAC,CAAC;YACJ,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG;SACvB,CAAC,CAAC;QACH,+EAA+E;QAC/E,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS;YAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,EAAE,CAAC;QAC7D,OAAO;YACL,GAAG,EAAE,MAAM,CAAC,GAAG;YACf,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -34,6 +34,11 @@ export interface MentorTickDeps {
|
|
|
34
34
|
safeWindowOpen: boolean;
|
|
35
35
|
/** Fail-closed budget gate (the GET /autonomous/can-start precedent). */
|
|
36
36
|
budgetOk: boolean;
|
|
37
|
+
/** LLM-availability gate: false when the shared LlmCircuitBreaker is open/half-open
|
|
38
|
+
* (the provider is rate-limited). The tick's Stage A (spawn) and Stage B (`claude -p`
|
|
39
|
+
* forensics) are both LLM-backed, so running while rate-limited just fails and
|
|
40
|
+
* RE-TRIPS the circuit (which pauses ALL LLM-backed work). Skip instead. */
|
|
41
|
+
llmAvailable: boolean;
|
|
37
42
|
/** Spawn Stage A (empty tool grant) and return its transcript. Injected so the
|
|
38
43
|
* pure tick has no SessionManager/tmux dependency. */
|
|
39
44
|
spawnStageA: (prompt: string) => Promise<string>;
|
|
@@ -56,7 +61,7 @@ export interface MentorTickDeps {
|
|
|
56
61
|
/** Leak-detector liveness check; defaults to the real canary. Injected for tests. */
|
|
57
62
|
canaryCheck?: () => boolean;
|
|
58
63
|
}
|
|
59
|
-
export type MentorTickReason = 'canary-failed' | 'budget' | 'unsafe-window' | 'stage-a-failed' | 'ran';
|
|
64
|
+
export type MentorTickReason = 'canary-failed' | 'budget' | 'llm-rate-limited' | 'unsafe-window' | 'stage-a-failed' | 'ran';
|
|
60
65
|
export interface MentorTickResult {
|
|
61
66
|
ran: boolean;
|
|
62
67
|
reason: MentorTickReason;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MentorOnboardingTick.d.ts","sourceRoot":"","sources":["../../src/scheduler/MentorOnboardingTick.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAKL,KAAK,mBAAmB,EACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAEhH;kFACkF;AAClF,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;AAE5C,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,UAAU,CAAC;IACjB,oEAAoE;IACpE,OAAO,EAAE,mBAAmB,CAAC;IAC7B;4FACwF;IACxF,cAAc,EAAE,OAAO,CAAC;IACxB,yEAAyE;IACzE,QAAQ,EAAE,OAAO,CAAC;IAClB;2DACuD;IACvD,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACjD;2DACuD;IACvD,kBAAkB,EAAE,MAAM,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;IACrD,iEAAiE;IACjE,OAAO,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,gBAAgB,CAAC;IACtD;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/D,6CAA6C;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CA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. Budget gate — fail-closed BEFORE any spend or contact (§6).
|
|
51
51
|
if (!deps.budgetOk)
|
|
52
52
|
return { ran: false, reason: 'budget' };
|
|
53
|
+
// 2b. LLM rate-limit gate — when the shared provider circuit is open, the
|
|
54
|
+
// tick's Stage A + Stage B are LLM-backed and would just fail and RE-TRIP the
|
|
55
|
+
// circuit (re-pausing all LLM work ~900s). Back off; we'll run when it closes.
|
|
56
|
+
if (!deps.llmAvailable)
|
|
57
|
+
return { ran: false, reason: 'llm-rate-limited' };
|
|
53
58
|
// 3. Safe-window — only act at a durable mentee state transition (§12 Q3).
|
|
54
59
|
if (!deps.safeWindowOpen)
|
|
55
60
|
return { ran: false, reason: 'unsafe-window' };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MentorOnboardingTick.js","sourceRoot":"","sources":["../../src/scheduler/MentorOnboardingTick.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,aAAa,GAEd,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"MentorOnboardingTick.js","sourceRoot":"","sources":["../../src/scheduler/MentorOnboardingTick.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,aAAa,GAEd,MAAM,+BAA+B,CAAC;AAyEvC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAAoB;IACtD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;IAEnE,6EAA6E;IAC7E,8DAA8D;IAC9D,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,IAAI,aAAa,CAAC;IACjD,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;QACd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IACnB,CAAC;IAED,OAAO;QACL,GAAG,EAAE,IAAI;QACT,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,SAAS;QACT,YAAY,EAAE,IAAI,CAAC,MAAM;QACzB,mBAAmB,EAAE,QAAQ,CAAC,mBAAmB;QACjD,aAAa,EAAE,QAAQ,CAAC,MAAM;QAC9B,6EAA6E;QAC7E,4EAA4E;QAC5E,4EAA4E;QAC5E,yEAAyE;QACzE,gCAAgC;QAChC,aAAa,EAAE,UAAU;KAC1B,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./builtin-manifest.schema.json",
|
|
3
3
|
"schemaVersion": 1,
|
|
4
|
-
"generatedAt": "2026-05-31T12:
|
|
5
|
-
"instarVersion": "1.3.
|
|
4
|
+
"generatedAt": "2026-05-31T12:19:24.469Z",
|
|
5
|
+
"instarVersion": "1.3.168",
|
|
6
6
|
"entryCount": 193,
|
|
7
7
|
"entries": {
|
|
8
8
|
"hook:session-start": {
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Upgrade Guide — vNEXT
|
|
2
|
+
|
|
3
|
+
<!-- assembled-by: assemble-next-md -->
|
|
4
|
+
<!-- bump: patch -->
|
|
5
|
+
|
|
6
|
+
## What to Tell Your User
|
|
7
|
+
|
|
8
|
+
If you run your agent across more than one machine and move a conversation to another
|
|
9
|
+
one, the moved conversation now remembers what you were talking about — the receiving
|
|
10
|
+
machine pulls the recent history from the machine that was serving it. Only relevant
|
|
11
|
+
when the multi-machine session pool is on; single-machine agents are unaffected. Nothing
|
|
12
|
+
to configure.
|
|
13
|
+
|
|
14
|
+
If you run an agent with the mentor routine enabled, it will stop making things worse during AI rate-limit periods — it now waits for the provider to recover instead of repeatedly tripping the system-wide pause. Nothing to configure.
|
|
15
|
+
|
|
16
|
+
## Summary of New Capabilities
|
|
17
|
+
|
|
18
|
+
- New `formatForwardedTopicContext` helper formats relayed history into the standard
|
|
19
|
+
thread-history block.
|
|
20
|
+
- `spawnSessionForTopic` accepts an optional pre-computed context, used verbatim when
|
|
21
|
+
provided (skipping the empty-on-a-standby local sources); single-machine behavior is
|
|
22
|
+
unchanged when it is absent.
|
|
23
|
+
- The owner-side resume fetches the router's recent topic messages and passes them, so a
|
|
24
|
+
moved session continues the conversation.
|
|
25
|
+
|
|
26
|
+
- The mentor onboarding tick now gates on LLM availability (the shared rate-limit circuit breaker) in addition to budget and safe-window: when the provider is rate-limited it backs off with reason `llm-rate-limited` and resumes automatically when the breaker closes. A new read-only `llmCircuitAvailable()` helper exposes the breaker state without consuming its recovery probe.
|
|
27
|
+
|
|
28
|
+
## Evidence
|
|
29
|
+
|
|
30
|
+
- Confirmed in code: on a standby, a moved session was spawned with no TopicMemory and an
|
|
31
|
+
empty local message history, so it started with no prior conversation context.
|
|
32
|
+
- Unit, `tests/unit/ForwardedTopicContext.test.ts`: the formatter over empty history,
|
|
33
|
+
multi-message threads with attribution, sender/timestamp fallbacks, and the
|
|
34
|
+
per-message length cap.
|
|
35
|
+
- Wiring, `tests/unit/session-pool-activation-wiring.test.ts`: the owner-side bridge
|
|
36
|
+
still spawns and fails safe with the history fetch wrapped around it.
|
|
37
|
+
- 51 session-pool + adapter tests pass; tsc --noEmit clean.
|
|
38
|
+
- Note: unit-verified; the live confirmation that a moved session retains its context
|
|
39
|
+
follows once the second machine's CLI is logged in.
|
|
40
|
+
- Spec, `docs/specs/moved-session-context-relay.md` plus the .eli16.md sibling.
|
|
41
|
+
|
|
42
|
+
- Found in the agent's own server log: the LLM circuit breaker opening repeatedly (trip #7) on the mentor's `claude -p` forensics call.
|
|
43
|
+
- The mentor tick gated on budget but not on the rate-limit circuit, so it ran LLM-backed Stage A + Stage B while the provider was throttled, re-tripping the breaker (which pauses all LLM-backed work ~900s per trip).
|
|
44
|
+
- Unit tests: the tick skips with reason `llm-rate-limited` BEFORE any spawn/forensics when the circuit is open; budget is still checked first; the existing gate-order and happy-path cases stay green.
|
|
45
|
+
|
|
46
|
+
## What Changed — a conversation moved to your other machine keeps its memory
|
|
47
|
+
|
|
48
|
+
A quality step for the multi-machine "move this conversation to my other machine"
|
|
49
|
+
feature. When a conversation moved to the backup machine, that machine started the
|
|
50
|
+
session fresh from its own records — which were empty for that conversation (it had
|
|
51
|
+
never been the one talking to you). So the moved conversation effectively forgot
|
|
52
|
+
everything that came before it.
|
|
53
|
+
|
|
54
|
+
This release has the receiving machine fetch the recent history from the machine that
|
|
55
|
+
was serving the conversation, and seed the moved session with it. So the conversation
|
|
56
|
+
picks up where it left off instead of resetting. It's best-effort: if the other machine
|
|
57
|
+
can't be reached, the session still starts (just without the prior history, as before),
|
|
58
|
+
so it never blocks the move.
|
|
59
|
+
|
|
60
|
+
## What Changed — The mentor routine no longer hammers a rate-limited provider and re-trips the pause
|
|
61
|
+
|
|
62
|
+
Agents can run a "mentor" routine that periodically studies a mentee agent using the AI model. There's also a safety breaker that pauses all AI work for a while when the provider says you're going too fast (rate-limited). The mentor checked its spending budget before running, but not whether the AI was currently rate-limited — so while the provider was throttled, the mentor kept firing off doomed analyses that failed and re-tripped the pause, restarting it again and again. The agent was effectively tripping itself.
|
|
63
|
+
|
|
64
|
+
Now the mentor also checks the breaker: if the AI is currently rate-limited, it skips this round and picks up on the next one, instead of throwing a doomed request at a throttled provider and re-pausing all the agent's other AI-backed monitors.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Side-effects — Mentor LLM rate-limit gate
|
|
2
|
+
|
|
3
|
+
## 1. What files/state does this touch at runtime?
|
|
4
|
+
`MentorOnboardingTick.ts` (new `llmAvailable` dep + a gate), `MentorOnboardingRunner.ts` (computes
|
|
5
|
+
`llmAvailable` from the circuit), `LlmCircuitBreaker.ts` (a new read-only `llmCircuitAvailable()`
|
|
6
|
+
helper). No new state, config, or schema.
|
|
7
|
+
|
|
8
|
+
## 2. Does it change any functional behavior?
|
|
9
|
+
The mentor onboarding tick now SKIPS (returns `{ran:false, reason:'llm-rate-limited'}`) when the
|
|
10
|
+
shared LLM circuit is open/half-open, instead of running Stage A + Stage B and failing. When the
|
|
11
|
+
circuit is closed (or disabled), behavior is unchanged.
|
|
12
|
+
|
|
13
|
+
## 3. What happens on failure / weird config?
|
|
14
|
+
If the breaker is disabled, `llmCircuitAvailable()` returns true (the mentor runs as before). The
|
|
15
|
+
helper is read-only (cannot throw on a normal status read). A skipped tick is simply retried on the
|
|
16
|
+
next eligible cycle — no work is lost (the mentor's forensics are not time-critical).
|
|
17
|
+
|
|
18
|
+
## 4. Migration parity — do existing agents get it?
|
|
19
|
+
Yes, via the normal release — code-only, compiled into `dist`. No agent-installed file / config /
|
|
20
|
+
template change → no `PostUpdateMigrator` pass.
|
|
21
|
+
|
|
22
|
+
## 5. Could it spam / flood / burn resources?
|
|
23
|
+
The opposite — it REDUCES burn: it stops the mentor from firing doomed LLM calls at a throttled
|
|
24
|
+
provider and re-tripping the circuit (each trip pauses all LLM-backed work ~900s). The added work is
|
|
25
|
+
one read-only circuit-status read per tick.
|
|
26
|
+
|
|
27
|
+
## 6. Rollback / off-switch?
|
|
28
|
+
Revert the gate + the `llmAvailable` dep + the helper. No data, no migration, no flag.
|
|
29
|
+
|
|
30
|
+
## 7. Concurrency / ordering?
|
|
31
|
+
Gate order is budget → llm-rate-limit → safe-window (budget still wins a tie; fail-closed precedence
|
|
32
|
+
unchanged). The circuit query is non-mutating — it does NOT consume the breaker's half-open probe
|
|
33
|
+
slot, so it can't perturb the breaker's recovery.
|
|
34
|
+
|
|
35
|
+
## Blast radius
|
|
36
|
+
Small + contained, mentor-only. One gate in the onboarding tick + a read-only circuit helper. Only
|
|
37
|
+
mentor-enabled agents (the mentor ships dark elsewhere) are affected, and only when the LLM circuit
|
|
38
|
+
is open. The dark autonomous-fix guardian makes LLM calls too and should get the same gate — noted as
|
|
39
|
+
a small follow-up, not bundled here.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Side-Effects Review — moved session inherits prior conversation (bug #2)
|
|
2
|
+
|
|
3
|
+
**Version / slug:** `moved-session-context-relay`
|
|
4
|
+
**Date:** `2026-05-31`
|
|
5
|
+
**Author:** `echo`
|
|
6
|
+
**Second-pass reviewer:** `not required`
|
|
7
|
+
|
|
8
|
+
## Summary of the change
|
|
9
|
+
|
|
10
|
+
A session moved to a standby now inherits the topic's recent history from the router.
|
|
11
|
+
New pure helper `formatForwardedTopicContext`; `spawnSessionForTopic` gains an optional
|
|
12
|
+
`precomputedContext`; the owner-side resume fetches the router's
|
|
13
|
+
`/telegram/topics/:topicId/messages` and passes it. Best-effort; default-off for
|
|
14
|
+
single-machine. Closes audit #2 (moved session started with no prior context).
|
|
15
|
+
|
|
16
|
+
## Decision-point inventory
|
|
17
|
+
|
|
18
|
+
- **spawnSessionForTopic context source** — `precomputedContext` provided → use it,
|
|
19
|
+
skip the local TopicMemory/JSONL sources; else → unchanged local logic. Both sides
|
|
20
|
+
covered (the helper tests + the single-machine path is untouched when undefined).
|
|
21
|
+
- **owner-side fetch** — router URL resolvable (`_resolveRouterUrl` → lease holder peer
|
|
22
|
+
URL, not self) + GET ok → format + pass; any failure → spawn without it. Best-effort.
|
|
23
|
+
|
|
24
|
+
## 1. Over-block
|
|
25
|
+
|
|
26
|
+
**What legitimate inputs does this reject?** None. The single-machine spawn path is
|
|
27
|
+
byte-identical when `precomputedContext` is undefined (no router). The fetch is purely
|
|
28
|
+
additive context; a failure falls back to today's behavior (spawn without prior
|
|
29
|
+
history). Nothing that worked before is rejected.
|
|
30
|
+
|
|
31
|
+
## 2. Under-block
|
|
32
|
+
|
|
33
|
+
**What does this still miss?** It fetches up to 50 recent messages (not the entire
|
|
34
|
+
history / no summaries) — sufficient for continuity, not a full replica. It is a
|
|
35
|
+
point-in-time fetch, not a shared/replicated ledger (the broader architectural fix
|
|
36
|
+
remains separate). It is NOT yet live-verified (the moved session can't run until the
|
|
37
|
+
mini's Claude is logged in — bug #12, pending the user). It does not sync userProfile
|
|
38
|
+
(a smaller, separate gap).
|
|
39
|
+
|
|
40
|
+
## 3. Level-of-abstraction fit
|
|
41
|
+
|
|
42
|
+
**Right layer?** Yes. The formatter is a pure module (testable, mirrors the existing
|
|
43
|
+
JSONL format). `precomputedContext` slots into `spawnSessionForTopic`'s existing
|
|
44
|
+
context-resolution as the highest-precedence source. The fetch lives in the owner-side
|
|
45
|
+
resume (the one place a moved session is spawned), using the same `_resolveRouterUrl` /
|
|
46
|
+
authToken plumbing as the outbound relay.
|
|
47
|
+
|
|
48
|
+
## 4. Signal vs authority compliance
|
|
49
|
+
|
|
50
|
+
**Required reference:** [docs/signal-vs-authority.md](../../docs/signal-vs-authority.md)
|
|
51
|
+
|
|
52
|
+
No blocking authority. It only ADDS context to a spawned session; it gates nothing and
|
|
53
|
+
blocks nothing. A fetch failure is swallowed (best-effort) and the session proceeds.
|
|
54
|
+
|
|
55
|
+
## 5. Interactions
|
|
56
|
+
|
|
57
|
+
Reuses the read-only `/telegram/topics/:topicId/messages` route (no new endpoint) and
|
|
58
|
+
the lease-holder resolution (`_resolveRouterUrl`) shared with the outbound relay. Pairs
|
|
59
|
+
with the owner-side resume (#9/#11): the same path that spawns + persists + confirms a
|
|
60
|
+
moved session now also seeds its context. Idempotent (a fresh fetch per spawn). No
|
|
61
|
+
interaction with the lease or shared-state guard.
|
|
62
|
+
|
|
63
|
+
## 6. External surfaces
|
|
64
|
+
|
|
65
|
+
One cross-machine GET from the standby to the router's existing messages route
|
|
66
|
+
(Bearer-authed). No new route, config, or notification. The visible effect: a moved
|
|
67
|
+
session continues the conversation instead of resetting.
|
|
68
|
+
|
|
69
|
+
## 7. Rollback cost
|
|
70
|
+
|
|
71
|
+
Low. Remove the `precomputedContext` param + the onAccepted fetch + the helper; a moved
|
|
72
|
+
session reverts to starting context-less (audit #2). No schema, no state, no migration.
|
|
73
|
+
|
|
74
|
+
## Conclusion
|
|
75
|
+
|
|
76
|
+
Targeted, additive, best-effort context relay; the formatter + the precedence both
|
|
77
|
+
unit-tested; the single-machine path untouched; no new authority/surface; cheap revert.
|
|
78
|
+
Makes a moved session continue its conversation. Honestly scoped: unit-verified, live
|
|
79
|
+
confirmation pending the mini's Claude login.
|
|
80
|
+
|
|
81
|
+
## Second-pass review (if required)
|
|
82
|
+
|
|
83
|
+
Not required — additive best-effort context, pure formatter fully tested, single-machine
|
|
84
|
+
path unchanged, reversible, no authority. The live moved-session-retains-context check
|
|
85
|
+
is the Tier-3 gate after the user's mini login.
|
|
86
|
+
|
|
87
|
+
## Evidence pointers
|
|
88
|
+
|
|
89
|
+
- `tests/unit/ForwardedTopicContext.test.ts` — formatter over empty/multi/fallback/cap.
|
|
90
|
+
- `tests/unit/session-pool-activation-wiring.test.ts` — owner-side bridge spawns + fails safe.
|
|
91
|
+
- 51 session-pool + adapter tests green; `tsc --noEmit` clean.
|
|
92
|
+
- Confirmed in code: on a standby, `spawnSessionForTopic` got `topicMemory: undefined`
|
|
93
|
+
and `getTopicHistory` returns `[]` → `contextContent = ''` (no prior history).
|
|
94
|
+
- Spec: `docs/specs/moved-session-context-relay.md` (+ `.eli16.md`).
|