test(orchestration-v2): replay subagent reuse after idle

This commit is contained in:
Shivam Sharma authored and T3 Code Test committed 2026-08-14 15:04:12 +05:30
1 parent 22e15a8423
commit 53d5009440
3 files changed
+27 -18

No files matched your search

@@ -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<OrchestratorReplayFixtu
},
],
},
// subagent_reuse_after_idle is scaffolded and recorded but not registered:
// replaying it leaves the second run running forever, so the scenario never
// reaches thread idle. Not caused by the reuse routing — the hang reproduces
// with those changes reverted, and persists now that the rebind demonstrably
// fires (subagent_continue proves that). Root cause still unknown; the
// recorded transcript uses the current Codex item shape (subAgentActivity
// started/interacted, collab `wait` with empty receiverThreadIds), whereas
// the passing subagent_continue transcript uses resumeAgent/sendInput.
{
name: "subagent_reuse_after_idle",
buildInput: subagentReuseAfterIdleInput,
providers: [
{
driver: ProviderDriverKind.make("codex"),
transcriptFile: new URL(
"./subagent_reuse_after_idle/codex_transcript.ndjson",
import.meta.url,
),
modelSelection: CODEX_MODEL_SELECTION,
assertOutput: assertSubagentReuseAfterIdleOutput,
},
],
},
{
name: "subagent_v2",
buildInput: subagentV2Input,
@@ -5,7 +5,7 @@
{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{}}}
{"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"shivam-macpro.local","installationId":"6a5680bf-d908-4d8f-b9f4-ee9e1d7089ae","environmentId":null},"emittedAtMs":1785137018968}}
{"type":"emit_inbound","label":"thread/start","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":"Spawn one subagent named idle_probe and have it reply exactly: idle probe first response","type":"text"}],"threadId":"019fa275-3860-7732-8f0b-6d43c27baf50"}}}
{"type":"expect_outbound","label":"turn/start","frame":{"id":3,"method":"turn/start","params":{"input":[{"text":"Spawn one subagent named idle_probe and have it reply exactly: idle probe first response","type":"text"}],"threadId":"019fa275-3860-7732-8f0b-6d43c27baf50","cwd":"<workspace>","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":"<workspace>","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}}
@@ -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 },
],
};