Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): restarts wake threads to resume their subagents #19184

Closedbrycedbjork(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/19184/headopened View on GitHub

Showing 7 changed files with 95 additions and 14 deletions (loading 4).

x
0 of 7 viewed, 7 left
55 additions and 9 deletionsapps/server/src/orchestration-v2/testkit/OrchestratorReplayRestartBackgroundNote.integration.test.tsModified
View file
@@ -30,6 +30,7 @@
const SESSION_ID = "cca274e4-25ae-4171-b972-bbb31118517e";
const FIRST_AFTER_RESTART = "Is the background subagent done yet?";
const SECOND_AFTER_RESTART = "Thanks. Anything else?";
+const RESUME_SUBAGENTS = "Resume any of this work that is still needed.";
const NOTE = [
"Note: the T3 server restarted, and this background work was cancelled before it finished. It will not report back:",
"- subagent: Background subagent test",
@@ -43,6 +44,8 @@
*/
const readRestartTranscript = Effect.fn("readRestartTranscript")(function* (
resumedPrompts: ReadonlyArray<string>,
+ /** Prompts the restarted server sends itself; the user's turns run on a later runtime. */
+ continuationPrompts: ReadonlyArray<string>,
) {
const recorded = yield* readProviderReplayTranscript(
new URL(`./fixtures/${SCENARIO}/claude_transcript.ndjson`, import.meta.url),
@@ -61,6 +64,11 @@
throw new Error(`${SCENARIO} must open with a recorded query.open frame.`);
const { sessionId: _sessionId, ...resumeOptions } = queryOptions as Record<string, unknown>;
+ const resumeQuery = (label: string): ProviderReplayEntry => ({
+ type: "expect_outbound",
+ label: `query.open:resume:${label}`,
+ frame: { type: "query.open", options: { ...resumeOptions, resume: SESSION_ID } },
+ });
const resumedTurn = (label: string, text: string): ReadonlyArray<ProviderReplayEntry> => [