instar 1.3.156 → 1.3.157
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 +17 -2
- package/dist/commands/server.js.map +1 -1
- package/dist/core/SessionRouter.d.ts +18 -0
- package/dist/core/SessionRouter.d.ts.map +1 -1
- package/dist/core/SessionRouter.js +27 -0
- package/dist/core/SessionRouter.js.map +1 -1
- package/package.json +1 -1
- package/src/data/builtin-manifest.json +2 -2
- package/upgrades/1.3.157.md +54 -0
- package/upgrades/side-effects/session-pool-route-shortcircuit.md +98 -0
|
@@ -44,6 +44,24 @@ export interface RouteOutcome {
|
|
|
44
44
|
* caller may advance the platform offset ONLY when this is true (§L4 ACK protocol). */
|
|
45
45
|
acked: boolean;
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Did this route() outcome place/forward the session onto ANOTHER machine — i.e.
|
|
49
|
+
* the inbound dispatch caller must NOT also handle it locally?
|
|
50
|
+
*
|
|
51
|
+
* `'forwarded'`/`'duplicate'` always mean delivered to a remote owner. A fresh
|
|
52
|
+
* placement on a remote machine returns `'spawned'` (self-placement returns
|
|
53
|
+
* `'handled-locally'`, never `'spawned'`), and owner-dead re-placement returns
|
|
54
|
+
* `'owner-dead-replaced'` for EITHER self or remote — so those two are remote only
|
|
55
|
+
* when the resolved owner is not us. Everything else ('handled-locally', a
|
|
56
|
+
* self 'owner-dead-replaced', 'queued', 'placement-blocked') is local/no-op and
|
|
57
|
+
* falls through to local dispatch.
|
|
58
|
+
*
|
|
59
|
+
* Pure + caller-agnostic so the inbound dispatch decision is unit-testable. Before
|
|
60
|
+
* this, the caller only treated 'forwarded'/'duplicate' as remote, so a just-moved
|
|
61
|
+
* topic was spawned on the target AND injected into the stale local session
|
|
62
|
+
* (double-dispatch — the bug the first live transfer test surfaced, 2026-05-31).
|
|
63
|
+
*/
|
|
64
|
+
export declare function isRemotelyHandled(outcome: RouteOutcome, selfMachineId: string | null): boolean;
|
|
47
65
|
export interface SessionRouterConfig {
|
|
48
66
|
deliverMessageMaxRetries: number;
|
|
49
67
|
deliverMessageRetryBackoffStartMs: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionRouter.d.ts","sourceRoot":"","sources":["../../src/core/SessionRouter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,cAAc,GAAG,IAAI,CAAC;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,QAAQ,GAAG,WAAW,GAAG,iBAAiB,CAAC;CACtD;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,cAAc,CAAC;CAChC;AAED,MAAM,MAAM,WAAW,GACnB,iBAAiB,GACjB,WAAW,GACX,SAAS,GACT,QAAQ,GACR,WAAW,GACX,qBAAqB,GACrB,mBAAmB,CAAC;AAExB,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,WAAW,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;2FACuF;IACvF,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,wBAAwB,EAAE,MAAM,C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
|
|
18
18
|
* timeout (it throws on timeout) — the router owns the retry/backoff/fallback loop.
|
|
19
19
|
*/
|
|
20
|
+
/**
|
|
21
|
+
* Did this route() outcome place/forward the session onto ANOTHER machine — i.e.
|
|
22
|
+
* the inbound dispatch caller must NOT also handle it locally?
|
|
23
|
+
*
|
|
24
|
+
* `'forwarded'`/`'duplicate'` always mean delivered to a remote owner. A fresh
|
|
25
|
+
* placement on a remote machine returns `'spawned'` (self-placement returns
|
|
26
|
+
* `'handled-locally'`, never `'spawned'`), and owner-dead re-placement returns
|
|
27
|
+
* `'owner-dead-replaced'` for EITHER self or remote — so those two are remote only
|
|
28
|
+
* when the resolved owner is not us. Everything else ('handled-locally', a
|
|
29
|
+
* self 'owner-dead-replaced', 'queued', 'placement-blocked') is local/no-op and
|
|
30
|
+
* falls through to local dispatch.
|
|
31
|
+
*
|
|
32
|
+
* Pure + caller-agnostic so the inbound dispatch decision is unit-testable. Before
|
|
33
|
+
* this, the caller only treated 'forwarded'/'duplicate' as remote, so a just-moved
|
|
34
|
+
* topic was spawned on the target AND injected into the stale local session
|
|
35
|
+
* (double-dispatch — the bug the first live transfer test surfaced, 2026-05-31).
|
|
36
|
+
*/
|
|
37
|
+
export function isRemotelyHandled(outcome, selfMachineId) {
|
|
38
|
+
if (outcome.action === 'forwarded' || outcome.action === 'duplicate')
|
|
39
|
+
return true;
|
|
40
|
+
const remoteOwner = outcome.owner != null && outcome.owner !== selfMachineId;
|
|
41
|
+
if (outcome.action === 'spawned' && remoteOwner)
|
|
42
|
+
return true;
|
|
43
|
+
if (outcome.action === 'owner-dead-replaced' && remoteOwner)
|
|
44
|
+
return true;
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
20
47
|
export const DEFAULT_ROUTER_CONFIG = {
|
|
21
48
|
deliverMessageMaxRetries: 3,
|
|
22
49
|
deliverMessageRetryBackoffStartMs: 250,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionRouter.js","sourceRoot":"","sources":["../../src/core/SessionRouter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;
|
|
1
|
+
{"version":3,"file":"SessionRouter.js","sourceRoot":"","sources":["../../src/core/SessionRouter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AA0CH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAqB,EAAE,aAA4B;IACnF,IAAI,OAAO,CAAC,MAAM,KAAK,WAAW,IAAI,OAAO,CAAC,MAAM,KAAK,WAAW;QAAE,OAAO,IAAI,CAAC;IAClF,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,IAAI,IAAI,IAAI,OAAO,CAAC,KAAK,KAAK,aAAa,CAAC;IAC7E,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,IAAI,WAAW;QAAE,OAAO,IAAI,CAAC;IAC7D,IAAI,OAAO,CAAC,MAAM,KAAK,qBAAqB,IAAI,WAAW;QAAE,OAAO,IAAI,CAAC;IACzE,OAAO,KAAK,CAAC;AACf,CAAC;AAUD,MAAM,CAAC,MAAM,qBAAqB,GAAwB;IACxD,wBAAwB,EAAE,CAAC;IAC3B,iCAAiC,EAAE,GAAG;IACtC,+BAA+B,EAAE,IAAI;IACrC,iBAAiB,EAAE,CAAC;CACrB,CAAC;AAuBF,MAAM,OAAO,aAAa;IACP,IAAI,CAAoB;IACxB,GAAG,CAAsB;IACzB,MAAM,GAAG,IAAI,GAAG,EAA4B,CAAC;IAE9D,YAAY,IAAuB,EAAE,MAA2B,qBAAqB;QACnF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED,qFAAqF;IACrF,KAAK,CAAC,GAAmB;QACvB,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACnE,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,KAAK,EAAE,IAAI,EAAE,CAAC;IAChE,CAAC;CACF"}
|
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-31T09:
|
|
5
|
-
"instarVersion": "1.3.
|
|
4
|
+
"generatedAt": "2026-05-31T09:52:37.332Z",
|
|
5
|
+
"instarVersion": "1.3.157",
|
|
6
6
|
"entryCount": 193,
|
|
7
7
|
"entries": {
|
|
8
8
|
"hook:session-start": {
|
|
@@ -0,0 +1,54 @@
|
|
|
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 on more than one machine and move a conversation between them,
|
|
9
|
+
the move now actually takes effect instead of the original machine continuing to
|
|
10
|
+
answer alongside the new one. This is one step in a larger effort to make moving live
|
|
11
|
+
conversations between your machines reliable. It only applies when the multi-machine
|
|
12
|
+
session pool is turned on; single-machine agents are unaffected. Nothing to configure.
|
|
13
|
+
|
|
14
|
+
## Summary of New Capabilities
|
|
15
|
+
|
|
16
|
+
- New exported `isRemotelyHandled(outcome, selfMachineId)` in `SessionRouter` — the
|
|
17
|
+
pure, unit-tested rule for whether a routed message was handled on another machine
|
|
18
|
+
(forwarded/duplicate always; spawned/owner-dead-replaced only when the owner isn't
|
|
19
|
+
this machine). Fail-safe: an unknown self with an unknown owner falls through to
|
|
20
|
+
local handling, never dropping a message.
|
|
21
|
+
- The inbound dispatcher uses it (instead of a forwarded/duplicate-only check), so a
|
|
22
|
+
freshly-placed remote session is no longer also dispatched locally.
|
|
23
|
+
- A new per-message routing-decision log line for session-pool observability.
|
|
24
|
+
|
|
25
|
+
## Evidence
|
|
26
|
+
|
|
27
|
+
- Found live on 2026-05-31 running the real "move this to the Mac mini" test on a
|
|
28
|
+
throwaway topic: the move command was recognized and pinned to the mini, but the
|
|
29
|
+
next message was injected into the existing local session instead of forwarding —
|
|
30
|
+
because the dispatcher's "spawned on the target" answer was not treated as remote.
|
|
31
|
+
- Unit, `tests/unit/SessionRouter.test.ts`: isRemotelyHandled across forwarded,
|
|
32
|
+
duplicate, remote vs self spawned, remote vs self owner-dead-replaced,
|
|
33
|
+
local/queued/blocked fall-through, and the null-self fail-safe.
|
|
34
|
+
- Wiring, `tests/unit/session-pool-activation-wiring.test.ts`: the dispatcher uses
|
|
35
|
+
the helper and still falls back to local dispatch on any routing error.
|
|
36
|
+
- 50 session-pool tests pass; tsc --noEmit clean.
|
|
37
|
+
- Spec, `docs/specs/session-pool-route-shortcircuit.md` plus the .eli16.md sibling.
|
|
38
|
+
- Side-effects, `upgrades/side-effects/session-pool-route-shortcircuit.md`.
|
|
39
|
+
|
|
40
|
+
## What Changed — moving a conversation between machines no longer double-handles it
|
|
41
|
+
|
|
42
|
+
Part of bringing the multi-machine "move this conversation to my other machine"
|
|
43
|
+
feature to life. When the feature is on and you move a conversation, an incoming
|
|
44
|
+
message is routed by a dispatcher that decides whether to keep it on this machine or
|
|
45
|
+
send it to the machine that now owns the conversation. The code reading that
|
|
46
|
+
dispatcher's decision only recognized two of its "it went to the other machine"
|
|
47
|
+
answers — it missed the answer the dispatcher gives when it freshly starts a moved
|
|
48
|
+
conversation on the target machine. So a just-moved conversation was started on the
|
|
49
|
+
target AND still answered on the original machine, which made the move look like it
|
|
50
|
+
did nothing.
|
|
51
|
+
|
|
52
|
+
This release teaches the reader the full set of "handled on another machine" answers
|
|
53
|
+
via a small, well-tested helper, and adds a log line that records every routing
|
|
54
|
+
decision so the live path is no longer a black box.
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Side-Effects Review — Session-pool inbound dispatch short-circuit (bug #8)
|
|
2
|
+
|
|
3
|
+
**Version / slug:** `session-pool-route-shortcircuit`
|
|
4
|
+
**Date:** `2026-05-31`
|
|
5
|
+
**Author:** `echo`
|
|
6
|
+
**Second-pass reviewer:** `not required`
|
|
7
|
+
|
|
8
|
+
## Summary of the change
|
|
9
|
+
|
|
10
|
+
Inbound Telegram dispatch (`src/commands/server.ts`) now short-circuits local
|
|
11
|
+
dispatch whenever `SessionRouter.route()` placed/forwarded the session onto another
|
|
12
|
+
machine — via a new pure helper `isRemotelyHandled(outcome, selfMachineId)` exported
|
|
13
|
+
from `SessionRouter.ts`. Previously only `'forwarded'`/`'duplicate'` short-circuited,
|
|
14
|
+
so a remote `'spawned'`/`'owner-dead-replaced'` fell through and double-dispatched
|
|
15
|
+
(spawn on target + inject into the stale local session). Adds a module-level
|
|
16
|
+
`_meshSelfId` and a one-line routing-decision log.
|
|
17
|
+
|
|
18
|
+
## Decision-point inventory
|
|
19
|
+
|
|
20
|
+
- **isRemotelyHandled** — the sole decision: forwarded|duplicate → remote;
|
|
21
|
+
spawned|owner-dead-replaced → remote only when owner!==self; everything else →
|
|
22
|
+
local. Both sides + the null-self boundary unit-tested.
|
|
23
|
+
- **call site** — `if (isRemotelyHandled(outcome, _meshSelfId)) return;` else fall
|
|
24
|
+
through to existing local dispatch (unchanged).
|
|
25
|
+
|
|
26
|
+
## 1. Over-block
|
|
27
|
+
|
|
28
|
+
**What legitimate inputs does this reject?** None are dropped. A remote outcome now
|
|
29
|
+
returns early (correct — the message was already handled on the owner machine). A
|
|
30
|
+
self/local/queued/blocked outcome still falls through to local dispatch exactly as
|
|
31
|
+
before. The change only ADDS two remote actions to the early-return set.
|
|
32
|
+
|
|
33
|
+
## 2. Under-block
|
|
34
|
+
|
|
35
|
+
**What does this still miss?** It does not address bug #7 (a moved session on a
|
|
36
|
+
tokenless standby cannot send Telegram replies). It does not change WHICH machine
|
|
37
|
+
`route()`/`PlacementExecutor` chooses — if the pin isn't honored or ownership isn't
|
|
38
|
+
released, `route()` returns a LOCAL outcome and this still (correctly) handles
|
|
39
|
+
locally; the new route-decision log is what will pinpoint that on the next live run.
|
|
40
|
+
|
|
41
|
+
## 3. Level-of-abstraction fit
|
|
42
|
+
|
|
43
|
+
**Right layer?** Yes. The decision is a pure function beside the `RouteOutcome` type
|
|
44
|
+
it interprets (testable, reusable). The call site is the single inbound chokepoint
|
|
45
|
+
that already consulted the router. `_meshSelfId` mirrors the existing
|
|
46
|
+
`_sessionRouter`/`_sessionPoolStage` module-capture pattern.
|
|
47
|
+
|
|
48
|
+
## 4. Signal vs authority compliance
|
|
49
|
+
|
|
50
|
+
**Required reference:** [docs/signal-vs-authority.md](../../docs/signal-vs-authority.md)
|
|
51
|
+
|
|
52
|
+
No new blocking authority. The helper only decides local-vs-already-handled-remotely
|
|
53
|
+
for dispatch; it gates nothing user-facing and blocks no message (a not-provably-
|
|
54
|
+
remote outcome falls through to local — fail-safe toward handling, never dropping).
|
|
55
|
+
|
|
56
|
+
## 5. Interactions
|
|
57
|
+
|
|
58
|
+
Consumes `SessionRouter.route()`'s existing `RouteOutcome`; no router behavior
|
|
59
|
+
change. Pairs with the `_tryNicknameRelocation` recognizer (which sets the pin +
|
|
60
|
+
releases ownership) — this fix makes the SUBSEQUENT routed message's remote
|
|
61
|
+
placement actually short-circuit the stale local session. Gated past `'dark'`, so
|
|
62
|
+
inert on single-machine / pool-disabled agents. Idempotent (pure decision per
|
|
63
|
+
message).
|
|
64
|
+
|
|
65
|
+
## 6. External surfaces
|
|
66
|
+
|
|
67
|
+
No HTTP routes, config, or notifications. One new server-log line per routed inbound
|
|
68
|
+
(`[session-pool] route topic N → action=… owner=… self=…`) — log-only observability.
|
|
69
|
+
|
|
70
|
+
## 7. Rollback cost
|
|
71
|
+
|
|
72
|
+
Low. Revert restores the `'forwarded'||'duplicate'`-only check (re-introducing the
|
|
73
|
+
double-dispatch on remote placement) and drops the helper + log. No schema, no
|
|
74
|
+
persisted state, no migration.
|
|
75
|
+
|
|
76
|
+
## Conclusion
|
|
77
|
+
|
|
78
|
+
Minimal, additive interpretation fix with a pure unit-tested decision, no new
|
|
79
|
+
authority, log-only external surface, cheap revert. Closes the double-dispatch half
|
|
80
|
+
of bug #8 and adds the observability to pinpoint the remainder of the live-transfer
|
|
81
|
+
cascade.
|
|
82
|
+
|
|
83
|
+
## Second-pass review (if required)
|
|
84
|
+
|
|
85
|
+
Not required — pure decision helper, both branches + fail-safe tested, no destructive
|
|
86
|
+
op, reversible, pool-gated. Live two-machine re-test is the Tier-3 gate that follows.
|
|
87
|
+
|
|
88
|
+
## Evidence pointers
|
|
89
|
+
|
|
90
|
+
- `tests/unit/SessionRouter.test.ts` — `isRemotelyHandled` over all RouteActions +
|
|
91
|
+
self/remote/null-self boundaries.
|
|
92
|
+
- `tests/unit/session-pool-activation-wiring.test.ts` — call site uses the helper +
|
|
93
|
+
still fails safe to local dispatch.
|
|
94
|
+
- 50 session-pool tests green; `tsc --noEmit` clean.
|
|
95
|
+
- Found live 2026-05-31 on throwaway topic 8882: recognizer pinned to mini, but the
|
|
96
|
+
follow-up injected into the local laptop session (`Injecting into
|
|
97
|
+
echo-standby-mode-edits`) — no forward.
|
|
98
|
+
- Spec: `docs/specs/session-pool-route-shortcircuit.md` (+ `.eli16.md`).
|