The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 23:15 UTC
fix(server): preserve subagent reasoning effort and fast mode (#16595)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Cristian Velasquez Ramos committed
Oct 20, 2026 at 00:55 UTC
9a05676cfa000e922380a741af8a4a1e19f76bd1
6 files changed
+254
-16
apps/server/src/mcp/OrchestratorMcpService.test.ts
+190
@@ -5,6 +5,7 @@ import {
5
EnvironmentId,
6
MessageId,
7
NodeId,
8
+ OrchestratorMcpTarget,
9
type OrchestrationV2ThreadShell,
10
type ScheduledTask,
11
ScheduledTaskId,
@@ -21,6 +22,7 @@ import * as DateTime from "effect/DateTime";
22
import * as Effect from "effect/Effect";
23
import * as Layer from "effect/Layer";
24
import * as Ref from "effect/Ref";
25
+import * as Schema from "effect/Schema";
26
27
import { CodexProviderCapabilitiesV2 } from "../orchestration-v2/Adapters/CodexAdapterV2.ts";
28
import * as CommandReceiptStore from "../orchestration-v2/CommandReceiptStore.ts";
@@ -51,6 +53,8 @@ import { idleThreadProjection, liveThreadShell } from "./McpToolAccess.testkit.t
53
import * as OrchestratorMcpService from "./OrchestratorMcpService.ts";
54
import type * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAdapter";
55
56
+const decodeTarget = Schema.decodeUnknownEffect(OrchestratorMcpTarget);
57
+
58
const layerOrchestratorService = OrchestratorMcpService.layer.pipe(
59
Layer.provide(Layer.mock(ThreadLaunchService.ThreadLaunchService)({})),
60
Layer.provide(Layer.mock(GitVcsDriver.GitVcsDriver)({})),
@@ -2448,6 +2452,192 @@ describe("OrchestratorMcpService provider resolution", () => {
2452
}),
2453
);
2454
});
2455
+ it.effect(
2456
+ "reports the child run's selection after a restart and the thread selection before launch",
2457
+ () =>
2458
+ Effect.gen(function* () {
2459
+ const runSelection = {
2460
+ instanceId: ProviderInstanceId.make("claudeAgent-personal"),
2461
+ model: "claude-opus-4-6",
2462
+ options: [
2463
+ { id: "effort", value: "max" },
2464
+ { id: "fastMode", value: true },
2465
+ ],
2466
+ } as const;
2467
+ const threadSelection = {
2468
+ instanceId: codexInstanceId,
2469
+ model: "gpt-5.4",
2470
+ options: [{ id: "reasoningEffort", value: "high" }],
2471
+ } as const;
2472
+ let hasRun = true;
2473
+ const task = {
2474
+ id: taskId,
2475
+ threadId: parentThreadId,
2476
+ origin: "app_owned",
2477
+ childThreadId,
2478
+ providerInstanceId: ProviderInstanceId.make("claudeAgent-work"),
2479
+ model: "claude-sonnet-4-6",
2480
+ status: "running",
2481
+ result: null,
2482
+ };
2483
+ const dependencies = Layer.mergeAll(
2484
+ NodeServices.layer,
2485
+ Layer.mock(ThreadManagementService.ThreadManagementService)({
2486
+ getThreadRecords: (threadId) =>
2487
+ Effect.succeed(
2488
+ threadId === parentThreadId
2489
+ ? parentProjection([task])
2490
+ : ({
2491
+ ...childProjection,
2492
+ thread: { ...childProjection.thread, modelSelection: threadSelection },
2493
+ runs: hasRun
2494
+ ? [
2495
+ {
2496
+ id: RunId.make("run:mcp-restarted-child"),
2497
+ ordinal: 1,
2498
+ status: "running",
2499
+ modelSelection: runSelection,
2500
+ },
2501
+ ]
2502
+ : [],
2503
+ } as unknown as OrchestrationV2ThreadProjection),
2504
+ ),
2505
+ }),
2506
+ ServerSettings.layerTest(),
2507
+ providerRegistryLayer([]),
2508
+ adapterRegistryLayer([]),
2509
+ Layer.mock(ProjectService.ProjectService)({}),
2510
+ Layer.mock(SecretRequests.SecretRequests)({}),
2511
+ Layer.mock(ScheduledTaskService.ScheduledTaskService)({}),
2512
+ );
2513
+ yield* Effect.gen(function* () {
2514
+ const service = yield* OrchestratorMcpService.OrchestratorMcpService;
2515
+ for (const selection of [runSelection, threadSelection]) {
2516
+ const result = yield* service.taskStatus(scope, taskId);
2517
+ assert.equal(result.providerInstanceId, selection.instanceId);
2518
+ assert.equal(result.model, selection.model);
2519
+ assert.deepEqual(result.options, selection.options);
2520
+ hasRun = false;
2521
+ }
2522
+ }).pipe(Effect.provide(layerOrchestratorService.pipe(Layer.provide(dependencies))));
2523
+ }),
2524
+ );
2525
+
2526
+ it.effect(
2527
+ "inherits delegated options, merges overrides, and resets on explicit clearing or a new target",
2528
+ () =>
2529
+ Effect.gen(function* () {
2530
+ const peerId = ProviderInstanceId.make("codex-subscription-2");
2531
+ const driver = ProviderDriverKind.make("codex");
2532
+ const inherited = {
2533
+ instanceId: codexInstanceId,
2534
+ model: "gpt-5.4",
2535
+ options: [
2536
+ { id: "reasoningEffort", value: "high" },
2537
+ { id: "serviceTier", value: "priority" },
2538
+ ],
2539
+ } as const;
2540
+ const override = [{ id: "reasoningEffort", value: "max" }] as const;
2541
+ const cases = [
2542
+ {
2543
+ name: "partial override",
2544
+ target: { options: override },
2545
+ expected: { ...inherited, options: [...override, inherited.options[1]] },
2546
+ },
2547
+ {
2548
+ name: "clear with array",
2549
+ target: { options: [] },
2550
+ expected: { ...inherited, options: [] },
2551
+ },
2552
+ {
2553
+ name: "clear with object",
2554
+ target: { options: {} },
2555
+ expected: { ...inherited, options: [] },
2556
+ },
2557
+ {
2558
+ name: "change model",
2559
+ target: { model: "other-model" },
2560
+ expected: { instanceId: codexInstanceId, model: "other-model" },
2561
+ },
2562
+ {
2563
+ name: "change provider with override",
2564
+ target: { providerInstanceId: peerId, options: { reasoningEffort: "max" } },
2565
+ expected: { instanceId: peerId, model: inherited.model, options: override },
2566
+ },
2567
+ ] as const;
2568
+ for (const testCase of cases) {
2569
+ const commands: Array<unknown> = [];
2570
+ const task = {
2571
+ id: taskId,
2572
+ threadId: parentThreadId,
2573
+ origin: "app_owned",
2574
+ childThreadId,
2575
+ providerInstanceId: testCase.expected.instanceId,
2576
+ model: testCase.expected.model,
2577
+ status: "running",
2578
+ result: null,
2579
+ };
2580
+ const dependencies = Layer.mergeAll(
2581
+ NodeServices.layer,
2582
+ Layer.mock(ThreadManagementService.ThreadManagementService)({
2583
+ hasReceipt: () => Effect.succeed(false),
2584
+ assertProviderInstanceEnabled: () => Effect.void,
2585
+ getThreadRecords: (threadId) =>
2586
+ Effect.succeed(
2587
+ threadId === parentThreadId
2588
+ ? parentProjection(commands.length > 0 ? [task] : [], inherited)
2589
+ : childProjection,
2590
+ ),
2591
+ dispatch: (command) =>
2592
+ Effect.sync(() => {
2593
+ commands.push(command);
2594
+ return {
2595
+ sequence: 1,
2596
+ storedEvents: [{ event: { type: "subagent.updated", payload: task } }],
2597
+ } as never;
2598
+ }),
2599
+ }),
2600
+ ServerSettings.layerTest(),
2601
+ providerRegistryLayer([
2602
+ {
2603
+ ...providerSnapshot({
2604
+ instanceId: codexInstanceId,
2605
+ driver,
2606
+ model: inherited.model,
2607
+ }),
2608
+ models: [inherited.model, "other-model"].map((model) => ({
2609
+ slug: model,
2610
+ name: model,
2611
+ isCustom: false,
2612
+ capabilities: null,
2613
+ })),
2614
+ },
2615
+ providerSnapshot({ instanceId: peerId, driver, model: inherited.model }),
2616
+ ]),
2617
+ adapterRegistryLayer([codexInstanceId, peerId]),
2618
+ Layer.mock(ProjectService.ProjectService)({}),
2619
+ Layer.mock(SecretRequests.SecretRequests)({}),
2620
+ Layer.mock(ScheduledTaskService.ScheduledTaskService)({}),
2621
+ );
2622
+ yield* Effect.gen(function* () {
2623
+ const service = yield* OrchestratorMcpService.OrchestratorMcpService;
2624
+ const capabilities = yield* service.capabilities(scope);
2625
+ assert.deepEqual(capabilities.inheritedOptions, inherited.options);
2626
+ yield* service.delegateTask(scope, {
2627
+ task: "Review the change.",
2628
+ target: yield* decodeTarget(testCase.target),
2629
+ mode: "async",
2630
+ clientRequestId: testCase.name,
2631
+ });
2632
+ assert.deepEqual(
2633
+ (commands[0] as { modelSelection: unknown }).modelSelection,
2634
+ testCase.expected,
2635
+ testCase.name,
2636
+ );
2637
+ }).pipe(Effect.provide(layerOrchestratorService.pipe(Layer.provide(dependencies))));
2638
+ }
2639
+ }),
2640
+ );
2641
2642
describe("resolveRuntimeMode", () => {
2643
const muse = {
apps/server/src/mcp/OrchestratorMcpService.ts
+25
-10
@@ -1329,15 +1329,23 @@ const make = Effect.gen(function* () {
1329
}
1330
}
1331
1332
+ const inheritsOptions =
1333
+ instanceId === inheritedSelection.instanceId && model === inheritedSelection.model;
1334
+ let options = inheritsOptions ? inheritedSelection.options : undefined;
1335
+ if (requestedOptions !== undefined) {
1336
+ const selections = new Map(
1337
+ (requestedOptions.length === 0 ? [] : (options ?? [])).map((selection) => [
1338
+ selection.id,
1339
+ selection,
1340
+ ]),
1341
+ );
1342
+ for (const selection of requestedOptions) {
1343
+ selections.set(selection.id, selection);
1344
+ }
1345
+ options = [...selections.values()];
1346
+ }
1347
return {
1333
- modelSelection:
1334
- instanceId === inheritedSelection.instanceId &&
1335
- model === inheritedSelection.model &&
1336
- requestedOptions === undefined
1337
- ? inheritedSelection
1338
- : requestedOptions === undefined
1339
- ? { instanceId, model }
1340
- : { instanceId, model, options: requestedOptions },
1348
+ modelSelection: { instanceId, model, ...(options === undefined ? {} : { options }) },
1349
supportedRuntimeModes: provider.supportedRuntimeModes,
1350
};
1351
});
@@ -1460,6 +1468,11 @@ const make = Effect.gen(function* () {
1468
: null;
1469
const resultContextTransferId = resultTransfer?.id ?? null;
1470
const latestTerminalResultContextTransferId = resultTransferForRun(terminalRun)?.id ?? null;
1471
+ const modelSelection = childRun?.modelSelection ??
1472
+ childControls.thread.modelSelection ?? {
1473
+ instanceId: task.providerInstanceId,
1474
+ model: task.model,
1475
+ };
1476
const response = {
1477
taskId: task.id,
1478
childThreadId: task.childThreadId,
@@ -1468,8 +1481,9 @@ const make = Effect.gen(function* () {
1481
status,
1482
workState,
1483
hasPendingChildRuns: hasPendingChildRuns(childProjection, childRun),
1471
- providerInstanceId: task.providerInstanceId,
1472
- model: task.model,
1484
+ providerInstanceId: modelSelection.instanceId,
1485
+ model: modelSelection.model,
1486
+ options: modelSelection.options ?? [],
1487
summary: derivedResult,
1488
resultContextTransferId,
1489
latestTerminalRunId: terminalRun?.id ?? null,
@@ -1924,6 +1938,7 @@ const make = Effect.gen(function* () {
1938
parentThreadId: parent?.thread.id ?? null,
1939
inheritedProviderInstanceId: parent?.thread.modelSelection.instanceId ?? null,
1940
inheritedModel: parent?.thread.modelSelection.model ?? null,
1941
+ inheritedOptions: parent?.thread.modelSelection.options ?? [],
1942
runtimeMode: limits.runtimeMode,
1943
interactionMode: limits.interactionMode,
1944
providers: providers.map((provider) => {
apps/server/src/mcp/OrchestratorMcpToolkit.integration.test.ts
+26
-2
@@ -100,7 +100,7 @@ const projectId = ProjectId.make("project:mcp-orchestrator");
100
const codexInstanceId = ProviderInstanceId.make("codex");
101
const claudeInstanceId = ProviderInstanceId.make("claudeAgent");
102
const codexModel = "gpt-5.4";
103
-const claudeModel = "claude-sonnet-4-6";
103
+const claudeModel = "claude-opus-4-6";
104
const parentPrompt = "Keep this parent turn active while orchestration tools are tested.";
105
const delegatedPrompt = "Inspect the delegated API boundary and return the result.";
106
const delegatedResult = "Delegated API boundary inspected.";
@@ -150,6 +150,7 @@ interface CapturedTurn {
150
readonly instanceId: ProviderInstanceId;
151
readonly threadId: ThreadId;
152
readonly text: string;
153
+ readonly modelSelection: ModelSelection;
154
}
155
156
function unsupported(driver: ProviderDriverKind, detail: string) {
@@ -271,6 +272,7 @@ function makeDeterministicAdapter(input: {
272
instanceId: input.instanceId,
273
threadId: turnInput.threadId,
274
text: turnInput.message.text,
275
+ modelSelection: turnInput.modelSelection,
276
},
277
]);
278
const eventTime = yield* DateTime.now;
@@ -652,6 +654,18 @@ describe("orchestrator MCP toolkit", () => {
654
instanceId: claudeInstanceId,
655
driver: ProviderDriverKind.make("claudeAgent"),
656
model: claudeModel,
657
+ optionDescriptors: [
658
+ {
659
+ id: "effort",
660
+ label: "Reasoning",
661
+ type: "select",
662
+ options: [
663
+ { id: "high", label: "High" },
664
+ { id: "max", label: "Max" },
665
+ ],
666
+ },
667
+ { id: "fastMode", label: "Fast mode", type: "boolean" },
668
+ ],
669
}),
670
makeProviderSnapshot({
671
instanceId: ProviderInstanceId.make("opencode"),
@@ -1652,11 +1666,16 @@ describe("orchestrator MCP toolkit", () => {
1666
.pipe(Effect.flip);
1667
expect(reused.message).toContain("already used");
1668
1669
+ const delegatedOptions = [
1670
+ { id: "effort", value: "max" },
1671
+ { id: "fastMode", value: true },
1672
+ ];
1673
const delegatedCall = yield* invoke("delegate_task", {
1674
task: delegatedPrompt,
1675
target: {
1676
providerInstanceId: claudeInstanceId,
1677
model: claudeModel,
1678
+ options: { effort: "max", fastMode: true },
1679
},
1680
mode: "wait",
1681
timeoutMs: 10_000,
@@ -1680,6 +1699,7 @@ describe("orchestrator MCP toolkit", () => {
1699
expect(delegated.status).toBe("completed");
1700
expect(delegated.summary).toBe(delegatedResult);
1701
expect(delegated.providerInstanceId).toBe(claudeInstanceId);
1702
+ expect(delegated.options).toEqual(delegatedOptions);
1703
1704
const completedParent = yield* waitForProjection(
1705
orchestrator,
@@ -1717,7 +1737,10 @@ describe("orchestrator MCP toolkit", () => {
1737
createdBy: "agent",
1738
creationSource: "mcp",
1739
});
1720
- expect(child.thread.modelSelection).toEqual(claudeSelection);
1740
+ expect(child.thread.modelSelection).toEqual({
1741
+ ...claudeSelection,
1742
+ options: delegatedOptions,
1743
+ });
1744
expect(
1745
child.messages
1746
.filter((message) => message.role === "user")
@@ -1737,6 +1760,7 @@ describe("orchestrator MCP toolkit", () => {
1760
instanceId: claudeInstanceId,
1761
threadId: delegated.childThreadId,
1762
text: delegatedPrompt,
1763
+ modelSelection: { ...claudeSelection, options: delegatedOptions },
1764
},
1765
]);
1766
expect(
apps/server/src/mcp/toolkits/orchestrator/tools.ts
+2
-2
@@ -65,7 +65,7 @@ const OrchestratorCapabilitiesTool = Tool.make("orchestrator_capabilities", {
65
66
export const DelegateTaskTool = Tool.make("delegate_task", {
67
description:
68
- "Needs an agent running inside a T3 thread. Delegate one task to a T3-owned child agent/subagent of THIS thread and run it with only the supplied task prompt, without copying parent conversation history. Choose providers and models from orchestrator_capabilities, which uses the same live catalog as the composer. Prefer native subagent tools for same-provider work only when they support the chosen model. Use this for any model missing from the native tool, including same-provider work, for cross-provider work, or for explicitly T3-owned child tasks. For every T3 delegated review round, call delegate_task again with the original brief, prior findings, responses, and unresolved objections in the task prompt. Track each round by its own taskId and use a distinct clientRequestId per round, stable across retries of that round. The childThreadId is backing storage, not the target for starting another delegated review round through t3_thread_send. Set isolation to worktree for a separate checkout based on the parent local commit, with project setup completed before the child starts. Uncommitted edits are not copied; omitted isolation shares the parent checkout. Provider, model, model options (see orchestrator_capabilities), runtime mode, and interaction mode inherit unless target overrides them. A requested runtimeMode must be one the target provider lists in orchestrator_capabilities runtimeModes; an inherited one steps down to the broadest mode it offers. Leave runtimeMode unset unless the user asks for a supervised child: approval-required and auto-accept-edits usually make the child wait for a person at each action that needs approval. Prefer mode='async' for long work; mode='wait' blocks until completion, a blocking question, or timeout. If hasPendingQuestion, pass threadId=childThreadId to t3_pending_request_list, t3_pending_request_read (with requestId) and t3_pending_request_respond, or ask the user; the task's completion still wakes this thread. timeoutMs on mode=wait is only the parent's wait budget and does not cancel the child. waitTimedOut on that wait call means the timeout fired; keep that taskId and read status on later task_status. An async child's completion wakes this thread through a notification, steered into active turns where supported or queued otherwise, so end the turn instead of polling or spawning watchers; use task_status only when the result is needed mid-turn.",
68
+ "Needs an agent running inside a T3 thread. Delegate one task to a T3-owned child agent/subagent of THIS thread and run it with only the supplied task prompt, without copying parent conversation history. Choose providers and models from orchestrator_capabilities, which uses the same live catalog as the composer. Prefer native subagent tools for same-provider work only when they support the chosen model and no model options are requested or inherited. Use this for any model missing from the native tool, including same-provider work, for cross-provider work, or for explicitly T3-owned child tasks. For every T3 delegated review round, call delegate_task again with the original brief, prior findings, responses, and unresolved objections in the task prompt. Track each round by its own taskId and use a distinct clientRequestId per round, stable across retries of that round. The childThreadId is backing storage, not the target for starting another delegated review round through t3_thread_send. Set isolation to worktree for a separate checkout based on the parent local commit, with project setup completed before the child starts. Uncommitted edits are not copied; omitted isolation shares the parent checkout. Use delegate_task when model options are requested or the child keeps the parent's provider instance and model with nonempty inheritedOptions from orchestrator_capabilities, even for native-supported models. Native subagents cannot reliably apply T3 model options. Set target.options using advertised IDs: Claude {effort: 'max', fastMode: true}; Codex {reasoningEffort: 'max', serviceTier: 'priority'}. Check providerInstanceId, model, and options in the result. Provider/model and modes inherit unless overridden. Options inherit only for the same instance and model; explicit entries override individual values and [] or {} clears them. A requested runtimeMode must be one the target provider lists in orchestrator_capabilities runtimeModes; an inherited one steps down to the broadest mode it offers. Leave runtimeMode unset unless the user asks for a supervised child: approval-required and auto-accept-edits usually make the child wait for a person at each action that needs approval. Prefer mode='async' for long work; mode='wait' blocks until completion, a blocking question, or timeout. If hasPendingQuestion, pass threadId=childThreadId to t3_pending_request_list, t3_pending_request_read (with requestId) and t3_pending_request_respond, or ask the user; the task's completion still wakes this thread. timeoutMs on mode=wait is only the parent's wait budget and does not cancel the child. waitTimedOut on that wait call means the timeout fired; keep that taskId and read status on later task_status. An async child's completion wakes this thread through a notification, steered into active turns where supported or queued otherwise, so end the turn instead of polling or spawning watchers; use task_status only when the result is needed mid-turn.",
69
parameters: OrchestratorMcpDelegateTaskInput,
70
success: OrchestratorMcpDelegateTaskResult,
71
failure: OrchestratorMcpFailure,
@@ -179,7 +179,7 @@ const RequestSecretTool = Tool.make("request_secret", {
179
180
export const CreateThreadsTool = Tool.make("create_threads", {
181
description:
182
- "Needs an agent running inside a T3 thread. Create one or more ORDINARY TOP-LEVEL T3 conversations. This is not delegation and does not create child agents/subagents. For delegated work, choose models from orchestrator_capabilities. Prefer native subagents only when they support the chosen model; otherwise call delegate_task, including for same-provider work. Use create_threads for a batch of separate top-level threads sharing this checkout. Prefer t3_thread_launch for a single thread. Both require the user to request separate/new/top-level threads or conversations. Each entry may override provider, model, options, runtime mode, and interaction mode; omitted settings inherit. Project, branch, and worktree always inherit and cannot be overridden here. For independent implementation or a PR stack in its own worktree, use t3_thread_launch with workspaceStrategy instead of asking the agent to create a worktree in its prompt.",
182
+ "Needs an agent running inside a T3 thread. Create one or more ORDINARY TOP-LEVEL T3 conversations. This is not delegation and does not create child agents/subagents. For delegated work, choose models from orchestrator_capabilities. Prefer native subagents only when they support the chosen model and no model options are requested or inherited; otherwise call delegate_task, including for same-provider work. This includes keeping the parent's provider instance and model with nonempty inheritedOptions from orchestrator_capabilities. Use create_threads for a batch of separate top-level threads sharing this checkout. Prefer t3_thread_launch for a single thread. Both require the user to request separate/new/top-level threads or conversations. Each entry may override provider, model, options, runtime mode, and interaction mode; omitted settings inherit. Project, branch, and worktree always inherit and cannot be overridden here. For independent implementation or a PR stack in its own worktree, use t3_thread_launch with workspaceStrategy instead of asking the agent to create a worktree in its prompt.",
183
parameters: OrchestratorMcpCreateThreadsInput,
184
success: OrchestratorMcpCreateThreadsResult,
185
failure: OrchestratorMcpFailure,
packages/contracts/src/orchestratorMcp.ts
+9
-1
@@ -114,7 +114,8 @@ export const OrchestratorMcpTarget = Schema.Struct({
114
),
115
options: Schema.optional(
116
OrchestratorMcpTargetOptions.annotate({
117
- description: "Model option selections advertised by orchestrator_capabilities.",
117
+ description:
118
+ "Model options from orchestrator_capabilities. For the same provider instance and model, overrides individual inherited values; [] or {} clears them. Claude: {effort: 'max', fastMode: true}; Codex: {reasoningEffort: 'max', serviceTier: 'priority'}. Only use options advertised by the selected model.",
119
}),
120
),
121
});
@@ -207,6 +208,12 @@ export const OrchestratorMcpDelegateTaskResult = Schema.Struct({
208
latestTerminalResultContextTransferId: Schema.NullOr(ContextTransferId),
209
providerInstanceId: ProviderInstanceId,
210
model: Schema.NullOr(Schema.String),
211
+ options: Schema.optional(
212
+ Schema.Array(ProviderOptionSelection).annotate({
213
+ description:
214
+ "Stored model option selections for the child run, or its thread before a run starts. Omitted selections use provider defaults.",
215
+ }),
216
+ ),
217
summary: Schema.NullOr(Schema.String),
218
resultContextTransferId: Schema.NullOr(ContextTransferId),
219
hasPendingQuestion: Schema.Boolean.annotate({
@@ -515,6 +522,7 @@ export const OrchestratorMcpCapabilitiesResult = Schema.Struct({
522
parentThreadId: Schema.NullOr(ThreadId),
523
inheritedProviderInstanceId: Schema.NullOr(ProviderInstanceId),
524
inheritedModel: Schema.NullOr(Schema.String),
525
+ inheritedOptions: Schema.optional(Schema.Array(ProviderOptionSelection)),
526
runtimeMode: RuntimeMode,
527
interactionMode: ProviderInteractionMode,
528
providers: Schema.Array(OrchestratorMcpProviderCapability),
packages/provider-core/src/server/orchestrationInstructions.ts
+2
-1
@@ -10,7 +10,7 @@ export const T3_CODE_ORCHESTRATION_SECTIONS: ReadonlyArray<string> = [
10
11
The \`t3-code\` MCP server provides app-owned orchestration. Treat these concepts distinctly:
12
13
-- A delegated task/subagent is child work owned by the current thread. Use \`orchestrator_capabilities\` to discover the current provider/model IDs from the same live catalog as the composer, including configured custom models. Do not treat a native tool's model list as the full list of available subagent models. Prefer native subagent tools for same-provider work only when they support the chosen model. Use \`delegate_task\` with that provider instance and model when native tools cannot, including for same-provider work. Also use \`delegate_task\` for cross-provider or explicitly T3-owned child tasks. For a child task that needs a separate checkout, use \`delegate_task\` with \`isolation:"worktree"\` across any provider or model. It starts from the parent local commit and runs project setup; uncommitted edits are not copied. Retain each returned \`taskId\`, and use \`task_status\` or \`task_cancel\` to manage it. The returned \`childThreadId\` is backing storage for the subagent, not the target for starting another delegated review round.
13
+- A delegated task/subagent is child work owned by the current thread. Use \`orchestrator_capabilities\` to discover the current provider/model IDs from the same live catalog as the composer, including configured custom models. Do not treat a native tool's model list as the full list of available subagent models. Prefer native subagent tools for same-provider work only when they support the chosen model and no model options are requested or inherited. Use \`delegate_task\` with that provider instance and model when native tools cannot, including for same-provider work. Also use \`delegate_task\` for cross-provider or explicitly T3-owned child tasks. For a child task that needs a separate checkout, use \`delegate_task\` with \`isolation:"worktree"\` across any provider or model. It starts from the parent local commit and runs project setup; uncommitted edits are not copied. Retain each returned \`taskId\`, and use \`task_status\` or \`task_cancel\` to manage it. The returned \`childThreadId\` is backing storage for the subagent, not the target for starting another delegated review round.
14
- \`t3_thread_launch\` and \`create_threads\` create ordinary top-level T3 conversations. Use them only when the user explicitly asks for separate/new/top-level threads or conversations. Never use them merely because the user said "subagent" or requested parallel delegated work.
15
- For every T3 delegated review round, call \`delegate_task\` again. Include the original brief, prior findings, responses, and unresolved objections in each new task prompt. Track each round by its own \`taskId\`. Use a distinct \`clientRequestId\` per round, stable across retries of that round. Do not use \`t3_thread_send\` on \`childThreadId\` to continue a delegated review.`,
16
`- \`schedule_task\` creates persistent recurring work in the app scheduler. Pass \`schedule\` as a structured object, never as JSON text: \`{"type":"interval","everyMs":3600000}\` for an interval, or \`{"type":"fixed_time","timeOfDay":"09:00","weekdays":[1,2,3,4,5]}\` for a wall-clock schedule, or \`{"type":"webhook"}\` to run on each request to the returned \`webhookUrl\` (the run sees the request only through \`{{body.path}}\`-style placeholders in the prompt). By default runs return to the current thread, which suits orchestrating: each trigger arrives here and you delegate or dedupe; set \`bindToCurrentThread=false\` only when the user wants a fresh thread for every run. After scheduling a timer, report the returned cadence and next run time; for a webhook, report its \`webhookUrl\`, or say T3 Connect remote access is needed if it is missing.
@@ -36,6 +36,7 @@ ACP fallback: some ACP agents accept the injected MCP server but fail to expose
36
### Showing visuals
37
38
When a chart, table, diagram, image collage, or mockup would say more than prose, build a self-contained HTML page, check it with \`html_preview\`, then publish it with \`html_render\` before your final reply. The reader sees the page above that reply, so don't announce or restate it; add only what it doesn't say.`,
39
+ `- When model options are requested or the child keeps the parent's provider instance and model with nonempty \`inheritedOptions\` from \`orchestrator_capabilities\`, use \`delegate_task\` even for native-supported models. Native subagents cannot reliably apply T3 model options. Read the selected model's descriptors from \`orchestrator_capabilities\` and put settings in \`target.options\`, not only in the prompt. Claude commonly uses {"effort":"max","fastMode":true}; Codex uses {"reasoningEffort":"max","serviceTier":"priority"}. Do not translate max to high or ignore unsupported settings: report a capability mismatch. Options inherit only for the same provider instance and model; explicit entries override individual values, and [] or {} clears them. Check the returned providerInstanceId, model, and options against the requested selection.`,
40
];
41
42
export const T3_CODE_ORCHESTRATION_INSTRUCTIONS = `