Skip to content

Commit e17acc9

Browse files
test(server): Force stop of an ended run answers its own Stop request
Seed the request with its derived id and assert the result's parent link. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent f7026f2 commit e17acc9

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎apps/server/src/orchestration-v2/ThreadStop.test.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import * as ProjectionStore from "./ProjectionStore.ts";
4040
import * as ProviderAdapterRegistry from "./ProviderAdapterRegistry.ts";
4141
import * as ThreadManagementService from "./ThreadManagementService.ts";
4242
import * as ProviderReplayHarness from "./testkit/ProviderReplayHarness.ts";
43+
import * as IdAllocator from "@t3tools/provider-core/server/IdAllocator";
4344
import type * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAdapter";
4445

4546
const instanceId = ProviderInstanceId.make("codex");
@@ -1678,6 +1679,10 @@ it.effect("Force stop answers an unresponsive Stop of an ended run's background
16781679
const attempt = started.attempts[0]!;
16791680
const providerThreadId = run.providerThreadId!;
16801681
const providerTurnId = ProviderTurnId.make("provider-turn:force-stop-ended");
1682+
const requestId = IdAllocator.derive.runSignalTurnItem({
1683+
runId: run.id,
1684+
signal: "interrupt-request",
1685+
});
16811686
const apply = (event: Omit<OrchestrationV2DomainEvent, "id" | "threadId">) =>
16821687
projections.apply({
16831688
...event,
@@ -1721,7 +1726,7 @@ it.effect("Force stop answers an unresponsive Stop of an ended run's background
17211726
runId: run.id,
17221727
occurredAt: now,
17231728
payload: {
1724-
id: TurnItemId.make("turn-item:force-stop-ended:interrupt-request"),
1729+
id: requestId,
17251730
threadId,
17261731
runId: run.id,
17271732
nodeId: run.rootNodeId!,
@@ -1759,6 +1764,7 @@ it.effect("Force stop answers an unresponsive Stop of an ended run's background
17591764
"Force stopped by user",
17601765
"Force stop must answer the unresponsive Stop of an ended run",
17611766
);
1767+
assert.equal(result?.parentItemId, requestId);
17621768
assert.deepEqual(
17631769
settled.runs.map((candidate) => candidate.status),
17641770
["completed"],

0 commit comments

Comments
 (0)