@defrex/autobuild 1.17.0 → 1.19.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.
Files changed (65) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +85 -11
  3. package/docs/architecture.md +57 -11
  4. package/docs/configuration.md +11 -3
  5. package/docs/dispatcher-hosting.md +5 -3
  6. package/docs/operator-api.md +14 -1
  7. package/docs/plugin-authoring.md +29 -1
  8. package/docs/remote-ticket-protocol.md +34 -1
  9. package/docs/restacking.md +5 -0
  10. package/docs/setup.md +9 -3
  11. package/docs/ticket-sources.md +28 -1
  12. package/docs/troubleshooting.md +15 -0
  13. package/docs/workspaces.md +1 -1
  14. package/package.json +4 -4
  15. package/packages/core/src/cli/dashboard/refresh.ts +8 -0
  16. package/packages/core/src/cli/dispatch.ts +2 -0
  17. package/packages/core/src/config/schema.ts +2 -1
  18. package/packages/core/src/events/catalog-identity.ts +3 -1
  19. package/packages/core/src/events/payloads.ts +7 -1
  20. package/packages/core/src/events/repository.ts +37 -1
  21. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/d41044cb2e54809c.json +194 -0
  22. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/e012e9e8f3e82935.json +424 -0
  23. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/e0f89f52e48cbf62.json +197 -0
  24. package/packages/core/src/kernel/janitor-failure.ts +1 -0
  25. package/packages/core/src/kernel/reducer-revisions.ts +9 -0
  26. package/packages/core/src/kernel/reducer.ts +6 -0
  27. package/packages/core/src/kernel/repository-read-facts.ts +9 -2
  28. package/packages/core/src/kernel/session-settlement.ts +82 -0
  29. package/packages/core/src/kernel/ticket-preparation.ts +10 -0
  30. package/packages/core/src/operator/registry.ts +64 -9
  31. package/packages/core/src/operator/tickets.ts +139 -25
  32. package/packages/core/src/plugin-sdk/index.ts +4 -0
  33. package/packages/core/src/plugins/manifest.ts +1 -1
  34. package/packages/core/src/ports/tickets/completion.ts +71 -0
  35. package/packages/core/src/ports/tickets/contract.ts +73 -0
  36. package/packages/core/src/ports/tickets/github-fake.ts +8 -0
  37. package/packages/core/src/ports/tickets/github-issues.ts +1 -0
  38. package/packages/core/src/ports/tickets/github.ts +18 -6
  39. package/packages/core/src/ports/tickets/hosted-index.ts +8 -0
  40. package/packages/core/src/ports/tickets/linear.ts +18 -2
  41. package/packages/core/src/ports/tickets/remote-protocol.ts +37 -8
  42. package/packages/core/src/ports/tickets/remote.ts +41 -3
  43. package/packages/core/src/ports/tickets/tree.ts +11 -1
  44. package/packages/core/src/ports/types.ts +32 -4
  45. package/packages/core/src/ports/workspace/vercel-sandbox.ts +78 -25
  46. package/packages/core/src/processes/build-runner.ts +100 -29
  47. package/packages/core/src/processes/dispatcher.ts +1016 -279
  48. package/packages/core/src/processes/execution-settlement.ts +30 -0
  49. package/packages/core/src/processes/pass-stages.ts +32 -6
  50. package/packages/core/src/store/reducer-value-shapes.json +8440 -8346
  51. package/packages/core/src/store/remote/released-clients.json +22 -0
  52. package/packages/core/src/store/remote/released-reducer-values/1.18.0.json +36436 -0
  53. package/packages/core/src/store/remote/released-reducer-values/1.19.0.json +36461 -0
  54. package/packages/core/src/store/remote/released-reducer-values/index.ts +20 -16
  55. package/packages/core/src/testing/dispatch-read-budget.ts +143 -16
  56. package/packages/core/src/testing/index.ts +2 -0
  57. package/packages/core/src/testing/reduced-read-budget.ts +234 -2
  58. package/skills/guide/SKILL.md +45 -15
  59. package/skills/guide/references/operator-api.md +14 -1
  60. package/skills/guide/references/plugin-authoring.md +29 -1
  61. package/skills/guide/references/remote-ticket-protocol.md +34 -1
  62. package/skills/guide/references/restacking.md +5 -0
  63. package/skills/guide/references/setup.md +9 -3
  64. package/skills/operate/SKILL.md +18 -1
  65. package/templates/hosted-service/package.json +2 -2
@@ -1124,18 +1124,30 @@ function redactRuntimeError(error: unknown, env: Record<string, string>): string
1124
1124
  * callers decide which names a guest may see — the build and harvest paths
1125
1125
  * forward `[workspace.config].environmentVariables`, while the operator
1126
1126
  * sandbox passes its credential-free forwarded set only (build-workspace
1127
- * variables never enter a sandbox). */
1127
+ * variables never enter a sandbox).
1128
+ *
1129
+ * `mode` selects the chain. `'install'` provisions a fresh workspace: every
1130
+ * group installs, then preflights. `'repair'` relaunches into an existing
1131
+ * workspace: every group preflights, and a group whose preflight fails installs
1132
+ * in place and preflights again, so a runtime a role change newly selected (or
1133
+ * a changed pin) reaches the workspace at its next launch. Only a failure after
1134
+ * that install fails a repair; a passing preflight is never reinstalled. */
1128
1135
  async function bootstrapRuntimes(
1129
1136
  sandbox: VercelSandboxHandle,
1130
1137
  config: VercelSandboxConfig,
1131
1138
  env: Record<string, string>,
1132
1139
  references: readonly RuntimeReferenceGroup[],
1133
- install: boolean,
1140
+ mode: 'install' | 'repair',
1134
1141
  signal?: AbortSignal,
1135
1142
  opts: {
1136
1143
  /** Bound for each install and preflight; its stage label is replaced by
1137
- * `runtime bootstrap <runtime> <install|preflight>`. */
1144
+ * `runtime bootstrap <runtime> <install|preflight>`. In `'repair'` mode it
1145
+ * bounds only the first preflight. */
1138
1146
  bound?: CommandBound
1147
+ /** Bound for the install and second preflight a `'repair'` runs after a
1148
+ * failed preflight; its stage label is replaced by
1149
+ * `runtime repair <runtime> <install|preflight>`. */
1150
+ repairBound?: CommandBound
1139
1151
  /** Reports `<runtime> install` / `<runtime> preflight` before each. */
1140
1152
  onStage?: (step: string) => void
1141
1153
  } = {},
@@ -1149,26 +1161,55 @@ async function bootstrapRuntimes(
1149
1161
  `runtime ${displayName(group.runtime)} selected by ${group.references.join(', ')} has no provisioning; add [workspace.config.runtimeProvisioning.${tomlKey(group.runtime)}] with install and preflight commands`,
1150
1162
  )
1151
1163
  }
1152
- for (const stage of install ? (['install', 'preflight'] as const) : (['preflight'] as const)) {
1164
+ const selectedBy = group.references.join(', ')
1165
+ const run = async (
1166
+ stage: 'install' | 'preflight',
1167
+ bound: CommandBound | undefined,
1168
+ label: string,
1169
+ ): Promise<void> => {
1153
1170
  const step = `${group.runtime} ${stage}`
1154
1171
  opts.onStage?.(step)
1155
- try {
1156
- await readableCommand(sandbox, {
1157
- cmd: 'sh',
1158
- args: ['-c', provisioning[stage]],
1159
- cwd: VERCEL_WORKSPACE_PATH,
1160
- env,
1161
- ...(signal === undefined ? {} : { signal }),
1162
- ...(opts.bound === undefined
1163
- ? {}
1164
- : { ...opts.bound, stage: `runtime bootstrap ${step}` }),
1165
- })
1166
- } catch (error) {
1167
- if (signal?.aborted) throw error
1168
- throw new Error(
1169
- `runtime ${displayName(group.runtime)} ${stage} failed (selected by ${group.references.join(', ')}); fix workspace.config.runtimeProvisioning.${group.runtime}.${stage}: ${redactRuntimeError(error, env)}`,
1170
- )
1172
+ await readableCommand(sandbox, {
1173
+ cmd: 'sh',
1174
+ args: ['-c', provisioning[stage]],
1175
+ cwd: VERCEL_WORKSPACE_PATH,
1176
+ env,
1177
+ ...(signal === undefined ? {} : { signal }),
1178
+ ...(bound === undefined ? {} : { ...bound, stage: `${label} ${step}` }),
1179
+ })
1180
+ }
1181
+ const failure = (stage: 'install' | 'preflight', qualifier: string, error: unknown): Error =>
1182
+ new Error(
1183
+ `runtime ${displayName(group.runtime)} ${stage} failed${qualifier} (selected by ${selectedBy}); fix workspace.config.runtimeProvisioning.${group.runtime}.${stage}: ${redactRuntimeError(error, env)}`,
1184
+ )
1185
+ if (mode === 'install') {
1186
+ for (const stage of ['install', 'preflight'] as const) {
1187
+ try {
1188
+ await run(stage, opts.bound, 'runtime bootstrap')
1189
+ } catch (error) {
1190
+ if (signal?.aborted) throw error
1191
+ throw failure(stage, '', error)
1192
+ }
1171
1193
  }
1194
+ continue
1195
+ }
1196
+ try {
1197
+ await run('preflight', opts.bound, 'runtime bootstrap')
1198
+ continue
1199
+ } catch (error) {
1200
+ if (signal?.aborted) throw error
1201
+ }
1202
+ try {
1203
+ await run('install', opts.repairBound, 'runtime repair')
1204
+ } catch (error) {
1205
+ if (signal?.aborted) throw error
1206
+ throw failure('install', ' after its preflight failed in an existing workspace', error)
1207
+ }
1208
+ try {
1209
+ await run('preflight', opts.repairBound, 'runtime repair')
1210
+ } catch (error) {
1211
+ if (signal?.aborted) throw error
1212
+ throw failure('preflight', ' after install', error)
1172
1213
  }
1173
1214
  }
1174
1215
  }
@@ -1575,7 +1616,7 @@ export async function validateVercelSandbox(
1575
1616
  options.env,
1576
1617
  ),
1577
1618
  options.runtimeReferences ?? [],
1578
- true,
1619
+ 'install',
1579
1620
  options.signal,
1580
1621
  )
1581
1622
  const setup = await readableCommand(
@@ -2822,7 +2863,7 @@ export class VercelSandboxProvider implements WorkspaceProvider {
2822
2863
  this.options.config,
2823
2864
  { ...this.guestEnvironment(), AB_TOKEN: scopedToken },
2824
2865
  references,
2825
- true,
2866
+ 'install',
2826
2867
  invocation,
2827
2868
  {
2828
2869
  bound: commandBound(timeouts, timeouts.runtime),
@@ -3258,12 +3299,19 @@ export class VercelSandboxProvider implements WorkspaceProvider {
3258
3299
  )
3259
3300
  }
3260
3301
  }
3302
+ // Every selected runtime preflights before the runner starts. A runtime
3303
+ // whose preflight fails — one a role change newly selected, or a changed
3304
+ // pin — is installed in place and preflighted again, so the change reaches
3305
+ // this existing workspace now instead of failing every relaunch.
3306
+ const repairTimeouts = resolveProvisioningTimeouts(this.options.provisioningTimeouts)
3261
3307
  await bootstrapRuntimes(
3262
3308
  sandbox,
3263
3309
  this.options.config,
3264
3310
  { ...this.guestEnvironment(), AB_TOKEN: scopedToken },
3265
3311
  currentRuntimeReferences(this.options.runtimeReferences),
3266
- false,
3312
+ 'repair',
3313
+ undefined,
3314
+ { repairBound: commandBound(repairTimeouts, repairTimeouts.runtime) },
3267
3315
  )
3268
3316
  this.sessions.set(ref, sandbox)
3269
3317
  const env: Record<string, string> = {
@@ -3534,7 +3582,7 @@ export class VercelSandboxProvider implements WorkspaceProvider {
3534
3582
  this.options.config,
3535
3583
  { ...this.guestEnvironment(), AB_TOKEN: scopedToken },
3536
3584
  currentRuntimeReferences(this.options.runtimeReferences),
3537
- true,
3585
+ 'install',
3538
3586
  )
3539
3587
  await commandOrThrow(sandbox, {
3540
3588
  cmd: 'touch',
@@ -3580,12 +3628,17 @@ export class VercelSandboxProvider implements WorkspaceProvider {
3580
3628
  }
3581
3629
  throw error
3582
3630
  }
3631
+ // A reused harvest sandbox installs a newly selected runtime in place,
3632
+ // exactly as a build relaunch does.
3633
+ const repairTimeouts = resolveProvisioningTimeouts(this.options.provisioningTimeouts)
3583
3634
  await bootstrapRuntimes(
3584
3635
  sandbox,
3585
3636
  this.options.config,
3586
3637
  { ...this.guestEnvironment(), AB_TOKEN: scopedToken },
3587
3638
  currentRuntimeReferences(this.options.runtimeReferences),
3588
- false,
3639
+ 'repair',
3640
+ undefined,
3641
+ { repairBound: commandBound(repairTimeouts, repairTimeouts.runtime) },
3589
3642
  )
3590
3643
  this.sessions.set(name, sandbox)
3591
3644
  const sessionId = sandbox.currentSession?.().sessionId
@@ -41,6 +41,7 @@ import { resumeAgent } from '../ports/runner/native-session'
41
41
  import type { AgentStartOpts, StartPromptOpts } from '../ports/types'
42
42
  import { readTerminalGuardBoundary } from '../store/reduced-reads'
43
43
  import type { OpenSession } from '../kernel/reducer'
44
+ import { recoveryMatches } from '../kernel/session-settlement'
44
45
  import { nativeSessionHandleSchema } from '../ports/runner/native-session'
45
46
  import type { NativeSessionObserver } from '../ports/types'
46
47
  import { suspendNativeLanding } from '../kernel/landing-publication'
@@ -604,18 +605,15 @@ function isPublicationBoundary(event: AbEvent, spec: SessionSpec, session: strin
604
605
  return false
605
606
  }
606
607
 
607
- function recoveryMatches(decision: Decision, session: OpenSession): boolean {
608
- if (decision.kind === 'run-verify-stage')
609
- return decision.members.some((member) =>
610
- recoveryMatches(member.kind === 'evaluate-verify' ? member.action : member, session),
611
- )
612
- return decision.kind === 'run-phase'
613
- ? session.phase === decision.phase && session.round === decision.round
614
- : decision.kind === 'run-agent-verify'
615
- ? session.phase === verifyPhase(decision.step) && session.round === decision.attempt
616
- : decision.kind === 'run-finalize-step'
617
- ? session.phase === 'finalize' && session.role === decision.step
618
- : false
608
+ /** The continuation cause a recovering runner records for `session`. A
609
+ * session the dispatcher suspended after its execution ended was lost with
610
+ * its runner, so it resumes as a runner loss, as it would have while open. */
611
+ function recoveryCauseOf(
612
+ session: OpenSession,
613
+ suspended: boolean,
614
+ ): 'shutdown' | 'pause' | 'runner-loss' {
615
+ if (!suspended || session.suspendedExecution !== undefined) return 'runner-loss'
616
+ return session.suspensionCause ?? 'shutdown'
619
617
  }
620
618
 
621
619
  /** One judge panel run's inputs (SPEC §13.1.1). */
@@ -762,9 +760,10 @@ export class BuildRunner {
762
760
  continuation: {
763
761
  ...write.payload.continuation!,
764
762
  handle: current.nativeHandle,
765
- cause:
766
- current.suspensionCause ??
767
- (current.suspendedActiveMs !== undefined ? 'shutdown' : 'runner-loss'),
763
+ cause: recoveryCauseOf(
764
+ current,
765
+ current.suspensionCause !== undefined || current.suspendedActiveMs !== undefined,
766
+ ),
768
767
  activeMs:
769
768
  (current.continuation?.activeMs ?? 0) +
770
769
  (current.suspendedActiveMs ??
@@ -1218,17 +1217,17 @@ export class BuildRunner {
1218
1217
  else {
1219
1218
  this.recoveryBoundaryMs = this.deps.clock().getTime()
1220
1219
  retained.add(candidate.session)
1220
+ const cause = recoveryCauseOf(
1221
+ candidate,
1222
+ state.sessions.suspended.some((s) => s.session === candidate.session),
1223
+ )
1221
1224
  if (decision.kind === 'run-verify-stage')
1222
1225
  this.stageRecoveries.set(verifyMemberKey(candidate.phase!.slice(7), candidate.round!), {
1223
1226
  session: candidate,
1224
- cause: state.sessions.suspended.some((s) => s.session === candidate.session)
1225
- ? (candidate.suspensionCause ?? 'shutdown')
1226
- : 'runner-loss',
1227
+ cause,
1227
1228
  })
1228
1229
  else this.recovery = candidate
1229
- this.recoveryCause = state.sessions.suspended.some((s) => s.session === candidate.session)
1230
- ? (candidate.suspensionCause ?? 'shutdown')
1231
- : 'runner-loss'
1230
+ this.recoveryCause = cause
1232
1231
  }
1233
1232
  }
1234
1233
  for (const session of [...state.sessions.open, ...state.sessions.suspended]) {
@@ -3408,6 +3407,38 @@ export class BuildRunner {
3408
3407
  }
3409
3408
  }
3410
3409
 
3410
+ /** Close the bracket of an occurrence whose outcome is already durable when
3411
+ * no transcript can be deposited: `reclaimed` by this runner, never a
3412
+ * fabricated transcript. The stream closes first. Best effort: whatever an
3413
+ * ended execution still leaves open, the dispatcher settles. */
3414
+ private async endFinishedBracket(
3415
+ session: string,
3416
+ stream?: SessionBracketStream,
3417
+ outcome: StreamOutcome = 'completed',
3418
+ ): Promise<void> {
3419
+ const { store, slug } = this.deps
3420
+ try {
3421
+ await stream?.sink.close(outcome)
3422
+ for (;;) {
3423
+ const facts = await readBuildFacts(store, slug)
3424
+ const { state } = facts.value
3425
+ if (!state.sessions.open.some((open) => open.session === session)) return
3426
+ const ended = await store.appendIfCurrent(slug, facts.cursor, {
3427
+ actor: KERNEL,
3428
+ type: 'session.ended',
3429
+ payload: {
3430
+ session,
3431
+ outcome: 'reclaimed',
3432
+ reclaimedBy: { instance: this.deps.instance, resumedFromSeq: state.lastSeq },
3433
+ },
3434
+ })
3435
+ if (ended) return
3436
+ }
3437
+ } catch {
3438
+ // The durable terminal remains authoritative over bracket cleanup.
3439
+ }
3440
+ }
3441
+
3411
3442
  /** Handles live only here; every scheduling and barrier decision is read
3412
3443
  * from durable facts. A child runner isolates each occurrence's recovery,
3413
3444
  * provider fallback, stream and retry state without another workspace. */
@@ -3554,6 +3585,22 @@ export class BuildRunner {
3554
3585
  entry.runner.closeBracketStream(stream, 'aborted')
3555
3586
  await entry.runner.closeProducerSessions()
3556
3587
  }
3588
+ // A member whose step has its outcome is finished, so its bracket must
3589
+ // not outlive the stage: the next stage or finalize starts only after
3590
+ // it ends. Under parent shutdown, suspension settles each bracket.
3591
+ // Best effort: a failed read must not mask the stage's own error.
3592
+ if (!this.deps.shutdownSignal?.aborted)
3593
+ try {
3594
+ const { state } = (await readBuildFacts(store, slug)).value
3595
+ for (const open of state.sessions.open) {
3596
+ if (!open.phase.startsWith('verify:') || open.round === undefined) continue
3597
+ const key = verifyMemberKey(open.phase.slice(7), open.round)
3598
+ if (inFlight.get(key)?.done && state.verifyStage.outcomes[key] !== undefined)
3599
+ await this.endFinishedBracket(open.session)
3600
+ }
3601
+ } catch {
3602
+ // The dispatcher settles what an ended execution leaves open.
3603
+ }
3557
3604
  }
3558
3605
  }
3559
3606
 
@@ -5390,13 +5437,29 @@ export class BuildRunner {
5390
5437
  activeMs: number,
5391
5438
  cause: 'shutdown' | 'pause',
5392
5439
  ): Promise<void> {
5440
+ const { store, slug } = this.deps
5441
+ const session = started.payload.session
5442
+ const postStep = started.payload.phase === 'finalize' && started.payload.role !== 'finalize'
5393
5443
  if (
5394
5444
  cause === 'shutdown' &&
5395
5445
  (this.deps.workspaceProvider !== 'git-worktree' || this.deps.workspaceRemote === true)
5396
- )
5446
+ ) {
5447
+ // Nothing here can resume natively. An occurrence whose outcome is
5448
+ // already durable still closes its bracket; an unfinished one stays open
5449
+ // for the dispatcher to settle once the execution ends.
5450
+ const guard = await readTerminalGuardBoundary(
5451
+ store,
5452
+ slug,
5453
+ started.payload.phase,
5454
+ started.payload.round ?? 1,
5455
+ session,
5456
+ )
5457
+ const finished = postStep
5458
+ ? (await readBuildFacts(store, slug)).value.log.finalizeStepsDone.has(started.payload.role)
5459
+ : guard.value.diagnostic !== undefined
5460
+ if (finished) await this.endFinishedBracket(session, this.bracketStreams.get(session))
5397
5461
  return
5398
- const { store, slug } = this.deps
5399
- const session = started.payload.session
5462
+ }
5400
5463
  const state = (await readBuildFacts(store, slug)).value.state
5401
5464
  const native = state.sessions.open.find((s) => s.session === session)?.nativeHandle
5402
5465
  const producer = [...this.producerSessions.entries()].find(
@@ -5437,7 +5500,6 @@ export class BuildRunner {
5437
5500
  )
5438
5501
  const facts = await readBuildFacts(store, slug)
5439
5502
  if (facts.cursor !== guard.cursor) continue
5440
- const postStep = started.payload.phase === 'finalize' && started.payload.role !== 'finalize'
5441
5503
  if (
5442
5504
  postStep
5443
5505
  ? facts.value.log.finalizeStepsDone.has(started.payload.role)
@@ -5456,6 +5518,7 @@ export class BuildRunner {
5456
5518
  usage,
5457
5519
  started.payload.model,
5458
5520
  )
5521
+ else await this.endFinishedBracket(session)
5459
5522
  return
5460
5523
  }
5461
5524
  if (!facts.value.state.sessions.open.some((s) => s.session === session)) return
@@ -5779,8 +5842,10 @@ export class BuildRunner {
5779
5842
  if (spec.producerPhase !== undefined) this.producerSessions.delete(spec.producerPhase)
5780
5843
  }
5781
5844
  } catch (error) {
5845
+ // The durable terminal remains authoritative over optional cleanup;
5846
+ // the finished occurrence's bracket still closes.
5847
+ await this.endFinishedBracket(session, streamBracket)
5782
5848
  if (!(error instanceof StoreWriteTooLargeError)) throw error
5783
- // The durable terminal remains authoritative over optional cleanup.
5784
5849
  }
5785
5850
  return
5786
5851
  }
@@ -5804,7 +5869,9 @@ export class BuildRunner {
5804
5869
  // and best-effort transcript cleanup.
5805
5870
  }
5806
5871
  }
5807
- this.closeBracketStream(streamBracket, 'completed')
5872
+ // A terminal with no endable handle or transcript still finishes the
5873
+ // occurrence: close its bracket rather than leave it open.
5874
+ await this.endFinishedBracket(session, streamBracket)
5808
5875
  if (spec.producerPhase !== undefined) this.producerSessions.delete(spec.producerPhase)
5809
5876
  return
5810
5877
  }
@@ -6108,8 +6175,10 @@ export class BuildRunner {
6108
6175
  )
6109
6176
  }
6110
6177
  } catch (error) {
6178
+ // The durable terminal remains authoritative over optional cleanup;
6179
+ // the finished occurrence's bracket still closes.
6180
+ await this.endFinishedBracket(session, streamBracket)
6111
6181
  if (!(error instanceof StoreWriteTooLargeError)) throw error
6112
- // The durable terminal remains authoritative over optional cleanup.
6113
6182
  }
6114
6183
  return
6115
6184
  }
@@ -6134,7 +6203,9 @@ export class BuildRunner {
6134
6203
  // and best-effort transcript cleanup.
6135
6204
  }
6136
6205
  }
6137
- this.closeBracketStream(streamBracket, 'completed')
6206
+ // A terminal with no endable handle or transcript still finishes the
6207
+ // occurrence: close its bracket rather than leave it open.
6208
+ await this.endFinishedBracket(session, streamBracket)
6138
6209
  if (spec.producerPhase !== undefined) this.producerSessions.delete(spec.producerPhase)
6139
6210
  return
6140
6211
  }