Skip to content
TypeScript

fix(server): preserve subagent reasoning effort and fast mode (#16595)

Cristian Velasquez Ramos9a05676cfa00
diff --git a/apps/server/src/mcp/OrchestratorMcpService.test.ts b/apps/server/src/mcp/OrchestratorMcpService.test.ts
index 1ea5e1ce414..b132db8fc7a 100644
--- a/apps/server/src/mcp/OrchestratorMcpService.test.ts
+++ b/apps/server/src/mcp/OrchestratorMcpService.test.ts
@@ -5,6 +5,7 @@ import {
EnvironmentId,
MessageId,
NodeId,
+ OrchestratorMcpTarget,
type OrchestrationV2ThreadShell,
type ScheduledTask,
ScheduledTaskId,
@@ -21,6 +22,7 @@ import * as DateTime from "effect/DateTime";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import * as Ref from "effect/Ref";
+import * as Schema from "effect/Schema";
import { CodexProviderCapabilitiesV2 } from "../orchestration-v2/Adapters/CodexAdapterV2.ts";
import * as CommandReceiptStore from "../orchestration-v2/CommandReceiptStore.ts";
@@ -51,6 +53,8 @@ import { idleThreadProjection, liveThreadShell } from "./McpToolAccess.testkit.t
import * as OrchestratorMcpService from "./OrchestratorMcpService.ts";
import type * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAdapter";
+const decodeTarget = Schema.decodeUnknownEffect(OrchestratorMcpTarget);
+
const layerOrchestratorService = OrchestratorMcpService.layer.pipe(
Layer.provide(Layer.mock(ThreadLaunchService.ThreadLaunchService)({})),
Layer.provide(Layer.mock(GitVcsDriver.GitVcsDriver)({})),
@@ -2448,6 +2452,192 @@ describe("OrchestratorMcpService provider resolution", () => {
}),
);
});
+ it.effect(
+ "reports the child run's selection after a restart and the thread selection before launch",
+ () =>
+ Effect.gen(function* () {
+ const runSelection = {
+ instanceId: ProviderInstanceId.make("claudeAgent-personal"),
+ model: "claude-opus-4-6",
+ options: [
+ { id: "effort", value: "max" },
+ { id: "fastMode", value: true },
+ ],
+ } as const;
+ const threadSelection = {
+ instanceId: codexInstanceId,
+ model: "gpt-5.4",
+ options: [{ id: "reasoningEffort", value: "high" }],
+ } as const;
+ let hasRun = true;
+ const task = {
+ id: taskId,
+ threadId: parentThreadId,
+ origin: "app_owned",
+ childThreadId,
+ providerInstanceId: ProviderInstanceId.make("claudeAgent-work"),
+ model: "claude-sonnet-4-6",
+ status: "running",
+ result: null,
+ };
+ const dependencies = Layer.mergeAll(
+ NodeServices.layer,
+ Layer.mock(ThreadManagementService.ThreadManagementService)({
+ getThreadRecords: (threadId) =>
+ Effect.succeed(
+ threadId === parentThreadId
+ ? parentProjection([task])
+ : ({
+ ...childProjection,
+ thread: { ...childProjection.thread, modelSelection: threadSelection },
+ runs: hasRun
+ ? [
+ {
+ id: RunId.make("run:mcp-restarted-child"),
+ ordinal: 1,
+ status: "running",
+ modelSelection: runSelection,
+ },
+ ]
+ : [],
+ } as unknown as OrchestrationV2ThreadProjection),
+ ),
+ }),
+ ServerSettings.layerTest(),
+ providerRegistryLayer([]),
+ adapterRegistryLayer([]),
+ Layer.mock(ProjectService.ProjectService)({}),
+ Layer.mock(SecretRequests.SecretRequests)({}),
+ Layer.mock(ScheduledTaskService.ScheduledTaskService)({}),
+ );
+ yield* Effect.gen(function* () {
+ const service = yield* OrchestratorMcpService.OrchestratorMcpService;
+ for (const selection of [runSelection, threadSelection]) {
+ const result = yield* service.taskStatus(scope, taskId);
+ assert.equal(result.providerInstanceId, selection.instanceId);
+ assert.equal(result.model, selection.model);
+ assert.deepEqual(result.options, selection.options);
+ hasRun = false;
+ }
+ }).pipe(Effect.provide(layerOrchestratorService.pipe(Layer.provide(dependencies))));
+ }),
+ );
+
+ it.effect(
+ "inherits delegated options, merges overrides, and resets on explicit clearing or a new target",
+ () =>
+ Effect.gen(function* () {
+ const peerId = ProviderInstanceId.make("codex-subscription-2");
+ const driver = ProviderDriverKind.make("codex");
+ const inherited = {
+ instanceId: codexInstanceId,
+ model: "gpt-5.4",
+ options: [
+ { id: "reasoningEffort", value: "high" },
+ { id: "serviceTier", value: "priority" },
+ ],
+ } as const;
+ const override = [{ id: "reasoningEffort", value: "max" }] as const;
+ const cases = [
+ {
+ name: "partial override",
+ target: { options: override },
+ expected: { ...inherited, options: [...override, inherited.options[1]] },
+ },
+ {
+ name: "clear with array",
+ target: { options: [] },
+ expected: { ...inherited, options: [] },
+ },
+ {
+ name: "clear with object",
+ target: { options: {} },
+ expected: { ...inherited, options: [] },
+ },
+ {
+ name: "change model",
+ target: { model: "other-model" },
+ expected: { instanceId: codexInstanceId, model: "other-model" },
+ },
+ {
+ name: "change provider with override",
+ target: { providerInstanceId: peerId, options: { reasoningEffort: "max" } },
+ expected: { instanceId: peerId, model: inherited.model, options: override },
+ },
+ ] as const;
+ for (const testCase of cases) {
+ const commands: Array<unknown> = [];
+ const task = {
+ id: taskId,
+ threadId: parentThreadId,
+ origin: "app_owned",
+ childThreadId,
+ providerInstanceId: testCase.expected.instanceId,
+ model: testCase.expected.model,
+ status: "running",
+ result: null,
+ };
+ const dependencies = Layer.mergeAll(
+ NodeServices.layer,
+ Layer.mock(ThreadManagementService.ThreadManagementService)({
+ hasReceipt: () => Effect.succeed(false),
+ assertProviderInstanceEnabled: () => Effect.void,
+ getThreadRecords: (threadId) =>
+ Effect.succeed(
+ threadId === parentThreadId
+ ? parentProjection(commands.length > 0 ? [task] : [], inherited)
+ : childProjection,
+ ),
+ dispatch: (command) =>
+ Effect.sync(() => {
+ commands.push(command);
+ return {
+ sequence: 1,
+ storedEvents: [{ event: { type: "subagent.updated", payload: task } }],
+ } as never;
+ }),
+ }),
+ ServerSettings.layerTest(),
+ providerRegistryLayer([
+ {
+ ...providerSnapshot({
+ instanceId: codexInstanceId,
+ driver,
+ model: inherited.model,
+ }),
+ models: [inherited.model, "other-model"].map((model) => ({
+ slug: model,
+ name: model,
+ isCustom: false,
+ capabilities: null,
+ })),
+ },
+ providerSnapshot({ instanceId: peerId, driver, model: inherited.model }),
+ ]),
+ adapterRegistryLayer([codexInstanceId, peerId]),
+ Layer.mock(ProjectService.ProjectService)({}),
+ Layer.mock(SecretRequests.SecretRequests)({}),
+ Layer.mock(ScheduledTaskService.ScheduledTaskService)({}),
+ );
+ yield* Effect.gen(function* () {
+ const service = yield* OrchestratorMcpService.OrchestratorMcpService;
+ const capabilities = yield* service.capabilities(scope);
+ assert.deepEqual(capabilities.inheritedOptions, inherited.options);
+ yield* service.delegateTask(scope, {
+ task: "Review the change.",
+ target: yield* decodeTarget(testCase.target),
+ mode: "async",
+ clientRequestId: testCase.name,
+ });
+ assert.deepEqual(
+ (commands[0] as { modelSelection: unknown }).modelSelection,
+ testCase.expected,
+ testCase.name,
+ );
+ }).pipe(Effect.provide(layerOrchestratorService.pipe(Layer.provide(dependencies))));
+ }
+ }),
+ );
describe("resolveRuntimeMode", () => {
const muse = {
diff --git a/apps/server/src/mcp/OrchestratorMcpService.ts b/apps/server/src/mcp/OrchestratorMcpService.ts
index 9e300aa23d2..c06a476cac9 100644
--- a/apps/server/src/mcp/OrchestratorMcpService.ts
+++ b/apps/server/src/mcp/OrchestratorMcpService.ts
@@ -1329,15 +1329,23 @@ const make = Effect.gen(function* () {
}
}
+ const inheritsOptions =
+ instanceId === inheritedSelection.instanceId && model === inheritedSelection.model;
+ let options = inheritsOptions ? inheritedSelection.options : undefined;
+ if (requestedOptions !== undefined) {
+ const selections = new Map(
+ (requestedOptions.length === 0 ? [] : (options ?? [])).map((selection) => [
+ selection.id,
+ selection,
+ ]),
+ );
+ for (const selection of requestedOptions) {
+ selections.set(selection.id, selection);
+ }
+ options = [...selections.values()];
+ }
return {
- modelSelection:
- instanceId === inheritedSelection.instanceId &&
- model === inheritedSelection.model &&
- requestedOptions === undefined
- ? inheritedSelection
- : requestedOptions === undefined
- ? { instanceId, model }
- : { instanceId, model, options: requestedOptions },
+ modelSelection: { instanceId, model, ...(options === undefined ? {} : { options }) },
supportedRuntimeModes: provider.supportedRuntimeModes,
};
});
@@ -1460,6 +1468,11 @@ const make = Effect.gen(function* () {
: null;
const resultContextTransferId = resultTransfer?.id ?? null;
const latestTerminalResultContextTransferId = resultTransferForRun(terminalRun)?.id ?? null;
+ const modelSelection = childRun?.modelSelection ??
+ childControls.thread.modelSelection ?? {
+ instanceId: task.providerInstanceId,
+ model: task.model,
+ };
const response = {
taskId: task.id,
childThreadId: task.childThreadId,
@@ -1468,8 +1481,9 @@ const make = Effect.gen(function* () {
status,
workState,
hasPendingChildRuns: hasPendingChildRuns(childProjection, childRun),
- providerInstanceId: task.providerInstanceId,
- model: task.model,
+ providerInstanceId: modelSelection.instanceId,
+ model: modelSelection.model,
+ options: modelSelection.options ?? [],
summary: derivedResult,
resultContextTransferId,
latestTerminalRunId: terminalRun?.id ?? null,
@@ -1924,6 +1938,7 @@ const make = Effect.gen(function* () {
parentThreadId: parent?.thread.id ?? null,
inheritedProviderInstanceId: parent?.thread.modelSelection.instanceId ?? null,
inheritedModel: parent?.thread.modelSelection.model ?? null,
+ inheritedOptions: parent?.thread.modelSelection.options ?? [],
runtimeMode: limits.runtimeMode,
interactionMode: limits.interactionMode,
providers: providers.map((provider) => {
diff --git a/apps/server/src/mcp/OrchestratorMcpToolkit.integration.test.ts b/apps/server/src/mcp/OrchestratorMcpToolkit.integration.test.ts
index 07fe6735b72..325b3548296 100644
--- a/apps/server/src/mcp/OrchestratorMcpToolkit.integration.test.ts
+++ b/apps/server/src/mcp/OrchestratorMcpToolkit.integration.test.ts
@@ -100,7 +100,7 @@ const projectId = ProjectId.make("project:mcp-orchestrator");
const codexInstanceId = ProviderInstanceId.make("codex");
const claudeInstanceId = ProviderInstanceId.make("claudeAgent");
const codexModel = "gpt-5.4";
-const claudeModel = "claude-sonnet-4-6";
+const claudeModel = "claude-opus-4-6";
const parentPrompt = "Keep this parent turn active while orchestration tools are tested.";
const delegatedPrompt = "Inspect the delegated API boundary and return the result.";
const delegatedResult = "Delegated API boundary inspected.";
@@ -150,6 +150,7 @@ interface CapturedTurn {
readonly instanceId: ProviderInstanceId;
readonly threadId: ThreadId;
readonly text: string;
+ readonly modelSelection: ModelSelection;
}
function unsupported(driver: ProviderDriverKind, detail: string) {
@@ -271,6 +272,7 @@ function makeDeterministicAdapter(input: {
instanceId: input.instanceId,
threadId: turnInput.threadId,
text: turnInput.message.text,
+ modelSelection: turnInput.modelSelection,
},
]);
const eventTime = yield* DateTime.now;
@@ -652,6 +654,18 @@ describe("orchestrator MCP toolkit", () => {
instanceId: claudeInstanceId,
driver: ProviderDriverKind.make("claudeAgent"),
model: claudeModel,
+ optionDescriptors: [
+ {
+ id: "effort",
+ label: "Reasoning",
+ type: "select",
+ options: [
+ { id: "high", label: "High" },
+ { id: "max", label: "Max" },
+ ],
+ },
+ { id: "fastMode", label: "Fast mode", type: "boolean" },
+ ],
}),
makeProviderSnapshot({
instanceId: ProviderInstanceId.make("opencode"),
@@ -1652,11 +1666,16 @@ describe("orchestrator MCP toolkit", () => {
.pipe(Effect.flip);
expect(reused.message).toContain("already used");
+ const delegatedOptions = [
+ { id: "effort", value: "max" },
+ { id: "fastMode", value: true },
+ ];
const delegatedCall = yield* invoke("delegate_task", {
task: delegatedPrompt,
target: {
providerInstanceId: claudeInstanceId,
model: claudeModel,
+ options: { effort: "max", fastMode: true },
},
mode: "wait",
timeoutMs: 10_000,
@@ -1680,6 +1699,7 @@ describe("orchestrator MCP toolkit", () => {
expect(delegated.status).toBe("completed");
expect(delegated.summary).toBe(delegatedResult);
expect(delegated.providerInstanceId).toBe(claudeInstanceId);
+ expect(delegated.options).toEqual(delegatedOptions);
const completedParent = yield* waitForProjection(
orchestrator,
@@ -1717,7 +1737,10 @@ describe("orchestrator MCP toolkit", () => {
createdBy: "agent",
creationSource: "mcp",
});
- expect(child.thread.modelSelection).toEqual(claudeSelection);
+ expect(child.thread.modelSelection).toEqual({
+ ...claudeSelection,
+ options: delegatedOptions,
+ });
expect(
child.messages
.filter((message) => message.role === "user")
@@ -1737,6 +1760,7 @@ describe("orchestrator MCP toolkit", () => {
instanceId: claudeInstanceId,
threadId: delegated.childThreadId,
text: delegatedPrompt,
+ modelSelection: { ...claudeSelection, options: delegatedOptions },
},
]);
expect(
diff --git a/apps/server/src/mcp/toolkits/orchestrator/tools.ts b/apps/server/src/mcp/toolkits/orchestrator/tools.ts
index bf2d2e01c41..6ffdfcc6871 100644
--- a/apps/server/src/mcp/toolkits/orchestrator/tools.ts
+++ b/apps/server/src/mcp/toolkits/orchestrator/tools.ts
@@ -65,7 +65,7 @@ const OrchestratorCapabilitiesTool = Tool.make("orchestrator_capabilities", {
export const DelegateTaskTool = Tool.make("delegate_task", {
description:
- "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.",
+ "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.",
parameters: OrchestratorMcpDelegateTaskInput,
success: OrchestratorMcpDelegateTaskResult,
failure: OrchestratorMcpFailure,
@@ -179,7 +179,7 @@ const RequestSecretTool = Tool.make("request_secret", {
export const CreateThreadsTool = Tool.make("create_threads", {
description:
- "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.",
+ "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.",
parameters: OrchestratorMcpCreateThreadsInput,
success: OrchestratorMcpCreateThreadsResult,
failure: OrchestratorMcpFailure,
diff --git a/packages/contracts/src/orchestratorMcp.ts b/packages/contracts/src/orchestratorMcp.ts
index bf41ea299d9..9e0348b0120 100644
--- a/packages/contracts/src/orchestratorMcp.ts
+++ b/packages/contracts/src/orchestratorMcp.ts
@@ -114,7 +114,8 @@ export const OrchestratorMcpTarget = Schema.Struct({
),
options: Schema.optional(
OrchestratorMcpTargetOptions.annotate({
- description: "Model option selections advertised by orchestrator_capabilities.",
+ description:
+ "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.",
}),
),
});
@@ -207,6 +208,12 @@ export const OrchestratorMcpDelegateTaskResult = Schema.Struct({
latestTerminalResultContextTransferId: Schema.NullOr(ContextTransferId),
providerInstanceId: ProviderInstanceId,
model: Schema.NullOr(Schema.String),
+ options: Schema.optional(
+ Schema.Array(ProviderOptionSelection).annotate({
+ description:
+ "Stored model option selections for the child run, or its thread before a run starts. Omitted selections use provider defaults.",
+ }),
+ ),
summary: Schema.NullOr(Schema.String),
resultContextTransferId: Schema.NullOr(ContextTransferId),
hasPendingQuestion: Schema.Boolean.annotate({
@@ -515,6 +522,7 @@ export const OrchestratorMcpCapabilitiesResult = Schema.Struct({
parentThreadId: Schema.NullOr(ThreadId),
inheritedProviderInstanceId: Schema.NullOr(ProviderInstanceId),
inheritedModel: Schema.NullOr(Schema.String),
+ inheritedOptions: Schema.optional(Schema.Array(ProviderOptionSelection)),
runtimeMode: RuntimeMode,
interactionMode: ProviderInteractionMode,
providers: Schema.Array(OrchestratorMcpProviderCapability),
diff --git a/packages/provider-core/src/server/orchestrationInstructions.ts b/packages/provider-core/src/server/orchestrationInstructions.ts
index 727fc5deba4..f06aacd6a3e 100644
--- a/packages/provider-core/src/server/orchestrationInstructions.ts
+++ b/packages/provider-core/src/server/orchestrationInstructions.ts
@@ -10,7 +10,7 @@ export const T3_CODE_ORCHESTRATION_SECTIONS: ReadonlyArray<string> = [
The \`t3-code\` MCP server provides app-owned orchestration. Treat these concepts distinctly:
-- 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.
+- 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.
- \`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.
- 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.`,
`- \`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
### Showing visuals
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.`,
+ `- 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.`,
];
export const T3_CODE_ORCHESTRATION_INSTRUCTIONS = `