Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): cancel pending questions on stop #7987

ClosedExotic209093(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/7987/headopened View on GitHub

Showing 2 changed files with 199 additions and 15 deletions (loading 1).

x
0 of 2 viewed, 2 left
199 additions and 15 deletionsapps/server/src/orchestration/Layers/ProviderCommandReactor.test.tsModified
View file
@@ -2449,28 +2449,144 @@
- it("reacts to thread.turn.interrupt-requested by calling provider interrupt", async () => {
+ it("interrupts the provider and cancels pending user input", async () => {
const harness = await createHarness();
- const now = "2026-01-01T00:00:00.000Z";
-​
- await Effect.runPromise(
+ // The interrupt command's timestamp predates every request below, so a
+ // synthetic cancellation carrying it would fold closed before the request
+ // it closes. The reactor must stamp cancellations with server time.
+ const now = "2025-12-31T00:00:00.000Z";
+​
+ const appendUserInputActivity = (input: {
+ readonly commandId: string;
+ readonly activityId: string;
+ readonly kind:
+ | "user-input.requested"
+ | "user-input.resolved"
+ | "provider.user-input.respond.failed";
+ readonly payload: Record<string, unknown>;
+ readonly createdAt: string;
+ }) =>
harness.engine.dispatch({
- type: "thread.session.set",
- commandId: CommandId.make("cmd-session-set"),
+ type: "thread.activity.append",
+ commandId: CommandId.make(input.commandId),