instar 1.3.986 → 1.3.987

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.
@@ -17,6 +17,7 @@ import { HandshakeManager } from './HandshakeManager.js';
17
17
  import { AgentDiscovery } from './AgentDiscovery.js';
18
18
  import { ThreadlineClient } from './client/ThreadlineClient.js';
19
19
  import { InboundMessageGate } from './InboundMessageGate.js';
20
+ import { type RelayConnectionEvent } from './relayConnectionObserver.js';
20
21
  import { AgentTrustManager } from './AgentTrustManager.js';
21
22
  export interface ThreadlineBootstrapConfig {
22
23
  /** Agent name */
@@ -64,6 +65,14 @@ export interface ThreadlineBootstrapResult {
64
65
  inboundGate?: InboundMessageGate;
65
66
  /** Trust manager */
66
67
  trustManager?: AgentTrustManager;
68
+ /**
69
+ * Most recent relay connection-LOSS event, or null if the relay has never
70
+ * dropped. Exists so a status surface can report WHY the relay is down rather
71
+ * than only that it is — the distinction the 2026-07-26 incident turned on,
72
+ * when the only record available said "connected" for a connection that was
73
+ * gone. See relayConnectionObserver.ts.
74
+ */
75
+ getLastRelayEvent?: () => RelayConnectionEvent | null;
67
76
  }
68
77
  /**
69
78
  * Bootstrap the Threadline protocol stack.
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadlineBootstrap.d.ts","sourceRoot":"","sources":["../../src/threadline/ThreadlineBootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAO3D,MAAM,WAAW,yBAAyB;IACxC,iBAAiB;IACjB,SAAS,EAAE,MAAM,CAAC;IACl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A+C;IAC/C,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,iDAAiD;IACjD,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,oBAAoB;IACpB,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,MAAM,oBAAoB,GAAG,IAAI,CAAC;CACvD;AAID;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAAC,yBAAyB,CAAC,CAqRpC"}
@@ -24,6 +24,7 @@ import { DEFAULT_RELAY_URL } from './constants.js';
24
24
  import { resolveThreadlineMcpEntry } from './mcpEntry.js';
25
25
  import { ThreadlineClient } from './client/ThreadlineClient.js';
26
26
  import { InboundMessageGate } from './InboundMessageGate.js';
27
+ import { attachRelayObservability } from './relayConnectionObserver.js';
27
28
  import { AgentTrustManager } from './AgentTrustManager.js';
28
29
  import { SafeFsExecutor } from '../core/SafeFsExecutor.js';
29
30
  import { IdentityManager } from './client/IdentityManager.js';
@@ -147,6 +148,7 @@ export async function bootstrapThreadline(config) {
147
148
  }
148
149
  }
149
150
  let relayClient;
151
+ let relayObservability;
150
152
  let inboundGate;
151
153
  let trustManager;
152
154
  // Always create trust manager when relay is enabled — needed for processing
@@ -249,6 +251,14 @@ export async function bootstrapThreadline(config) {
249
251
  relayClient.on('auto-discovered', (info) => {
250
252
  console.log(`Threadline: auto-discovered ${info.count} agent(s) on relay`);
251
253
  });
254
+ // Record connection LOSS, not just connection. Without this the successful
255
+ // connect line below is the last word the record can ever contain, so a relay
256
+ // that drops afterwards — including the terminal `displaced` case, which
257
+ // disarms reconnect permanently — is invisible. See relayConnectionObserver.ts
258
+ // for the incident this closes.
259
+ relayObservability = attachRelayObservability(relayClient, {
260
+ logDir: path.join(config.stateDir, '..', 'logs'),
261
+ });
252
262
  try {
253
263
  await relayClient.connect();
254
264
  console.log(`Threadline: relay connected (fingerprint: ${relayClient.fingerprint})`);
@@ -273,6 +283,10 @@ export async function bootstrapThreadline(config) {
273
283
  discovery,
274
284
  trustManager,
275
285
  relayClient,
286
+ /** Most recent relay connection-loss event, or null if it has never dropped.
287
+ * Lets a status surface report WHY the relay is down instead of only that it
288
+ * is — the distinction the 2026-07-26 incident turned on. */
289
+ getLastRelayEvent: () => relayObservability?.getLastEvent() ?? null,
276
290
  inboundGate,
277
291
  shutdown: async () => {
278
292
  stopHeartbeat();
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadlineBootstrap.js","sourceRoot":"","sources":["../../src/threadline/ThreadlineBootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAiD/D,wEAAwE;AAExE;;;;;;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,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;QACjF,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC7B,MAAM,EAAE,qBAAqB,EAAE,GAAG,MAAM,MAAM,CAC5C,mEAAmE,CACpE,CAAC;YACF,MAAM,qBAAqB,EAAE,CAAC,QAAQ,CACpC;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,YAAY;gBAClB,OAAO,EAAE,QAAQ,CAAC,OAAO;gBACzB,IAAI,EAAE,QAAQ,CAAC,IAAI;aACpB,EACD,EAAE,KAAK,EAAE,MAAM,EAAE,CAClB,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,uDAAuD;IACzD,CAAC;AACH,CAAC"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Observability for the server's relay connection.
3
+ *
4
+ * WHY THIS EXISTS
5
+ * ---------------
6
+ * On 2026-07-26 the agent could not send to a peer. The peer was healthy and
7
+ * listening; this agent's relay was down. Diagnosing it was impossible from the
8
+ * record, because the record could only ever say one thing:
9
+ *
10
+ * Threadline: relay connected (fingerprint: …)
11
+ *
12
+ * `RelayClient` emits BOTH `disconnected` (socket close) and `displaced` (another
13
+ * connection claimed the same identity). `ThreadlineBootstrap` subscribed to
14
+ * `message`, `unknown-sender` and `auto-discovered` — and to NEITHER of those two.
15
+ * So a connection that dropped after startup left the successful connect line as
16
+ * the last word forever.
17
+ *
18
+ * THE PART THAT MAKES IT WORTH A MODULE. `displaced` sets `shouldReconnect = false`
19
+ * permanently — deliberately, so two processes do not fight over one identity. That
20
+ * is a *terminal* state: the exponential backoff that would otherwise recover the
21
+ * connection is switched off and never re-armed for the life of the process. A
22
+ * terminal state that is never recorded is the worst combination available: the
23
+ * channel is gone for good and nothing says so.
24
+ *
25
+ * The bootstrap itself documents a known "displacement race" between the server's
26
+ * client and the standalone listener daemon. Whether that race is what fired here
27
+ * is UNKNOWN — and unknowable from the existing record, which is precisely the
28
+ * defect. This module does not diagnose the cause; it makes the next occurrence
29
+ * diagnosable.
30
+ *
31
+ * SCOPE — deliberately narrow. This RECORDS transitions. It does not reconnect,
32
+ * does not re-arm anything, and never changes the client's behaviour. Any recovery
33
+ * fix belongs after this, and would be unverifiable before it.
34
+ */
35
+ /** One recorded relay-connection transition. */
36
+ export interface RelayConnectionEvent {
37
+ ts: string;
38
+ /**
39
+ * `disconnected` — socket closed; the client's backoff will retry.
40
+ * `displaced` — another connection took this identity. TERMINAL: retry is
41
+ * disarmed permanently and this process will not reconnect.
42
+ */
43
+ event: 'disconnected' | 'displaced';
44
+ /** Reason string from the client, clamped. Never trusted as structured data. */
45
+ reason: string;
46
+ fingerprint: string;
47
+ /**
48
+ * True only for `displaced`. Recorded explicitly rather than left implicit,
49
+ * because "will retry" and "will never retry" are the two states a reader
50
+ * actually needs to tell apart, and they are otherwise indistinguishable.
51
+ */
52
+ terminal: boolean;
53
+ }
54
+ /** Minimal shape this module needs — keeps it testable without a real socket. */
55
+ export interface RelayEventSource {
56
+ on(event: string, listener: (...args: unknown[]) => void): unknown;
57
+ readonly fingerprint?: string | null;
58
+ }
59
+ /**
60
+ * Subscribe to the relay client's connection-loss events and record each one.
61
+ *
62
+ * Returns a getter for the most recent event so a status surface can report WHY
63
+ * the connection is down rather than only that it is. Returns null until one
64
+ * fires — which correctly distinguishes "never dropped" from "dropped, cause X".
65
+ */
66
+ export declare function attachRelayObservability(client: RelayEventSource, opts: {
67
+ /** Directory for the durable record. Created if absent. */
68
+ logDir: string;
69
+ /** Injected so tests capture output instead of writing to the console. */
70
+ log?: (line: string) => void;
71
+ /** Injected for the same reason. */
72
+ logError?: (line: string) => void;
73
+ }): {
74
+ getLastEvent: () => RelayConnectionEvent | null;
75
+ };
76
+ //# sourceMappingURL=relayConnectionObserver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relayConnectionObserver.d.ts","sourceRoot":"","sources":["../../src/threadline/relayConnectionObserver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAKH,gDAAgD;AAChD,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX;;;;OAIG;IACH,KAAK,EAAE,cAAc,GAAG,WAAW,CAAC;IACpC,gFAAgF;IAChF,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,iFAAiF;AACjF,MAAM,WAAW,gBAAgB;IAC/B,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC;IACnE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;AASD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE;IACJ,2DAA2D;IAC3D,MAAM,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,oCAAoC;IACpC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC,GACA;IAAE,YAAY,EAAE,MAAM,oBAAoB,GAAG,IAAI,CAAA;CAAE,CA6CrD"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Observability for the server's relay connection.
3
+ *
4
+ * WHY THIS EXISTS
5
+ * ---------------
6
+ * On 2026-07-26 the agent could not send to a peer. The peer was healthy and
7
+ * listening; this agent's relay was down. Diagnosing it was impossible from the
8
+ * record, because the record could only ever say one thing:
9
+ *
10
+ * Threadline: relay connected (fingerprint: …)
11
+ *
12
+ * `RelayClient` emits BOTH `disconnected` (socket close) and `displaced` (another
13
+ * connection claimed the same identity). `ThreadlineBootstrap` subscribed to
14
+ * `message`, `unknown-sender` and `auto-discovered` — and to NEITHER of those two.
15
+ * So a connection that dropped after startup left the successful connect line as
16
+ * the last word forever.
17
+ *
18
+ * THE PART THAT MAKES IT WORTH A MODULE. `displaced` sets `shouldReconnect = false`
19
+ * permanently — deliberately, so two processes do not fight over one identity. That
20
+ * is a *terminal* state: the exponential backoff that would otherwise recover the
21
+ * connection is switched off and never re-armed for the life of the process. A
22
+ * terminal state that is never recorded is the worst combination available: the
23
+ * channel is gone for good and nothing says so.
24
+ *
25
+ * The bootstrap itself documents a known "displacement race" between the server's
26
+ * client and the standalone listener daemon. Whether that race is what fired here
27
+ * is UNKNOWN — and unknowable from the existing record, which is precisely the
28
+ * defect. This module does not diagnose the cause; it makes the next occurrence
29
+ * diagnosable.
30
+ *
31
+ * SCOPE — deliberately narrow. This RECORDS transitions. It does not reconnect,
32
+ * does not re-arm anything, and never changes the client's behaviour. Any recovery
33
+ * fix belongs after this, and would be unverifiable before it.
34
+ */
35
+ import fs from 'node:fs';
36
+ import path from 'node:path';
37
+ const MAX_REASON_CHARS = 300;
38
+ function clampReason(reason) {
39
+ const s = typeof reason === 'string' ? reason : String(reason ?? '');
40
+ return s.length > MAX_REASON_CHARS ? `${s.slice(0, MAX_REASON_CHARS)}…` : s;
41
+ }
42
+ /**
43
+ * Subscribe to the relay client's connection-loss events and record each one.
44
+ *
45
+ * Returns a getter for the most recent event so a status surface can report WHY
46
+ * the connection is down rather than only that it is. Returns null until one
47
+ * fires — which correctly distinguishes "never dropped" from "dropped, cause X".
48
+ */
49
+ export function attachRelayObservability(client, opts) {
50
+ const log = opts.log ?? ((line) => console.log(line));
51
+ const logError = opts.logError ?? ((line) => console.error(line));
52
+ let lastEvent = null;
53
+ const record = (event, reason, terminal) => {
54
+ const entry = {
55
+ ts: new Date().toISOString(),
56
+ event,
57
+ reason: clampReason(reason),
58
+ fingerprint: client.fingerprint ?? 'unknown',
59
+ terminal,
60
+ };
61
+ lastEvent = entry;
62
+ // Loud on the console FIRST. If the durable write fails, the operator still
63
+ // sees the transition — the whole point is that this must not be silent.
64
+ if (terminal) {
65
+ logError(`Threadline: relay DISPLACED by another connection using this identity — ${entry.reason}. `
66
+ + 'Reconnect is now disarmed for the life of this process; this agent cannot send or '
67
+ + 'receive until it restarts.');
68
+ }
69
+ else {
70
+ log(`Threadline: relay disconnected — ${entry.reason}. Client will retry with backoff.`);
71
+ }
72
+ try {
73
+ fs.mkdirSync(opts.logDir, { recursive: true });
74
+ fs.appendFileSync(path.join(opts.logDir, 'threadline-relay-events.jsonl'), `${JSON.stringify(entry)}\n`, 'utf-8');
75
+ }
76
+ catch (err) {
77
+ // Never throw out of an event handler — a failed audit write must not take
78
+ // down the connection path it is observing.
79
+ logError(`Threadline: failed to record relay ${event} — ${err instanceof Error ? err.message : err}`);
80
+ }
81
+ };
82
+ client.on('disconnected', (reason) => record('disconnected', reason, false));
83
+ client.on('displaced', (reason) => record('displaced', reason, true));
84
+ return { getLastEvent: () => lastEvent };
85
+ }
86
+ //# sourceMappingURL=relayConnectionObserver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relayConnectionObserver.js","sourceRoot":"","sources":["../../src/threadline/relayConnectionObserver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AA4B7B,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B,SAAS,WAAW,CAAC,MAAe;IAClC,MAAM,CAAC,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;IACrE,OAAO,CAAC,CAAC,MAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAA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ACvD,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAC5B,OAAO,CACR,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,2EAA2E;YAC3E,4CAA4C;YAC5C,QAAQ,CAAC,sCAAsC,KAAK,MAAM,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;QACxG,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,CAAC,EAAE,CAAC,cAAc,EAAE,CAAC,MAAe,EAAE,EAAE,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;IACtF,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,MAAe,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAE/E,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC;AAC3C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "instar",
3
- "version": "1.3.986",
3
+ "version": "1.3.987",
4
4
  "description": "Coherence infrastructure for self-evolving AI agents — on the Claude Code or Codex subscription you already have.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "./builtin-manifest.schema.json",
3
3
  "schemaVersion": 1,
4
- "generatedAt": "2026-07-26T18:49:10.482Z",
5
- "instarVersion": "1.3.986",
4
+ "generatedAt": "2026-07-26T19:26:36.562Z",
5
+ "instarVersion": "1.3.987",
6
6
  "entryCount": 202,
7
7
  "entries": {
8
8
  "hook:session-start": {
@@ -0,0 +1,100 @@
1
+ # Upgrade Guide — vNEXT
2
+
3
+ <!-- assembled-by: assemble-next-md -->
4
+ <!-- bump: patch -->
5
+
6
+ ## What Changed
7
+
8
+ **When the agent-to-agent relay connection dropped, nothing recorded it — so the startup line
9
+ saying it had connected stayed the last word forever, whatever happened afterwards.**
10
+
11
+ `RelayClient` emits two connection-loss events: `disconnected` (socket close; the client retries
12
+ with exponential backoff) and `displaced` (another connection claimed this identity — **terminal**,
13
+ because `case 'displaced': shouldReconnect = false` disarms retry for the life of the process).
14
+ `ThreadlineBootstrap` subscribed to `message`, `unknown-sender` and `auto-discovered` — and to
15
+ **neither** loss event. Only `listener-daemon.ts` handled them.
16
+
17
+ **Observed (2026-07-26).** The agent could not send to a peer; two send paths refused with
18
+ `Relay not connected and local delivery unavailable`. The peer's own server reported
19
+ `ready: true, relay.connected: true` and had been listening since the previous day — the peer was
20
+ healthy. This agent reported `ready: false, relay.connected: false`, while its last written word on
21
+ the subject was `Threadline: relay connected` at `18:21:27Z`, with no disconnect line anywhere.
22
+
23
+ **The property that made this worth fixing rather than noting: the defect concealed its own cause.**
24
+ A `displaced` frame would fully explain why backoff never recovered the connection, and
25
+ `ThreadlineBootstrap` documents a known displacement race between the server's client and the
26
+ standalone listener daemon. Whether that is what fired is **unknowable**, because nothing recorded
27
+ it — the absence of evidence was produced by the defect itself.
28
+
29
+ The server now subscribes to both and records each transition, appending to
30
+ `logs/threadline-relay-events.jsonl` and exposing the latest event on the bootstrap result.
31
+
32
+ **Ordering note.** This ships observability and *not* reconnection, reversing the author's first
33
+ plan. A reconnect fix built first would have been unverifiable — there would have been no way to
34
+ observe whether it held.
35
+
36
+ ## What to Tell Your User
37
+
38
+ If I have ever been unable to reach another agent and could not tell you why, this is one reason.
39
+ My link to the shared relay could go down and leave behind a note saying it was up — not merely
40
+ silent, but actively misleading, because that startup note was the only note that could ever exist.
41
+
42
+ Two things can end that connection. An ordinary drop, which retries by itself and usually recovers.
43
+ And being displaced, where another process takes the same identity — in which case retrying is
44
+ switched off deliberately and permanently, so the link is gone until a restart. Those demand
45
+ opposite reactions from anyone reading, and both were equally invisible.
46
+
47
+ Now a drop is reported calmly and says a retry is coming, and a displacement is reported as an error
48
+ that says plainly the agent cannot send or receive until it restarts.
49
+
50
+ Two honest limits. This does not reconnect anything — a restart still fixes it, as before, and
51
+ recovery is separate work. And it cannot explain the outage that prompted it, because that evidence
52
+ was never created; what changes is that the next one is diagnosable.
53
+
54
+ ## Summary of New Capabilities
55
+
56
+ - A relay disconnection is recorded durably instead of passing silently.
57
+ - A relay *displacement* is recorded, flagged terminal, and reported at error level with its
58
+ consequence stated — that retry is disarmed and the agent cannot send or receive until restart.
59
+ - The two are distinguishable, so a reader can tell "wait for the retry" from "this is over".
60
+ - Every occurrence is appended rather than overwriting the last, so a flapping connection is
61
+ visible — the shape a reconnection bug actually takes.
62
+ - The most recent loss event is exposed on the bootstrap result, so a status surface can report
63
+ *why* the relay is down rather than only that it is.
64
+ - A connection that has never dropped records nothing and reports no last event, keeping
65
+ "never dropped" distinct from "dropped, cause unknown".
66
+
67
+ ## Evidence
68
+
69
+ **Before**, on the affected agent:
70
+
71
+ | surface | reading |
72
+ |---|---|
73
+ | peer's own server | `ready: true`, `relay.connected: true`, listening since 2026-07-25 |
74
+ | this agent | `ready: false`, `relay.connected: false` |
75
+ | this agent's log, last relay line | `Threadline: relay connected` @ `18:21:27Z` |
76
+ | disconnect / displacement lines | none — no handler existed |
77
+
78
+ **After** — every row asserted by a test:
79
+
80
+ | event | recorded | terminal | reported as | says |
81
+ |---|---|---|---|---|
82
+ | `disconnected` | yes | `false` | log | will retry with backoff |
83
+ | `displaced` | yes | `true` | **error** | retry disarmed; cannot send/receive until restart |
84
+ | never dropped | nothing written | — | — | last event is `null`, not a falsy "unknown" |
85
+ | 5 consecutive drops | 5 rows appended | — | — | flapping stays visible |
86
+ | unwritable log dir | handler does not throw | — | error | console + in-memory state still correct |
87
+ | 5,000-char reason | clamped below 400 | — | — | untrusted text is not written whole |
88
+ | null fingerprint | `"unknown"` | — | — | recorded honestly, not as empty string |
89
+
90
+ **Three guards refuse.** Each regression was introduced deliberately and the suite re-run:
91
+
92
+ ```
93
+ remove the 'displaced' subscription → 4 failed | 6 passed (10)
94
+ remove the 'disconnected' subscription → 7 failed | 3 passed (10)
95
+ collapse terminal into one verdict (false) → 4 failed | 6 passed (10)
96
+ restored → 10 passed (10)
97
+ ```
98
+
99
+ **Scope run:** `npx tsc --noEmit` clean; tree-scanning tests plus every threadline test — counts in
100
+ the PR body.
@@ -0,0 +1,160 @@
1
+ # Side-Effects Review — a relay that dropped left "connected" as the last word
2
+
3
+ **Version / slug:** `relay-drop-was-unrecorded`
4
+ **Date:** `2026-07-26`
5
+ **Author:** `Echo (instar-dev agent)`
6
+ **Second-pass reviewer:** `see Phase 5`
7
+
8
+ ## Summary of the change
9
+
10
+ `RelayClient` emits two connection-loss events: `disconnected` (socket close, client
11
+ retries with backoff) and `displaced` (another connection claimed this identity —
12
+ **terminal**, because `case 'displaced': shouldReconnect = false` disarms retry for
13
+ the life of the process). `ThreadlineBootstrap` subscribed to `message`,
14
+ `unknown-sender` and `auto-discovered` — and to **neither** loss event. Verified by
15
+ grep: both return empty in that file. Only `listener-daemon.ts` handles them.
16
+
17
+ So the server logged `Threadline: relay connected (fingerprint: …)` and could log
18
+ nothing afterwards, whatever happened.
19
+
20
+ **Observed (2026-07-26, topic 29723).** The agent could not send to peer
21
+ `instar-codey`; two send paths refused with `Relay not connected and local delivery
22
+ unavailable`. The peer's own server reported `ready:true, relay.connected:true`,
23
+ listening since 2026-07-25 — the peer was fine. This agent reported
24
+ `ready:false, relay.connected:false`, while its last written word on the subject was
25
+ `relay connected` at 18:21:27Z, with no disconnect line anywhere.
26
+
27
+ **The property that makes this worth fixing rather than noting: the defect conceals
28
+ its own cause.** `displaced` would fully explain why exponential backoff never
29
+ recovered the connection. Whether a `displaced` frame arrived is **unknowable**,
30
+ because nothing recorded it. The absence of evidence is produced by the defect.
31
+ `ThreadlineBootstrap` itself documents a known "displacement race" between the
32
+ server's client and the standalone listener daemon — a candidate, **not asserted**.
33
+
34
+ This change RECORDS transitions. It does not reconnect and does not alter client
35
+ behaviour. That ordering is deliberate and is a correction to my own first plan
36
+ ("reconnect, then observe"): a reconnect fix built first would have been
37
+ unverifiable, because there would be no way to see whether it held.
38
+
39
+ ## Decision-point inventory
40
+
41
+ | point | classification | note |
42
+ |---|---|---|
43
+ | `disconnected` → record, non-terminal | `invariant` | Deterministic event subscription. |
44
+ | `displaced` → record, terminal + error-level | `invariant` | Same. `terminal` is stored explicitly rather than inferred, because "will retry" vs "will never retry" is the distinction a reader needs and they are otherwise identical. |
45
+ | reason string clamped to 300 chars | `invariant` | The reason originates off-machine; it is treated as untrusted text, never structured data. |
46
+ | audit-write failure swallowed | `invariant` | An observer must not throw out of a handler on the path it observes. |
47
+
48
+ No judgment points. No model call. Nothing gates or blocks.
49
+
50
+ ## 1. Over-block
51
+
52
+ Nothing is blocked. The observer only appends and logs; it cannot refuse a
53
+ connection, a send, or a message. The strongest available failure is noise in the
54
+ log if the relay flaps — which is information, not a block, and is the signal a
55
+ future reconnect fix will be judged against.
56
+
57
+ ## 2. Under-block
58
+
59
+ **It does not fix the outage.** The relay is still down as of writing, and this
60
+ change does not reconnect it. Restarting the server restores the connection; that is
61
+ unchanged and untouched.
62
+
63
+ **It does not identify tonight's cause.** That evidence was destroyed before it
64
+ existed. The honest claim is narrower than it looks: the *next* occurrence becomes
65
+ diagnosable, this one does not become explicable.
66
+
67
+ **It observes only the server's client.** The MCP server and the listener daemon each
68
+ construct their own client. The daemon already handles both events; the MCP path is
69
+ untouched and remains unobserved. Recorded, not silently deferred.
70
+
71
+ **A record that is never read is only half of observability.** This writes a durable
72
+ JSONL and exposes the latest event through the bootstrap result. Surfacing it on
73
+ `/threadline/status` is the obvious next step and is deliberately not bundled — this
74
+ PR's refusal evidence is about recording, and mixing a route change in would blur it.
75
+
76
+ ## 3. Level-of-abstraction fit
77
+
78
+ A pure-ish module (`fs` only), below the bootstrap, testable with a fake
79
+ `EventEmitter` and no socket. The bootstrap owns wiring; the module owns recording.
80
+
81
+ **A smarter component already exists and was consulted, not duplicated.**
82
+ `listener-daemon.ts` handles both events and writes `listener-displaced-alert.json` —
83
+ a single-slot file. This deliberately appends instead: a one-slot file cannot show a
84
+ flapping connection, which is exactly the shape a reconnect bug takes.
85
+
86
+ ## 4. Signal vs authority compliance
87
+
88
+ Pure signal. It records and logs; it holds no authority over anything. It cannot
89
+ block a send, refuse a connection, or influence reconnection. `docs/signal-vs-authority.md`
90
+ is satisfied trivially — there is no decision to misplace.
91
+
92
+ The one risk an observer can carry is taking down what it watches. That is closed by
93
+ swallowing audit-write failures, asserted by a test.
94
+
95
+ ## 4b. Judgment-point check (Judgment Within Floors standard)
96
+
97
+ None introduced. Every branch is a deterministic event subscription.
98
+
99
+ ## 5. Interactions
100
+
101
+ - **`listener-daemon.ts`** — already handles both events independently; unchanged.
102
+ Its single-slot alert file is left alone; this is a second, additive record.
103
+ - **`ThreadlineClient` / `RelayClient`** — unchanged. No new emissions, no altered
104
+ reconnect behaviour, no change to `shouldReconnect`.
105
+ - **The daemon-handles-relay branch** — when the daemon owns the relay, the server
106
+ never connects and the observer is never attached. Correct: nothing to observe.
107
+ - **`/threadline/status`** — unchanged in this PR (see §2).
108
+
109
+ ## 6. External surfaces
110
+
111
+ One new durable file, `logs/threadline-relay-events.jsonl`, and one optional field on
112
+ the bootstrap result. No route, no config key, no CLI flag, no message to any user.
113
+
114
+ **Content:** timestamps, event names, this agent's own fingerprint, and a clamped
115
+ reason string from the relay. No message bodies, no peer content.
116
+
117
+ ## 6b. Operator-surface quality
118
+
119
+ Two new log lines. The displacement line is error-level and states the consequence in
120
+ plain terms — that retry is disarmed and the agent cannot send or receive until
121
+ restart — rather than naming the event and leaving the reader to infer what it means.
122
+ The disconnect line is calm and says a retry is coming. That difference is the entire
123
+ point; a reader must be able to tell "wait" from "this is over".
124
+
125
+ ## 7. Multi-machine posture (Cross-Machine Coherence)
126
+
127
+ Machine-local by design. Each machine observes its own relay client and writes its own
128
+ record; a relay connection is per-process and cannot be reasoned about remotely. No
129
+ replication, no lease interaction, no shared state, no generated URL.
130
+
131
+ ## 8. Rollback cost
132
+
133
+ Low. Delete the module, remove one import, one declaration, one call, one optional
134
+ result field. No migration, no persisted state anyone reads yet, no config default,
135
+ nothing installed into an agent home. The test would fail on revert, announcing it.
136
+
137
+ ## Phase 5 — Second-pass review
138
+
139
+ The change touches the session/dispatch family only in the sense that it observes it;
140
+ it holds no authority, gates nothing, and cannot alter connection behaviour, so the
141
+ high-risk trigger list (block/allow decisions, session lifecycle, trust) is not
142
+ engaged. Author-applied lenses, disclosed:
143
+
144
+ **Adversarial — "how would I make this useless?"** By recording to a single slot (a
145
+ flap would overwrite itself) or by letting a write failure kill the handler. Both are
146
+ closed and asserted by tests.
147
+
148
+ **"Did I fix the symptom or the cause?"** Neither — deliberately. This fixes the
149
+ *blindness*, which is a precondition for diagnosing the cause. Stated plainly in §2
150
+ rather than implied.
151
+
152
+ **"Would it have caught the incident?"** It would have recorded the transition and,
153
+ if a displacement occurred, said so at error level with the consequence spelled out.
154
+ It would not have prevented it.
155
+
156
+ **Weakest point:** §2's last item. A durable record that no status surface reads is
157
+ observability only for someone who knows the file exists. I judged the route change
158
+ worth separating to keep this PR's refusal evidence unambiguous, but a reader could
159
+ reasonably call that half a job — which is why it is written down here rather than
160
+ left for them to notice.