@agent-native/core 0.84.40 → 0.84.41

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,5 +1,11 @@
1
1
  # @agent-native/core
2
2
 
3
+ ## 0.84.41
4
+
5
+ ### Patch Changes
6
+
7
+ - a8548bc: Continue durable background runs when a chunk completes tool calls without final assistant text.
8
+
3
9
  ## 0.84.40
4
10
 
5
11
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.84.40",
3
+ "version": "0.84.41",
4
4
  "description": "Framework for agent-native application development — where AI agents and UI share SQL state, actions, and context",
5
5
  "homepage": "https://github.com/BuilderIO/agent-native#readme",
6
6
  "bugs": {
@@ -4137,34 +4137,94 @@ function isPreparingActionActivityEvent(
4137
4137
  export function lastUnfinishedPreparingActionToolFromEvents(
4138
4138
  events: readonly AgentChatEvent[],
4139
4139
  ): string | undefined {
4140
- let active: {
4140
+ const active = new Map<
4141
+ string,
4142
+ {
4143
+ id?: string;
4144
+ order: number;
4145
+ tool: string;
4146
+ }
4147
+ >();
4148
+ const idlessToolStarts = new Map<string, number>();
4149
+ const removeOldestMatchingActivePreparation = (
4150
+ tool: string,
4151
+ shouldRemove: (value: {
4152
+ id?: string;
4153
+ order: number;
4154
+ tool: string;
4155
+ }) => boolean = () => true,
4156
+ ) => {
4157
+ let oldest:
4158
+ | {
4159
+ key: string;
4160
+ order: number;
4161
+ }
4162
+ | undefined;
4163
+ for (const [key, value] of active) {
4164
+ if (value.tool !== tool || !shouldRemove(value)) continue;
4165
+ if (!oldest || value.order < oldest.order) {
4166
+ oldest = {
4167
+ key,
4168
+ order: value.order,
4169
+ };
4170
+ }
4171
+ }
4172
+ if (oldest) active.delete(oldest.key);
4173
+ return Boolean(oldest);
4174
+ };
4175
+ const removeMatchingActivePreparation = (event: {
4141
4176
  id?: string;
4142
- tool: string;
4143
- } | null = null;
4144
- for (const event of events) {
4177
+ tool?: string;
4178
+ type: "tool_done" | "tool_start";
4179
+ }) => {
4180
+ const id = event.id?.trim();
4181
+ const tool = event.tool?.trim();
4182
+ if (!tool) return;
4183
+ if (id) {
4184
+ if (!active.delete(`id:${id}`)) {
4185
+ removeOldestMatchingActivePreparation(tool, (value) => !value.id);
4186
+ }
4187
+ return;
4188
+ }
4189
+
4190
+ if (event.type === "tool_start") {
4191
+ if (removeOldestMatchingActivePreparation(tool)) {
4192
+ idlessToolStarts.set(tool, (idlessToolStarts.get(tool) ?? 0) + 1);
4193
+ }
4194
+ return;
4195
+ }
4196
+
4197
+ const startedCount = idlessToolStarts.get(tool) ?? 0;
4198
+ if (startedCount > 0) {
4199
+ if (startedCount === 1) {
4200
+ idlessToolStarts.delete(tool);
4201
+ } else {
4202
+ idlessToolStarts.set(tool, startedCount - 1);
4203
+ }
4204
+ return;
4205
+ }
4206
+ removeOldestMatchingActivePreparation(tool);
4207
+ };
4208
+ events.forEach((event, order) => {
4145
4209
  if (isPreparingActionActivityEvent(event)) {
4146
4210
  const tool = event.tool?.trim();
4147
4211
  if (tool) {
4148
- active = {
4212
+ const id = event.id?.trim();
4213
+ const key = id ? `id:${id}` : `tool:${tool}:${order}`;
4214
+ active.set(key, {
4149
4215
  tool,
4150
- ...(event.id?.trim() ? { id: event.id.trim() } : {}),
4151
- };
4216
+ order,
4217
+ ...(id ? { id } : {}),
4218
+ });
4152
4219
  }
4153
- continue;
4220
+ return;
4154
4221
  }
4155
4222
  if (event.type === "tool_start" || event.type === "tool_done") {
4156
- const tool = event.tool?.trim();
4157
- const id = event.id?.trim();
4158
- if (
4159
- active &&
4160
- ((id && active.id === id) || (!id && tool && active.tool === tool))
4161
- ) {
4162
- active = null;
4163
- }
4164
- continue;
4223
+ removeMatchingActivePreparation(event);
4224
+ return;
4165
4225
  }
4166
4226
  if (event.type === "error" && isRecoverableContinuationError(event)) {
4167
- continue;
4227
+ return;
4168
4228
  }
4169
4229
  if (
4170
4230
  event.type === "clear" ||
@@ -4172,10 +4232,46 @@ export function lastUnfinishedPreparingActionToolFromEvents(
4172
4232
  event.type === "error" ||
4173
4233
  event.type === "missing_api_key"
4174
4234
  ) {
4175
- active = null;
4235
+ active.clear();
4236
+ idlessToolStarts.clear();
4237
+ }
4238
+ });
4239
+ let latest:
4240
+ | {
4241
+ order: number;
4242
+ tool: string;
4243
+ }
4244
+ | undefined;
4245
+ for (const value of active.values()) {
4246
+ if (!latest || value.order > latest.order) {
4247
+ latest = value;
4248
+ }
4249
+ }
4250
+ return latest?.tool;
4251
+ }
4252
+
4253
+ function endsAfterCompletedToolWithoutAssistantFinal(run: ActiveRun): boolean {
4254
+ let completedToolAfterLastAssistantText = false;
4255
+ for (const { event } of run.events) {
4256
+ if (event.type === "text" && event.text.trim().length > 0) {
4257
+ completedToolAfterLastAssistantText = false;
4258
+ continue;
4259
+ }
4260
+ if (event.type === "tool_done" && event.isError !== true) {
4261
+ completedToolAfterLastAssistantText = true;
4262
+ continue;
4263
+ }
4264
+ if (
4265
+ event.type === "clear" ||
4266
+ event.type === "error" ||
4267
+ event.type === "missing_api_key" ||
4268
+ event.type === "auto_continue" ||
4269
+ event.type === "loop_limit"
4270
+ ) {
4271
+ completedToolAfterLastAssistantText = false;
4176
4272
  }
4177
4273
  }
4178
- return active?.tool;
4274
+ return completedToolAfterLastAssistantText;
4179
4275
  }
4180
4276
 
4181
4277
  function lastUnfinishedPreparingActionTool(run: ActiveRun): string | undefined {
@@ -4200,9 +4296,19 @@ export function backgroundContinuationReasonForRun(
4200
4296
  new EngineError(last.error, { errorCode: last.errorCode }),
4201
4297
  );
4202
4298
  }
4299
+ if (endsAfterCompletedToolWithoutAssistantFinal(run)) {
4300
+ return "stream_ended";
4301
+ }
4203
4302
  return "run_timeout";
4204
4303
  }
4205
4304
 
4305
+ function endsAtContinuationBoundary(run: ActiveRun): boolean {
4306
+ return (
4307
+ endsAtInternalContinuationBoundary(run) ||
4308
+ endsAfterCompletedToolWithoutAssistantFinal(run)
4309
+ );
4310
+ }
4311
+
4206
4312
  /**
4207
4313
  * Hard cap on server-driven background→background continuation chunks for a
4208
4314
  * single logical turn. A `backgroundFunction` run gets a ~13-min soft timeout,
@@ -4215,9 +4321,8 @@ export const MAX_BACKGROUND_RUN_CONTINUATIONS = 20;
4215
4321
  /**
4216
4322
  * Whether the background worker should self-fire the next server-driven
4217
4323
  * continuation chunk. True only when this is a background worker run that ended
4218
- * at a recoverable soft-timeout boundary (not aborted/stopped) and the chain is
4219
- * still under its budget. Extracted so the decision is unit testable without
4220
- * booting the whole handler.
4324
+ * at a recoverable unfinished boundary (not aborted/stopped) and the chain is
4325
+ * still under its budget. Aborted / user-stopped runs do NOT chain.
4221
4326
  */
4222
4327
  export function shouldChainBackgroundContinuation(opts: {
4223
4328
  isBackgroundWorker: boolean;
@@ -4227,7 +4332,7 @@ export function shouldChainBackgroundContinuation(opts: {
4227
4332
  return (
4228
4333
  opts.isBackgroundWorker &&
4229
4334
  opts.run.status !== "aborted" &&
4230
- endsAtInternalContinuationBoundary(opts.run) &&
4335
+ endsAtContinuationBoundary(opts.run) &&
4231
4336
  opts.continuationCount < MAX_BACKGROUND_RUN_CONTINUATIONS
4232
4337
  );
4233
4338
  }
@@ -5370,13 +5475,19 @@ export function createProductionAgentHandler(
5370
5475
  turnId: effectiveTurnId,
5371
5476
  }
5372
5477
  : null;
5478
+ const willChainBackgroundContinuation = (run: ActiveRun) =>
5479
+ shouldChainBackgroundContinuation({
5480
+ isBackgroundWorker,
5481
+ run,
5482
+ continuationCount: backgroundContinuationCount,
5483
+ });
5373
5484
 
5374
5485
  const completeTrackedProgressRun = async (
5375
5486
  run: ActiveRun,
5376
5487
  completionError?: unknown,
5377
5488
  ) => {
5378
5489
  if (!trackedProgressRunId || !trackedProgressOwner) return;
5379
- if (!completionError && endsAtInternalContinuationBoundary(run)) {
5490
+ if (!completionError && willChainBackgroundContinuation(run)) {
5380
5491
  return;
5381
5492
  }
5382
5493
  const terminalStatus =
@@ -5472,7 +5583,7 @@ export function createProductionAgentHandler(
5472
5583
  if (
5473
5584
  isBackgroundWorker &&
5474
5585
  run.status === "errored" &&
5475
- !endsAtInternalContinuationBoundary(run)
5586
+ !willChainBackgroundContinuation(run)
5476
5587
  ) {
5477
5588
  const errEvent = [...run.events]
5478
5589
  .reverse()
@@ -5501,30 +5612,24 @@ export function createProductionAgentHandler(
5501
5612
  // agent-teams `fireInternalDispatch({ body: { mode: "continue" }})`
5502
5613
  // chain. Bounded by MAX_BACKGROUND_RUN_CONTINUATIONS. Aborted /
5503
5614
  // user-stopped runs do NOT chain.
5504
- if (
5505
- shouldChainBackgroundContinuation({
5506
- // Self-chain server-side for EVERY durable worker, not only the
5507
- // ones inside a `-background` function. Server-driven
5508
- // continuation is the whole point of durable background: the run
5509
- // must survive the client disconnecting (closed tab), so it
5510
- // cannot depend on the browser re-POSTing `auto_continue`. A
5511
- // worker on the regular ~60s function — a Netlify routing miss,
5512
- // or a non-Netlify host (Vercel/Cloudflare/Render/Fly) that
5513
- // never emits a `-background` function checkpoints at the 40s
5514
- // soft-timeout and self-dispatches the next 40s chunk; a worker
5515
- // in a real `-background` function chains ~13-min chunks. Only
5516
- // the per-chunk BUDGET differs by function type (gated by
5517
- // `runsInBackgroundFunction` at the startRun call below); the
5518
- // continuation itself must stay server-driven on both. (The
5519
- // self-chain is only reachable when the initial dispatch already
5520
- // succeeded a dispatch fast-fail degrades to the inline
5521
- // foreground fallback, which is not a worker and rides the
5522
- // connected client's auto_continue instead.)
5523
- isBackgroundWorker,
5524
- run,
5525
- continuationCount: backgroundContinuationCount,
5526
- })
5527
- ) {
5615
+ // Self-chain server-side for EVERY durable worker, not only the
5616
+ // ones inside a `-background` function. Server-driven
5617
+ // continuation is the whole point of durable background: the run
5618
+ // must survive the client disconnecting (closed tab), so it
5619
+ // cannot depend on the browser re-POSTing `auto_continue`. A
5620
+ // worker on the regular ~60s function a Netlify routing miss,
5621
+ // or a non-Netlify host (Vercel/Cloudflare/Render/Fly) that
5622
+ // never emits a `-background` function — checkpoints at the 40s
5623
+ // soft-timeout and self-dispatches the next 40s chunk; a worker
5624
+ // in a real `-background` function chains ~13-min chunks. Only
5625
+ // the per-chunk BUDGET differs by function type (gated by
5626
+ // `runsInBackgroundFunction` at the startRun call below); the
5627
+ // continuation itself must stay server-driven on both. (The
5628
+ // self-chain is only reachable when the initial dispatch already
5629
+ // succeeded a dispatch fast-fail degrades to the inline
5630
+ // foreground fallback, which is not a worker and rides the
5631
+ // connected client's auto_continue instead.)
5632
+ if (willChainBackgroundContinuation(run)) {
5528
5633
  // Mint the next chunk's runId here and sign the dispatch token
5529
5634
  // over it, so the `_process-run` route's HMAC check and the
5530
5635
  // worker's run identity agree. Fresh runId (not this chunk's) so
@@ -473,9 +473,8 @@ export declare const MAX_BACKGROUND_RUN_CONTINUATIONS = 20;
473
473
  /**
474
474
  * Whether the background worker should self-fire the next server-driven
475
475
  * continuation chunk. True only when this is a background worker run that ended
476
- * at a recoverable soft-timeout boundary (not aborted/stopped) and the chain is
477
- * still under its budget. Extracted so the decision is unit testable without
478
- * booting the whole handler.
476
+ * at a recoverable unfinished boundary (not aborted/stopped) and the chain is
477
+ * still under its budget. Aborted / user-stopped runs do NOT chain.
479
478
  */
480
479
  export declare function shouldChainBackgroundContinuation(opts: {
481
480
  isBackgroundWorker: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"production-agent.d.ts","sourceRoot":"","sources":["../../src/agent/production-agent.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,IAAI,cAAc,EAAE,MAAM,IAAI,CAAC;AAkCzD,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,+BAA+B,CAAC;AA8BvC,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAMhE,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,aAAa,EACb,iBAAiB,EAGlB,MAAM,mBAAmB,CAAC;AAgB3B,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,iBAAiB,CAAC;AAC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,MAAM,CAAC;IAC1B,wBAAwB,EAAE,OAAO,CAAC;IAClC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,IAAI,CAAC,EAAE;QACL,mBAAmB,CAAC,EAAE,OAAO,mBAAmB,CAAC;QACjD,SAAS,CAAC,EAAE,OAAO,SAAS,CAAC;QAC7B,kBAAkB,CAAC,EAAE,OAAO,kBAAkB,CAAC;QAC/C,kBAAkB,CAAC,EAAE,OAAO,kBAAkB,CAAC;KAChD,CAAC;CACH,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CA2CnE;AA+BD,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,sBAAsB,GAC9B,cAAc,CAwwDhB;AAED,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,MAAM,EACN,QAAQ,EACR,cAAc,GACf,CAAC"}
@@ -3135,38 +3135,110 @@ function isPreparingActionActivityEvent(event) {
3135
3135
  return label.startsWith("preparing ") && label.includes(" action");
3136
3136
  }
3137
3137
  export function lastUnfinishedPreparingActionToolFromEvents(events) {
3138
- let active = null;
3139
- for (const event of events) {
3138
+ const active = new Map();
3139
+ const idlessToolStarts = new Map();
3140
+ const removeOldestMatchingActivePreparation = (tool, shouldRemove = () => true) => {
3141
+ let oldest;
3142
+ for (const [key, value] of active) {
3143
+ if (value.tool !== tool || !shouldRemove(value))
3144
+ continue;
3145
+ if (!oldest || value.order < oldest.order) {
3146
+ oldest = {
3147
+ key,
3148
+ order: value.order,
3149
+ };
3150
+ }
3151
+ }
3152
+ if (oldest)
3153
+ active.delete(oldest.key);
3154
+ return Boolean(oldest);
3155
+ };
3156
+ const removeMatchingActivePreparation = (event) => {
3157
+ const id = event.id?.trim();
3158
+ const tool = event.tool?.trim();
3159
+ if (!tool)
3160
+ return;
3161
+ if (id) {
3162
+ if (!active.delete(`id:${id}`)) {
3163
+ removeOldestMatchingActivePreparation(tool, (value) => !value.id);
3164
+ }
3165
+ return;
3166
+ }
3167
+ if (event.type === "tool_start") {
3168
+ if (removeOldestMatchingActivePreparation(tool)) {
3169
+ idlessToolStarts.set(tool, (idlessToolStarts.get(tool) ?? 0) + 1);
3170
+ }
3171
+ return;
3172
+ }
3173
+ const startedCount = idlessToolStarts.get(tool) ?? 0;
3174
+ if (startedCount > 0) {
3175
+ if (startedCount === 1) {
3176
+ idlessToolStarts.delete(tool);
3177
+ }
3178
+ else {
3179
+ idlessToolStarts.set(tool, startedCount - 1);
3180
+ }
3181
+ return;
3182
+ }
3183
+ removeOldestMatchingActivePreparation(tool);
3184
+ };
3185
+ events.forEach((event, order) => {
3140
3186
  if (isPreparingActionActivityEvent(event)) {
3141
3187
  const tool = event.tool?.trim();
3142
3188
  if (tool) {
3143
- active = {
3189
+ const id = event.id?.trim();
3190
+ const key = id ? `id:${id}` : `tool:${tool}:${order}`;
3191
+ active.set(key, {
3144
3192
  tool,
3145
- ...(event.id?.trim() ? { id: event.id.trim() } : {}),
3146
- };
3193
+ order,
3194
+ ...(id ? { id } : {}),
3195
+ });
3147
3196
  }
3148
- continue;
3197
+ return;
3149
3198
  }
3150
3199
  if (event.type === "tool_start" || event.type === "tool_done") {
3151
- const tool = event.tool?.trim();
3152
- const id = event.id?.trim();
3153
- if (active &&
3154
- ((id && active.id === id) || (!id && tool && active.tool === tool))) {
3155
- active = null;
3156
- }
3157
- continue;
3200
+ removeMatchingActivePreparation(event);
3201
+ return;
3158
3202
  }
3159
3203
  if (event.type === "error" && isRecoverableContinuationError(event)) {
3160
- continue;
3204
+ return;
3161
3205
  }
3162
3206
  if (event.type === "clear" ||
3163
3207
  event.type === "done" ||
3164
3208
  event.type === "error" ||
3165
3209
  event.type === "missing_api_key") {
3166
- active = null;
3210
+ active.clear();
3211
+ idlessToolStarts.clear();
3212
+ }
3213
+ });
3214
+ let latest;
3215
+ for (const value of active.values()) {
3216
+ if (!latest || value.order > latest.order) {
3217
+ latest = value;
3167
3218
  }
3168
3219
  }
3169
- return active?.tool;
3220
+ return latest?.tool;
3221
+ }
3222
+ function endsAfterCompletedToolWithoutAssistantFinal(run) {
3223
+ let completedToolAfterLastAssistantText = false;
3224
+ for (const { event } of run.events) {
3225
+ if (event.type === "text" && event.text.trim().length > 0) {
3226
+ completedToolAfterLastAssistantText = false;
3227
+ continue;
3228
+ }
3229
+ if (event.type === "tool_done" && event.isError !== true) {
3230
+ completedToolAfterLastAssistantText = true;
3231
+ continue;
3232
+ }
3233
+ if (event.type === "clear" ||
3234
+ event.type === "error" ||
3235
+ event.type === "missing_api_key" ||
3236
+ event.type === "auto_continue" ||
3237
+ event.type === "loop_limit") {
3238
+ completedToolAfterLastAssistantText = false;
3239
+ }
3240
+ }
3241
+ return completedToolAfterLastAssistantText;
3170
3242
  }
3171
3243
  function lastUnfinishedPreparingActionTool(run) {
3172
3244
  return lastUnfinishedPreparingActionToolFromEvents(run.events.map(({ event }) => event));
@@ -3182,8 +3254,15 @@ export function backgroundContinuationReasonForRun(run) {
3182
3254
  if (last?.type === "error" && isRecoverableContinuationError(last)) {
3183
3255
  return continuationReasonForResumableError(new EngineError(last.error, { errorCode: last.errorCode }));
3184
3256
  }
3257
+ if (endsAfterCompletedToolWithoutAssistantFinal(run)) {
3258
+ return "stream_ended";
3259
+ }
3185
3260
  return "run_timeout";
3186
3261
  }
3262
+ function endsAtContinuationBoundary(run) {
3263
+ return (endsAtInternalContinuationBoundary(run) ||
3264
+ endsAfterCompletedToolWithoutAssistantFinal(run));
3265
+ }
3187
3266
  /**
3188
3267
  * Hard cap on server-driven background→background continuation chunks for a
3189
3268
  * single logical turn. A `backgroundFunction` run gets a ~13-min soft timeout,
@@ -3195,14 +3274,13 @@ export const MAX_BACKGROUND_RUN_CONTINUATIONS = 20;
3195
3274
  /**
3196
3275
  * Whether the background worker should self-fire the next server-driven
3197
3276
  * continuation chunk. True only when this is a background worker run that ended
3198
- * at a recoverable soft-timeout boundary (not aborted/stopped) and the chain is
3199
- * still under its budget. Extracted so the decision is unit testable without
3200
- * booting the whole handler.
3277
+ * at a recoverable unfinished boundary (not aborted/stopped) and the chain is
3278
+ * still under its budget. Aborted / user-stopped runs do NOT chain.
3201
3279
  */
3202
3280
  export function shouldChainBackgroundContinuation(opts) {
3203
3281
  return (opts.isBackgroundWorker &&
3204
3282
  opts.run.status !== "aborted" &&
3205
- endsAtInternalContinuationBoundary(opts.run) &&
3283
+ endsAtContinuationBoundary(opts.run) &&
3206
3284
  opts.continuationCount < MAX_BACKGROUND_RUN_CONTINUATIONS);
3207
3285
  }
3208
3286
  export async function claimBackgroundWorkerRunEarly(opts) {
@@ -4122,10 +4200,15 @@ export function createProductionAgentHandler(options) {
4122
4200
  turnId: effectiveTurnId,
4123
4201
  }
4124
4202
  : null;
4203
+ const willChainBackgroundContinuation = (run) => shouldChainBackgroundContinuation({
4204
+ isBackgroundWorker,
4205
+ run,
4206
+ continuationCount: backgroundContinuationCount,
4207
+ });
4125
4208
  const completeTrackedProgressRun = async (run, completionError) => {
4126
4209
  if (!trackedProgressRunId || !trackedProgressOwner)
4127
4210
  return;
4128
- if (!completionError && endsAtInternalContinuationBoundary(run)) {
4211
+ if (!completionError && willChainBackgroundContinuation(run)) {
4129
4212
  return;
4130
4213
  }
4131
4214
  const terminalStatus = run.status === "aborted"
@@ -4210,7 +4293,7 @@ export function createProductionAgentHandler(options) {
4210
4293
  // below, they did not "throw").
4211
4294
  if (isBackgroundWorker &&
4212
4295
  run.status === "errored" &&
4213
- !endsAtInternalContinuationBoundary(run)) {
4296
+ !willChainBackgroundContinuation(run)) {
4214
4297
  const errEvent = [...run.events]
4215
4298
  .reverse()
4216
4299
  .find((e) => e.event.type === "error")?.event;
@@ -4231,28 +4314,24 @@ export function createProductionAgentHandler(options) {
4231
4314
  // agent-teams `fireInternalDispatch({ body: { mode: "continue" }})`
4232
4315
  // chain. Bounded by MAX_BACKGROUND_RUN_CONTINUATIONS. Aborted /
4233
4316
  // user-stopped runs do NOT chain.
4234
- if (shouldChainBackgroundContinuation({
4235
- // Self-chain server-side for EVERY durable worker, not only the
4236
- // ones inside a `-background` function. Server-driven
4237
- // continuation is the whole point of durable background: the run
4238
- // must survive the client disconnecting (closed tab), so it
4239
- // cannot depend on the browser re-POSTing `auto_continue`. A
4240
- // worker on the regular ~60s function — a Netlify routing miss,
4241
- // or a non-Netlify host (Vercel/Cloudflare/Render/Fly) that
4242
- // never emits a `-background` function checkpoints at the 40s
4243
- // soft-timeout and self-dispatches the next 40s chunk; a worker
4244
- // in a real `-background` function chains ~13-min chunks. Only
4245
- // the per-chunk BUDGET differs by function type (gated by
4246
- // `runsInBackgroundFunction` at the startRun call below); the
4247
- // continuation itself must stay server-driven on both. (The
4248
- // self-chain is only reachable when the initial dispatch already
4249
- // succeeded a dispatch fast-fail degrades to the inline
4250
- // foreground fallback, which is not a worker and rides the
4251
- // connected client's auto_continue instead.)
4252
- isBackgroundWorker,
4253
- run,
4254
- continuationCount: backgroundContinuationCount,
4255
- })) {
4317
+ // Self-chain server-side for EVERY durable worker, not only the
4318
+ // ones inside a `-background` function. Server-driven
4319
+ // continuation is the whole point of durable background: the run
4320
+ // must survive the client disconnecting (closed tab), so it
4321
+ // cannot depend on the browser re-POSTing `auto_continue`. A
4322
+ // worker on the regular ~60s function — a Netlify routing miss,
4323
+ // or a non-Netlify host (Vercel/Cloudflare/Render/Fly) that
4324
+ // never emits a `-background` function checkpoints at the 40s
4325
+ // soft-timeout and self-dispatches the next 40s chunk; a worker
4326
+ // in a real `-background` function chains ~13-min chunks. Only
4327
+ // the per-chunk BUDGET differs by function type (gated by
4328
+ // `runsInBackgroundFunction` at the startRun call below); the
4329
+ // continuation itself must stay server-driven on both. (The
4330
+ // self-chain is only reachable when the initial dispatch already
4331
+ // succeeded a dispatch fast-fail degrades to the inline
4332
+ // foreground fallback, which is not a worker and rides the
4333
+ // connected client's auto_continue instead.)
4334
+ if (willChainBackgroundContinuation(run)) {
4256
4335
  // Mint the next chunk's runId here and sign the dispatch token
4257
4336
  // over it, so the `_process-run` route's HMAC check and the
4258
4337
  // worker's run identity agree. Fresh runId (not this chunk's) so