Skip to content

Commit c192252

Browse files
committed
test(server): force stop before asserting late ACP usage
1 parent 01be710 commit c192252

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

‎apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -773,15 +773,18 @@ describe("AcpAdapterV2", () => {
773773
driver: ACP_TEST_DRIVER,
774774
capabilities: AcpProviderCapabilitiesV2,
775775
reportsPerTurnPromptUsage: true,
776+
terminateRuntimeProcessGroupOnInterrupt: true,
776777
makeRuntime: makeMockRuntime({
777778
childProcessSpawner: yield* ChildProcessSpawner.ChildProcessSpawner,
778779
mockAgentPath: yield* path.fromFileUrl(
779780
new URL("../../../scripts/acp-mock-agent.ts", import.meta.url),
780781
),
782+
ownDetachedProcessGroup: true,
783+
processGroupTerminationGrace: 0,
781784
wrapRuntime: (runtime) => ({
782785
...runtime,
783786
// The response only leaves the agent after the turn has been
784-
// Stopped and finalized: cancel does not interrupt this fiber.
787+
// force stopped and finalized: teardown does not interrupt this fiber.
785788
prompt: () =>
786789
Deferred.succeed(dispatched, undefined).pipe(
787790
Effect.andThen(Deferred.await(gate)),
@@ -793,7 +796,6 @@ describe("AcpAdapterV2", () => {
793796
),
794797
),
795798
}),
796-
wrapCancel: () => Effect.void,
797799
}),
798800
},
799801
});
@@ -844,9 +846,12 @@ describe("AcpAdapterV2", () => {
844846
driver: ACP_TEST_DRIVER,
845847
nativeTurnId: acpScopedNativeId(instanceId, "mock-session-1:turn:1"),
846848
});
847-
// The gated prompt never acknowledges the cancel, so the interrupt times
848-
// out — and that timeout path is what finalizes the turn as interrupted.
849-
yield* runtime.interruptTurn({ providerThread, providerTurnId }).pipe(Effect.option);
849+
// Force stop finalizes the turn without waiting for the gated prompt response.
850+
yield* runtime.interruptTurn({
851+
providerThread,
852+
providerTurnId,
853+
requestRuntimeRestart: true,
854+
});
850855
yield* Deferred.await(usageRecorded);
851856
const usageAt = () => {
852857
const turns = events.filter(

0 commit comments

Comments
 (0)