condukt 0.25.0 → 0.26.0

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.
@@ -214,6 +214,14 @@ export interface CopilotSession {
214
214
  readonly usage?: CopilotSessionUsage;
215
215
  /** Send a prompt to the agent. Agent begins working. */
216
216
  send(prompt: string): void;
217
+ /**
218
+ * Append one more user turn to the live session and resolve when it settles.
219
+ *
220
+ * Backends that can keep the session handle alive implement this; the
221
+ * declared-output guard uses it to recover a missing artifact without a cold
222
+ * restart. Backends that cannot simply leave it undefined.
223
+ */
224
+ continueSession?(prompt: string): Promise<void>;
217
225
  /** Subscribe to streaming text output from the agent */
218
226
  on(event: 'text', handler: (text: string, parentToolCallId?: string) => void): void;
219
227
  /** Subscribe to tool execution start (file read, bash, Kusto, etc.) */
@@ -1 +1 @@
1
- {"version":3,"file":"copilot-backend.d.ts","sourceRoot":"","sources":["../../../runtimes/copilot/copilot-backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,EACb,aAAa,EACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAChD,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MA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AAI,OAAO,CAAC,OAAO,CAAC;IAY/B,aAAa,CACjB,MAAM,EAAE,aAAa,EACrB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,cAAc,CAAC;CAoB3B"}
@@ -111,6 +111,33 @@ function recoveryDelayMs(policy, failedContinuation) {
111
111
  const delayed = policy.jitter ? Math.random() * capped : capped;
112
112
  return Math.max(100, Number.isFinite(delayed) ? delayed : 100);
113
113
  }
114
+ /**
115
+ * A failed reconnect step, tagged with the stage that threw so an `exhausted`
116
+ * event can name it.
117
+ *
118
+ * `fatal` marks the two steps whose failure cannot change its answer on a
119
+ * retry: a missing client factory, and a resumed session whose id is not the one
120
+ * we asked for. Every other step is retried until the continuation count or the
121
+ * recovery budget runs out.
122
+ */
123
+ class SessionResumeAttemptError extends Error {
124
+ stage;
125
+ fatal;
126
+ constructor(stage, message, fatal, options) {
127
+ super(message, options);
128
+ this.stage = stage;
129
+ this.fatal = fatal;
130
+ this.name = 'SessionResumeAttemptError';
131
+ }
132
+ }
133
+ function toResumeAttemptError(value, stage) {
134
+ if (value instanceof SessionResumeAttemptError)
135
+ return value;
136
+ const message = value instanceof Error ? value.message : String(value);
137
+ return new SessionResumeAttemptError(stage, message, false, {
138
+ cause: value instanceof Error ? value : undefined,
139
+ });
140
+ }
114
141
  function numericStatusCode(value) {
115
142
  if (typeof value === 'number' && Number.isFinite(value))
116
143
  return value;
@@ -119,6 +146,48 @@ function numericStatusCode(value) {
119
146
  const parsed = Number(value);
120
147
  return Number.isFinite(parsed) ? parsed : undefined;
121
148
  }
149
+ /**
150
+ * The CLI and the SDK describe a failed model call differently.
151
+ *
152
+ * The SDK surfaces `model.call_failure` in its typed shape: `source`,
153
+ * `failureKind`, `transport`, `errorMessage` and friends, flat and camelCase,
154
+ * with `source` always set. The CLI emits `model.model_call_failure` (routed
155
+ * here by the type-substring branch in `dispatchClassEvent`) in its own
156
+ * envelope: the details nested under `modelCall` in snake_case, and no `source`
157
+ * anywhere.
158
+ *
159
+ * Both land in `handleModelCallFailure`, so classification reads one view of
160
+ * either. Without this the recovery predicate, which tests `source ===
161
+ * 'top_level'` first, rejected every transport failure that arrived in the CLI
162
+ * shape, and the run restarted the node from a cold session instead of
163
+ * resuming it.
164
+ *
165
+ * The original envelope is kept alongside the unwrapped fields: the failure log
166
+ * still shows exactly what arrived, and the added keys are the ones the
167
+ * classifier reads.
168
+ */
169
+ function normalizeModelCallFailure(data) {
170
+ if (!data)
171
+ return data;
172
+ const nested = isRecord(data.modelCall) ? data.modelCall : undefined;
173
+ // Already the flat SDK shape, or nothing to unwrap: leave it alone.
174
+ if (!nested)
175
+ return data;
176
+ return {
177
+ ...data,
178
+ failureKind: data.failureKind ?? nested.failure_kind ?? nested.failureKind,
179
+ transport: data.transport ?? nested.transport,
180
+ errorMessage: data.errorMessage ?? nested.error ?? nested.errorMessage,
181
+ errorCode: data.errorCode ?? nested.error_code ?? nested.errorCode,
182
+ apiEndpoint: data.apiEndpoint ?? nested.api_endpoint,
183
+ model: data.model ?? nested.model,
184
+ durationMs: data.durationMs ?? data.modelCallDurationMs ?? nested.durationMs,
185
+ // The CLI envelope carries no `source`, and an agent-scoped failure never
186
+ // reaches here: `handleModelCallFailure` returns on `logAgentScopedFailure`
187
+ // first. An absent source on this shape is the root session's own call.
188
+ source: typeof data.source === 'string' ? data.source : 'top_level',
189
+ };
190
+ }
122
191
  function isRecoverableModelCallFailure(data) {
123
192
  if (!data)
124
193
  return false;
@@ -1115,6 +1184,13 @@ class SdkSession {
1115
1184
  deferredIdle = false;
1116
1185
  parentUsage;
1117
1186
  turnSettled = false;
1187
+ /**
1188
+ * Resolvers parked by `continueSession`, settled by the *next* idle/error.
1189
+ * `continueSession` owns the wait for its own turn so `agent()` does not have
1190
+ * to re-register idle/error handlers it cannot remove (the session interface
1191
+ * has no `off`).
1192
+ */
1193
+ settleWaiters = [];
1118
1194
  aborted = false;
1119
1195
  sessionId;
1120
1196
  originalPrompt;
@@ -1227,6 +1303,9 @@ class SdkSession {
1227
1303
  this.emitError(new Error('Session is aborted'));
1228
1304
  return;
1229
1305
  }
1306
+ // A parked `continueSession` belongs to the previous turn. This is a fresh
1307
+ // lifecycle; leaving it parked would hang its caller forever.
1308
+ this.rejectContinuation(new Error('Session was restarted before the continuation settled'));
1230
1309
  this.originalPrompt = prompt;
1231
1310
  this.sessionId = undefined;
1232
1311
  this.sdkSessionConfigFactory = undefined;
@@ -1262,6 +1341,67 @@ class SdkSession {
1262
1341
  this.fail(err instanceof Error ? err : new Error(String(err)), 'session.run');
1263
1342
  });
1264
1343
  }
1344
+ /**
1345
+ * Append one more user turn to the live session and resolve when it settles.
1346
+ *
1347
+ * This is the warm counterpart to `send()`: it never creates or resumes a
1348
+ * session, so whatever the first turn built stays intact. `agent()` uses it to
1349
+ * ask for a declared output the first turn forgot.
1350
+ *
1351
+ * Rejects when the session is aborted, the handle is gone, a compaction owns
1352
+ * the session, the transport refuses the turn, or the turn itself fails. Every
1353
+ * rejection means "no continuation happened"; callers report the miss rather
1354
+ * than falling back to a cold restart.
1355
+ */
1356
+ async continueSession(prompt) {
1357
+ if (this.aborted)
1358
+ throw new Error('Session is aborted');
1359
+ // A recovery in flight is already resuming this session; let it finish so we
1360
+ // send the continuation over whatever handle it installs.
1361
+ if (this.recoveryInProgress)
1362
+ await this.recoveryInProgress;
1363
+ if (this.aborted)
1364
+ throw new Error('Session is aborted');
1365
+ if (this.activeCompactionEventId !== undefined) {
1366
+ throw new Error('Session is compacting; cannot continue the turn');
1367
+ }
1368
+ const handle = this._sdkSession;
1369
+ if (!handle)
1370
+ throw new Error('Session handle is gone; cannot continue the turn');
1371
+ // Reopen the turn so idle, the heartbeat and `fail()` treat the
1372
+ // continuation as live rather than as an already-settled turn.
1373
+ this.turnSettled = false;
1374
+ this.deferredIdle = false;
1375
+ this._turnText.clear();
1376
+ this.lastForwardProgressAt = Date.now();
1377
+ this.lastForwardProgressType = 'continuation-prompt';
1378
+ const waiter = { resolve: () => undefined, reject: () => undefined };
1379
+ const settled = new Promise((resolve, reject) => {
1380
+ waiter.resolve = resolve;
1381
+ waiter.reject = reject;
1382
+ });
1383
+ this.settleWaiters.push(waiter);
1384
+ // The attempt deadline is absolute, so this re-arms the remainder of it
1385
+ // rather than granting the continuation a fresh budget.
1386
+ this.rearmHardTimeout(handle);
1387
+ this.resetHeartbeat();
1388
+ try {
1389
+ await handle.rpc.sendMessages({
1390
+ messages: [{ prompt, displayPrompt: prompt }],
1391
+ wait: false,
1392
+ });
1393
+ }
1394
+ catch (error) {
1395
+ this.removeContinuationWaiter(waiter);
1396
+ throw error instanceof Error ? error : new Error(String(error));
1397
+ }
1398
+ await settled;
1399
+ }
1400
+ removeContinuationWaiter(waiter) {
1401
+ const index = this.settleWaiters.indexOf(waiter);
1402
+ if (index >= 0)
1403
+ this.settleWaiters.splice(index, 1);
1404
+ }
1265
1405
  /**
1266
1406
  * Internal async entrypoint that creates the client, session, wires events,
1267
1407
  * sends the prompt, and handles lifecycle.
@@ -1972,49 +2112,126 @@ class SdkSession {
1972
2112
  this.exhaustRecovery(policy, sessionId, originalError, 'balanced root history has no terminal completion evidence', data);
1973
2113
  return;
1974
2114
  }
1975
- this.recoveryContinuation += 1;
1976
- this.emitRecovery('resuming', policy, this.recoveryContinuation, sessionId, {
1977
- ...this.recoveryMetadata(data),
1978
- });
1979
- // Fence the old handle synchronously before any asynchronous cleanup.
2115
+ // A handshake that fails reconnects and nudges again rather than ending
2116
+ // the turn. Every resume passes `continuePendingWork: false` and every
2117
+ // continuation sends an empty message list, so no attempt replays a turn
2118
+ // or re-issues a tool call: the session is left exactly where the failed
2119
+ // turn stopped, and the next attempt resumes that same state. The
2120
+ // continuation count and the recovery budget are what bound the loop.
2121
+ for (;;) {
2122
+ this.recoveryContinuation += 1;
2123
+ this.emitRecovery('resuming', policy, this.recoveryContinuation, sessionId, {
2124
+ ...this.recoveryMetadata(data),
2125
+ });
2126
+ try {
2127
+ await this.attemptSameSessionResume(failedHandle, policy, before, data);
2128
+ return;
2129
+ }
2130
+ catch (attemptError) {
2131
+ if (this.aborted || this.turnSettled)
2132
+ return;
2133
+ const failed = toResumeAttemptError(attemptError, 'fence');
2134
+ if (failed.fatal
2135
+ || this.recoveryContinuation >= policy.maxContinuations
2136
+ || (this.recoveryDeadlineMs !== undefined && Date.now() >= this.recoveryDeadlineMs)) {
2137
+ this.exhaustRecovery(policy, sessionId, originalError, failed.message, data, failed.stage);
2138
+ return;
2139
+ }
2140
+ const retryDelayMs = recoveryDelayMs(policy, this.recoveryContinuation);
2141
+ this.emitRecovery('scheduled', policy, this.recoveryContinuation + 1, sessionId, {
2142
+ delayMs: retryDelayMs,
2143
+ ...this.recoveryMetadata(data),
2144
+ });
2145
+ try {
2146
+ await this.waitWithinRecoveryDeadline(retryDelayMs);
2147
+ }
2148
+ catch {
2149
+ // The budget, not the handshake, is what ended recovery, so the
2150
+ // reason worth reporting is the handshake's own failure.
2151
+ this.exhaustRecovery(policy, sessionId, originalError, failed.message, data, failed.stage);
2152
+ return;
2153
+ }
2154
+ }
2155
+ }
2156
+ }
2157
+ catch (recoveryError) {
2158
+ if (this.aborted || this.turnSettled)
2159
+ return;
2160
+ // Only the pre-flight reaches here: the initial recovery wait and the
2161
+ // history audit that precedes the first handshake. A failing handshake is
2162
+ // handled inside the loop, which retries it within the same bounds.
2163
+ const normalized = recoveryError instanceof Error
2164
+ ? recoveryError
2165
+ : new Error(String(recoveryError));
2166
+ this.exhaustRecovery(policy, sessionId, originalError, normalized.message, data);
2167
+ }
2168
+ }
2169
+ /**
2170
+ * One reconnect handshake: fence the failed handle, stand up a fresh client,
2171
+ * resume the same session without replaying any turn, restore the resumed
2172
+ * session's configuration, and nudge it with an empty message.
2173
+ *
2174
+ * Repeating this is safe by construction. `continuePendingWork: false` plus an
2175
+ * empty-message send appends nothing to the transcript, so a handshake that
2176
+ * fails at any step leaves the session where the failed turn stopped and the
2177
+ * next attempt resumes that same state.
2178
+ *
2179
+ * Returns once the continuation was sent, or once the abandoned turn turns out
2180
+ * to have completed. Throws otherwise, after tearing down whatever it built,
2181
+ * so the caller can retry from a clean fence.
2182
+ */
2183
+ async attemptSameSessionResume(failedHandle, policy, before, data) {
2184
+ const sessionId = this.sessionId;
2185
+ if (!sessionId)
2186
+ return;
2187
+ let stage = 'fence';
2188
+ try {
2189
+ // Fence synchronously before any asynchronous cleanup. Target whatever
2190
+ // handle is live: after a resume that succeeded through the handshake and
2191
+ // then failed on the nudge, that is the resumed handle, not the original.
2192
+ const handleToFence = this._sdkSession ?? failedHandle;
1980
2193
  this._sdkSession = null;
1981
2194
  this.handleGeneration += 1;
1982
2195
  this.activeCompactionEventId = undefined;
1983
2196
  this.suspendHeartbeat();
1984
- await failedHandle.disconnect().catch(() => undefined);
2197
+ await handleToFence.disconnect().catch(() => undefined);
1985
2198
  const oldClient = this._client;
1986
2199
  this._client = null;
1987
2200
  if (oldClient) {
1988
2201
  await boundedCleanup(oldClient.stop()).catch(() => undefined);
1989
2202
  await oldClient.forceStop().catch(() => undefined);
1990
2203
  }
2204
+ stage = 'client';
1991
2205
  const clientFactory = this.clientFactory;
1992
2206
  const configFactory = this.sdkSessionConfigFactory;
1993
2207
  if (!clientFactory || !configFactory) {
1994
- throw new Error('SDK recovery configuration is unavailable');
2208
+ throw new SessionResumeAttemptError(stage, 'SDK recovery configuration is unavailable', true);
1995
2209
  }
1996
2210
  const client = clientFactory();
1997
2211
  this._client = client;
1998
2212
  await client.start();
1999
2213
  const { sessionId: _createSessionId, ...resumeConfig } = configFactory(client);
2214
+ stage = 'resume';
2000
2215
  const resumed = await client.resumeSession(sessionId, {
2001
2216
  ...resumeConfig,
2002
2217
  continuePendingWork: false,
2003
2218
  });
2004
2219
  if (resumed.sessionId !== sessionId) {
2005
2220
  await resumed.disconnect().catch(() => undefined);
2006
- throw new Error(`SDK resumed unexpected session '${resumed.sessionId}' instead of '${sessionId}'`);
2221
+ throw new SessionResumeAttemptError(stage, `SDK resumed unexpected session '${resumed.sessionId}' instead of '${sessionId}'`, true);
2007
2222
  }
2008
2223
  if (this.aborted || this.turnSettled) {
2009
2224
  await resumed.disconnect().catch(() => undefined);
2010
2225
  return;
2011
2226
  }
2227
+ stage = 'configuration';
2012
2228
  this._sdkSession = resumed;
2013
2229
  this.handleGeneration += 1;
2014
2230
  this.resetStateAfterResume();
2015
2231
  this.rearmHardTimeout(resumed);
2016
2232
  await this.applyResumedSessionConfiguration(resumed);
2017
2233
  this._wireEvents(resumed);
2234
+ stage = 'audit';
2018
2235
  const afterResume = await this.auditRecoveryHistory(resumed, sessionId);
2019
2236
  if (afterResume.unmatchedRootTurns === 0) {
2020
2237
  const taskCompletedDuringHandoff = afterResume.latestRootTurnHasTerminalResponse
@@ -2029,6 +2246,7 @@ class SdkSession {
2029
2246
  // Disconnect can close the abandoned turn without completing the task.
2030
2247
  // Keep the continuation path active rather than synthesizing false success.
2031
2248
  }
2249
+ stage = 'continuation';
2032
2250
  this.lastForwardProgressAt = Date.now();
2033
2251
  this.lastForwardProgressType = 'continuation-sent';
2034
2252
  await resumed.rpc.sendMessages({ messages: [], wait: false });
@@ -2037,20 +2255,29 @@ class SdkSession {
2037
2255
  ...this.recoveryMetadata(data),
2038
2256
  });
2039
2257
  }
2040
- catch (recoveryError) {
2041
- if (this.aborted || this.turnSettled)
2042
- return;
2043
- const normalized = recoveryError instanceof Error
2044
- ? recoveryError
2045
- : new Error(String(recoveryError));
2046
- if (this.recoveryContinuation >= policy.maxContinuations
2047
- || (this.recoveryDeadlineMs !== undefined && Date.now() >= this.recoveryDeadlineMs)) {
2048
- this.exhaustRecovery(policy, sessionId, originalError, normalized.message, data);
2049
- return;
2050
- }
2051
- // Resume failures are unsafe to replay blindly. They exhaust this logical
2052
- // turn even when numerical continuations remain.
2053
- this.exhaustRecovery(policy, sessionId, originalError, normalized.message, data);
2258
+ catch (error) {
2259
+ await this.tearDownFailedResume();
2260
+ throw toResumeAttemptError(error, stage);
2261
+ }
2262
+ }
2263
+ /**
2264
+ * Undo a failed handshake so the next attempt fences from the state it would
2265
+ * have started from. The attempt may already have reached the server, so both
2266
+ * the resumed handle and the client holding it come down: a lingering client
2267
+ * could make the SDK refuse the next resume as already active.
2268
+ */
2269
+ async tearDownFailedResume() {
2270
+ const handle = this._sdkSession;
2271
+ this._sdkSession = null;
2272
+ this.handleGeneration += 1;
2273
+ this.suspendHeartbeat();
2274
+ if (handle)
2275
+ await handle.disconnect().catch(() => undefined);
2276
+ const client = this._client;
2277
+ this._client = null;
2278
+ if (client) {
2279
+ await boundedCleanup(client.stop()).catch(() => undefined);
2280
+ await client.forceStop().catch(() => undefined);
2054
2281
  }
2055
2282
  }
2056
2283
  async auditRecoveryHistory(handle, sessionId) {
@@ -2236,9 +2463,15 @@ class SdkSession {
2236
2463
  ...fields,
2237
2464
  });
2238
2465
  }
2239
- exhaustRecovery(policy, sessionId, cause, reason, data) {
2466
+ /**
2467
+ * `stage` names the reconnect step whose failure ended recovery, when the
2468
+ * end came from a handshake rather than from the budget alone. The `reason`
2469
+ * alone ("Connection is disposed.") does not say which RPC produced it.
2470
+ */
2471
+ exhaustRecovery(policy, sessionId, cause, reason, data, stage) {
2240
2472
  this.emitRecovery('exhausted', policy, this.recoveryContinuation, sessionId, {
2241
2473
  reason,
2474
+ ...(stage !== undefined ? { stage } : {}),
2242
2475
  ...this.recoveryMetadata(data),
2243
2476
  });
2244
2477
  this.fail(new types_1.SessionRecoveryExhaustedError(`Session recovery exhausted after ${this.recoveryContinuation} continuation(s): ${reason}`, { cause }), 'session.recovery_exhausted', data);
@@ -2258,6 +2491,7 @@ class SdkSession {
2258
2491
  return;
2259
2492
  const error = new Error('Session aborted');
2260
2493
  this.clearTimers();
2494
+ this.rejectContinuation(error);
2261
2495
  this.emitError(error);
2262
2496
  this.aborted = true;
2263
2497
  await this._cleanup();
@@ -2312,22 +2546,48 @@ class SdkSession {
2312
2546
  settleIdle() {
2313
2547
  if (this.aborted || this.turnSettled)
2314
2548
  return;
2549
+ // A parked waiter means this idle closes a declared-output continuation
2550
+ // rather than the attempt's first turn, so the recovery bookkeeping (and
2551
+ // its `recovered` event) does not apply to it.
2552
+ const isContinuation = this.settleWaiters.length > 0;
2315
2553
  const policy = effectiveSessionRecoveryPolicy(this.config.sessionRecovery);
2316
- if (policy && this.recoveryContinuation > 0 && this.sessionId) {
2554
+ if (!isContinuation && policy && this.recoveryContinuation > 0 && this.sessionId) {
2317
2555
  this.emitRecovery('recovered', policy, this.recoveryContinuation, this.sessionId);
2318
2556
  }
2319
2557
  this.turnSettled = true;
2320
2558
  this._turnText.clear();
2321
2559
  this.clearTimers();
2322
2560
  this.emit('idle');
2323
- void this._cleanup();
2561
+ this.settleContinuation();
2562
+ // The handle is deliberately left alive: `agent()`'s declared-output guard
2563
+ // continues the same session when the turn ended without the artifact, and
2564
+ // it cannot do that against a torn-down client. Teardown is owned by
2565
+ // `abort()`, which the agent node always calls in its `finally`.
2566
+ }
2567
+ settleContinuation() {
2568
+ const waiters = this.settleWaiters;
2569
+ if (waiters.length === 0)
2570
+ return;
2571
+ this.settleWaiters = [];
2572
+ for (const waiter of waiters)
2573
+ waiter.resolve();
2574
+ }
2575
+ rejectContinuation(error) {
2576
+ const waiters = this.settleWaiters;
2577
+ if (waiters.length === 0)
2578
+ return;
2579
+ this.settleWaiters = [];
2580
+ for (const waiter of waiters)
2581
+ waiter.reject(error);
2324
2582
  }
2325
2583
  handleModelCallFailure(sdkSession, e) {
2326
2584
  if (this._sdkSession !== sdkSession || this.aborted)
2327
2585
  return;
2328
2586
  if (this.logAgentScopedFailure(e))
2329
2587
  return;
2330
- const data = e.data;
2588
+ // The payload may be the flat SDK shape or the CLI's nested envelope; see
2589
+ // `normalizeModelCallFailure`. Everything below reads the normalized view.
2590
+ const data = normalizeModelCallFailure(e.data);
2331
2591
  const detail = typeof data?.errorMessage === 'string'
2332
2592
  ? data.errorMessage
2333
2593
  : typeof data?.errorCode === 'string'
@@ -2377,6 +2637,7 @@ class SdkSession {
2377
2637
  this.activeCompactionEventId = undefined;
2378
2638
  this.turnSettled = true;
2379
2639
  this.clearTimers();
2640
+ this.rejectContinuation(err);
2380
2641
  try {
2381
2642
  this.writeStderr('error', `[SdkBackend] ${eventType}: ${this.serializeEventDataCompact(eventType, data)}\n`);
2382
2643
  }
@@ -2687,16 +2948,23 @@ class SdkSession {
2687
2948
  inactivityMs,
2688
2949
  lastProgressType: this.lastForwardProgressType,
2689
2950
  };
2690
- if (this.activeToolCalls.size > 0 || this.pendingExternalRequests.size > 0) {
2691
- this.fail(error, 'session.progress_timeout.pending_work', {
2692
- ...data,
2693
- activeToolCalls: this.activeToolCalls.size,
2694
- pendingExternalRequests: this.pendingExternalRequests.size,
2695
- });
2696
- return;
2697
- }
2951
+ // Resolve the policy before the in-flight test: a node that opted into
2952
+ // recovery prefers the warm continuation over failing outright, even with
2953
+ // a tool call outstanding. The resume does not replay that call, so a
2954
+ // genuinely running subagent read is abandoned and re-issued by the model.
2955
+ // For the read-only work recovery is opted into for, that is the right
2956
+ // trade against failing the node; a mutating node opts out of recovery.
2698
2957
  const policy = effectiveSessionRecoveryPolicy(this.config.sessionRecovery);
2958
+ const hasPendingWork = this.activeToolCalls.size > 0 || this.pendingExternalRequests.size > 0;
2699
2959
  if (!policy) {
2960
+ if (hasPendingWork) {
2961
+ this.fail(error, 'session.progress_timeout.pending_work', {
2962
+ ...data,
2963
+ activeToolCalls: this.activeToolCalls.size,
2964
+ pendingExternalRequests: this.pendingExternalRequests.size,
2965
+ });
2966
+ return;
2967
+ }
2700
2968
  this.fail(error, 'session.progress_timeout', data);
2701
2969
  return;
2702
2970
  }