GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(server): a Stop accepted after the turn ends still interrupts the… · pingdotgg/t3code@c7bbfa3

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/server/src/orchestration-v2
    • CheckpointCaptureService.ts
    • SteeringCompletion.integration.test.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/server/src/orchestration-v2/CheckpointCaptureService.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/CheckpointCaptureService.ts
+11-9Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -262,18 +262,20 @@ export const layer: Layer.Layer<
262262
return;
263263
}
264264
// A Stop accepted once the provider's turn had ended stored only its request: the
265-
// terminal already wrote `waiting`. That Stop still wins, and gets its result here.
266-
const stopSignals = !legacyWaiting
267-
? []
268-
: (yield* projections.getThreadRecords(input.threadId, ["turnItems"], {
269-
turnItemTypes: ["run_interrupt_request", "run_interrupt_result"],
270-
turnItemRunIds: [run.id],
271-
})).turnItems;
265+
// terminal already wrote `completed` (or legacy `waiting`). That Stop still wins here.
266+
const stopSignals =
267+
!legacyWaiting && currentRun.status !== "completed"
268+
? []
269+
: (yield* projections.getThreadRecords(input.threadId, ["turnItems"], {
270+
turnItemTypes: ["run_interrupt_request", "run_interrupt_result"],
271+
turnItemRunIds: [run.id],
272+
})).turnItems;
272273
const stopRequest = stopSignals.some((item) => item.type === "run_interrupt_result")
273274
? undefined
274275
: stopSignals.find((item) => item.type === "run_interrupt_request");
275276
const settledStatus =
276277
stopRequest === undefined ? ("completed" as const) : ("interrupted" as const);
278+
const settlesRun = legacyWaiting || stopRequest !== undefined;
277279
// Omit delegatedCompletion to preserve cohort writes made after capture loaded the run.
278280
const { delegatedCompletion: _delegatedCompletion, ...runWithoutDelegatedCompletion } =
279281
currentRun;
@@ -372,7 +374,7 @@ export const layer: Layer.Layer<
372374
nodeId: rootNode.id,
373375
providerInstanceId: run.providerInstanceId,
374376
occurredAt: capturedAt,
375-
payload: legacyWaiting
377+
payload: settlesRun
376378
? {
377379
...runWithoutDelegatedCompletion,
378380
status: settledStatus,
@@ -381,7 +383,7 @@ export const layer: Layer.Layer<
381383
}
382384
: { ...runWithoutDelegatedCompletion, checkpointId: checkpoint.id },
383385
},
384-
...(!legacyWaiting
386+
...(!settlesRun
385387
? []
386388
: [
387389
{
Collapse file

‎apps/server/src/orchestration-v2/SteeringCompletion.integration.test.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/SteeringCompletion.integration.test.ts
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3473,12 +3473,12 @@ it.effect(
34733473
});
34743474
const draining = yield* worker.drain().pipe(Effect.forkScoped);
34753475
yield* Deferred.await(interruptReached);
3476-
const waiting = yield* orchestrator.streamDomainEvents.pipe(
3476+
const completed = yield* orchestrator.streamDomainEvents.pipe(
34773477
Stream.filter(
34783478
(event) =>
34793479
event.type === "run.updated" &&
34803480
event.payload.id === first.runId &&
3481-
event.payload.status === "waiting",
3481+
event.payload.status === "completed",
34823482
),
34833483
Stream.take(1),
34843484
Stream.runDrain,
@@ -3500,7 +3500,7 @@ it.effect(
35003500
failure: null,
35013501
threadDisposition: "reusable",
35023502
});
3503-
yield* Fiber.join(waiting);
3503+
yield* Fiber.join(completed);
35043504
yield* Deferred.succeed(releaseInterrupt, undefined);
35053505
yield* Fiber.join(draining);
35063506
yield* worker.drain();

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.