From 53d50094405f3ea863edd88a8d22f6a8e9512e4e Mon Sep 17 00:00:00 2001 From: Shivam Sharma <91240327+shivamhwp@users.noreply.github.com> Date: Thu, 30 Jul 2026 05:27:13 +0530 Subject: [PATCH] test(orchestration-v2): replay subagent reuse after idle --- .../testkit/fixtures/index.ts | 25 +++++++++++++------ .../codex_transcript.ndjson | 12 ++++++--- .../subagent_reuse_after_idle/input.ts | 8 +----- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/index.ts b/apps/server/src/orchestration-v2/testkit/fixtures/index.ts index 476d83568c..a2fcac7903 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/index.ts +++ b/apps/server/src/orchestration-v2/testkit/fixtures/index.ts @@ -41,6 +41,8 @@ import { subagentInput } from "./subagent/input.ts"; import { assertCursorSubagentOutput } from "./subagent/cursor_output.ts"; import { assertSubagentContinueOutput } from "./subagent_continue/codex_output.ts"; import { subagentContinueInput } from "./subagent_continue/input.ts"; +import { assertSubagentReuseAfterIdleOutput } from "./subagent_reuse_after_idle/codex_output.ts"; +import { subagentReuseAfterIdleInput } from "./subagent_reuse_after_idle/input.ts"; import { assertSubagentV2Output } from "./subagent_v2/codex_output.ts"; import { subagentV2Input } from "./subagent_v2/input.ts"; import { assertSubagentV2NestedOutput } from "./subagent_v2_nested/codex_output.ts"; @@ -406,14 +408,21 @@ export const ORCHESTRATOR_REPLAY_FIXTURES: ReadonlyArray","model":"gpt-5.4","approvalsReviewer":"user"}}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"019fa275-3860-7732-8f0b-6d43c27baf50","extra":null,"sessionId":"019fa275-3860-7732-8f0b-6d43c27baf50","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"historyMode":"legacy","modelProvider":"openai","createdAt":1785137019,"updatedAt":1785137019,"recencyAt":1785137019,"status":{"type":"idle"},"path":"/Users/shivam/.codex/sessions/2026/07/27/rollout-2026-07-27T12-53-38-019fa275-3860-7732-8f0b-6d43c27baf50.jsonl","cwd":"/Users/shivam/Developer/t3/ccing/open/t3code-2/apps/server","cliVersion":"0.145.0","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]}},"emittedAtMs":1785137019108}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"019fa275-3860-7732-8f0b-6d43c27baf50","name":"xcodebuildmcp","status":"starting","error":null,"failureReason":null},"emittedAtMs":1785137019109}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"019fa275-3860-7732-8f0b-6d43c27baf50","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1785137019109}} @@ -77,8 +77,14 @@ {"type":"emit_inbound","label":"account/rateLimits/updated","frame":{"method":"account/rateLimits/updated","params":{"rateLimits":{"limitId":"codex","limitName":null,"primary":{"usedPercent":8,"windowDurationMins":10080,"resetsAt":1785634197},"secondary":null,"credits":{"hasCredits":false,"unlimited":false,"balance":"0"},"individualLimit":null,"spendControlReached":null,"planType":"prolite","rateLimitReachedType":null}},"emittedAtMs":1785137032924}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"019fa275-3860-7732-8f0b-6d43c27baf50","status":{"type":"idle"}},"emittedAtMs":1785137032925}} {"type":"emit_inbound","label":"turn/completed","frame":{"method":"turn/completed","params":{"threadId":"019fa275-3860-7732-8f0b-6d43c27baf50","turn":{"id":"019fa275-38e7-7a12-9975-235b0e73bc77","items":[],"itemsView":"notLoaded","status":"completed","error":null,"startedAt":1785137019,"completedAt":1785137032,"durationMs":13811}},"emittedAtMs":1785137032925}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":4,"method":"turn/start","params":{"input":[{"text":"Send another message to the same idle_probe subagent. Do not spawn a replacement. Have it reply exactly: idle probe resumed response","type":"text"}],"threadId":"019fa275-3860-7732-8f0b-6d43c27baf50"}}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":4,"result":{"turn":{"id":"019fa275-6edd-7d23-932f-9a8bcd630dce","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"runtime_exit","status":"success"} +{"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true},"clientInfo":{"name":"t3code_desktop","title":"T3 Code Desktop","version":"0.1.0"}}}} +{"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.145.0 (Mac OS 26.5.2; arm64) unknown (t3code_desktop; 0.1.0)","codexHome":"/Users/shivam/.codex","platformFamily":"unix","platformOs":"macos"}}} +{"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} +{"type":"expect_outbound","label":"thread/resume","frame":{"id":2,"method":"thread/resume","params":{"threadId":"019fa275-3860-7732-8f0b-6d43c27baf50"}}} +{"type":"emit_inbound","label":"thread/resume","frame":{"id":2,"result":{"thread":{"id":"019fa275-3860-7732-8f0b-6d43c27baf50","extra":null,"sessionId":"019fa275-3860-7732-8f0b-6d43c27baf50","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"historyMode":"legacy","modelProvider":"openai","createdAt":1785137019,"updatedAt":1785137019,"recencyAt":1785137019,"status":{"type":"idle"},"path":"/Users/shivam/.codex/sessions/2026/07/27/rollout-2026-07-27T12-53-38-019fa275-3860-7732-8f0b-6d43c27baf50.jsonl","cwd":"/Users/shivam/Developer/t3/ccing/open/t3code-2/apps/server","cliVersion":"0.145.0","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]},"model":"gpt-5.6-sol","modelProvider":"openai","serviceTier":"priority","cwd":"/Users/shivam/Developer/t3/ccing/open/t3code-2/apps/server","runtimeWorkspaceRoots":["/Users/shivam/Developer/t3/ccing/open/t3code-2/apps/server"],"instructionSources":["/Users/shivam/.codex/AGENTS.md","/Users/shivam/Developer/t3/ccing/open/t3code-2/AGENTS.md"],"approvalPolicy":"never","approvalsReviewer":"user","sandbox":{"type":"dangerFullAccess"},"activePermissionProfile":null,"reasoningEffort":"high","multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":3,"method":"turn/start","params":{"input":[{"text":"Send another message to the same idle_probe subagent. Do not spawn a replacement. Have it reply exactly: idle probe resumed response","type":"text"}],"threadId":"019fa275-3860-7732-8f0b-6d43c27baf50","cwd":"","model":"gpt-5.4","approvalsReviewer":"user"}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":3,"result":{"turn":{"id":"019fa275-6edd-7d23-932f-9a8bcd630dce","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"019fa275-3860-7732-8f0b-6d43c27baf50","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1785137032927}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"019fa275-3860-7732-8f0b-6d43c27baf50","name":"openaiDeveloperDocs","status":"starting","error":null,"failureReason":null},"emittedAtMs":1785137032927}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"019fa275-3860-7732-8f0b-6d43c27baf50","name":"node_repl","status":"starting","error":null,"failureReason":null},"emittedAtMs":1785137032927}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/subagent_reuse_after_idle/input.ts b/apps/server/src/orchestration-v2/testkit/fixtures/subagent_reuse_after_idle/input.ts index 4b23f65b0d..3a66bfdc28 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/subagent_reuse_after_idle/input.ts +++ b/apps/server/src/orchestration-v2/testkit/fixtures/subagent_reuse_after_idle/input.ts @@ -13,18 +13,12 @@ import { * unrecognised on the next turn and gets registered as a brand new subagent — * the user sees a duplicate appear and the original frozen forever. * - * Not registered yet. The recorded transcript does contain a real reuse, but - * replaying it leaves the second run running forever so the scenario never - * reaches thread idle, and that is unrelated to the reuse routing here — it - * reproduces with those changes reverted. An advance_clock step to cross the - * 30-minute idle timeout (which is what would exercise rehydration rather than - * plain reuse) fails the same way, so it is left out until the hang is - * understood. */ export function subagentReuseAfterIdleInput(): OrchestratorFixtureInput { return { steps: [ { type: "message", text: SUBAGENT_REUSE_AFTER_IDLE_PROMPT }, + { type: "advance_clock", duration: "31 minutes" }, { type: "message", text: SUBAGENT_REUSE_AFTER_IDLE_RESUME_PROMPT }, ], };