From c1d528a342ef14fa960a8cc6283d6324b4488f5c Mon Sep 17 00:00:00 2001 From: Ben Davis <45952064+bmdavis419@users.noreply.github.com> Date: Sun, 11 Oct 2026 16:01:35 -0700 Subject: [PATCH] feat(provider-muse): native subagents open in their own child threads (#18353) Co-authored-by: Theo Browne Co-authored-by: Claude Opus 5.5 --- .../testkit/fixtures/index.ts | 38 +++ .../fixtures/muse_subagent_approval/input.ts | 15 + .../muse_transcript.ndjson | 69 +++++ .../fixtures/muse_subagent_approval/output.ts | 56 ++++ .../fixtures/muse_subagent_interrupt/input.ts | 14 + .../muse_transcript.ndjson | 33 ++ .../muse_subagent_interrupt/output.ts | 47 +++ .../fixtures/subagent_v2/muse_output.ts | 58 ++++ .../subagent_v2/muse_transcript.ndjson | 57 ++++ .../provider-muse/src/server/adapter.test.ts | 86 ++++++ packages/provider-muse/src/server/adapter.ts | 285 +++++++++++++++++- 11 files changed, 754 insertions(+), 4 deletions(-) create mode 100644 apps/server/src/orchestration-v2/testkit/fixtures/muse_subagent_approval/input.ts create mode 100644 apps/server/src/orchestration-v2/testkit/fixtures/muse_subagent_approval/muse_transcript.ndjson create mode 100644 apps/server/src/orchestration-v2/testkit/fixtures/muse_subagent_approval/output.ts create mode 100644 apps/server/src/orchestration-v2/testkit/fixtures/muse_subagent_interrupt/input.ts create mode 100644 apps/server/src/orchestration-v2/testkit/fixtures/muse_subagent_interrupt/muse_transcript.ndjson create mode 100644 apps/server/src/orchestration-v2/testkit/fixtures/muse_subagent_interrupt/output.ts create mode 100644 apps/server/src/orchestration-v2/testkit/fixtures/subagent_v2/muse_output.ts create mode 100644 apps/server/src/orchestration-v2/testkit/fixtures/subagent_v2/muse_transcript.ndjson diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/index.ts b/apps/server/src/orchestration-v2/testkit/fixtures/index.ts index 77882f3cc5f573b897a1e904ec5898dd09d0e570..e68fa3bef7cdb390eab633c34443f4335b7d9367 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/index.ts +++ b/apps/server/src/orchestration-v2/testkit/fixtures/index.ts @@ -58,8 +58,13 @@ import { messageSteeringInput } from "./message_steering/input.ts"; import { assertPiMessageSteeringOutput } from "./message_steering/pi_output.ts"; import { MUSE_PERMISSION_DECLINED_FILE, musePermissionInput } from "./muse_permission/input.ts"; import { assertMusePermissionOutput } from "./muse_permission/output.ts"; +import { museSubagentApprovalInput } from "./muse_subagent_approval/input.ts"; +import { assertMuseSubagentApprovalOutput } from "./muse_subagent_approval/output.ts"; +import { museSubagentInterruptInput } from "./muse_subagent_interrupt/input.ts"; +import { assertMuseSubagentInterruptOutput } from "./muse_subagent_interrupt/output.ts"; import { museWorkflowInput } from "./muse_workflow/input.ts"; import { assertMuseWorkflowOutput } from "./muse_workflow/output.ts"; +import { assertMuseSubagentV2Output } from "./subagent_v2/muse_output.ts"; import { assertMuseMultiTurnOutput } from "./multi_turn/muse_output.ts"; import { assertMuseTurnInterruptOutput } from "./turn_interrupt/muse_output.ts"; import { piCompactionInput } from "./pi_compaction/input.ts"; @@ -860,6 +865,12 @@ export const ORCHESTRATOR_REPLAY_FIXTURES: ReadonlyArray","modelId":"muse-spark-1.3-contributor","providerId":"meta","approvalMode":"promptUnmatched","commandId":"01a12d1d-a1b8-7000-8d6c-f1324b724cdb"}}} +{"type":"emit_inbound","label":"session/started","frame":{"jsonrpc":"2.0","method":"session/started","params":{"session":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","path":"~/.local/share/muse/sessions/2026/10/11/01a12d1d-a1b7-7000-9697-d430c2e2afd8/session.jsonl","status":"idle","activeTurnId":null,"createdAt":"2026-10-11T22:37:59.14136Z","updatedAt":"2026-10-11T22:37:59.141364Z","workspaceRoot":"","providerId":"meta","modelId":"muse-spark-1.3-contributor","turnCount":0,"forkedFrom":null,"sideFrom":null,"approvalMode":{"mode":"promptUnmatched","source":"startup","lastCommandId":null},"createdByClient":{"name":"t3_code","version":"1"},"kind":"root"}},"emittedAtMs":1791758279294}} +{"type":"emit_inbound","label":"response:session/start","frame":{"jsonrpc":"2.0","id":2,"result":{"session":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","path":"~/.local/share/muse/sessions/2026/10/11/01a12d1d-a1b7-7000-9697-d430c2e2afd8/session.jsonl","status":"idle","activeTurnId":null,"createdAt":"2026-10-11T22:37:59.14136Z","updatedAt":"2026-10-11T22:37:59.141364Z","workspaceRoot":"","providerId":"meta","modelId":"muse-spark-1.3-contributor","turnCount":0,"forkedFrom":null,"sideFrom":null,"approvalMode":{"mode":"promptUnmatched","source":"startup","lastCommandId":null},"createdByClient":{"name":"t3_code","version":"1"},"kind":"root"},"viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:1"}}} +{"type":"emit_inbound","label":"session/approvalModeChanged","frame":{"jsonrpc":"2.0","method":"session/approvalModeChanged","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:1","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"ed95a9db-eada-4751-a7e6-22ccc9bdabd5","sequence":5},"last":{"id":"ed95a9db-eada-4751-a7e6-22ccc9bdabd5","sequence":5}},"mode":"promptUnmatched","source":"approvalReconfigure","commandId":"01a12d1d-a1b8-7000-8d6c-f1324b724cdb","clientName":"t3_code"},"emittedAtMs":1791758279297}} +{"type":"expect_outbound","label":"turn/start","frame":{"jsonrpc":"2.0","id":3,"method":"turn/start","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","input":[{"type":"text","text":"In case you're asked: you are running in T3 Code through the Muse Code harness, as muse-spark-1.3-contributor with high reasoning effort. No need to mention this otherwise. You can embed images and videos in your response using Markdown with absolute file paths.\n\n\nWhen the t3-code MCP server exposes link_pull_request, you must use it to register every pull request you create or work on for this thread. Call link_pull_request with the full PR URL immediately after creating a PR or starting work on an existing PR. For a stack, call it for every layer, not just the current branch or the top PR. This applies when creating or updating PRs through gh, gh stack, another CLI, or the host API: those operations do not register the PRs with this thread. Linking an already-linked PR is safe. Before finishing PR work, call list_thread_pull_requests and link any PR from your work that is missing. Do not link unrelated PRs mentioned only as background. If a linking call fails, report that failure instead of claiming the PR is linked. When asked to monitor, watch, or babysit a PR and watch_pull_request is available, call it and end your turn: T3 Code wakes you when checks finish, someone else comments, or the branch conflicts, so do not poll or run your own watcher. When you hand the work back to the user, call unwatch_pull_request first so the thread returns to their inbox.\n"},{"type":"text","text":"Do not run any commands yourself. Spawn one subagent whose only task is to run this exact shell command: printf 'subagent approval fixture' > subagent-approval.txt and then reply with exactly: Written. Wait for it to finish, then reply with exactly what it said."}],"displayText":"Do not run any commands yourself. Spawn one subagent whose only task is to run this exact shell command: printf 'subagent approval fixture' > subagent-approval.txt and then reply with exactly: Written. Wait for it to finish, then reply with exactly what it said.","workspaceRoots":[""],"ifBusy":"queue","reasoningEffort":"high","commandId":"01a12d1d-a348-7000-ae97-9d27b5f80bce"}}} +{"type":"emit_inbound","label":"session/branchChanged","frame":{"jsonrpc":"2.0","method":"session/branchChanged","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:2","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"4f170229-d428-4a64-9516-7a355ff3bcdb","sequence":15},"last":{"id":"4f170229-d428-4a64-9516-7a355ff3bcdb","sequence":15}},"workspaceRoot":"","branch":"main","vcs":"git"},"emittedAtMs":1791758279531}} +{"type":"emit_inbound","label":"response:turn/start","frame":{"jsonrpc":"2.0","id":3,"result":{"commandId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","status":"accepted","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","startedNewTurn":true,"disposition":"started"}}} +{"type":"emit_inbound","label":"session/statusChanged","frame":{"jsonrpc":"2.0","method":"session/statusChanged","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","status":"running","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:3"},"emittedAtMs":1791758279541}} +{"type":"emit_inbound","label":"turn/started","frame":{"jsonrpc":"2.0","method":"turn/started","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:3","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"429e8ecf-d532-4b14-a303-b9f832c36a51","sequence":17},"last":{"id":"429e8ecf-d532-4b14-a303-b9f832c36a51","sequence":17}},"turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","commandId":"01a12d1d-a348-7000-ae97-9d27b5f80bce"},"emittedAtMs":1791758279542}} +{"type":"emit_inbound","label":"item/completed","frame":{"jsonrpc":"2.0","method":"item/completed","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:4","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"429e8ecf-d532-4b14-a303-b9f832c36a51","sequence":17},"last":{"id":"429e8ecf-d532-4b14-a303-b9f832c36a51","sequence":17}},"item":{"itemId":"a4b3de8d-842b-4065-8769-aed18e62e9fc","kind":"userMessage","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","revision":1,"status":"completed","recordedAt":"2026-10-11T22:37:59.531477Z","text":"In case you're asked: you are running in T3 Code through the Muse Code harness, as muse-spark-1.3-contributor with high reasoning effort. No need to mention this otherwise. You can embed images and videos in your response using Markdown with absolute file paths.\n\n\nWhen the t3-code MCP server exposes link_pull_request, you must use it to register every pull request you create or work on for this thread. Call link_pull_request with the full PR URL immediately after creating a PR or starting work on an existing PR. For a stack, call it for every layer, not just the current branch or the top PR. This applies when creating or updating PRs through gh, gh stack, another CLI, or the host API: those operations do not register the PRs with this thread. Linking an already-linked PR is safe. Before finishing PR work, call list_thread_pull_requests and link any PR from your work that is missing. Do not link unrelated PRs mentioned only as background. If a linking call fails, report that failure instead of claiming the PR is linked. When asked to monitor, watch, or babysit a PR and watch_pull_request is available, call it and end your turn: T3 Code wakes you when checks finish, someone else comments, or the branch conflicts, so do not poll or run your own watcher. When you hand the work back to the user, call unwatch_pull_request first so the thread returns to their inbox.\nDo not run any commands yourself. Spawn one subagent whose only task is to run this exact shell command: printf 'subagent approval fixture' > subagent-approval.txt and then reply with exactly: Written. Wait for it to finish, then reply with exactly what it said.","commandId":"01a12d1d-a348-7000-ae97-9d27b5f80bce"}},"emittedAtMs":1791758279542}} +{"type":"emit_inbound","label":"item/updated","frame":{"jsonrpc":"2.0","method":"item/updated","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:5","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"5a63e348-5bf6-4262-b37f-d31d307ea6d8","sequence":19},"last":{"id":"5a63e348-5bf6-4262-b37f-d31d307ea6d8","sequence":19}},"item":{"itemId":"a4b3de8d-842b-4065-8769-aed18e62e9fc","kind":"userMessage","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","revision":2,"status":"completed","recordedAt":"2026-10-11T22:37:59.545908Z","text":"In case you're asked: you are running in T3 Code through the Muse Code harness, as muse-spark-1.3-contributor with high reasoning effort. No need to mention this otherwise. You can embed images and videos in your response using Markdown with absolute file paths.\n\n\nWhen the t3-code MCP server exposes link_pull_request, you must use it to register every pull request you create or work on for this thread. Call link_pull_request with the full PR URL immediately after creating a PR or starting work on an existing PR. For a stack, call it for every layer, not just the current branch or the top PR. This applies when creating or updating PRs through gh, gh stack, another CLI, or the host API: those operations do not register the PRs with this thread. Linking an already-linked PR is safe. Before finishing PR work, call list_thread_pull_requests and link any PR from your work that is missing. Do not link unrelated PRs mentioned only as background. If a linking call fails, report that failure instead of claiming the PR is linked. When asked to monitor, watch, or babysit a PR and watch_pull_request is available, call it and end your turn: T3 Code wakes you when checks finish, someone else comments, or the branch conflicts, so do not poll or run your own watcher. When you hand the work back to the user, call unwatch_pull_request first so the thread returns to their inbox.\nDo not run any commands yourself. Spawn one subagent whose only task is to run this exact shell command: printf 'subagent approval fixture' > subagent-approval.txt and then reply with exactly: Written. Wait for it to finish, then reply with exactly what it said.","displayText":"Do not run any commands yourself. Spawn one subagent whose only task is to run this exact shell command: printf 'subagent approval fixture' > subagent-approval.txt and then reply with exactly: Written. Wait for it to finish, then reply with exactly what it said.","commandId":"01a12d1d-a348-7000-ae97-9d27b5f80bce"}},"emittedAtMs":1791758279553}} +{"type":"emit_inbound","label":"item/started","frame":{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:6","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"d55286a9-a9e2-4d7b-be97-d44360bcca2b","sequence":37},"last":{"id":"d55286a9-a9e2-4d7b-be97-d44360bcca2b","sequence":37}},"item":{"itemId":"d55286a9-a9e2-4d7b-be97-d44360bcca2b","kind":"reminderChild","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","revision":1,"status":"inProgress","recordedAt":"2026-10-11T22:37:59.660065Z","fallbackText":"Reminder child session","childSessionId":"0779d605-54b8-45dc-90b6-91dc58b9a52c","reminderAgentId":"skill-reminder","generationId":1,"taskId":"01a12d1d-a3d4-7712-8b98-26f3c4f9bf38"}},"emittedAtMs":1791758279666}} +{"type":"emit_inbound","label":"item/started","frame":{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:6.1","item":{"itemId":"21b74b34-fe9f-457c-83f0-cf49257b5948","kind":"reasoning","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","revision":1,"status":"inProgress","summary":[""]}},"emittedAtMs":1791758282481}} +{"type":"emit_inbound","label":"item/delta","frame":{"jsonrpc":"2.0","method":"item/delta","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:6.2","itemId":"21b74b34-fe9f-457c-83f0-cf49257b5948","field":"summary.0","delta":"Spawning a subagent via muse_subagent_spawn to run a shell command and return its exact output, while avoiding direct command execution."},"emittedAtMs":1791758282481}} +{"type":"emit_inbound","label":"item/completed","frame":{"jsonrpc":"2.0","method":"item/completed","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:7","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"3a4718a2-9320-498c-b8aa-69eaf1453958","sequence":50},"last":{"id":"3a4718a2-9320-498c-b8aa-69eaf1453958","sequence":50}},"item":{"itemId":"21b74b34-fe9f-457c-83f0-cf49257b5948","kind":"reasoning","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","revision":2,"status":"completed","recordedAt":"2026-10-11T22:38:03.384565Z","summary":["Spawning a subagent via muse_subagent_spawn to run a shell command and return its exact output, while avoiding direct command execution."],"providerItemId":"rs_6acc0fc80414b9259c30405e:rs_01a12d1da8a2746b83f02f9ee776d987"}},"emittedAtMs":1791758283388}} +{"type":"emit_inbound","label":"session/tokenUsage","frame":{"jsonrpc":"2.0","method":"session/tokenUsage","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:8","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"23cce26b-52c2-491d-8b6a-77804eb6e400","sequence":55},"last":{"id":"23cce26b-52c2-491d-8b6a-77804eb6e400","sequence":55}},"turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","modelId":"muse-spark-1.3-contributor","usage":{"inputTokens":33182,"outputTokens":630,"cachedTokens":0,"cacheWriteTokens":0,"cacheReadTokens":0,"reasoningTokens":457},"promptTokens":33182,"totalTokens":33812,"finishReason":"tool_calls","durationMs":4184,"cumulative":{"promptTokens":33182,"outputTokens":630,"totalTokens":33812,"cost":{"usd":0.0034442,"partial":false}}},"emittedAtMs":1791758283932}} +{"type":"emit_inbound","label":"session/contextUsage","frame":{"jsonrpc":"2.0","method":"session/contextUsage","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:9","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"23cce26b-52c2-491d-8b6a-77804eb6e400","sequence":55},"last":{"id":"23cce26b-52c2-491d-8b6a-77804eb6e400","sequence":55}},"windowTokens":1007997,"usedTokens":33812,"pressure":"normal"},"emittedAtMs":1791758283932}} +{"type":"emit_inbound","label":"item/started","frame":{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:10","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"b174ba42-e393-44c4-a5b6-d8f4aaeb395f","sequence":57},"last":{"id":"1fdd975e-94b9-4b5a-8193-884b41ccc64e","sequence":62}},"item":{"itemId":"01a12d1d-b4ab-7ab0-ad39-d8c00adae105","kind":"toolCall","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","revision":1,"status":"inProgress","recordedAt":"2026-10-11T22:38:03.982749Z","tool":"subagent_spawn","callId":"call_01a12d1db2d871bbbd31c63d91fd8182","args":"{\"command_id\":\"subagent-approval-001\",\"objective\":\"Your only task is to run this exact shell command: printf 'subagent approval fixture' > subagent-approval.txt and then reply with exactly: Written.\",\"role\":\"runner\"}"}},"emittedAtMs":1791758283987}} +{"type":"emit_inbound","label":"item/started","frame":{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:11","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"5c0c79a8-26d3-4c22-9b28-5db7d6b381e3","sequence":64},"last":{"id":"5c0c79a8-26d3-4c22-9b28-5db7d6b381e3","sequence":64}},"item":{"itemId":"01a12d1d-b4d9-74e2-ae49-6a2363589cbc","kind":"subagent","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","revision":1,"status":"inProgress","recordedAt":"2026-10-11T22:38:03.993782Z","fallbackText":"Subagent: Your only task is to run this exact shell command: printf 'subagent approval fixture' > subagent-approval.txt and then reply with exactly: Written.","subagentId":"subagent-1","agentPath":"main/runner/1","depth":1,"role":"runner","objective":"Your only task is to run this exact shell command: printf 'subagent approval fixture' > subagent-approval.txt and then reply with exactly: Written.","controlStatus":"accepted"}},"emittedAtMs":1791758284002}} +{"type":"emit_inbound","label":"session/branchChanged","frame":{"jsonrpc":"2.0","method":"session/branchChanged","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:12","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"57a0ee04-dff4-4fb4-85db-d1908ced70f3","sequence":72},"last":{"id":"57a0ee04-dff4-4fb4-85db-d1908ced70f3","sequence":72}},"workspaceRoot":"","branch":"main","vcs":"git"},"emittedAtMs":1791758284071}} +{"type":"emit_inbound","label":"item/updated","frame":{"jsonrpc":"2.0","method":"item/updated","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:13","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"5c0c79a8-26d3-4c22-9b28-5db7d6b381e3","sequence":64},"last":{"id":"37c2eeea-dfdf-4005-9dcd-a2b34d41661b","sequence":75}},"item":{"itemId":"01a12d1d-b4d9-74e2-ae49-6a2363589cbc","kind":"subagent","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","revision":2,"status":"inProgress","recordedAt":"2026-10-11T22:38:04.076035Z","fallbackText":"Subagent: Your only task is to run this exact shell command: printf 'subagent approval fixture' > subagent-approval.txt and then reply with exactly: Written.","subagentId":"subagent-1","agentPath":"main/runner/1","depth":1,"role":"runner","objective":"Your only task is to run this exact shell command: printf 'subagent approval fixture' > subagent-approval.txt and then reply with exactly: Written.","childSessionId":"01a12d1d-b510-7171-ae34-b9ebb94eb11b","controlStatus":"running"}},"emittedAtMs":1791758284083}} +{"type":"emit_inbound","label":"item/updated","frame":{"jsonrpc":"2.0","method":"item/updated","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:14","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"5c0c79a8-26d3-4c22-9b28-5db7d6b381e3","sequence":64},"last":{"id":"14e726b0-d79e-4554-a815-7bbe641e0aea","sequence":76}},"item":{"itemId":"01a12d1d-b4d9-74e2-ae49-6a2363589cbc","kind":"subagent","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","revision":3,"status":"inProgress","recordedAt":"2026-10-11T22:38:04.083535Z","fallbackText":"Subagent: Your only task is to run this exact shell command: printf 'subagent approval fixture' > subagent-approval.txt and then reply with exactly: Written.","subagentId":"subagent-1","agentPath":"main/runner/1","depth":1,"role":"runner","objective":"Your only task is to run this exact shell command: printf 'subagent approval fixture' > subagent-approval.txt and then reply with exactly: Written.","childSessionId":"01a12d1d-b510-7171-ae34-b9ebb94eb11b","controlStatus":"running"}},"emittedAtMs":1791758284092}} +{"type":"emit_inbound","label":"item/completed","frame":{"jsonrpc":"2.0","method":"item/completed","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:15","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"b174ba42-e393-44c4-a5b6-d8f4aaeb395f","sequence":57},"last":{"id":"dcb97459-3c7e-47ef-945e-cf0baba791ef","sequence":79}},"item":{"itemId":"01a12d1d-b4ab-7ab0-ad39-d8c00adae105","kind":"toolCall","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","revision":2,"status":"completed","recordedAt":"2026-10-11T22:38:04.228702Z","tool":"subagent_spawn","callId":"call_01a12d1db2d871bbbd31c63d91fd8182","args":"{\"command_id\":\"subagent-approval-001\",\"objective\":\"Your only task is to run this exact shell command: printf 'subagent approval fixture' > subagent-approval.txt and then reply with exactly: Written.\",\"role\":\"runner\"}","visibleOutput":"{\"status\":\"accepted\",\"subagent_id\":\"subagent-1\",\"agent_path\":\"main/runner/1\",\"task_ref\":\"task/01a12d1d-b4d9-74e2-ae49-6a2363589cbc#0\",\"advisories\":[{\"code\":\"work_stop_activation_unavailable\",\"message\":\"Work Stop activation unavailable: no authenticated Agent Tree authority for a record-derived runtime until #29453\"}]}"}},"emittedAtMs":1791758284233}} +{"type":"emit_inbound","label":"request:approval/request","frame":{"jsonrpc":"2.0","id":1,"method":"approval/request","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","approvalId":"01a12d1d-bb5f-7a13-b494-2dc27653d86d","turnId":"01a12d1d-b510-7171-ae34-b9ebb94eb11b","taskId":"01a12d1d-bb5f-7a13-b494-2dc27653d86d","itemId":"01a12d1d-bb5f-7a13-b494-2dc27653d86d","toolCallId":"call_01a12d1db9f675878c55d714c795a74d","toolName":"bash","rawArgs":"{\"command\":\"printf 'subagent approval fixture' > subagent-approval.txt\",\"description\":\"Write subagent approval fixture file\"}","viewCursor":"v:01a12d1d-b510-7171-ae34-b9ebb94eb11b:4","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-b510-7171-ae34-b9ebb94eb11b"},"first":{"id":"4f219c37-5a1d-497b-9325-d5f5312405ed","sequence":35},"last":{"id":"4f219c37-5a1d-497b-9325-d5f5312405ed","sequence":35}},"subject":{"kind":"shell","command":"printf 'subagent approval fixture' > subagent-approval.txt","workspaceRoot":"","stages":[{"requirementId":{"approvalId":"01a12d1d-bb5f-7a13-b494-2dc27653d86d","sourceIndex":0},"position":1,"totalStages":1,"argv":["printf","subagent approval fixture"],"argvComplete":false,"resolution":{"kind":"unresolved"}}]},"currentRequirementId":{"approvalId":"01a12d1d-bb5f-7a13-b494-2dc27653d86d","sourceIndex":0},"availableChoices":[{"choiceId":"allow_once","label":"Allow once","decision":"approved","scope":"once"},{"choiceId":"abort","label":"Reject","decision":"abort","scope":"once","acceptsFeedback":true}],"protectedWrite":false,"judgeEscalated":false,"subagentOrigin":{"subagentId":"subagent-1","childSessionId":"01a12d1d-b510-7171-ae34-b9ebb94eb11b","childRunId":"01a12d1d-b510-7171-ae34-b9ebb94eb11b"}}}} +{"type":"emit_inbound","label":"approval/requested","frame":{"jsonrpc":"2.0","method":"approval/requested","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","approvalId":"01a12d1d-bb5f-7a13-b494-2dc27653d86d","turnId":"01a12d1d-b510-7171-ae34-b9ebb94eb11b","taskId":"01a12d1d-bb5f-7a13-b494-2dc27653d86d","itemId":"01a12d1d-bb5f-7a13-b494-2dc27653d86d","toolCallId":"call_01a12d1db9f675878c55d714c795a74d","toolName":"bash","rawArgs":"{\"command\":\"printf 'subagent approval fixture' > subagent-approval.txt\",\"description\":\"Write subagent approval fixture file\"}","viewCursor":"v:01a12d1d-b510-7171-ae34-b9ebb94eb11b:4","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-b510-7171-ae34-b9ebb94eb11b"},"first":{"id":"4f219c37-5a1d-497b-9325-d5f5312405ed","sequence":35},"last":{"id":"4f219c37-5a1d-497b-9325-d5f5312405ed","sequence":35}},"subject":{"kind":"shell","command":"printf 'subagent approval fixture' > subagent-approval.txt","workspaceRoot":"","stages":[{"requirementId":{"approvalId":"01a12d1d-bb5f-7a13-b494-2dc27653d86d","sourceIndex":0},"position":1,"totalStages":1,"argv":["printf","subagent approval fixture"],"argvComplete":false,"resolution":{"kind":"unresolved"}}]},"currentRequirementId":{"approvalId":"01a12d1d-bb5f-7a13-b494-2dc27653d86d","sourceIndex":0},"availableChoices":[{"choiceId":"allow_once","label":"Allow once","decision":"approved","scope":"once"},{"choiceId":"abort","label":"Reject","decision":"abort","scope":"once","acceptsFeedback":true}],"protectedWrite":false,"judgeEscalated":false,"subagentOrigin":{"subagentId":"subagent-1","childSessionId":"01a12d1d-b510-7171-ae34-b9ebb94eb11b","childRunId":"01a12d1d-b510-7171-ae34-b9ebb94eb11b"}},"emittedAtMs":1791758285686}} +{"type":"expect_outbound","label":"reply:approval/request","frame":{"jsonrpc":"2.0","id":1,"result":{}}} +{"type":"expect_outbound","label":"approval/decide","frame":{"jsonrpc":"2.0","id":4,"method":"approval/decide","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","approvalId":"01a12d1d-bb5f-7a13-b494-2dc27653d86d","requirementId":{"approvalId":"01a12d1d-bb5f-7a13-b494-2dc27653d86d","sourceIndex":0},"choiceId":"allow_once","commandId":"01a12d1d-bb8a-7000-aa1b-3fbb5c9b87a4"}}} +{"type":"emit_inbound","label":"response:approval/decide","frame":{"jsonrpc":"2.0","id":4,"result":{"commandId":"01a12d1d-bb8a-7000-aa1b-3fbb5c9b87a4","status":"accepted","approvalId":"01a12d1d-bb5f-7a13-b494-2dc27653d86d","terminal":true}}} +{"type":"emit_inbound","label":"approval/updated","frame":{"jsonrpc":"2.0","method":"approval/updated","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-b510-7171-ae34-b9ebb94eb11b:5","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-b510-7171-ae34-b9ebb94eb11b"},"first":{"id":"93bfe574-f9f8-4d13-89b5-cce8d35c9168","sequence":37},"last":{"id":"93bfe574-f9f8-4d13-89b5-cce8d35c9168","sequence":37}},"approvalId":"01a12d1d-bb5f-7a13-b494-2dc27653d86d","currentRequirementId":{"approvalId":"01a12d1d-bb5f-7a13-b494-2dc27653d86d","sourceIndex":0},"subject":{"kind":"shell","command":"printf 'subagent approval fixture' > subagent-approval.txt","workspaceRoot":"","stages":[{"requirementId":{"approvalId":"01a12d1d-bb5f-7a13-b494-2dc27653d86d","sourceIndex":0},"position":1,"totalStages":1,"argv":["printf","subagent approval fixture"],"argvComplete":false,"resolution":{"kind":"allowOnce"}}]},"availableChoices":[{"choiceId":"allow_once","label":"Allow once","decision":"approved","scope":"once"},{"choiceId":"abort","label":"Reject","decision":"abort","scope":"once","acceptsFeedback":true}],"change":{"kind":"stageResolved","requirementId":{"approvalId":"01a12d1d-bb5f-7a13-b494-2dc27653d86d","sourceIndex":0},"choiceId":"allow_once","decision":"approved"},"subagentOrigin":{"subagentId":"subagent-1","childSessionId":"01a12d1d-b510-7171-ae34-b9ebb94eb11b","childRunId":"01a12d1d-b510-7171-ae34-b9ebb94eb11b"}},"emittedAtMs":1791758285788}} +{"type":"emit_inbound","label":"approval/resolved","frame":{"jsonrpc":"2.0","method":"approval/resolved","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-b510-7171-ae34-b9ebb94eb11b:6","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-b510-7171-ae34-b9ebb94eb11b"},"first":{"id":"a5172a02-5d0d-4362-a4b8-7f8a605d4ee2","sequence":38},"last":{"id":"a5172a02-5d0d-4362-a4b8-7f8a605d4ee2","sequence":38}},"approvalId":"01a12d1d-bb5f-7a13-b494-2dc27653d86d","itemId":"01a12d1d-bb5f-7a13-b494-2dc27653d86d","turnId":"01a12d1d-b510-7171-ae34-b9ebb94eb11b","decision":"approved","policyResult":"allow","resolvedBy":"user","decidedByCommandId":"01a12d1d-bb8a-7000-aa1b-3fbb5c9b87a4","decidedAt":"2026-10-11T22:38:05.737652Z","stageEvidence":[{"requirementId":{"approvalId":"01a12d1d-bb5f-7a13-b494-2dc27653d86d","sourceIndex":0},"position":1,"totalStages":1,"argv":["printf","subagent approval fixture"],"resolution":{"kind":"allowOnce"}}],"subagentOrigin":{"subagentId":"subagent-1","childSessionId":"01a12d1d-b510-7171-ae34-b9ebb94eb11b","childRunId":"01a12d1d-b510-7171-ae34-b9ebb94eb11b"}},"emittedAtMs":1791758285788}} +{"type":"emit_inbound","label":"session/tokenUsage","frame":{"jsonrpc":"2.0","method":"session/tokenUsage","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:16","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"57543a42-0ea0-4269-aeb3-9f5f6097935a","sequence":102},"last":{"id":"57543a42-0ea0-4269-aeb3-9f5f6097935a","sequence":102}},"turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","modelId":"muse-spark-1.3-contributor","usage":{"inputTokens":33896,"outputTokens":208,"cachedTokens":33649,"cacheWriteTokens":0,"cacheReadTokens":33649,"reasoningTokens":74},"promptTokens":33896,"totalTokens":34104,"finishReason":"tool_calls","durationMs":2646,"cumulative":{"promptTokens":67078,"outputTokens":838,"totalTokens":67916,"cacheReadTokens":33649,"cost":{"usd":0.003577798,"partial":false}}},"emittedAtMs":1791758286989}} +{"type":"emit_inbound","label":"session/contextUsage","frame":{"jsonrpc":"2.0","method":"session/contextUsage","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:17","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"57543a42-0ea0-4269-aeb3-9f5f6097935a","sequence":102},"last":{"id":"57543a42-0ea0-4269-aeb3-9f5f6097935a","sequence":102}},"windowTokens":1007997,"usedTokens":34104,"pressure":"normal"},"emittedAtMs":1791758286989}} +{"type":"emit_inbound","label":"item/started","frame":{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:18","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"04d0f2e3-b9be-4bda-a4d0-a8d49931ee26","sequence":104},"last":{"id":"b7a6f78e-1924-4f5b-8bf4-d7382f2d83e3","sequence":109}},"item":{"itemId":"01a12d1d-c09c-7622-8f70-fb08c43ae484","kind":"toolCall","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","revision":1,"status":"inProgress","recordedAt":"2026-10-11T22:38:07.031194Z","tool":"subagent_wait","callId":"call_01a12d1db9d971b3a6ffff1078398032","args":"{\"command_id\":\"subagent-approval-wait-001\",\"subagent_id\":\"subagent-1\",\"timeout_ms\":120000,\"wait_for\":\"result_ready\"}"}},"emittedAtMs":1791758287038}} +{"type":"emit_inbound","label":"item/started","frame":{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:18.1","item":{"itemId":"a93bfa9e-3fc6-4251-834c-1b9fe71c276d","kind":"agentMessage","turnId":"01a12d1d-b510-7171-ae34-b9ebb94eb11b","revision":1,"status":"inProgress","text":""}},"emittedAtMs":1791758287779}} +{"type":"emit_inbound","label":"item/delta","frame":{"jsonrpc":"2.0","method":"item/delta","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:18.2","itemId":"a93bfa9e-3fc6-4251-834c-1b9fe71c276d","field":"text","delta":"Written."},"emittedAtMs":1791758287779}} +{"type":"emit_inbound","label":"item/updated","frame":{"jsonrpc":"2.0","method":"item/updated","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:19","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"5c0c79a8-26d3-4c22-9b28-5db7d6b381e3","sequence":64},"last":{"id":"c8b65c46-9027-402a-b53a-91c9e6818f0b","sequence":112}},"item":{"itemId":"01a12d1d-b4d9-74e2-ae49-6a2363589cbc","kind":"subagent","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","revision":4,"status":"inProgress","recordedAt":"2026-10-11T22:38:07.830083Z","fallbackText":"Subagent: Your only task is to run this exact shell command: printf 'subagent approval fixture' > subagent-approval.txt and then reply with exactly: Written.","durationMs":3732,"subagentId":"subagent-1","agentPath":"main/runner/1","depth":1,"role":"runner","objective":"Your only task is to run this exact shell command: printf 'subagent approval fixture' > subagent-approval.txt and then reply with exactly: Written.","childSessionId":"01a12d1d-b510-7171-ae34-b9ebb94eb11b","controlStatus":"running","usage":{"inputTokens":52053,"outputTokens":126,"cachedTokens":25969,"cacheWriteTokens":0,"cacheReadTokens":25969,"reasoningTokens":14}}},"emittedAtMs":1791758287833}} +{"type":"emit_inbound","label":"item/updated","frame":{"jsonrpc":"2.0","method":"item/updated","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:20","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"5c0c79a8-26d3-4c22-9b28-5db7d6b381e3","sequence":64},"last":{"id":"a4ee3d55-019d-4fb5-97b3-00c91be84736","sequence":114}},"item":{"itemId":"01a12d1d-b4d9-74e2-ae49-6a2363589cbc","kind":"subagent","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","revision":5,"status":"inProgress","recordedAt":"2026-10-11T22:38:07.83809Z","fallbackText":"Subagent: Your only task is to run this exact shell command: printf 'subagent approval fixture' > subagent-approval.txt and then reply with exactly: Written.","durationMs":3732,"subagentId":"subagent-1","agentPath":"main/runner/1","depth":1,"role":"runner","objective":"Your only task is to run this exact shell command: printf 'subagent approval fixture' > subagent-approval.txt and then reply with exactly: Written.","childSessionId":"01a12d1d-b510-7171-ae34-b9ebb94eb11b","controlStatus":"resultReady","usage":{"inputTokens":52053,"outputTokens":126,"cachedTokens":25969,"cacheWriteTokens":0,"cacheReadTokens":25969,"reasoningTokens":14},"result":{"summary":"Written.","text":"Written.","evidenceRefs":[],"artifactRefs":[]}}},"emittedAtMs":1791758287846}} +{"type":"emit_inbound","label":"item/completed","frame":{"jsonrpc":"2.0","method":"item/completed","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:21","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"04d0f2e3-b9be-4bda-a4d0-a8d49931ee26","sequence":104},"last":{"id":"671b65c4-3833-489e-a366-a3c9bf7c2d50","sequence":120}},"item":{"itemId":"01a12d1d-c09c-7622-8f70-fb08c43ae484","kind":"toolCall","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","revision":2,"status":"completed","recordedAt":"2026-10-11T22:38:07.880707Z","tool":"subagent_wait","callId":"call_01a12d1db9d971b3a6ffff1078398032","args":"{\"command_id\":\"subagent-approval-wait-001\",\"subagent_id\":\"subagent-1\",\"timeout_ms\":120000,\"wait_for\":\"result_ready\"}","visibleOutput":"{\"status\":\"ready\",\"subagent_id\":\"subagent-1\",\"task_ref\":\"task/01a12d1d-b4d9-74e2-ae49-6a2363589cbc#5\",\"summary\":\"Written.\",\"workspace\":{\"placement\":\"shared\",\"setup\":\"active\",\"parent_changes\":\"not_recorded\"}}"}},"emittedAtMs":1791758287888}} +{"type":"emit_inbound","label":"item/completed","frame":{"jsonrpc":"2.0","method":"item/completed","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:22","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"d55286a9-a9e2-4d7b-be97-d44360bcca2b","sequence":37},"last":{"id":"87c14c9a-740c-4d91-b888-76c053bd0b28","sequence":123}},"item":{"itemId":"d55286a9-a9e2-4d7b-be97-d44360bcca2b","kind":"reminderChild","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","revision":2,"status":"completed","recordedAt":"2026-10-11T22:38:07.89955Z","fallbackText":"Reminder child session","childSessionId":"0779d605-54b8-45dc-90b6-91dc58b9a52c","reminderAgentId":"skill-reminder","generationId":1,"taskId":"01a12d1d-a3d4-7712-8b98-26f3c4f9bf38"}},"emittedAtMs":1791758287910}} +{"type":"emit_inbound","label":"item/started","frame":{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:23","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"c5e36d37-784f-4111-b590-427409233f15","sequence":132},"last":{"id":"c5e36d37-784f-4111-b590-427409233f15","sequence":132}},"item":{"itemId":"c5e36d37-784f-4111-b590-427409233f15","kind":"reminderChild","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","revision":1,"status":"inProgress","recordedAt":"2026-10-11T22:38:07.964293Z","fallbackText":"Reminder child session","childSessionId":"f05ae391-54f3-4f63-8d0d-acdc4fcbe0da","reminderAgentId":"skill-reminder","generationId":2,"taskId":"01a12d1d-c43e-7000-a0ab-36ba04d863e3"}},"emittedAtMs":1791758287971}} +{"type":"emit_inbound","label":"session/tokenUsage","frame":{"jsonrpc":"2.0","method":"session/tokenUsage","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:24","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"b4ca3d0b-ab6f-488f-a084-4b77bf279304","sequence":148},"last":{"id":"b4ca3d0b-ab6f-488f-a084-4b77bf279304","sequence":148}},"turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","modelId":"muse-spark-1.3-contributor","usage":{"inputTokens":34198,"outputTokens":151,"cachedTokens":33649,"cacheWriteTokens":0,"cacheReadTokens":33649,"reasoningTokens":71},"promptTokens":34198,"totalTokens":34349,"finishReason":"tool_calls","durationMs":2082,"cumulative":{"promptTokens":101276,"outputTokens":989,"totalTokens":102265,"cacheReadTokens":67298,"cost":{"usd":0.0037301960000000003,"partial":false}}},"emittedAtMs":1791758290135}} +{"type":"emit_inbound","label":"session/contextUsage","frame":{"jsonrpc":"2.0","method":"session/contextUsage","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:25","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"b4ca3d0b-ab6f-488f-a084-4b77bf279304","sequence":148},"last":{"id":"b4ca3d0b-ab6f-488f-a084-4b77bf279304","sequence":148}},"windowTokens":1007997,"usedTokens":34349,"pressure":"normal"},"emittedAtMs":1791758290135}} +{"type":"emit_inbound","label":"item/started","frame":{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:26","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"68cf9576-b1d4-48b7-94bf-0a6e222ef6fb","sequence":150},"last":{"id":"9ada62c0-9ac8-4750-9c2b-0e7faf077aa9","sequence":155}},"item":{"itemId":"01a12d1d-cced-71d1-8306-86f78bc7255d","kind":"toolCall","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","revision":1,"status":"inProgress","recordedAt":"2026-10-11T22:38:10.196637Z","tool":"subagent_read_result","callId":"call_01a12d1dc87874858d60cf083193c0ed","args":"{\"subagent_id\":\"subagent-1\"}"}},"emittedAtMs":1791758290202}} +{"type":"emit_inbound","label":"item/completed","frame":{"jsonrpc":"2.0","method":"item/completed","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:27","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"68cf9576-b1d4-48b7-94bf-0a6e222ef6fb","sequence":150},"last":{"id":"f00753a5-2fb8-4241-852d-e6a38ab8a222","sequence":159}},"item":{"itemId":"01a12d1d-cced-71d1-8306-86f78bc7255d","kind":"toolCall","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","revision":2,"status":"completed","recordedAt":"2026-10-11T22:38:10.233345Z","tool":"subagent_read_result","callId":"call_01a12d1dc87874858d60cf083193c0ed","args":"{\"subagent_id\":\"subagent-1\"}","visibleOutput":"{\"status\":\"ready\",\"subagent_id\":\"subagent-1\",\"task_ref\":\"task/01a12d1d-b4d9-74e2-ae49-6a2363589cbc#5\",\"summary\":\"Written.\",\"workspace\":{\"placement\":\"shared\",\"setup\":\"active\",\"parent_changes\":\"not_recorded\"}}"}},"emittedAtMs":1791758290298}} +{"type":"emit_inbound","label":"item/started","frame":{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:27.1","item":{"itemId":"e0325e50-90ee-435f-8197-b1af018bb06f","kind":"reasoning","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","revision":1,"status":"inProgress","summary":[""]}},"emittedAtMs":1791758292306}} +{"type":"emit_inbound","label":"item/delta","frame":{"jsonrpc":"2.0","method":"item/delta","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:27.2","itemId":"e0325e50-90ee-435f-8197-b1af018bb06f","field":"summary.0","delta":"Interpreting an ambiguous instruction about whether a trailing period is part of the required exact reply text."},"emittedAtMs":1791758292306}} +{"type":"emit_inbound","label":"item/delta","frame":{"jsonrpc":"2.0","method":"item/delta","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:27.3","itemId":"e0325e50-90ee-435f-8197-b1af018bb06f","field":"summary.1","delta":"Resolving punctuation ambiguity on whether the period belongs to the required exact reply text."},"emittedAtMs":1791758293700}} +{"type":"emit_inbound","label":"item/completed","frame":{"jsonrpc":"2.0","method":"item/completed","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:28","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"f5fe8b66-210f-40ad-8a9b-7fc5deb5acc0","sequence":177},"last":{"id":"f5fe8b66-210f-40ad-8a9b-7fc5deb5acc0","sequence":177}},"item":{"itemId":"e0325e50-90ee-435f-8197-b1af018bb06f","kind":"reasoning","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","revision":2,"status":"completed","recordedAt":"2026-10-11T22:38:16.570142Z","summary":["Interpreting an ambiguous instruction about whether a trailing period is part of the required exact reply text.","Resolving punctuation ambiguity on whether the period belongs to the required exact reply text."],"providerItemId":"rs_6acc0fd251c426de63bb4c13:rs_01a12d1dcf3374129361d7408b8dd273"}},"emittedAtMs":1791758296574}} +{"type":"emit_inbound","label":"item/started","frame":{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:28.1","item":{"itemId":"9f556fc4-396d-467d-9faf-ccf534bb9b02","kind":"agentMessage","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","revision":1,"status":"inProgress","text":""}},"emittedAtMs":1791758296616}} +{"type":"emit_inbound","label":"item/delta","frame":{"jsonrpc":"2.0","method":"item/delta","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:28.2","itemId":"9f556fc4-396d-467d-9faf-ccf534bb9b02","field":"text","delta":"Written"},"emittedAtMs":1791758296616}} +{"type":"emit_inbound","label":"item/completed","frame":{"jsonrpc":"2.0","method":"item/completed","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:29","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"88689ec5-780d-40f1-a480-24f353cfff4f","sequence":179},"last":{"id":"88689ec5-780d-40f1-a480-24f353cfff4f","sequence":179}},"item":{"itemId":"9f556fc4-396d-467d-9faf-ccf534bb9b02","kind":"agentMessage","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","revision":2,"status":"completed","recordedAt":"2026-10-11T22:38:16.619132Z","text":"Written"}},"emittedAtMs":1791758296623}} +{"type":"emit_inbound","label":"session/tokenUsage","frame":{"jsonrpc":"2.0","method":"session/tokenUsage","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:30","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"d336a238-8423-4857-9233-1489882f11dc","sequence":182},"last":{"id":"d336a238-8423-4857-9233-1489882f11dc","sequence":182}},"turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","modelId":"muse-spark-1.3-contributor","usage":{"inputTokens":34445,"outputTokens":881,"cachedTokens":34161,"cacheWriteTokens":0,"cacheReadTokens":34161,"reasoningTokens":826},"promptTokens":34445,"totalTokens":35326,"durationMs":6277,"cumulative":{"promptTokens":135721,"outputTokens":1870,"totalTokens":137591,"cacheReadTokens":101459,"cost":{"usd":0.004003118000000001,"partial":false}}},"emittedAtMs":1791758296660}} +{"type":"emit_inbound","label":"session/contextUsage","frame":{"jsonrpc":"2.0","method":"session/contextUsage","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:31","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"d336a238-8423-4857-9233-1489882f11dc","sequence":182},"last":{"id":"d336a238-8423-4857-9233-1489882f11dc","sequence":182}},"windowTokens":1007997,"usedTokens":35326,"pressure":"normal"},"emittedAtMs":1791758296660}} +{"type":"emit_inbound","label":"item/completed","frame":{"jsonrpc":"2.0","method":"item/completed","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:32","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"c5e36d37-784f-4111-b590-427409233f15","sequence":132},"last":{"id":"e024055a-a1e4-4a12-bc05-5dfadcd50fe7","sequence":184}},"item":{"itemId":"c5e36d37-784f-4111-b590-427409233f15","kind":"reminderChild","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","revision":2,"status":"completed","recordedAt":"2026-10-11T22:38:16.665314Z","fallbackText":"Reminder child session","childSessionId":"f05ae391-54f3-4f63-8d0d-acdc4fcbe0da","reminderAgentId":"skill-reminder","generationId":2,"taskId":"01a12d1d-c43e-7000-a0ab-36ba04d863e3"}},"emittedAtMs":1791758296675}} +{"type":"emit_inbound","label":"turn/foregroundCompleted","frame":{"jsonrpc":"2.0","method":"turn/foregroundCompleted","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:33","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"f686f8f8-c6bc-43a8-8f2b-c20c0692fdfb","sequence":193},"last":{"id":"f686f8f8-c6bc-43a8-8f2b-c20c0692fdfb","sequence":193}},"turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","blockingAgents":["goal-reminder","verify-reminder"]},"emittedAtMs":1791758296726}} +{"type":"emit_inbound","label":"item/started","frame":{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:34","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"f686f8f8-c6bc-43a8-8f2b-c20c0692fdfb","sequence":193},"last":{"id":"f686f8f8-c6bc-43a8-8f2b-c20c0692fdfb","sequence":193}},"item":{"itemId":"f686f8f8-c6bc-43a8-8f2b-c20c0692fdfb","kind":"reminderChild","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","revision":1,"status":"inProgress","recordedAt":"2026-10-11T22:38:16.721758Z","fallbackText":"Reminder child session","childSessionId":"44d29ff6-c01f-48d3-9e35-71c7ca203750","reminderAgentId":"goal-reminder","generationId":1,"taskId":"01a12d1d-e677-7a90-9d57-89947890d927","blocking":true}},"emittedAtMs":1791758296726}} +{"type":"emit_inbound","label":"item/started","frame":{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:35","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"de85ff78-ce8a-4237-9b4e-ab74ac911fa2","sequence":200},"last":{"id":"de85ff78-ce8a-4237-9b4e-ab74ac911fa2","sequence":200}},"item":{"itemId":"de85ff78-ce8a-4237-9b4e-ab74ac911fa2","kind":"reminderChild","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","revision":1,"status":"inProgress","recordedAt":"2026-10-11T22:38:16.760186Z","fallbackText":"Reminder child session","childSessionId":"9f805ae2-dd39-45f0-80b1-8cfa7e101f97","reminderAgentId":"verify-reminder","generationId":1,"taskId":"01a12d1d-e699-7410-98e0-74293e74c0fe","blocking":true}},"emittedAtMs":1791758296767}} +{"type":"emit_inbound","label":"item/completed","frame":{"jsonrpc":"2.0","method":"item/completed","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:36","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"f686f8f8-c6bc-43a8-8f2b-c20c0692fdfb","sequence":193},"last":{"id":"c85ae9c4-ec73-4aec-885d-968fff4165af","sequence":202}},"item":{"itemId":"f686f8f8-c6bc-43a8-8f2b-c20c0692fdfb","kind":"reminderChild","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","revision":2,"status":"completed","recordedAt":"2026-10-11T22:38:31.95787Z","fallbackText":"Reminder child session","childSessionId":"44d29ff6-c01f-48d3-9e35-71c7ca203750","reminderAgentId":"goal-reminder","generationId":1,"taskId":"01a12d1d-e677-7a90-9d57-89947890d927","blocking":true}},"emittedAtMs":1791758311963}} +{"type":"emit_inbound","label":"item/completed","frame":{"jsonrpc":"2.0","method":"item/completed","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:37","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"de85ff78-ce8a-4237-9b4e-ab74ac911fa2","sequence":200},"last":{"id":"7c0fc5d8-b5d4-4200-83e9-7a9f73f762b7","sequence":203}},"item":{"itemId":"de85ff78-ce8a-4237-9b4e-ab74ac911fa2","kind":"reminderChild","turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","revision":2,"status":"completed","recordedAt":"2026-10-11T22:38:31.96353Z","fallbackText":"Reminder child session","childSessionId":"9f805ae2-dd39-45f0-80b1-8cfa7e101f97","reminderAgentId":"verify-reminder","generationId":1,"taskId":"01a12d1d-e699-7410-98e0-74293e74c0fe","blocking":true}},"emittedAtMs":1791758311972}} +{"type":"emit_inbound","label":"session/statusChanged","frame":{"jsonrpc":"2.0","method":"session/statusChanged","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","status":"idle","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:38"},"emittedAtMs":1791758312007}} +{"type":"emit_inbound","label":"turn/completed","frame":{"jsonrpc":"2.0","method":"turn/completed","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:38","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"567c1e33-4fb4-4f52-b8a1-2f8a6f114404","sequence":208},"last":{"id":"567c1e33-4fb4-4f52-b8a1-2f8a6f114404","sequence":208}},"turnId":"01a12d1d-a348-7000-ae97-9d27b5f80bce","terminal":"completed","durationMs":32467,"timeToFirstTokenMs":2945},"emittedAtMs":1791758312007}} +{"type":"emit_inbound","label":"session/branchChanged","frame":{"jsonrpc":"2.0","method":"session/branchChanged","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:39","sourceRange":{"stream":{"kind":"session","id":"01a12d1d-a1b7-7000-9697-d430c2e2afd8"},"first":{"id":"22e714fa-df1b-4554-978b-253a71130a55","sequence":209},"last":{"id":"22e714fa-df1b-4554-978b-253a71130a55","sequence":209}},"workspaceRoot":"","branch":"main","vcs":"git"},"emittedAtMs":1791758312014}} +{"type":"emit_inbound","label":"session/closed","frame":{"jsonrpc":"2.0","method":"session/closed","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","reason":"hostShutdown","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:39"},"emittedAtMs":1791758312288}} +{"type":"emit_inbound","label":"session/statusChanged","frame":{"jsonrpc":"2.0","method":"session/statusChanged","params":{"sessionId":"01a12d1d-a1b7-7000-9697-d430c2e2afd8","status":"notLoaded","viewCursor":"v:01a12d1d-a1b7-7000-9697-d430c2e2afd8:39"},"emittedAtMs":1791758312288}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/muse_subagent_approval/output.ts b/apps/server/src/orchestration-v2/testkit/fixtures/muse_subagent_approval/output.ts new file mode 100644 index 0000000000000000000000000000000000000000..325a5a01c4a28b1331728319bb536378d068116f --- /dev/null +++ b/apps/server/src/orchestration-v2/testkit/fixtures/muse_subagent_approval/output.ts @@ -0,0 +1,56 @@ +import { assert } from "@effect/vitest"; +import type { ProviderReplayTranscript } from "@t3tools/contracts"; + +import type { OrchestratorV2ScenarioResult } from "../../OrchestratorScenario.ts"; +import { assertSemanticProjectionIntegrity, projectionFor } from "../shared.ts"; + +/** + * A native subagent's approval is asked on the parent thread, as Codex and + * OpenCode ask theirs: Muse children have no provider session of their own to + * answer from. The answer reaches Muse and the subagent finishes its work. + */ +export function assertMuseSubagentApprovalOutput( + result: OrchestratorV2ScenarioResult, + transcript: ProviderReplayTranscript, +) { + const projection = projectionFor(result, transcript.scenario); + assertSemanticProjectionIntegrity(projection); + assert.deepEqual( + projection.runs.map((run) => run.status), + ["completed"], + ); + + const requests = projection.runtimeRequests; + assert.lengthOf(requests, 1); + assert.equal(requests[0]?.kind, "command"); + assert.equal(requests[0]?.status, "resolved"); + assert.equal(requests[0]?.decision, "accept"); + const outbound = transcript.entries.flatMap((entry) => + entry.type === "expect_outbound" ? [entry.frame] : [], + ); + assert.isTrue( + outbound.some( + (frame) => + typeof frame === "object" && + frame !== null && + Reflect.get(frame, "method") === "approval/decide", + ), + "the answer reaches Muse", + ); + + assert.lengthOf(projection.subagents, 1); + const subagent = projection.subagents[0]!; + assert.equal(subagent.status, "completed"); + assert.match(subagent.result ?? "", /^Written\.?$/u); + if (subagent.childThreadId === null) throw new Error("The subagent has no child thread"); + const child = result.projections.get(subagent.childThreadId); + if (child === undefined) throw new Error("The child thread has no projection"); + assert.lengthOf(child.runtimeRequests, 0); + assert.deepEqual( + child.messages.map((message) => [message.role, message.text]), + [ + ["user", subagent.prompt], + ["assistant", subagent.result], + ], + ); +} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/muse_subagent_interrupt/input.ts b/apps/server/src/orchestration-v2/testkit/fixtures/muse_subagent_interrupt/input.ts new file mode 100644 index 0000000000000000000000000000000000000000..da0584e85fe069baa225d7d3450214b193d54641 --- /dev/null +++ b/apps/server/src/orchestration-v2/testkit/fixtures/muse_subagent_interrupt/input.ts @@ -0,0 +1,14 @@ +import type { OrchestratorFixtureInput } from "../shared.ts"; + +const MUSE_SUBAGENT_INTERRUPT_PROMPT = + "Spawn one subagent whose only task is to run the shell command `sleep 30` and then reply with exactly: Done. Wait for it to finish, then reply with exactly what it said."; + +/** Stop while a Muse native subagent is still running. */ +export function museSubagentInterruptInput(): OrchestratorFixtureInput { + return { + steps: [ + { type: "message", text: MUSE_SUBAGENT_INTERRUPT_PROMPT }, + { type: "interrupt", targetRunIndex: 1, waitForTurnItemType: "subagent" }, + ], + }; +} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/muse_subagent_interrupt/muse_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/muse_subagent_interrupt/muse_transcript.ndjson new file mode 100644 index 0000000000000000000000000000000000000000..26f5b056c60a7396113e9b5ff4455eeccd47d0af --- /dev/null +++ b/apps/server/src/orchestration-v2/testkit/fixtures/muse_subagent_interrupt/muse_transcript.ndjson @@ -0,0 +1,33 @@ +{"type":"transcript_start","provider":"muse","protocol":"muse.msp-jsonl","version":"1.4.4-R5419.1","scenario":"muse_subagent_interrupt","metadata":{"generatedBy":"live-muse-recorder","model":"muse-spark-1.3-contributor","commandIds":[["01a12d28-7788-7000-a946-c407f380868e","01a12d28-7788-7001-a223-c10e52187cdf","01a12d28-7912-7000-993a-afd019e6ac5c","01a12d28-889c-7000-8577-23019c9d175f"]]}} +{"type":"expect_outbound","label":"host_start","frame":{"type":"host_start","args":["serve","--trust-workspace","--disable-sandbox"]}} +{"type":"expect_outbound","label":"initialize","frame":{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"clientInfo":{"name":"t3_code","title":"T3 Code","version":"1"},"capabilities":{"requestedCapabilities":["sessionMcp"]}}}} +{"type":"emit_inbound","label":"response:initialize","frame":{"jsonrpc":"2.0","id":1,"result":{"serverInfo":{"name":"muse","version":"1.4.4"},"userAgent":"muse-build/1.4.4 (serve; macos-aarch64; build 1e1635eda6610b6dec0803bc76c1ceb0dbff7caa)","museHome":"~/.local/share/muse","platformFamily":"unix","platformOs":"macos","schema":{"version":1,"fingerprint":"sha256:7c94f153c41659cb3f1bd3c3e04438be254644cb2a97d65d48edc7449b74858a"},"grantedCapabilities":["sessionMcp"],"experimentalApi":false,"sessionDurability":"durable"}}} +{"type":"expect_outbound","label":"initialized","frame":{"jsonrpc":"2.0","method":"initialized"}} +{"type":"expect_outbound","label":"session/start","frame":{"jsonrpc":"2.0","id":2,"method":"session/start","params":{"sessionId":"01a12d28-7788-7000-a946-c407f380868e","workspaceRoot":"","modelId":"muse-spark-1.3-contributor","providerId":"meta","approvalMode":"allowAll","commandId":"01a12d28-7788-7001-a223-c10e52187cdf"}}} +{"type":"emit_inbound","label":"session/started","frame":{"jsonrpc":"2.0","method":"session/started","params":{"session":{"sessionId":"01a12d28-7788-7000-a946-c407f380868e","path":"~/.local/share/muse/sessions/2026/10/11/01a12d28-7788-7000-a946-c407f380868e/session.jsonl","status":"idle","activeTurnId":null,"createdAt":"2026-10-11T22:49:49.235205Z","updatedAt":"2026-10-11T22:49:49.235209Z","workspaceRoot":"","providerId":"meta","modelId":"muse-spark-1.3-contributor","turnCount":0,"forkedFrom":null,"sideFrom":null,"approvalMode":{"mode":"allowAll","source":"startup","lastCommandId":null},"createdByClient":{"name":"t3_code","version":"1"},"kind":"root"}},"emittedAtMs":1791758989388}} +{"type":"emit_inbound","label":"response:session/start","frame":{"jsonrpc":"2.0","id":2,"result":{"session":{"sessionId":"01a12d28-7788-7000-a946-c407f380868e","path":"~/.local/share/muse/sessions/2026/10/11/01a12d28-7788-7000-a946-c407f380868e/session.jsonl","status":"idle","activeTurnId":null,"createdAt":"2026-10-11T22:49:49.235205Z","updatedAt":"2026-10-11T22:49:49.235209Z","workspaceRoot":"","providerId":"meta","modelId":"muse-spark-1.3-contributor","turnCount":0,"forkedFrom":null,"sideFrom":null,"approvalMode":{"mode":"allowAll","source":"startup","lastCommandId":null},"createdByClient":{"name":"t3_code","version":"1"},"kind":"root"},"viewCursor":"v:01a12d28-7788-7000-a946-c407f380868e:1"}}} +{"type":"emit_inbound","label":"session/approvalModeChanged","frame":{"jsonrpc":"2.0","method":"session/approvalModeChanged","params":{"sessionId":"01a12d28-7788-7000-a946-c407f380868e","viewCursor":"v:01a12d28-7788-7000-a946-c407f380868e:1","sourceRange":{"stream":{"kind":"session","id":"01a12d28-7788-7000-a946-c407f380868e"},"first":{"id":"29d4e769-78f7-48fa-90cd-3ac9f8fa04bf","sequence":5},"last":{"id":"29d4e769-78f7-48fa-90cd-3ac9f8fa04bf","sequence":5}},"mode":"allowAll","source":"approvalReconfigure","commandId":"01a12d28-7788-7001-a223-c10e52187cdf","clientName":"t3_code"},"emittedAtMs":1791758989391}} +{"type":"expect_outbound","label":"turn/start","frame":{"jsonrpc":"2.0","id":3,"method":"turn/start","params":{"sessionId":"01a12d28-7788-7000-a946-c407f380868e","input":[{"type":"text","text":"In case you're asked: you are running in T3 Code through the Muse Code harness, as muse-spark-1.3-contributor with high reasoning effort. No need to mention this otherwise. You can embed images and videos in your response using Markdown with absolute file paths.\n\n\nWhen the t3-code MCP server exposes link_pull_request, you must use it to register every pull request you create or work on for this thread. Call link_pull_request with the full PR URL immediately after creating a PR or starting work on an existing PR. For a stack, call it for every layer, not just the current branch or the top PR. This applies when creating or updating PRs through gh, gh stack, another CLI, or the host API: those operations do not register the PRs with this thread. Linking an already-linked PR is safe. Before finishing PR work, call list_thread_pull_requests and link any PR from your work that is missing. Do not link unrelated PRs mentioned only as background. If a linking call fails, report that failure instead of claiming the PR is linked. When asked to monitor, watch, or babysit a PR and watch_pull_request is available, call it and end your turn: T3 Code wakes you when checks finish, someone else comments, or the branch conflicts, so do not poll or run your own watcher. When you hand the work back to the user, call unwatch_pull_request first so the thread returns to their inbox.\n"},{"type":"text","text":"Spawn one subagent whose only task is to run the shell command `sleep 30` and then reply with exactly: Done. Wait for it to finish, then reply with exactly what it said."}],"displayText":"Spawn one subagent whose only task is to run the shell command `sleep 30` and then reply with exactly: Done. Wait for it to finish, then reply with exactly what it said.","workspaceRoots":[""],"ifBusy":"queue","reasoningEffort":"high","commandId":"01a12d28-7912-7000-993a-afd019e6ac5c"}}} +{"type":"emit_inbound","label":"session/branchChanged","frame":{"jsonrpc":"2.0","method":"session/branchChanged","params":{"sessionId":"01a12d28-7788-7000-a946-c407f380868e","viewCursor":"v:01a12d28-7788-7000-a946-c407f380868e:2","sourceRange":{"stream":{"kind":"session","id":"01a12d28-7788-7000-a946-c407f380868e"},"first":{"id":"660e2cfd-318a-4d2d-87bb-0b1375d79fdf","sequence":15},"last":{"id":"660e2cfd-318a-4d2d-87bb-0b1375d79fdf","sequence":15}},"workspaceRoot":"","branch":"main","vcs":"git"},"emittedAtMs":1791758989619}} +{"type":"emit_inbound","label":"response:turn/start","frame":{"jsonrpc":"2.0","id":3,"result":{"commandId":"01a12d28-7912-7000-993a-afd019e6ac5c","status":"accepted","turnId":"01a12d28-7912-7000-993a-afd019e6ac5c","startedNewTurn":true,"disposition":"started"}}} +{"type":"emit_inbound","label":"session/statusChanged","frame":{"jsonrpc":"2.0","method":"session/statusChanged","params":{"sessionId":"01a12d28-7788-7000-a946-c407f380868e","status":"running","viewCursor":"v:01a12d28-7788-7000-a946-c407f380868e:3"},"emittedAtMs":1791758989632}} +{"type":"emit_inbound","label":"turn/started","frame":{"jsonrpc":"2.0","method":"turn/started","params":{"sessionId":"01a12d28-7788-7000-a946-c407f380868e","viewCursor":"v:01a12d28-7788-7000-a946-c407f380868e:3","sourceRange":{"stream":{"kind":"session","id":"01a12d28-7788-7000-a946-c407f380868e"},"first":{"id":"5cb199bd-04e5-40d9-a299-8760be80e0a4","sequence":17},"last":{"id":"5cb199bd-04e5-40d9-a299-8760be80e0a4","sequence":17}},"turnId":"01a12d28-7912-7000-993a-afd019e6ac5c","commandId":"01a12d28-7912-7000-993a-afd019e6ac5c"},"emittedAtMs":1791758989632}} +{"type":"emit_inbound","label":"item/completed","frame":{"jsonrpc":"2.0","method":"item/completed","params":{"sessionId":"01a12d28-7788-7000-a946-c407f380868e","viewCursor":"v:01a12d28-7788-7000-a946-c407f380868e:4","sourceRange":{"stream":{"kind":"session","id":"01a12d28-7788-7000-a946-c407f380868e"},"first":{"id":"5cb199bd-04e5-40d9-a299-8760be80e0a4","sequence":17},"last":{"id":"5cb199bd-04e5-40d9-a299-8760be80e0a4","sequence":17}},"item":{"itemId":"5e234d9d-0744-4757-9629-761ea4e7f062","kind":"userMessage","turnId":"01a12d28-7912-7000-993a-afd019e6ac5c","revision":1,"status":"completed","recordedAt":"2026-10-11T22:49:49.620067Z","text":"In case you're asked: you are running in T3 Code through the Muse Code harness, as muse-spark-1.3-contributor with high reasoning effort. No need to mention this otherwise. You can embed images and videos in your response using Markdown with absolute file paths.\n\n\nWhen the t3-code MCP server exposes link_pull_request, you must use it to register every pull request you create or work on for this thread. Call link_pull_request with the full PR URL immediately after creating a PR or starting work on an existing PR. For a stack, call it for every layer, not just the current branch or the top PR. This applies when creating or updating PRs through gh, gh stack, another CLI, or the host API: those operations do not register the PRs with this thread. Linking an already-linked PR is safe. Before finishing PR work, call list_thread_pull_requests and link any PR from your work that is missing. Do not link unrelated PRs mentioned only as background. If a linking call fails, report that failure instead of claiming the PR is linked. When asked to monitor, watch, or babysit a PR and watch_pull_request is available, call it and end your turn: T3 Code wakes you when checks finish, someone else comments, or the branch conflicts, so do not poll or run your own watcher. When you hand the work back to the user, call unwatch_pull_request first so the thread returns to their inbox.\nSpawn one subagent whose only task is to run the shell command `sleep 30` and then reply with exactly: Done. Wait for it to finish, then reply with exactly what it said.","commandId":"01a12d28-7912-7000-993a-afd019e6ac5c"}},"emittedAtMs":1791758989632}} +{"type":"emit_inbound","label":"item/updated","frame":{"jsonrpc":"2.0","method":"item/updated","params":{"sessionId":"01a12d28-7788-7000-a946-c407f380868e","viewCursor":"v:01a12d28-7788-7000-a946-c407f380868e:5","sourceRange":{"stream":{"kind":"session","id":"01a12d28-7788-7000-a946-c407f380868e"},"first":{"id":"5724636e-9398-4d23-87ac-1e9a2b83ad9f","sequence":19},"last":{"id":"5724636e-9398-4d23-87ac-1e9a2b83ad9f","sequence":19}},"item":{"itemId":"5e234d9d-0744-4757-9629-761ea4e7f062","kind":"userMessage","turnId":"01a12d28-7912-7000-993a-afd019e6ac5c","revision":2,"status":"completed","recordedAt":"2026-10-11T22:49:49.635395Z","text":"In case you're asked: you are running in T3 Code through the Muse Code harness, as muse-spark-1.3-contributor with high reasoning effort. No need to mention this otherwise. You can embed images and videos in your response using Markdown with absolute file paths.\n\n\nWhen the t3-code MCP server exposes link_pull_request, you must use it to register every pull request you create or work on for this thread. Call link_pull_request with the full PR URL immediately after creating a PR or starting work on an existing PR. For a stack, call it for every layer, not just the current branch or the top PR. This applies when creating or updating PRs through gh, gh stack, another CLI, or the host API: those operations do not register the PRs with this thread. Linking an already-linked PR is safe. Before finishing PR work, call list_thread_pull_requests and link any PR from your work that is missing. Do not link unrelated PRs mentioned only as background. If a linking call fails, report that failure instead of claiming the PR is linked. When asked to monitor, watch, or babysit a PR and watch_pull_request is available, call it and end your turn: T3 Code wakes you when checks finish, someone else comments, or the branch conflicts, so do not poll or run your own watcher. When you hand the work back to the user, call unwatch_pull_request first so the thread returns to their inbox.\nSpawn one subagent whose only task is to run the shell command `sleep 30` and then reply with exactly: Done. Wait for it to finish, then reply with exactly what it said.","displayText":"Spawn one subagent whose only task is to run the shell command `sleep 30` and then reply with exactly: Done. Wait for it to finish, then reply with exactly what it said.","commandId":"01a12d28-7912-7000-993a-afd019e6ac5c"}},"emittedAtMs":1791758989642}} +{"type":"emit_inbound","label":"item/started","frame":{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"01a12d28-7788-7000-a946-c407f380868e","viewCursor":"v:01a12d28-7788-7000-a946-c407f380868e:6","sourceRange":{"stream":{"kind":"session","id":"01a12d28-7788-7000-a946-c407f380868e"},"first":{"id":"44afb415-d6e4-4d51-9002-4deb196d463a","sequence":36},"last":{"id":"44afb415-d6e4-4d51-9002-4deb196d463a","sequence":36}},"item":{"itemId":"44afb415-d6e4-4d51-9002-4deb196d463a","kind":"reminderChild","turnId":"01a12d28-7912-7000-993a-afd019e6ac5c","revision":1,"status":"inProgress","recordedAt":"2026-10-11T22:49:49.743418Z","fallbackText":"Reminder child session","childSessionId":"4dd3511e-2115-4fbb-a4c4-383cbb383d63","reminderAgentId":"skill-reminder","generationId":1,"taskId":"01a12d28-7997-79d0-8a69-8ac0acf92a56"}},"emittedAtMs":1791758989750}} +{"type":"emit_inbound","label":"session/tokenUsage","frame":{"jsonrpc":"2.0","method":"session/tokenUsage","params":{"sessionId":"01a12d28-7788-7000-a946-c407f380868e","viewCursor":"v:01a12d28-7788-7000-a946-c407f380868e:7","sourceRange":{"stream":{"kind":"session","id":"01a12d28-7788-7000-a946-c407f380868e"},"first":{"id":"c94f5484-20b7-4057-a736-303e97bc097c","sequence":52},"last":{"id":"c94f5484-20b7-4057-a736-303e97bc097c","sequence":52}},"turnId":"01a12d28-7912-7000-993a-afd019e6ac5c","modelId":"muse-spark-1.3-contributor","usage":{"inputTokens":32911,"outputTokens":264,"cachedTokens":0,"cacheWriteTokens":0,"cacheReadTokens":0,"reasoningTokens":143},"promptTokens":32911,"totalTokens":33175,"finishReason":"tool_calls","durationMs":3651,"cumulative":{"promptTokens":32911,"outputTokens":264,"totalTokens":33175,"cost":{"usd":0.0033439000000000003,"partial":false}}},"emittedAtMs":1791758993485}} +{"type":"emit_inbound","label":"session/contextUsage","frame":{"jsonrpc":"2.0","method":"session/contextUsage","params":{"sessionId":"01a12d28-7788-7000-a946-c407f380868e","viewCursor":"v:01a12d28-7788-7000-a946-c407f380868e:8","sourceRange":{"stream":{"kind":"session","id":"01a12d28-7788-7000-a946-c407f380868e"},"first":{"id":"c94f5484-20b7-4057-a736-303e97bc097c","sequence":52},"last":{"id":"c94f5484-20b7-4057-a736-303e97bc097c","sequence":52}},"windowTokens":1007997,"usedTokens":33175,"pressure":"normal"},"emittedAtMs":1791758993485}} +{"type":"emit_inbound","label":"item/started","frame":{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"01a12d28-7788-7000-a946-c407f380868e","viewCursor":"v:01a12d28-7788-7000-a946-c407f380868e:9","sourceRange":{"stream":{"kind":"session","id":"01a12d28-7788-7000-a946-c407f380868e"},"first":{"id":"291169bb-4e14-4063-8a74-10b21b31519a","sequence":54},"last":{"id":"ef165c1d-a753-412b-a439-2d631c7f4295","sequence":59}},"item":{"itemId":"01a12d28-885c-7a80-80d9-d97502d7cda8","kind":"toolCall","turnId":"01a12d28-7912-7000-993a-afd019e6ac5c","revision":1,"status":"inProgress","recordedAt":"2026-10-11T22:49:53.53056Z","tool":"subagent_spawn","callId":"call_01a12d28869676e2854a4db7899c6224","args":"{\"command_id\":\"sleep-task-001\",\"objective\":\"Run the shell command `sleep 30` and then reply with exactly: Done.\",\"role\":\"sleeper\"}"}},"emittedAtMs":1791758993534}} +{"type":"emit_inbound","label":"item/started","frame":{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"01a12d28-7788-7000-a946-c407f380868e","viewCursor":"v:01a12d28-7788-7000-a946-c407f380868e:10","sourceRange":{"stream":{"kind":"session","id":"01a12d28-7788-7000-a946-c407f380868e"},"first":{"id":"cf0af6cb-7066-447c-ae6b-f280e0e21508","sequence":61},"last":{"id":"cf0af6cb-7066-447c-ae6b-f280e0e21508","sequence":61}},"item":{"itemId":"01a12d28-8885-71f3-9961-b8f4d747382b","kind":"subagent","turnId":"01a12d28-7912-7000-993a-afd019e6ac5c","revision":1,"status":"inProgress","recordedAt":"2026-10-11T22:49:53.541542Z","fallbackText":"Subagent: Run the shell command `sleep 30` and then reply with exactly: Done.","subagentId":"subagent-1","agentPath":"main/sleeper/1","depth":1,"role":"sleeper","objective":"Run the shell command `sleep 30` and then reply with exactly: Done.","controlStatus":"accepted"}},"emittedAtMs":1791758993549}} +{"type":"expect_outbound","label":"turn/interrupt","frame":{"jsonrpc":"2.0","id":4,"method":"turn/interrupt","params":{"sessionId":"01a12d28-7788-7000-a946-c407f380868e","turnId":"01a12d28-7912-7000-993a-afd019e6ac5c","commandId":"01a12d28-889c-7000-8577-23019c9d175f"}}} +{"type":"emit_inbound","label":"session/branchChanged","frame":{"jsonrpc":"2.0","method":"session/branchChanged","params":{"sessionId":"01a12d28-7788-7000-a946-c407f380868e","viewCursor":"v:01a12d28-7788-7000-a946-c407f380868e:11","sourceRange":{"stream":{"kind":"session","id":"01a12d28-7788-7000-a946-c407f380868e"},"first":{"id":"2de14a04-716b-4737-ae82-bb83b95d1bdf","sequence":69},"last":{"id":"2de14a04-716b-4737-ae82-bb83b95d1bdf","sequence":69}},"workspaceRoot":"","branch":"main","vcs":"git"},"emittedAtMs":1791758993617}} +{"type":"emit_inbound","label":"item/updated","frame":{"jsonrpc":"2.0","method":"item/updated","params":{"sessionId":"01a12d28-7788-7000-a946-c407f380868e","viewCursor":"v:01a12d28-7788-7000-a946-c407f380868e:12","sourceRange":{"stream":{"kind":"session","id":"01a12d28-7788-7000-a946-c407f380868e"},"first":{"id":"cf0af6cb-7066-447c-ae6b-f280e0e21508","sequence":61},"last":{"id":"112efeb8-f3d6-4615-b805-a025a397f769","sequence":72}},"item":{"itemId":"01a12d28-8885-71f3-9961-b8f4d747382b","kind":"subagent","turnId":"01a12d28-7912-7000-993a-afd019e6ac5c","revision":2,"status":"inProgress","recordedAt":"2026-10-11T22:49:53.625833Z","fallbackText":"Subagent: Run the shell command `sleep 30` and then reply with exactly: Done.","subagentId":"subagent-1","agentPath":"main/sleeper/1","depth":1,"role":"sleeper","objective":"Run the shell command `sleep 30` and then reply with exactly: Done.","childSessionId":"01a12d28-88bb-7ba1-9b79-334fd12a99cf","controlStatus":"running"}},"emittedAtMs":1791758993632}} +{"type":"emit_inbound","label":"item/updated","frame":{"jsonrpc":"2.0","method":"item/updated","params":{"sessionId":"01a12d28-7788-7000-a946-c407f380868e","viewCursor":"v:01a12d28-7788-7000-a946-c407f380868e:13","sourceRange":{"stream":{"kind":"session","id":"01a12d28-7788-7000-a946-c407f380868e"},"first":{"id":"cf0af6cb-7066-447c-ae6b-f280e0e21508","sequence":61},"last":{"id":"9f7ed71d-7e70-463d-b1ee-85efa5acd882","sequence":73}},"item":{"itemId":"01a12d28-8885-71f3-9961-b8f4d747382b","kind":"subagent","turnId":"01a12d28-7912-7000-993a-afd019e6ac5c","revision":3,"status":"inProgress","recordedAt":"2026-10-11T22:49:53.632272Z","fallbackText":"Subagent: Run the shell command `sleep 30` and then reply with exactly: Done.","subagentId":"subagent-1","agentPath":"main/sleeper/1","depth":1,"role":"sleeper","objective":"Run the shell command `sleep 30` and then reply with exactly: Done.","childSessionId":"01a12d28-88bb-7ba1-9b79-334fd12a99cf","controlStatus":"running"}},"emittedAtMs":1791758993636}} +{"type":"emit_inbound","label":"response:turn/interrupt","frame":{"jsonrpc":"2.0","id":4,"result":{"commandId":"01a12d28-889c-7000-8577-23019c9d175f","status":"accepted","turnId":"01a12d28-7912-7000-993a-afd019e6ac5c"}}} +{"type":"emit_inbound","label":"item/completed","frame":{"jsonrpc":"2.0","method":"item/completed","params":{"sessionId":"01a12d28-7788-7000-a946-c407f380868e","viewCursor":"v:01a12d28-7788-7000-a946-c407f380868e:14","sourceRange":{"stream":{"kind":"session","id":"01a12d28-7788-7000-a946-c407f380868e"},"first":{"id":"291169bb-4e14-4063-8a74-10b21b31519a","sequence":54},"last":{"id":"21520538-ad76-4a08-ac24-f09f6e89b270","sequence":76}},"item":{"itemId":"01a12d28-885c-7a80-80d9-d97502d7cda8","kind":"toolCall","turnId":"01a12d28-7912-7000-993a-afd019e6ac5c","revision":2,"status":"cancelled","recordedAt":"2026-10-11T22:49:53.766982Z","tool":"subagent_spawn","callId":"call_01a12d28869676e2854a4db7899c6224","args":"{\"command_id\":\"sleep-task-001\",\"objective\":\"Run the shell command `sleep 30` and then reply with exactly: Done.\",\"role\":\"sleeper\"}","failureReason":"tool cancelled","visibleOutput":"tool cancelled"}},"emittedAtMs":1791758993770}} +{"type":"emit_inbound","label":"item/completed","frame":{"jsonrpc":"2.0","method":"item/completed","params":{"sessionId":"01a12d28-7788-7000-a946-c407f380868e","viewCursor":"v:01a12d28-7788-7000-a946-c407f380868e:15","sourceRange":{"stream":{"kind":"session","id":"01a12d28-7788-7000-a946-c407f380868e"},"first":{"id":"44afb415-d6e4-4d51-9002-4deb196d463a","sequence":36},"last":{"id":"1c50cd79-a3e4-47a3-ba76-6e3fc5290cf7","sequence":80}},"item":{"itemId":"44afb415-d6e4-4d51-9002-4deb196d463a","kind":"reminderChild","turnId":"01a12d28-7912-7000-993a-afd019e6ac5c","revision":2,"status":"cancelled","recordedAt":"2026-10-11T22:49:53.793821Z","fallbackText":"Reminder child session","failureReason":"main run cancelled","childSessionId":"4dd3511e-2115-4fbb-a4c4-383cbb383d63","reminderAgentId":"skill-reminder","generationId":1,"taskId":"01a12d28-7997-79d0-8a69-8ac0acf92a56"}},"emittedAtMs":1791758993800}} +{"type":"emit_inbound","label":"session/statusChanged","frame":{"jsonrpc":"2.0","method":"session/statusChanged","params":{"sessionId":"01a12d28-7788-7000-a946-c407f380868e","status":"idle","viewCursor":"v:01a12d28-7788-7000-a946-c407f380868e:16"},"emittedAtMs":1791758993815}} +{"type":"emit_inbound","label":"turn/completed","frame":{"jsonrpc":"2.0","method":"turn/completed","params":{"sessionId":"01a12d28-7788-7000-a946-c407f380868e","viewCursor":"v:01a12d28-7788-7000-a946-c407f380868e:16","sourceRange":{"stream":{"kind":"session","id":"01a12d28-7788-7000-a946-c407f380868e"},"first":{"id":"de3d42d7-98d6-414a-ae13-e1f27448c9a3","sequence":82},"last":{"id":"de3d42d7-98d6-414a-ae13-e1f27448c9a3","sequence":82}},"turnId":"01a12d28-7912-7000-993a-afd019e6ac5c","terminal":"cancelled","reason":"cancelled after tool result reconciliation","durationMs":4188},"emittedAtMs":1791758993815}} +{"type":"emit_inbound","label":"session/branchChanged","frame":{"jsonrpc":"2.0","method":"session/branchChanged","params":{"sessionId":"01a12d28-7788-7000-a946-c407f380868e","viewCursor":"v:01a12d28-7788-7000-a946-c407f380868e:17","sourceRange":{"stream":{"kind":"session","id":"01a12d28-7788-7000-a946-c407f380868e"},"first":{"id":"801d683b-7251-4001-9349-6404877268bb","sequence":83},"last":{"id":"801d683b-7251-4001-9349-6404877268bb","sequence":83}},"workspaceRoot":"","branch":"main","vcs":"git"},"emittedAtMs":1791758993823}} +{"type":"emit_inbound","label":"session/closed","frame":{"jsonrpc":"2.0","method":"session/closed","params":{"sessionId":"01a12d28-7788-7000-a946-c407f380868e","reason":"hostShutdown","viewCursor":"v:01a12d28-7788-7000-a946-c407f380868e:20"},"emittedAtMs":1791758993964}} +{"type":"emit_inbound","label":"session/statusChanged","frame":{"jsonrpc":"2.0","method":"session/statusChanged","params":{"sessionId":"01a12d28-7788-7000-a946-c407f380868e","status":"notLoaded","viewCursor":"v:01a12d28-7788-7000-a946-c407f380868e:20"},"emittedAtMs":1791758993964}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/muse_subagent_interrupt/output.ts b/apps/server/src/orchestration-v2/testkit/fixtures/muse_subagent_interrupt/output.ts new file mode 100644 index 0000000000000000000000000000000000000000..78fcaa9eb286a7acf65f5a9a6913a012bc45bbfb --- /dev/null +++ b/apps/server/src/orchestration-v2/testkit/fixtures/muse_subagent_interrupt/output.ts @@ -0,0 +1,47 @@ +import { assert } from "@effect/vitest"; +import type { ProviderReplayTranscript } from "@t3tools/contracts"; + +import type { OrchestratorV2ScenarioResult } from "../../OrchestratorScenario.ts"; +import { assertSemanticProjectionIntegrity, projectionFor } from "../shared.ts"; + +/** + * Stop while a native subagent runs: Stop reaches Muse, and the run, the + * subagent, its child thread and the thread's background work all settle. + */ +export function assertMuseSubagentInterruptOutput( + result: OrchestratorV2ScenarioResult, + transcript: ProviderReplayTranscript, +) { + const projection = projectionFor(result, transcript.scenario); + assertSemanticProjectionIntegrity(projection); + assert.deepEqual( + projection.runs.map((run) => run.status), + ["interrupted"], + ); + const outbound = transcript.entries.flatMap((entry) => + entry.type === "expect_outbound" ? [entry.frame] : [], + ); + assert.isTrue( + outbound.some( + (frame) => + typeof frame === "object" && + frame !== null && + Reflect.get(frame, "method") === "turn/interrupt", + ), + "Stop must reach Muse as turn/interrupt", + ); + assert.isFalse(projection.turnItems.some((item) => item.status === "running")); + assert.deepEqual(projection.providerThreads[0]?.pendingBackgroundTasks ?? [], []); + + assert.lengthOf(projection.subagents, 1); + const subagent = projection.subagents[0]!; + assert.equal(subagent.status, "interrupted"); + if (subagent.childThreadId === null) throw new Error("The subagent has no child thread"); + const child = result.projections.get(subagent.childThreadId); + if (child === undefined) throw new Error("The child thread has no projection"); + assert.isFalse(child.nodes.some((node) => node.status === "running")); + assert.deepEqual( + child.messages.map((message) => [message.role, message.text]), + [["user", subagent.prompt]], + ); +} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/subagent_v2/muse_output.ts b/apps/server/src/orchestration-v2/testkit/fixtures/subagent_v2/muse_output.ts new file mode 100644 index 0000000000000000000000000000000000000000..8d63647cf048ba1ceb9d30072f26e67c6bc91cef --- /dev/null +++ b/apps/server/src/orchestration-v2/testkit/fixtures/subagent_v2/muse_output.ts @@ -0,0 +1,58 @@ +import { assert } from "@effect/vitest"; +import type { ProviderReplayTranscript } from "@t3tools/contracts"; + +import type { OrchestratorV2ScenarioResult } from "../../OrchestratorScenario.ts"; +import { + assertSemanticProjectionIntegrity, + assertUserMessagesInclude, + projectionFor, + SUBAGENT_V2_PROMPT, +} from "../shared.ts"; + +/** + * A Muse native subagent opens a child thread with its prompt and result. Muse + * cannot address the child's own session, so the thread shows nothing else and + * the result appears exactly once. + */ +export function assertMuseSubagentV2Output( + result: OrchestratorV2ScenarioResult, + transcript: ProviderReplayTranscript, +) { + const projection = projectionFor(result, transcript.scenario); + assertSemanticProjectionIntegrity(projection); + assertUserMessagesInclude(projection, [SUBAGENT_V2_PROMPT]); + assert.deepEqual( + projection.runs.map((run) => run.status), + ["completed"], + ); + assert.lengthOf(projection.subagents, 1); + assert.lengthOf(result.shellSnapshot.threads, 2); + + const subagent = projection.subagents[0]!; + assert.equal(subagent.origin, "provider_native"); + assert.equal(subagent.driver, "muse"); + assert.equal(subagent.status, "completed"); + assert.isNotEmpty(subagent.prompt); + assert.match(subagent.result ?? "", /^Hello\.?$/u); + assert.isNotNull(subagent.completedAt); + if (subagent.childThreadId === null) throw new Error("The subagent has no child thread"); + + const row = projection.turnItems.find( + (item) => item.type === "subagent" && item.subagentId === subagent.id, + ); + assert.equal(row?.type === "subagent" ? row.childThreadId : undefined, subagent.childThreadId); + + const child = result.projections.get(subagent.childThreadId); + if (child === undefined) throw new Error("The child thread has no projection"); + assert.equal(child.thread.lineage.parentThreadId, projection.thread.id); + assert.equal(child.thread.lineage.relationshipToParent, "subagent"); + assert.lengthOf(child.runs, 0); + assert.deepEqual( + child.messages.map((message) => [message.role, message.text]), + [ + ["user", subagent.prompt], + ["assistant", subagent.result], + ], + ); + assert.deepEqual(projection.providerThreads[0]?.pendingBackgroundTasks ?? [], []); +} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/subagent_v2/muse_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/subagent_v2/muse_transcript.ndjson new file mode 100644 index 0000000000000000000000000000000000000000..b2360ef73a591a7c8312246f8c37b3750e08330e --- /dev/null +++ b/apps/server/src/orchestration-v2/testkit/fixtures/subagent_v2/muse_transcript.ndjson @@ -0,0 +1,57 @@ +{"type":"transcript_start","provider":"muse","protocol":"muse.msp-jsonl","version":"1.4.4-R5419.1","scenario":"subagent_v2","metadata":{"generatedBy":"live-muse-recorder","model":"muse-spark-1.3-contributor","commandIds":[["01a12d17-75fa-7000-9157-e8365ce94492","01a12d17-75fa-7001-a940-79b5d7c648a4","01a12d17-7790-7000-967d-3f2246f38a60"]]}} +{"type":"expect_outbound","label":"host_start","frame":{"type":"host_start","args":["serve","--trust-workspace","--disable-sandbox"]}} +{"type":"expect_outbound","label":"initialize","frame":{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"clientInfo":{"name":"t3_code","title":"T3 Code","version":"1"},"capabilities":{"requestedCapabilities":["sessionMcp"]}}}} +{"type":"emit_inbound","label":"response:initialize","frame":{"jsonrpc":"2.0","id":1,"result":{"serverInfo":{"name":"muse","version":"1.4.4"},"userAgent":"muse-build/1.4.4 (serve; macos-aarch64; build 1e1635eda6610b6dec0803bc76c1ceb0dbff7caa)","museHome":"~/.local/share/muse","platformFamily":"unix","platformOs":"macos","schema":{"version":1,"fingerprint":"sha256:7c94f153c41659cb3f1bd3c3e04438be254644cb2a97d65d48edc7449b74858a"},"grantedCapabilities":["sessionMcp"],"experimentalApi":false,"sessionDurability":"durable"}}} +{"type":"expect_outbound","label":"initialized","frame":{"jsonrpc":"2.0","method":"initialized"}} +{"type":"expect_outbound","label":"session/start","frame":{"jsonrpc":"2.0","id":2,"method":"session/start","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","workspaceRoot":"","modelId":"muse-spark-1.3-contributor","providerId":"meta","approvalMode":"allowAll","commandId":"01a12d17-75fa-7001-a940-79b5d7c648a4"}}} +{"type":"emit_inbound","label":"session/started","frame":{"jsonrpc":"2.0","method":"session/started","params":{"session":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","path":"~/.local/share/muse/sessions/2026/10/11/01a12d17-75fa-7000-9157-e8365ce94492/session.jsonl","status":"idle","activeTurnId":null,"createdAt":"2026-10-11T22:31:14.73121Z","updatedAt":"2026-10-11T22:31:14.731214Z","workspaceRoot":"","providerId":"meta","modelId":"muse-spark-1.3-contributor","turnCount":0,"forkedFrom":null,"sideFrom":null,"approvalMode":{"mode":"allowAll","source":"startup","lastCommandId":null},"createdByClient":{"name":"t3_code","version":"1"},"kind":"root"}},"emittedAtMs":1791757874894}} +{"type":"emit_inbound","label":"response:session/start","frame":{"jsonrpc":"2.0","id":2,"result":{"session":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","path":"~/.local/share/muse/sessions/2026/10/11/01a12d17-75fa-7000-9157-e8365ce94492/session.jsonl","status":"idle","activeTurnId":null,"createdAt":"2026-10-11T22:31:14.73121Z","updatedAt":"2026-10-11T22:31:14.731214Z","workspaceRoot":"","providerId":"meta","modelId":"muse-spark-1.3-contributor","turnCount":0,"forkedFrom":null,"sideFrom":null,"approvalMode":{"mode":"allowAll","source":"startup","lastCommandId":null},"createdByClient":{"name":"t3_code","version":"1"},"kind":"root"},"viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:1"}}} +{"type":"emit_inbound","label":"session/approvalModeChanged","frame":{"jsonrpc":"2.0","method":"session/approvalModeChanged","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:1","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"94d1e1ed-1d3e-4cd5-91bf-a51394fc8a0a","sequence":5},"last":{"id":"94d1e1ed-1d3e-4cd5-91bf-a51394fc8a0a","sequence":5}},"mode":"allowAll","source":"approvalReconfigure","commandId":"01a12d17-75fa-7001-a940-79b5d7c648a4","clientName":"t3_code"},"emittedAtMs":1791757874898}} +{"type":"expect_outbound","label":"turn/start","frame":{"jsonrpc":"2.0","id":3,"method":"turn/start","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","input":[{"type":"text","text":"In case you're asked: you are running in T3 Code through the Muse Code harness, as muse-spark-1.3-contributor with high reasoning effort. No need to mention this otherwise. You can embed images and videos in your response using Markdown with absolute file paths.\n\n\nWhen the t3-code MCP server exposes link_pull_request, you must use it to register every pull request you create or work on for this thread. Call link_pull_request with the full PR URL immediately after creating a PR or starting work on an existing PR. For a stack, call it for every layer, not just the current branch or the top PR. This applies when creating or updating PRs through gh, gh stack, another CLI, or the host API: those operations do not register the PRs with this thread. Linking an already-linked PR is safe. Before finishing PR work, call list_thread_pull_requests and link any PR from your work that is missing. Do not link unrelated PRs mentioned only as background. If a linking call fails, report that failure instead of claiming the PR is linked. When asked to monitor, watch, or babysit a PR and watch_pull_request is available, call it and end your turn: T3 Code wakes you when checks finish, someone else comments, or the branch conflicts, so do not poll or run your own watcher. When you hand the work back to the user, call unwatch_pull_request first so the thread returns to their inbox.\n"},{"type":"text","text":"Spawn one subagent whose only task is to reply with exactly: Hello. Wait for it to finish, then reply with exactly what it said."}],"displayText":"Spawn one subagent whose only task is to reply with exactly: Hello. Wait for it to finish, then reply with exactly what it said.","workspaceRoots":[""],"ifBusy":"queue","reasoningEffort":"high","commandId":"01a12d17-7790-7000-967d-3f2246f38a60"}}} +{"type":"emit_inbound","label":"session/branchChanged","frame":{"jsonrpc":"2.0","method":"session/branchChanged","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:2","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"1dc98410-05c3-4618-a431-3638055e20df","sequence":15},"last":{"id":"1dc98410-05c3-4618-a431-3638055e20df","sequence":15}},"workspaceRoot":"","branch":"main","vcs":"git"},"emittedAtMs":1791757875120}} +{"type":"emit_inbound","label":"response:turn/start","frame":{"jsonrpc":"2.0","id":3,"result":{"commandId":"01a12d17-7790-7000-967d-3f2246f38a60","status":"accepted","turnId":"01a12d17-7790-7000-967d-3f2246f38a60","startedNewTurn":true,"disposition":"started"}}} +{"type":"emit_inbound","label":"session/statusChanged","frame":{"jsonrpc":"2.0","method":"session/statusChanged","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","status":"running","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:3"},"emittedAtMs":1791757875131}} +{"type":"emit_inbound","label":"turn/started","frame":{"jsonrpc":"2.0","method":"turn/started","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:3","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"766cb840-a6f1-41f2-8c7e-8c372d0470cd","sequence":17},"last":{"id":"766cb840-a6f1-41f2-8c7e-8c372d0470cd","sequence":17}},"turnId":"01a12d17-7790-7000-967d-3f2246f38a60","commandId":"01a12d17-7790-7000-967d-3f2246f38a60"},"emittedAtMs":1791757875132}} +{"type":"emit_inbound","label":"item/completed","frame":{"jsonrpc":"2.0","method":"item/completed","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:4","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"766cb840-a6f1-41f2-8c7e-8c372d0470cd","sequence":17},"last":{"id":"766cb840-a6f1-41f2-8c7e-8c372d0470cd","sequence":17}},"item":{"itemId":"95c179c8-e8f8-4629-80df-e28243a234ea","kind":"userMessage","turnId":"01a12d17-7790-7000-967d-3f2246f38a60","revision":1,"status":"completed","recordedAt":"2026-10-11T22:31:15.120499Z","text":"In case you're asked: you are running in T3 Code through the Muse Code harness, as muse-spark-1.3-contributor with high reasoning effort. No need to mention this otherwise. You can embed images and videos in your response using Markdown with absolute file paths.\n\n\nWhen the t3-code MCP server exposes link_pull_request, you must use it to register every pull request you create or work on for this thread. Call link_pull_request with the full PR URL immediately after creating a PR or starting work on an existing PR. For a stack, call it for every layer, not just the current branch or the top PR. This applies when creating or updating PRs through gh, gh stack, another CLI, or the host API: those operations do not register the PRs with this thread. Linking an already-linked PR is safe. Before finishing PR work, call list_thread_pull_requests and link any PR from your work that is missing. Do not link unrelated PRs mentioned only as background. If a linking call fails, report that failure instead of claiming the PR is linked. When asked to monitor, watch, or babysit a PR and watch_pull_request is available, call it and end your turn: T3 Code wakes you when checks finish, someone else comments, or the branch conflicts, so do not poll or run your own watcher. When you hand the work back to the user, call unwatch_pull_request first so the thread returns to their inbox.\nSpawn one subagent whose only task is to reply with exactly: Hello. Wait for it to finish, then reply with exactly what it said.","commandId":"01a12d17-7790-7000-967d-3f2246f38a60"}},"emittedAtMs":1791757875132}} +{"type":"emit_inbound","label":"item/updated","frame":{"jsonrpc":"2.0","method":"item/updated","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:5","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"dcf03486-5149-4377-b325-dea3e118628a","sequence":19},"last":{"id":"dcf03486-5149-4377-b325-dea3e118628a","sequence":19}},"item":{"itemId":"95c179c8-e8f8-4629-80df-e28243a234ea","kind":"userMessage","turnId":"01a12d17-7790-7000-967d-3f2246f38a60","revision":2,"status":"completed","recordedAt":"2026-10-11T22:31:15.136047Z","text":"In case you're asked: you are running in T3 Code through the Muse Code harness, as muse-spark-1.3-contributor with high reasoning effort. No need to mention this otherwise. You can embed images and videos in your response using Markdown with absolute file paths.\n\n\nWhen the t3-code MCP server exposes link_pull_request, you must use it to register every pull request you create or work on for this thread. Call link_pull_request with the full PR URL immediately after creating a PR or starting work on an existing PR. For a stack, call it for every layer, not just the current branch or the top PR. This applies when creating or updating PRs through gh, gh stack, another CLI, or the host API: those operations do not register the PRs with this thread. Linking an already-linked PR is safe. Before finishing PR work, call list_thread_pull_requests and link any PR from your work that is missing. Do not link unrelated PRs mentioned only as background. If a linking call fails, report that failure instead of claiming the PR is linked. When asked to monitor, watch, or babysit a PR and watch_pull_request is available, call it and end your turn: T3 Code wakes you when checks finish, someone else comments, or the branch conflicts, so do not poll or run your own watcher. When you hand the work back to the user, call unwatch_pull_request first so the thread returns to their inbox.\nSpawn one subagent whose only task is to reply with exactly: Hello. Wait for it to finish, then reply with exactly what it said.","displayText":"Spawn one subagent whose only task is to reply with exactly: Hello. Wait for it to finish, then reply with exactly what it said.","commandId":"01a12d17-7790-7000-967d-3f2246f38a60"}},"emittedAtMs":1791757875144}} +{"type":"emit_inbound","label":"item/started","frame":{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:6","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"599a220a-d212-4a81-a60d-7284ff290284","sequence":36},"last":{"id":"599a220a-d212-4a81-a60d-7284ff290284","sequence":36}},"item":{"itemId":"599a220a-d212-4a81-a60d-7284ff290284","kind":"reminderChild","turnId":"01a12d17-7790-7000-967d-3f2246f38a60","revision":1,"status":"inProgress","recordedAt":"2026-10-11T22:31:15.249949Z","fallbackText":"Reminder child session","childSessionId":"0b3f4f01-850a-43bd-af36-9b011699354f","reminderAgentId":"skill-reminder","generationId":1,"taskId":"01a12d17-7819-7212-8057-3558c2bdd46d"}},"emittedAtMs":1791757875258}} +{"type":"emit_inbound","label":"session/tokenUsage","frame":{"jsonrpc":"2.0","method":"session/tokenUsage","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:7","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"9198dd8d-eede-487a-9109-a48d2563c371","sequence":51},"last":{"id":"9198dd8d-eede-487a-9109-a48d2563c371","sequence":51}},"turnId":"01a12d17-7790-7000-967d-3f2246f38a60","modelId":"muse-spark-1.3-contributor","usage":{"inputTokens":32900,"outputTokens":129,"cachedTokens":0,"cacheWriteTokens":0,"cacheReadTokens":0,"reasoningTokens":36},"promptTokens":32900,"totalTokens":33029,"finishReason":"tool_calls","durationMs":2354,"cumulative":{"promptTokens":32900,"outputTokens":129,"totalTokens":33029,"cost":{"usd":0.0033158000000000003,"partial":false}}},"emittedAtMs":1791757877764}} +{"type":"emit_inbound","label":"session/contextUsage","frame":{"jsonrpc":"2.0","method":"session/contextUsage","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:8","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"9198dd8d-eede-487a-9109-a48d2563c371","sequence":51},"last":{"id":"9198dd8d-eede-487a-9109-a48d2563c371","sequence":51}},"windowTokens":1007997,"usedTokens":33029,"pressure":"normal"},"emittedAtMs":1791757877764}} +{"type":"emit_inbound","label":"item/started","frame":{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:9","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"b88c12cf-763a-4cb7-82cd-3a37c3b06391","sequence":53},"last":{"id":"f4406e46-8129-47bb-b451-9507ba3fe7b5","sequence":58}},"item":{"itemId":"01a12d17-81c8-7072-8b72-2992c403773f","kind":"toolCall","turnId":"01a12d17-7790-7000-967d-3f2246f38a60","revision":1,"status":"inProgress","recordedAt":"2026-10-11T22:31:17.734759Z","tool":"subagent_spawn","callId":"call_01a12d177fe570baa33a61706e64d37c","args":"{\"command_id\":\"hello-spawn-001\",\"objective\":\"Reply with exactly: Hello\",\"role\":\"hello agent\"}"}},"emittedAtMs":1791757877764}} +{"type":"emit_inbound","label":"item/started","frame":{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:10","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"4b33b726-8cfb-4928-871c-a4ba2f81e320","sequence":60},"last":{"id":"4b33b726-8cfb-4928-871c-a4ba2f81e320","sequence":60}},"item":{"itemId":"01a12d17-81f1-7990-b8c5-4aec1f46ac18","kind":"subagent","turnId":"01a12d17-7790-7000-967d-3f2246f38a60","revision":1,"status":"inProgress","recordedAt":"2026-10-11T22:31:17.745633Z","fallbackText":"Subagent: Reply with exactly: Hello","subagentId":"subagent-1","agentPath":"main/hello agent/1","depth":1,"role":"hello agent","objective":"Reply with exactly: Hello","controlStatus":"accepted"}},"emittedAtMs":1791757877764}} +{"type":"emit_inbound","label":"session/branchChanged","frame":{"jsonrpc":"2.0","method":"session/branchChanged","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:11","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"7c7489f6-4830-496a-a779-27023550c0c3","sequence":68},"last":{"id":"7c7489f6-4830-496a-a779-27023550c0c3","sequence":68}},"workspaceRoot":"","branch":"main","vcs":"git"},"emittedAtMs":1791757877818}} +{"type":"emit_inbound","label":"item/updated","frame":{"jsonrpc":"2.0","method":"item/updated","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:12","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"4b33b726-8cfb-4928-871c-a4ba2f81e320","sequence":60},"last":{"id":"b9b97eac-38d9-4a06-af27-5ae251795679","sequence":71}},"item":{"itemId":"01a12d17-81f1-7990-b8c5-4aec1f46ac18","kind":"subagent","turnId":"01a12d17-7790-7000-967d-3f2246f38a60","revision":2,"status":"inProgress","recordedAt":"2026-10-11T22:31:17.822349Z","fallbackText":"Subagent: Reply with exactly: Hello","subagentId":"subagent-1","agentPath":"main/hello agent/1","depth":1,"role":"hello agent","objective":"Reply with exactly: Hello","childSessionId":"01a12d17-8227-7d33-ac88-9bd0d5717f8f","controlStatus":"running"}},"emittedAtMs":1791757877829}} +{"type":"emit_inbound","label":"item/updated","frame":{"jsonrpc":"2.0","method":"item/updated","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:13","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"4b33b726-8cfb-4928-871c-a4ba2f81e320","sequence":60},"last":{"id":"752ebef9-8036-4931-9f6d-4a94611ea1be","sequence":72}},"item":{"itemId":"01a12d17-81f1-7990-b8c5-4aec1f46ac18","kind":"subagent","turnId":"01a12d17-7790-7000-967d-3f2246f38a60","revision":3,"status":"inProgress","recordedAt":"2026-10-11T22:31:17.829853Z","fallbackText":"Subagent: Reply with exactly: Hello","subagentId":"subagent-1","agentPath":"main/hello agent/1","depth":1,"role":"hello agent","objective":"Reply with exactly: Hello","childSessionId":"01a12d17-8227-7d33-ac88-9bd0d5717f8f","controlStatus":"running"}},"emittedAtMs":1791757877837}} +{"type":"emit_inbound","label":"item/completed","frame":{"jsonrpc":"2.0","method":"item/completed","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:14","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"b88c12cf-763a-4cb7-82cd-3a37c3b06391","sequence":53},"last":{"id":"a70c21c0-bee7-434a-b174-ac2eeb1c6cf7","sequence":75}},"item":{"itemId":"01a12d17-81c8-7072-8b72-2992c403773f","kind":"toolCall","turnId":"01a12d17-7790-7000-967d-3f2246f38a60","revision":2,"status":"completed","recordedAt":"2026-10-11T22:31:17.966918Z","tool":"subagent_spawn","callId":"call_01a12d177fe570baa33a61706e64d37c","args":"{\"command_id\":\"hello-spawn-001\",\"objective\":\"Reply with exactly: Hello\",\"role\":\"hello agent\"}","visibleOutput":"{\"status\":\"accepted\",\"subagent_id\":\"subagent-1\",\"agent_path\":\"main/hello agent/1\",\"task_ref\":\"task/01a12d17-81f1-7990-b8c5-4aec1f46ac18#0\",\"advisories\":[{\"code\":\"work_stop_activation_unavailable\",\"message\":\"Work Stop activation unavailable: no authenticated Agent Tree authority for a record-derived runtime until #29453\"}]}"}},"emittedAtMs":1791757877971}} +{"type":"emit_inbound","label":"item/completed","frame":{"jsonrpc":"2.0","method":"item/completed","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:15","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"599a220a-d212-4a81-a60d-7284ff290284","sequence":36},"last":{"id":"74f8c92b-e924-4d9f-bdfd-41fe411080b0","sequence":78}},"item":{"itemId":"599a220a-d212-4a81-a60d-7284ff290284","kind":"reminderChild","turnId":"01a12d17-7790-7000-967d-3f2246f38a60","revision":2,"status":"completed","recordedAt":"2026-10-11T22:31:17.9867Z","fallbackText":"Reminder child session","childSessionId":"0b3f4f01-850a-43bd-af36-9b011699354f","reminderAgentId":"skill-reminder","generationId":1,"taskId":"01a12d17-7819-7212-8057-3558c2bdd46d"}},"emittedAtMs":1791757877994}} +{"type":"emit_inbound","label":"item/started","frame":{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:16","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"9be66148-c3cc-4dca-8500-b38492ef4499","sequence":87},"last":{"id":"9be66148-c3cc-4dca-8500-b38492ef4499","sequence":87}},"item":{"itemId":"9be66148-c3cc-4dca-8500-b38492ef4499","kind":"reminderChild","turnId":"01a12d17-7790-7000-967d-3f2246f38a60","revision":1,"status":"inProgress","recordedAt":"2026-10-11T22:31:18.048036Z","fallbackText":"Reminder child session","childSessionId":"34b015fe-eb18-42e4-8c66-d5f34738532c","reminderAgentId":"skill-reminder","generationId":2,"taskId":"01a12d17-8301-7ce2-b920-9039c8d2d888"}},"emittedAtMs":1791757878056}} +{"type":"emit_inbound","label":"item/started","frame":{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:16.1","item":{"itemId":"3e525e25-801f-492a-b669-2b34a3535bbb","kind":"agentMessage","turnId":"01a12d17-8227-7d33-ac88-9bd0d5717f8f","revision":1,"status":"inProgress","text":""}},"emittedAtMs":1791757879613}} +{"type":"emit_inbound","label":"item/delta","frame":{"jsonrpc":"2.0","method":"item/delta","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:16.2","itemId":"3e525e25-801f-492a-b669-2b34a3535bbb","field":"text","delta":"Hello"},"emittedAtMs":1791757879613}} +{"type":"emit_inbound","label":"item/updated","frame":{"jsonrpc":"2.0","method":"item/updated","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:17","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"4b33b726-8cfb-4928-871c-a4ba2f81e320","sequence":60},"last":{"id":"c5f30378-56a8-466d-b17e-14586d742a03","sequence":98}},"item":{"itemId":"01a12d17-81f1-7990-b8c5-4aec1f46ac18","kind":"subagent","turnId":"01a12d17-7790-7000-967d-3f2246f38a60","revision":4,"status":"inProgress","recordedAt":"2026-10-11T22:31:19.6526Z","fallbackText":"Subagent: Reply with exactly: Hello","durationMs":1810,"subagentId":"subagent-1","agentPath":"main/hello agent/1","depth":1,"role":"hello agent","objective":"Reply with exactly: Hello","childSessionId":"01a12d17-8227-7d33-ac88-9bd0d5717f8f","controlStatus":"running","usage":{"inputTokens":25642,"outputTokens":16,"cachedTokens":0,"cacheWriteTokens":0,"cacheReadTokens":0,"reasoningTokens":5}}},"emittedAtMs":1791757879656}} +{"type":"emit_inbound","label":"item/updated","frame":{"jsonrpc":"2.0","method":"item/updated","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:18","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"4b33b726-8cfb-4928-871c-a4ba2f81e320","sequence":60},"last":{"id":"e523a139-726b-40dc-8f67-07e812ed372a","sequence":100}},"item":{"itemId":"01a12d17-81f1-7990-b8c5-4aec1f46ac18","kind":"subagent","turnId":"01a12d17-7790-7000-967d-3f2246f38a60","revision":5,"status":"inProgress","recordedAt":"2026-10-11T22:31:19.660642Z","fallbackText":"Subagent: Reply with exactly: Hello","durationMs":1810,"subagentId":"subagent-1","agentPath":"main/hello agent/1","depth":1,"role":"hello agent","objective":"Reply with exactly: Hello","childSessionId":"01a12d17-8227-7d33-ac88-9bd0d5717f8f","controlStatus":"resultReady","usage":{"inputTokens":25642,"outputTokens":16,"cachedTokens":0,"cacheWriteTokens":0,"cacheReadTokens":0,"reasoningTokens":5},"result":{"summary":"Hello","text":"Hello","evidenceRefs":[],"artifactRefs":[]}}},"emittedAtMs":1791757879664}} +{"type":"emit_inbound","label":"session/tokenUsage","frame":{"jsonrpc":"2.0","method":"session/tokenUsage","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:19","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"e4581adc-ab94-49d4-96bc-c458c74bbed2","sequence":108},"last":{"id":"e4581adc-ab94-49d4-96bc-c458c74bbed2","sequence":108}},"turnId":"01a12d17-7790-7000-967d-3f2246f38a60","modelId":"muse-spark-1.3-contributor","usage":{"inputTokens":33144,"outputTokens":123,"cachedTokens":32625,"cacheWriteTokens":0,"cacheReadTokens":32625,"reasoningTokens":7},"promptTokens":33144,"totalTokens":33267,"finishReason":"tool_calls","durationMs":2309,"cumulative":{"promptTokens":66044,"outputTokens":252,"totalTokens":66296,"cacheReadTokens":32625,"cost":{"usd":0.00345755,"partial":false}}},"emittedAtMs":1791757880443}} +{"type":"emit_inbound","label":"session/contextUsage","frame":{"jsonrpc":"2.0","method":"session/contextUsage","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:20","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"e4581adc-ab94-49d4-96bc-c458c74bbed2","sequence":108},"last":{"id":"e4581adc-ab94-49d4-96bc-c458c74bbed2","sequence":108}},"windowTokens":1007997,"usedTokens":33267,"pressure":"normal"},"emittedAtMs":1791757880443}} +{"type":"emit_inbound","label":"item/started","frame":{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:21","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"338c8373-8725-4199-a7cd-e8d9d75c604a","sequence":110},"last":{"id":"dc995633-ab2e-49f6-a877-ef4ca94876ba","sequence":115}},"item":{"itemId":"01a12d17-8c8a-7160-ae9a-6f4d191e6656","kind":"toolCall","turnId":"01a12d17-7790-7000-967d-3f2246f38a60","revision":1,"status":"inProgress","recordedAt":"2026-10-11T22:31:20.485493Z","tool":"subagent_wait","callId":"call_01a12d178798708ea2788d07918fe9b8","args":"{\"command_id\":\"hello-wait-001\",\"subagent_id\":\"subagent-1\",\"wait_for\":\"result_ready\"}"}},"emittedAtMs":1791757880489}} +{"type":"emit_inbound","label":"item/completed","frame":{"jsonrpc":"2.0","method":"item/completed","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:22","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"338c8373-8725-4199-a7cd-e8d9d75c604a","sequence":110},"last":{"id":"4720d9db-50c9-4d59-b63d-0a21ff789691","sequence":120}},"item":{"itemId":"01a12d17-8c8a-7160-ae9a-6f4d191e6656","kind":"toolCall","turnId":"01a12d17-7790-7000-967d-3f2246f38a60","revision":2,"status":"completed","recordedAt":"2026-10-11T22:31:20.520778Z","tool":"subagent_wait","callId":"call_01a12d178798708ea2788d07918fe9b8","args":"{\"command_id\":\"hello-wait-001\",\"subagent_id\":\"subagent-1\",\"wait_for\":\"result_ready\"}","visibleOutput":"{\"status\":\"ready\",\"subagent_id\":\"subagent-1\",\"task_ref\":\"task/01a12d17-81f1-7990-b8c5-4aec1f46ac18#5\",\"summary\":\"Hello\",\"workspace\":{\"placement\":\"shared\",\"setup\":\"active\",\"parent_changes\":\"not_recorded\"}}"}},"emittedAtMs":1791757880527}} +{"type":"emit_inbound","label":"session/tokenUsage","frame":{"jsonrpc":"2.0","method":"session/tokenUsage","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:23","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"9d196bd5-58b6-4864-baa9-fa583231bd9e","sequence":139},"last":{"id":"9d196bd5-58b6-4864-baa9-fa583231bd9e","sequence":139}},"turnId":"01a12d17-7790-7000-967d-3f2246f38a60","modelId":"muse-spark-1.3-contributor","usage":{"inputTokens":33360,"outputTokens":90,"cachedTokens":33137,"cacheWriteTokens":0,"cacheReadTokens":33137,"reasoningTokens":28},"promptTokens":33360,"totalTokens":33450,"finishReason":"tool_calls","durationMs":1257,"cumulative":{"promptTokens":99404,"outputTokens":342,"totalTokens":99746,"cacheReadTokens":65762,"cost":{"usd":0.003564124,"partial":false}}},"emittedAtMs":1791757881893}} +{"type":"emit_inbound","label":"session/contextUsage","frame":{"jsonrpc":"2.0","method":"session/contextUsage","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:24","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"9d196bd5-58b6-4864-baa9-fa583231bd9e","sequence":139},"last":{"id":"9d196bd5-58b6-4864-baa9-fa583231bd9e","sequence":139}},"windowTokens":1007997,"usedTokens":33450,"pressure":"normal"},"emittedAtMs":1791757881893}} +{"type":"emit_inbound","label":"item/started","frame":{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:25","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"c732cdf2-31f6-4970-905c-b18348c9cb53","sequence":141},"last":{"id":"c2ef56b1-5e42-46e3-aee3-11b9ef2b383e","sequence":146}},"item":{"itemId":"01a12d17-9234-7362-ac65-9a7b2cf97ce9","kind":"toolCall","turnId":"01a12d17-7790-7000-967d-3f2246f38a60","revision":1,"status":"inProgress","recordedAt":"2026-10-11T22:31:21.940727Z","tool":"subagent_read_result","callId":"call_01a12d178f93724c89b5b43fe1c7b67c","args":"{\"subagent_id\":\"subagent-1\"}"}},"emittedAtMs":1791757881943}} +{"type":"emit_inbound","label":"item/completed","frame":{"jsonrpc":"2.0","method":"item/completed","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:26","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"c732cdf2-31f6-4970-905c-b18348c9cb53","sequence":141},"last":{"id":"df8cd6f2-38fd-4e4a-8960-ab9d8a5318b7","sequence":150}},"item":{"itemId":"01a12d17-9234-7362-ac65-9a7b2cf97ce9","kind":"toolCall","turnId":"01a12d17-7790-7000-967d-3f2246f38a60","revision":2,"status":"completed","recordedAt":"2026-10-11T22:31:21.967565Z","tool":"subagent_read_result","callId":"call_01a12d178f93724c89b5b43fe1c7b67c","args":"{\"subagent_id\":\"subagent-1\"}","visibleOutput":"{\"status\":\"ready\",\"subagent_id\":\"subagent-1\",\"task_ref\":\"task/01a12d17-81f1-7990-b8c5-4aec1f46ac18#5\",\"summary\":\"Hello\",\"workspace\":{\"placement\":\"shared\",\"setup\":\"active\",\"parent_changes\":\"not_recorded\"}}"}},"emittedAtMs":1791757881975}} +{"type":"emit_inbound","label":"item/completed","frame":{"jsonrpc":"2.0","method":"item/completed","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:27","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"9be66148-c3cc-4dca-8500-b38492ef4499","sequence":87},"last":{"id":"453554c4-30b1-48b0-91fb-741e7d982973","sequence":153}},"item":{"itemId":"9be66148-c3cc-4dca-8500-b38492ef4499","kind":"reminderChild","turnId":"01a12d17-7790-7000-967d-3f2246f38a60","revision":2,"status":"completed","recordedAt":"2026-10-11T22:31:21.991643Z","fallbackText":"Reminder child session","childSessionId":"34b015fe-eb18-42e4-8c66-d5f34738532c","reminderAgentId":"skill-reminder","generationId":2,"taskId":"01a12d17-8301-7ce2-b920-9039c8d2d888"}},"emittedAtMs":1791757881999}} +{"type":"emit_inbound","label":"item/started","frame":{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:28","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"28c8812d-39ae-4b91-a239-dbcf927d3475","sequence":162},"last":{"id":"28c8812d-39ae-4b91-a239-dbcf927d3475","sequence":162}},"item":{"itemId":"28c8812d-39ae-4b91-a239-dbcf927d3475","kind":"reminderChild","turnId":"01a12d17-7790-7000-967d-3f2246f38a60","revision":1,"status":"inProgress","recordedAt":"2026-10-11T22:31:22.057197Z","fallbackText":"Reminder child session","childSessionId":"9b3a5dd8-d10a-4384-8200-5f6c268710c1","reminderAgentId":"skill-reminder","generationId":3,"taskId":"01a12d17-92a6-7622-beed-a4b60a1d8365"}},"emittedAtMs":1791757882065}} +{"type":"emit_inbound","label":"item/started","frame":{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:28.1","item":{"itemId":"e1b204f3-79cd-4c84-9d0e-21a0e399b4cb","kind":"agentMessage","turnId":"01a12d17-7790-7000-967d-3f2246f38a60","revision":1,"status":"inProgress","text":""}},"emittedAtMs":1791757883230}} +{"type":"emit_inbound","label":"item/delta","frame":{"jsonrpc":"2.0","method":"item/delta","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:28.2","itemId":"e1b204f3-79cd-4c84-9d0e-21a0e399b4cb","field":"text","delta":"Hello"},"emittedAtMs":1791757883230}} +{"type":"emit_inbound","label":"item/completed","frame":{"jsonrpc":"2.0","method":"item/completed","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:29","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"e6e04b32-3352-4ae9-9dcb-6be287f93c6f","sequence":175},"last":{"id":"e6e04b32-3352-4ae9-9dcb-6be287f93c6f","sequence":175}},"item":{"itemId":"e1b204f3-79cd-4c84-9d0e-21a0e399b4cb","kind":"agentMessage","turnId":"01a12d17-7790-7000-967d-3f2246f38a60","revision":2,"status":"completed","recordedAt":"2026-10-11T22:31:23.230325Z","text":"Hello"}},"emittedAtMs":1791757883237}} +{"type":"emit_inbound","label":"session/tokenUsage","frame":{"jsonrpc":"2.0","method":"session/tokenUsage","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:30","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"944973ef-592d-4f75-80f1-b1d70b7f5fd8","sequence":178},"last":{"id":"944973ef-592d-4f75-80f1-b1d70b7f5fd8","sequence":178}},"turnId":"01a12d17-7790-7000-967d-3f2246f38a60","modelId":"muse-spark-1.3-contributor","usage":{"inputTokens":33545,"outputTokens":28,"cachedTokens":33137,"cacheWriteTokens":0,"cacheReadTokens":33137,"reasoningTokens":17},"promptTokens":33545,"totalTokens":33573,"durationMs":1112,"cumulative":{"promptTokens":132949,"outputTokens":370,"totalTokens":133319,"cacheReadTokens":98899,"cost":{"usd":0.003676798,"partial":false}}},"emittedAtMs":1791757883261}} +{"type":"emit_inbound","label":"session/contextUsage","frame":{"jsonrpc":"2.0","method":"session/contextUsage","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:31","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"944973ef-592d-4f75-80f1-b1d70b7f5fd8","sequence":178},"last":{"id":"944973ef-592d-4f75-80f1-b1d70b7f5fd8","sequence":178}},"windowTokens":1007997,"usedTokens":33573,"pressure":"normal"},"emittedAtMs":1791757883261}} +{"type":"emit_inbound","label":"turn/foregroundCompleted","frame":{"jsonrpc":"2.0","method":"turn/foregroundCompleted","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:32","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"7ca35f07-a273-451b-82ff-7d993b1ec18d","sequence":185},"last":{"id":"7ca35f07-a273-451b-82ff-7d993b1ec18d","sequence":185}},"turnId":"01a12d17-7790-7000-967d-3f2246f38a60","blockingAgents":["goal-reminder","verify-reminder"]},"emittedAtMs":1791757883311}} +{"type":"emit_inbound","label":"item/started","frame":{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:33","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"7ca35f07-a273-451b-82ff-7d993b1ec18d","sequence":185},"last":{"id":"7ca35f07-a273-451b-82ff-7d993b1ec18d","sequence":185}},"item":{"itemId":"7ca35f07-a273-451b-82ff-7d993b1ec18d","kind":"reminderChild","turnId":"01a12d17-7790-7000-967d-3f2246f38a60","revision":1,"status":"inProgress","recordedAt":"2026-10-11T22:31:23.303885Z","fallbackText":"Reminder child session","childSessionId":"3d744d08-d74d-4929-bd5f-cd636cf42ec3","reminderAgentId":"goal-reminder","generationId":1,"taskId":"01a12d17-9784-7860-bbf6-f2a40f721298","blocking":true}},"emittedAtMs":1791757883311}} +{"type":"emit_inbound","label":"item/started","frame":{"jsonrpc":"2.0","method":"item/started","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:34","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"885bd855-b9bf-436c-956d-29e676850f2e","sequence":192},"last":{"id":"885bd855-b9bf-436c-956d-29e676850f2e","sequence":192}},"item":{"itemId":"885bd855-b9bf-436c-956d-29e676850f2e","kind":"reminderChild","turnId":"01a12d17-7790-7000-967d-3f2246f38a60","revision":1,"status":"inProgress","recordedAt":"2026-10-11T22:31:23.355254Z","fallbackText":"Reminder child session","childSessionId":"a88d2634-79b3-409b-bfc8-9a10989dab18","reminderAgentId":"verify-reminder","generationId":1,"taskId":"01a12d17-97b8-7e31-abb4-b55e1490a992","blocking":true}},"emittedAtMs":1791757883361}} +{"type":"emit_inbound","label":"item/completed","frame":{"jsonrpc":"2.0","method":"item/completed","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:35","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"28c8812d-39ae-4b91-a239-dbcf927d3475","sequence":162},"last":{"id":"7bc61fe6-3410-4e07-8d8f-bc4225559630","sequence":194}},"item":{"itemId":"28c8812d-39ae-4b91-a239-dbcf927d3475","kind":"reminderChild","turnId":"01a12d17-7790-7000-967d-3f2246f38a60","revision":2,"status":"completed","recordedAt":"2026-10-11T22:31:29.922803Z","fallbackText":"Reminder child session","childSessionId":"9b3a5dd8-d10a-4384-8200-5f6c268710c1","reminderAgentId":"skill-reminder","generationId":3,"taskId":"01a12d17-92a6-7622-beed-a4b60a1d8365"}},"emittedAtMs":1791757889928}} +{"type":"emit_inbound","label":"item/completed","frame":{"jsonrpc":"2.0","method":"item/completed","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:36","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"7ca35f07-a273-451b-82ff-7d993b1ec18d","sequence":185},"last":{"id":"31f2cd6b-dbba-4556-8384-3955364ca7ca","sequence":195}},"item":{"itemId":"7ca35f07-a273-451b-82ff-7d993b1ec18d","kind":"reminderChild","turnId":"01a12d17-7790-7000-967d-3f2246f38a60","revision":2,"status":"completed","recordedAt":"2026-10-11T22:31:29.928457Z","fallbackText":"Reminder child session","childSessionId":"3d744d08-d74d-4929-bd5f-cd636cf42ec3","reminderAgentId":"goal-reminder","generationId":1,"taskId":"01a12d17-9784-7860-bbf6-f2a40f721298","blocking":true}},"emittedAtMs":1791757889932}} +{"type":"emit_inbound","label":"item/completed","frame":{"jsonrpc":"2.0","method":"item/completed","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:37","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"885bd855-b9bf-436c-956d-29e676850f2e","sequence":192},"last":{"id":"dbf2b107-a483-4612-a387-2f6dd21436a9","sequence":196}},"item":{"itemId":"885bd855-b9bf-436c-956d-29e676850f2e","kind":"reminderChild","turnId":"01a12d17-7790-7000-967d-3f2246f38a60","revision":2,"status":"completed","recordedAt":"2026-10-11T22:31:29.932949Z","fallbackText":"Reminder child session","childSessionId":"a88d2634-79b3-409b-bfc8-9a10989dab18","reminderAgentId":"verify-reminder","generationId":1,"taskId":"01a12d17-97b8-7e31-abb4-b55e1490a992","blocking":true}},"emittedAtMs":1791757889941}} +{"type":"emit_inbound","label":"session/statusChanged","frame":{"jsonrpc":"2.0","method":"session/statusChanged","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","status":"idle","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:38"},"emittedAtMs":1791757889997}} +{"type":"emit_inbound","label":"turn/completed","frame":{"jsonrpc":"2.0","method":"turn/completed","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:38","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"7b037a6e-c614-47a3-9828-b897a489e167","sequence":204},"last":{"id":"7b037a6e-c614-47a3-9828-b897a489e167","sequence":204}},"turnId":"01a12d17-7790-7000-967d-3f2246f38a60","terminal":"completed","durationMs":14869,"timeToFirstTokenMs":8109},"emittedAtMs":1791757889998}} +{"type":"emit_inbound","label":"session/branchChanged","frame":{"jsonrpc":"2.0","method":"session/branchChanged","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:39","sourceRange":{"stream":{"kind":"session","id":"01a12d17-75fa-7000-9157-e8365ce94492"},"first":{"id":"b910ce96-80f4-46e9-ace5-327b2a8f7bc3","sequence":205},"last":{"id":"b910ce96-80f4-46e9-ace5-327b2a8f7bc3","sequence":205}},"workspaceRoot":"","branch":"main","vcs":"git"},"emittedAtMs":1791757890009}} +{"type":"emit_inbound","label":"session/closed","frame":{"jsonrpc":"2.0","method":"session/closed","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","reason":"hostShutdown","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:39"},"emittedAtMs":1791757890237}} +{"type":"emit_inbound","label":"session/statusChanged","frame":{"jsonrpc":"2.0","method":"session/statusChanged","params":{"sessionId":"01a12d17-75fa-7000-9157-e8365ce94492","status":"notLoaded","viewCursor":"v:01a12d17-75fa-7000-9157-e8365ce94492:39"},"emittedAtMs":1791757890237}} diff --git a/packages/provider-muse/src/server/adapter.test.ts b/packages/provider-muse/src/server/adapter.test.ts index 2a5417ba0d06aaa2334d3d99f7774ab9ecb9dd3a..05b7cd3def28b59402c43a393d82a8cd54690727 100644 --- a/packages/provider-muse/src/server/adapter.test.ts +++ b/packages/provider-muse/src/server/adapter.test.ts @@ -1130,4 +1130,90 @@ describe("MuseAdapterV2", () => { assert.isTrue((yield* harness.adapter.getCapabilities()).planning.emitsTodoList); }).pipe(Effect.scoped, Effect.provide(testLayer)), ); + + it.effect("opens a prompt-and-result child thread for a native subagent", () => + Effect.gen(function* () { + const fake = yield* makeFakeMuse(); + const harness = yield* makeHarness(fake); + const { nativeId } = yield* startConversation(harness, fake); + yield* fake.emit("item/started", { + turnId: nativeId, + item: { + itemId: "sub-1", + kind: "subagent", + revision: 1, + status: "inProgress", + turnId: nativeId, + subagentId: "subagent-1", + controlStatus: "running", + childSessionId: "child-session-1", + objective: "Check the thing", + role: "general-purpose", + }, + }); + const created = yield* harness.takeEvent("app_thread.created"); + const childThreadId = created.appThread.id; + yield* fake.emit("item/updated", { + turnId: nativeId, + item: { + itemId: "sub-1", + kind: "subagent", + revision: 2, + status: "inProgress", + turnId: nativeId, + subagentId: "subagent-1", + controlStatus: "resultReady", + childSessionId: "child-session-1", + objective: "Check the thing", + result: { summary: "All done" }, + }, + }); + // The revision without a role keeps the title the child thread opened with. + const completed = yield* harness.takeEvent( + "subagent.updated", + (event) => event.subagent.status === "completed", + ); + assert.strictEqual(completed.subagent.title, created.appThread.title); + const result = yield* harness.takeEvent( + "message.updated", + (event) => event.message.threadId === childThreadId && event.message.role === "assistant", + ); + assert.strictEqual(result.message.text, "All done"); + yield* fake.emit("turn/completed", { turnId: nativeId, terminal: "completed" }); + const terminal = yield* harness.takeEvent("turn.terminal"); + assert.strictEqual(terminal.status, "completed"); + }).pipe(Effect.scoped, Effect.provide(testLayer)), + ); + + it.effect("keeps a workflow child's first label after later revisions drop it", () => + Effect.gen(function* () { + const fake = yield* makeFakeMuse(); + const harness = yield* makeHarness(fake); + const { nativeId } = yield* startConversation(harness, fake); + const workflowItem = (revision: number, children: unknown) => ({ + itemId: "wf-1", + kind: "workflow", + revision, + status: "inProgress", + turnId: nativeId, + entryId: "Probe workflow", + children, + }); + yield* fake.emit("item/started", { + turnId: nativeId, + item: workflowItem(1, [{ childId: "c1", attempt: 1, status: "scheduled", label: "ping" }]), + }); + const scheduled = yield* harness.takeEvent("subagent.updated"); + assert.strictEqual(scheduled.subagent.title, "ping"); + yield* fake.emit("item/updated", { + turnId: nativeId, + item: workflowItem(2, [{ childId: "c1", attempt: 1, status: "started" }]), + }); + const started = yield* harness.takeEvent( + "subagent.updated", + (event) => event.subagent.status === "running", + ); + assert.strictEqual(started.subagent.title, "ping"); + }).pipe(Effect.scoped, Effect.provide(testLayer)), + ); }); diff --git a/packages/provider-muse/src/server/adapter.ts b/packages/provider-muse/src/server/adapter.ts index 4c91835969e64e095af82523947005ee9781ad1d..085e5737cf782a341fc0d2cb6b5749632a64f1ff 100644 --- a/packages/provider-muse/src/server/adapter.ts +++ b/packages/provider-muse/src/server/adapter.ts @@ -3,6 +3,7 @@ import { MUSE_DEFAULT_MODEL, ProviderDriverKind, type ModelSelection, + type OrchestrationV2AppThread, type OrchestrationV2ConversationMessage, type OrchestrationV2ExecutionNode, type OrchestrationV2ProviderCapabilities, @@ -20,6 +21,7 @@ import { type ProviderApprovalDecision, type RuntimeRequestId, type ServerProviderModel, + type ThreadId, } from "@t3tools/contracts"; import type { MuseSettings } from "../settings.ts"; import { AgentScope } from "@t3tools/shared/AgentScope"; @@ -79,6 +81,11 @@ import { } from "@t3tools/provider-core/server/notification"; import type * as ProviderContinuationRequests from "@t3tools/provider-core/server/ProviderContinuationRequests"; import { makeProviderFailure } from "@t3tools/provider-core/server/failure"; +import { + makeSubagentChildThread, + makeSubagentConversationArtifacts, + subagentThreadTitle, +} from "@t3tools/provider-core/server/subagentProjection"; import { turnScopedSelectionTransition } from "@t3tools/provider-core/server/selectionTransition"; import { museItemStatus, museToolPresentation } from "./itemPresentation.ts"; @@ -148,9 +155,9 @@ const MuseProviderCapabilitiesV2 = { planDeltasHaveItemIds: false, }, subagents: { - supportsSubagents: false, + supportsSubagents: true, exposesSubagentThreadIds: false, - emitsSubagentLifecycle: false, + emitsSubagentLifecycle: true, canWaitForSubagents: false, canCloseSubagents: false, canForkSubagentThread: false, @@ -226,6 +233,22 @@ interface PendingRequest { response?: Pick; } +/** + * One native subagent's child thread. Muse 1.4.4 cannot address an inline + * child session (`session/read` and `view/subscribe` answer sessionNotFound), + * so the thread carries the prompt, live status (on its root node) and result. + */ +interface ChildContext { + readonly childSessionId: string; + readonly childThreadId: ThreadId; + readonly appThread: OrchestrationV2AppThread; + readonly rootNodeId: NodeId; + readonly parentThreadId: ThreadId; + status: OrchestrationV2TurnItemStatus; + /** The result shown in the child thread, once the subagent settled. */ + result?: string; +} + const nativeRef = (nativeId: string) => ({ driver: MUSE_PROVIDER, nativeId, @@ -324,6 +347,10 @@ export const makeMuseAdapterV2 = Effect.fn("makeMuseAdapterV2")(function* ( const seenTerminals = new Set(); // Workflows and subagents that outlive their turn, by item id, with the turn that owns them. const observedChildren = new Map(); + // Native subagents' child threads, by subagent item id. + const childrenByItemId = new Map(); + // Titles per native subagent and workflow child attempt; later revisions drop the label. + const agentTitles = new Map(); // Background work that finished since the last turn, reported to the turn Muse starts for it. const finishedBackground: Array = []; // A turn Muse started on its own, held until the continuation run T3 opens for it takes it. @@ -422,6 +449,247 @@ export const makeMuseAdapterV2 = Effect.fn("makeMuseAdapterV2")(function* ( updatedAt: time, }; }; + const childItemIdentity = (context: ChildContext, nativeId: string) => + `${options.instanceId}:child:${context.childSessionId}:${nativeId}`; + /** A subagent with a ready result has finished its work even while Muse keeps it open. */ + const itemStatus = (item: MuseItem): OrchestrationV2TurnItemStatus => { + const status = museItemStatus(item); + return status === "running" && + item.kind === "subagent" && + item.controlStatus === "resultReady" + ? "completed" + : status; + }; + const publishChildRoot = Effect.fnUntraced(function* ( + context: ChildContext, + status: OrchestrationV2TurnItemStatus, + time: DateTime.Utc, + ) { + context.status = status; + yield* emit({ + type: "node.updated", + driver: MUSE_PROVIDER, + node: { + id: context.rootNodeId, + threadId: context.childThreadId, + runId: null, + parentNodeId: null, + rootNodeId: context.rootNodeId, + kind: "root_turn", + status, + countsForRun: false, + providerThreadId: null, + providerTurnId: null, + nativeItemRef: nativeRef(context.childSessionId), + runtimeRequestId: null, + checkpointScopeId: null, + startedAt: context.appThread.createdAt, + completedAt: status === "running" || status === "pending" ? null : time, + }, + }); + }); + /** One synthesized conversation row in a child thread: its prompt or its result. */ + const publishChildMessage = Effect.fnUntraced(function* ( + context: ChildContext, + role: "user" | "assistant", + text: string, + suffix: "prompt" | "result", + time: DateTime.Utc, + ) { + const identity = childItemIdentity(context, suffix); + const artifacts = makeSubagentConversationArtifacts({ + messageId: idAllocator.derive.messageFromProviderItem({ + driver: MUSE_PROVIDER, + nativeItemId: identity, + }), + ...(role === "user" ? { senderThreadId: context.parentThreadId } : {}), + turnItemId: idAllocator.derive.turnItemFromProviderItem({ + driver: MUSE_PROVIDER, + nativeItemId: identity, + }), + threadId: context.childThreadId, + rootNodeId: context.rootNodeId, + providerThreadId: null, + providerTurnId: null, + nativeItemRef: nativeRef(context.childSessionId), + role, + text, + ordinal: suffix === "prompt" ? 1 : 2, + now: time, + }); + yield* emit({ type: "message.updated", driver: MUSE_PROVIDER, message: artifacts.message }); + yield* emit({ + type: "turn_item.updated", + driver: MUSE_PROVIDER, + turnItem: artifacts.turnItem, + }); + }); + /** Creates the child thread for a native subagent the first time its session id is known. */ + const ensureChildContext = Effect.fnUntraced(function* ( + turn: ActiveTurn, + item: MuseItem, + parentNodeId: NodeId, + title: string, + prompt: string, + status: OrchestrationV2TurnItemStatus, + time: DateTime.Utc, + ) { + const existing = childrenByItemId.get(item.itemId); + const childSessionId = item.childSessionId; + if (existing || !childSessionId) return existing; + const childThreadId = idAllocator.derive.threadFromProviderThread({ + driver: MUSE_PROVIDER, + providerInstanceId: options.instanceId, + nativeThreadId: childSessionId, + }); + const appThread = makeSubagentChildThread({ + parentThread: turn.input.appThread, + childThreadId, + parentNodeId, + activeProviderThreadId: null, + providerInstanceId: options.instanceId, + modelSelection: turn.input.modelSelection, + title, + now: time, + createdBy: "agent", + creationSource: "provider", + }); + const context: ChildContext = { + childSessionId, + childThreadId, + appThread, + rootNodeId: idAllocator.derive.nodeFromProviderItem({ + driver: MUSE_PROVIDER, + nativeItemId: `${options.instanceId}:child:${childSessionId}:thread-root`, + }), + parentThreadId: turn.input.threadId, + status, + }; + childrenByItemId.set(item.itemId, context); + yield* emit({ type: "app_thread.created", driver: MUSE_PROVIDER, appThread }); + yield* publishChildRoot(context, status, time); + if (prompt) yield* publishChildMessage(context, "user", prompt, "prompt", time); + return context; + }); + /** + * Shows a native subagent on its parent thread and mirrors it into a child + * thread the user can open, like Claude's and Codex's subagents. + */ + const publishNativeSubagent = Effect.fnUntraced(function* ( + turn: ActiveTurn, + item: MuseItem, + base: ReturnType & { + readonly status: OrchestrationV2TurnItemStatus; + readonly completedAt: DateTime.Utc | null; + readonly title: string | null; + }, + status: OrchestrationV2TurnItemStatus, + time: DateTime.Utc, + ) { + const prompt = item.objective ?? item.fallbackText ?? ""; + const settled = status !== "running" && status !== "pending"; + const endKey = `subagent:${item.itemId}`; + if (settled && !agentEndedAt.has(endKey)) agentEndedAt.set(endKey, time); + if (!settled) agentEndedAt.delete(endKey); + const completedAt = settled ? (agentEndedAt.get(endKey) ?? time) : null; + if (!agentTitles.has(endKey)) + agentTitles.set( + endKey, + subagentThreadTitle({ + parentTitle: turn.input.appThread.title, + prompt, + title: item.role ?? null, + ordinal: childrenByItemId.size + 1, + }), + ); + const title = agentTitles.get(endKey)!; + const context = yield* ensureChildContext( + turn, + item, + base.nodeId, + title, + prompt, + status, + time, + ); + const resultText = + item.result?.text ?? + item.result?.summary ?? + (status === "failed" ? item.failureReason : undefined); + const result = resultText ?? null; + const nativeTaskRef = item.childSessionId + ? nativeRef(item.childSessionId) + : nativeRef(item.subagentId ?? item.itemId); + const subagent: OrchestrationV2Subagent = { + id: base.nodeId, + threadId: base.threadId, + runId: base.runId, + parentNodeId: turn.input.rootNodeId, + origin: "provider_native", + createdBy: "agent", + driver: MUSE_PROVIDER, + providerInstanceId: options.instanceId, + providerThreadId: base.providerThreadId, + childThreadId: context?.childThreadId ?? null, + nativeTaskRef, + prompt, + title, + model: null, + status, + result, + startedAt: base.startedAt, + completedAt, + updatedAt: time, + }; + yield* emit({ type: "subagent.updated", driver: MUSE_PROVIDER, subagent }); + yield* emit({ + type: "node.updated", + driver: MUSE_PROVIDER, + node: { + id: base.nodeId, + threadId: base.threadId, + runId: base.runId, + parentNodeId: turn.input.rootNodeId, + rootNodeId: turn.input.rootNodeId, + kind: "subagent", + status, + countsForRun: false, + providerThreadId: base.providerThreadId, + providerTurnId: base.providerTurnId, + nativeItemRef: nativeTaskRef, + runtimeRequestId: null, + checkpointScopeId: null, + startedAt: base.startedAt, + completedAt, + }, + }); + yield* emit({ + type: "turn_item.updated", + driver: MUSE_PROVIDER, + turnItem: { + ...base, + nativeItemRef: nativeTaskRef, + type: "subagent", + status, + title, + completedAt, + subagentId: subagent.id, + origin: "provider_native", + driver: MUSE_PROVIDER, + providerInstanceId: options.instanceId, + childThreadId: subagent.childThreadId, + prompt, + result, + }, + }); + if (context) { + if (context.status !== status) yield* publishChildRoot(context, status, time); + if (settled && result?.trim() && context.result !== result) { + context.result = result; + yield* publishChildMessage(context, "assistant", result, "result", time); + } + } + }); /** Lists running workflows and subagents on the thread, so it shows it still waits on them. */ const syncBackground = Effect.fnUntraced(function* () { yield* updateThread({ @@ -455,7 +723,7 @@ export const makeMuseAdapterV2 = Effect.fn("makeMuseAdapterV2")(function* ( ) return; const time = yield* DateTime.now; - const status = terminal ?? museItemStatus(item); + const status = terminal ?? itemStatus(item); if (item.kind === "subagent" || item.kind === "workflow") { const wasRunning = observedChildren.has(item.itemId); if (status === "running") observedChildren.set(item.itemId, turn); @@ -479,6 +747,10 @@ export const makeMuseAdapterV2 = Effect.fn("makeMuseAdapterV2")(function* ( completedAt: streaming ? null : time, title: item.tool ?? null, }; + if (item.kind === "subagent") { + yield* publishNativeSubagent(turn, item, base, status, time); + return; + } const text = item.text ?? item.summary?.join("\n") ?? item.fallbackText ?? ""; let turnItem: OrchestrationV2TurnItem; if (item.kind === "agentMessage") { @@ -574,7 +846,9 @@ export const makeMuseAdapterV2 = Effect.fn("makeMuseAdapterV2")(function* ( // Children are re-sent on every workflow change; keep each one's first end time. const endKey = `${item.itemId}:${child.childId}:${child.attempt}`; if (settled && !agentEndedAt.has(endKey)) agentEndedAt.set(endKey, time); - const title = child.label?.trim() || `Agent ${index + 1}`; + // Later revisions drop the label; keep the last one seen. + if (child.label?.trim()) agentTitles.set(endKey, child.label.trim()); + const title = agentTitles.get(endKey) || `Agent ${index + 1}`; const result = child.failureReason ?? null; const subagent: OrchestrationV2Subagent = { id: base.nodeId, @@ -696,9 +970,12 @@ export const makeMuseAdapterV2 = Effect.fn("makeMuseAdapterV2")(function* ( seenTerminals.add(turn.nativeId); const completedAt = yield* DateTime.now; for (const item of turn.items.values()) { + // Workflows and subagents outlive a completed turn. A stopped or failed + // turn ends them in T3 too, as the orchestrator stops following them. if ( (item.kind === "subagent" || item.kind === "workflow") && item.status === "inProgress" && + status === "completed" && disposition === "reusable" ) continue; -- 2.54.0