instar 1.3.162 → 1.3.164

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.
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAqSH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAqwDD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAgwPtE;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDzE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD5E"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAsSH,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAqwDD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAkwPtE;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDzE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD5E"}
@@ -15,6 +15,7 @@ import { fileURLToPath } from 'node:url';
15
15
  import pc from 'picocolors';
16
16
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
17
17
  import { loadConfig, ensureStateDir, detectTmuxPath } from '../core/Config.js';
18
+ import { isNonFatalUncaught } from '../core/uncaughtExceptionPolicy.js';
18
19
  import { SessionManager } from '../core/SessionManager.js';
19
20
  import { StateManager } from '../core/StateManager.js';
20
21
  import { StuckInputSentinel } from '../core/StuckInputSentinel.js';
@@ -8778,6 +8779,14 @@ export async function startServer(options) {
8778
8779
  const r = ownReg.cas({ type: 'place', machineId }, { sessionKey: sk, sender: meshSelfId, nonce: `${meshSelfId}:c:${++routerNonce}` });
8779
8780
  return { ok: r.ok, epoch: ownReg.read(sk)?.ownershipEpoch ?? 0 };
8780
8781
  },
8782
+ // bug #11: confirm the remote owner (placing → active) after the spawn is
8783
+ // dispatched. The router holds the authoritative ownReg (single-router
8784
+ // topology); the FSM permits a claim whose machineId equals the placed
8785
+ // owner, so the router confirms on the target's behalf. Without this the
8786
+ // record stays 'placing' and every later message for the session queues.
8787
+ confirmClaim: (sk, machineId) => {
8788
+ ownReg.cas({ type: 'claim', machineId }, { sessionKey: sk, sender: meshSelfId, nonce: `${meshSelfId}:cl:${++routerNonce}` });
8789
+ },
8781
8790
  deliverMessage: async (target, env) => {
8782
8791
  const url = peerUrl(target);
8783
8792
  if (!url)
@@ -9357,17 +9366,11 @@ export async function startServer(options) {
9357
9366
  // the "mutex lock failed" error on next start. This doesn't prevent the crash,
9358
9367
  // but ensures the next boot is clean.
9359
9368
  process.on('uncaughtException', (err) => {
9360
- // Non-fatal HTTP errors — log and continue, don't crash the server.
9361
- // "Cannot set headers" is a double-response race condition (common during
9362
- // tunnel reconnect storms). The affected request is already handled; the
9363
- // server can keep serving new requests.
9364
- const nonFatalPatterns = [
9365
- 'Cannot set headers after they are sent',
9366
- 'write after end',
9367
- 'ERR_HTTP_HEADERS_SENT',
9368
- 'ERR_STREAM_WRITE_AFTER_END',
9369
- ];
9370
- if (nonFatalPatterns.some(p => err.message?.includes(p))) {
9369
+ // Isolated, recoverable uncaught exceptions — log and continue, don't
9370
+ // crash the server (which would close its databases + drop in-flight
9371
+ // work). See isNonFatalUncaught for the allowlist + rationale (HTTP
9372
+ // double-response races, Slack Socket Mode reconnect races).
9373
+ if (isNonFatalUncaught(err)) {
9371
9374
  console.warn(`[WARN] Non-fatal uncaught exception (suppressed): ${err.message}`);
9372
9375
  return; // Don't crash — the server is fine
9373
9376
  }