From 5ffbb35e7f3e167920ae20960e2e269f6347fb65 Mon Sep 17 00:00:00 2001 From: Etan Joseph Heyman Date: Thu, 29 Oct 2026 12:00:25 +0200 Subject: [PATCH] fix(server): t3_workflow_run states the repeat shape Co-Authored-By: GPT-6.1 Sol (Codex) --- apps/server/src/mcp/McpHttpServer.test.ts | 89 +++++++++++++++++++ .../src/mcp/toolkits/orchestrator/tools.ts | 28 +++++- apps/server/src/mcp/workflowRun.ts | 21 ++--- .../src/provider/agentContextBudget.json | 2 +- evals/mcp-tool-use/cases/orchestration.ndjson | 1 + packages/contracts/src/orchestratorMcp.ts | 3 +- 6 files changed, 128 insertions(+), 16 deletions(-) diff --git a/apps/server/src/mcp/McpHttpServer.test.ts b/apps/server/src/mcp/McpHttpServer.test.ts index 484de4e6b1ff..92a4c4505593 100644 --- a/apps/server/src/mcp/McpHttpServer.test.ts +++ b/apps/server/src/mcp/McpHttpServer.test.ts @@ -36,6 +36,7 @@ import * as McpSessionRegistry from "./McpSessionRegistry.ts"; import * as OrchestratorMcpService from "./OrchestratorMcpService.ts"; import * as PreviewAutomationBroker from "./PreviewAutomationBroker.ts"; import * as WorkflowRuns from "./WorkflowRuns.ts"; +import { decodeWorkflowSpec } from "./workflowRun.ts"; import * as ThreadMetadataMcpService from "./ThreadMetadataMcpService.ts"; import * as OrchestratorHandlers from "./toolkits/orchestrator/handlers.ts"; import * as PeerForwarding from "../peer/PeerForwarding.ts"; @@ -495,6 +496,94 @@ it("advertises workflow stages as objects that need an id", () => { expect(schema.properties.stages.items?.required).toEqual(["id"]); }); +const repeatSpec = { + name: "review-loop", + stages: [ + { + id: "loop", + repeat: { + stages: [ + { + id: "review", + agents: [ + { + id: "judge", + task: "Judge.", + resultSchema: { + type: "object", + properties: { verdict: { type: "string" } }, + required: ["verdict"], + }, + }, + ], + }, + ], + judge: "judge", + until: { path: "verdict", equals: "accept" }, + max: 3, + }, + }, + ], +}; + +it("advertises the repeat shape with a string judge and required stages, until and max", () => { + const schema = advertisedJsonSchema(OrchestratorToolkit.tools.t3_workflow_run); + expect(schema).toMatchObject({ + properties: { + stages: { + items: { + properties: { + repeat: { + type: "object", + required: ["stages", "judge", "until", "max"], + properties: { + stages: { type: "array", items: { type: "object", required: ["id", "agents"] } }, + judge: { type: "string" }, + until: { type: "object", required: ["path", "equals"] }, + max: { type: "integer", minimum: 1 }, + onExhausted: { enum: ["fail", "pass"] }, + }, + }, + }, + }, + }, + }, + }); +}); + +it.effect.each(["judge", "stages", "until", "max"])( + "rejects malformed repeat %s by naming the expected shape before the run starts", + (field) => { + const calls: Array = []; + return Effect.gen(function* () { + const { repeat } = repeatSpec.stages[0]!; + const malformed: Record = Object.fromEntries( + Object.entries(repeat).filter(([key]) => key !== field), + ); + if (field === "judge") malformed.judge = { id: "private-input" }; + const rejected = yield* callTool("t3_workflow_run", { + ...repeatSpec, + stages: [{ id: "loop", repeat: malformed }], + }).pipe(Effect.flip); + expect(String(rejected)).toContain( + 'repeat is {stages:[{id, agents:[…]}], judge:"agent-id", until:{path, equals}, max:1..10, onExhausted?:"fail"|"pass"}', + ); + expect(String(rejected)).not.toContain("private-input"); + expect(calls).toEqual([]); + }).pipe(Effect.provide(layerRecordingTools(calls))); + }, +); + +const decodeWorkflowParameters = Schema.decodeUnknownEffect( + OrchestratorToolkit.tools.t3_workflow_run.parametersSchema, +); +it.effect("keeps a valid repeat spec unchanged through tool and runner decoding", () => + Effect.gen(function* () { + const input = yield* decodeWorkflowParameters(repeatSpec); + expect(yield* decodeWorkflowSpec(input)).toEqual(repeatSpec); + }), +); + it("keeps cross-tool routing out of the delegate_task description", () => { const description = OrchestratorToolkit.tools.delegate_task.description ?? ""; expect(description).toContain("Start one child agent with only `task`"); diff --git a/apps/server/src/mcp/toolkits/orchestrator/tools.ts b/apps/server/src/mcp/toolkits/orchestrator/tools.ts index 9aab62c70592..459668404414 100644 --- a/apps/server/src/mcp/toolkits/orchestrator/tools.ts +++ b/apps/server/src/mcp/toolkits/orchestrator/tools.ts @@ -41,7 +41,9 @@ import { TrimmedNonEmptyString, } from "@t3tools/contracts"; import { McpSchema, Tool, Toolkit } from "effect/ai"; +import * as Effect from "effect/Effect"; import * as Schema from "effect/Schema"; +import * as SchemaIssue from "effect/SchemaIssue"; import * as Struct from "effect/Struct"; import * as ThreadManagementService from "../../../orchestration-v2/ThreadManagementService.ts"; @@ -52,6 +54,7 @@ import * as McpInvocationContext from "../../McpInvocationContext.ts"; import * as OrchestratorMcpService from "../../OrchestratorMcpService.ts"; import * as ThreadMetadataMcpService from "../../ThreadMetadataMcpService.ts"; import * as WorkflowRuns from "../../WorkflowRuns.ts"; +import { WorkflowRepeat } from "../../workflowRun.ts"; const dependencies = [ McpInvocationContext.McpInvocationContext, @@ -128,15 +131,34 @@ const TaskCancelTool = Tool.make("task_cancel", { const workflowDependencies = [...dependencies, WorkflowRuns.WorkflowRuns]; // Stages advertise only their outline to keep the tool list small; the service decodes the full spec. +const WorkflowAgentStage = Schema.Struct({ + id: Schema.String, + agents: Schema.Array(Schema.Unknown), +}); +const WorkflowRepeatInput = Schema.Struct({ + ...WorkflowRepeat.fields, + stages: Schema.Array(WorkflowAgentStage), + judge: Schema.String, + until: Schema.Struct({ path: Schema.String, equals: Schema.Unknown }), +}).pipe( + Schema.catchDecoding(() => + Effect.fail( + new SchemaIssue.InvalidValue({ + message: + 'repeat is {stages:[{id, agents:[…]}], judge:"agent-id", until:{path, equals}, max:1..10, onExhausted?:"fail"|"pass"}', + }), + ), + ), +); const WorkflowStage = Schema.Struct({ id: Schema.String, agents: Schema.optional(Schema.Array(Schema.Unknown)), - repeat: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)), + repeat: Schema.optional(WorkflowRepeatInput), }).annotate({ message: "stages[] entries are objects: {id, agents:[…]} or {id, repeat:{…}}" }); const WorkflowRunTool = Tool.make("t3_workflow_run", { description: - "Run agents in stages; returns at once and wakes you when done. Stages run in order: `{id, agents:[{id, task, target?, role?, isolation?, resultSchema?}]}` in parallel, or `{id, repeat:{stages, judge, until:{path, equals}, max, onExhausted?}}`. `{{stage}}`, `{{stage.agent}}`, `{{feedback}}` in a task insert results.", + "Ordered stages; parallel agent objects {id,task,target?,resultSchema?}. Wakes on completion. Judge: last-stage agent id. Tasks insert {{stage.agent}}, {{feedback}}.", parameters: Schema.Struct({ name: TrimmedNonEmptyString, stages: Schema.Array(WorkflowStage), @@ -155,7 +177,7 @@ const WorkflowRunTool = Tool.make("t3_workflow_run", { .annotate(Tool.OpenWorld, true); const WorkflowStatusTool = Tool.make("t3_workflow_status", { - description: "Read a `t3_workflow_run` and each agent's result.", + description: "Results.", parameters: Schema.Struct({ subagentId: NodeId }), success: Schema.Unknown, failure: OrchestratorMcpFailure, diff --git a/apps/server/src/mcp/workflowRun.ts b/apps/server/src/mcp/workflowRun.ts index 9d9ff832777b..79f687fdcf07 100644 --- a/apps/server/src/mcp/workflowRun.ts +++ b/apps/server/src/mcp/workflowRun.ts @@ -27,18 +27,19 @@ export type WorkflowAgent = typeof WorkflowAgent.Type; const AgentStage = Schema.Struct({ id: WorkflowId, agents: Schema.NonEmptyArray(WorkflowAgent) }); type AgentStage = typeof AgentStage.Type; +export const WorkflowRepeat = Schema.Struct({ + stages: Schema.NonEmptyArray(AgentStage), + judge: WorkflowId, + until: Schema.Struct({ + path: TrimmedNonEmptyString, + equals: Schema.Union([Schema.String, Schema.Number, Schema.Boolean, Schema.Null]), + }), + max: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 10 })), + onExhausted: Schema.optional(Schema.Literals(["fail", "pass"])), +}); const RepeatStage = Schema.Struct({ id: WorkflowId, - repeat: Schema.Struct({ - stages: Schema.NonEmptyArray(AgentStage), - judge: WorkflowId, - until: Schema.Struct({ - path: TrimmedNonEmptyString, - equals: Schema.Union([Schema.String, Schema.Number, Schema.Boolean, Schema.Null]), - }), - max: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 10 })), - onExhausted: Schema.optional(Schema.Literals(["fail", "pass"])), - }), + repeat: WorkflowRepeat, }); type RepeatStage = typeof RepeatStage.Type; diff --git a/apps/server/src/provider/agentContextBudget.json b/apps/server/src/provider/agentContextBudget.json index 0f9ad7d1fad0..8e0129744654 100644 --- a/apps/server/src/provider/agentContextBudget.json +++ b/apps/server/src/provider/agentContextBudget.json @@ -1,5 +1,5 @@ { "claudeSystemAppendBytes": 5135, "codexAdditionalContextBytes": 6865, - "mcpToolListJsonBytes": 46990 + "mcpToolListJsonBytes": 47103 } diff --git a/evals/mcp-tool-use/cases/orchestration.ndjson b/evals/mcp-tool-use/cases/orchestration.ndjson index a8f4f367ba10..6c7ad32b8966 100644 --- a/evals/mcp-tool-use/cases/orchestration.ndjson +++ b/evals/mcp-tool-use/cases/orchestration.ndjson @@ -37,3 +37,4 @@ {"id": "staged-loop-uses-workflow-run", "area": "orchestration", "kind": "guard", "pattern": "staged multi-provider loop", "experience": "A staged ask (parallel drafts, a judge, revise until accepted, then polish) is one t3_workflow_run. Driving each stage with delegate_task needs a parent turn per stage, and Codex's exec cell yields after about 31 s.", "rule": "Tool description: t3_workflow_run in apps/server/src/mcp/toolkits/orchestrator/tools.ts", "source": {"request": "T3 workflows v2 (EtanHey/t3code#8): t3_workflow_run lets any provider run a staged multi-provider loop"}, "privacy": "commit-safe", "setup": {"role": "top", "mocks": {"orchestrator_capabilities": {"parentThreadId": "33333333-3333-4333-8333-333333333333", "inheritedProviderInstanceId": "claudeAgent", "inheritedModel": "claude-sonnet-5-5", "inheritedOptions": [{"id": "effort", "value": "high"}], "runtimeMode": "full-access", "interactionMode": "default", "features": {"appOwnedSubagents": true, "asyncPolling": true, "cancellation": true, "batchThreadCreation": true, "threadManagement": true, "incrementalThreadRead": true, "scheduledTasks": true}, "providers": [{"providerInstanceId": "claudeAgent", "driverKind": "claudeAgent", "displayName": "Claude", "models": [{"id": "claude-opus-5-5", "label": "Claude Opus 5.5", "options": [{"id": "effort", "values": ["low", "medium", "high", "xhigh", "max"], "default": "high"}, {"id": "fastMode", "type": "boolean", "default": false}]}, {"id": "claude-sonnet-5-5", "label": "Claude Sonnet 5.5", "options": [{"id": "effort", "values": ["low", "medium", "high", "xhigh", "max"], "default": "high"}]}, {"id": "claude-haiku-5-5", "label": "Claude Haiku 5.5", "options": [{"id": "effort", "values": ["low", "medium", "high", "xhigh", "max"], "default": "high"}]}]}, {"providerInstanceId": "codex", "driverKind": "codex", "displayName": "Codex", "models": [{"id": "gpt-6.1-sol", "label": "GPT-6.1 Sol", "options": [{"id": "reasoningEffort", "values": ["low", "medium", "high", "xhigh", "max"], "default": "high"}, {"id": "serviceTier", "values": ["default", "priority"], "default": "default"}]}]}, {"providerInstanceId": "muse", "driverKind": "muse", "displayName": "Muse Code", "runtimeModes": ["approval-required", "full-access"], "models": [{"id": "muse-wonder-full", "label": "Muse Wonder Full", "options": [{"id": "reasoningEffort", "values": ["minimal", "low", "medium", "high", "xhigh", "max"], "default": "high"}]}]}, {"providerInstanceId": "grok", "driverKind": "grok", "displayName": "Grok", "models": [{"id": "grok-4.7", "label": "Grok 4.7", "options": []}]}]}}, "world": {"files": {"CHANGELOG.md": "# Changelog\n\n## 2.4.0\n\n- Threads can be archived from the sidebar.\n- Faster startup on large projects.\n- Fix: the composer no longer loses drafts on reload.\n"}}}, "prompt": "Write the 2.4 release notes from CHANGELOG.md as a pipeline. Claude Sonnet 5.5, GPT-6.1 Sol and Muse Wonder Full each draft in parallel. Then Claude Opus 5.5 judges the drafts and either accepts one or sends feedback. On feedback the three revise and Opus judges again, at most 3 rounds. Then Sonnet polishes the accepted draft. Tell me when it's done.", "expect": {"calls": [{"tool": "t3_workflow_run", "args": {"stages": [{"repeat.max": 3, "repeat.stages": [{"agents": [{"target.model": "claude-opus-5-5"}]}]}]}, "ok": true}, {"tool": "t3_workflow_run", "args": {"stages": "~gpt-6.1-sol"}, "ok": true}, {"tool": "t3_workflow_run", "args": {"stages": "~muse-wonder-full"}, "ok": true}, {"tool": "t3_workflow_run", "args": {"stages": "~claude-sonnet-5-5"}, "ok": true}], "maxCalls": {"delegate_task": 0, "task_status": 0, "t3_workflow_status": 0, "t3_thread_wait": 0, "t3_workflow_run": 1}, "notCalls": ["Workflow"], "shellMustNot": ["\\bsleep\\b"]}, "notes": "Written with the tool, so it cannot fail on text without it. Its control is independent-reviews-stay-delegate. The mock decodes the spec with the real decoder and fails invalid ones; `ok` counts only an accepted call.", "maxSteps": 10} {"id": "independent-reviews-stay-delegate", "area": "orchestration", "kind": "control", "pattern": "independent parallel reviews", "experience": "Two independent reviews, each reported as it lands, are two async delegate_task calls with one wake per child. A workflow run wakes once, at the end.", "rule": "Tool description: t3_workflow_run in apps/server/src/mcp/toolkits/orchestrator/tools.ts", "source": {"request": "T3 workflows v2 (EtanHey/t3code#8): t3_workflow_run lets any provider run a staged multi-provider loop"}, "privacy": "commit-safe", "setup": {"role": "top", "mocks": {"orchestrator_capabilities": {"parentThreadId": "33333333-3333-4333-8333-333333333333", "inheritedProviderInstanceId": "claudeAgent", "inheritedModel": "claude-sonnet-5-5", "inheritedOptions": [{"id": "effort", "value": "high"}], "runtimeMode": "full-access", "interactionMode": "default", "features": {"appOwnedSubagents": true, "asyncPolling": true, "cancellation": true, "batchThreadCreation": true, "threadManagement": true, "incrementalThreadRead": true, "scheduledTasks": true}, "providers": [{"providerInstanceId": "claudeAgent", "driverKind": "claudeAgent", "displayName": "Claude", "models": [{"id": "claude-opus-5-5", "label": "Claude Opus 5.5", "options": [{"id": "effort", "values": ["low", "medium", "high", "xhigh", "max"], "default": "high"}, {"id": "fastMode", "type": "boolean", "default": false}]}, {"id": "claude-sonnet-5-5", "label": "Claude Sonnet 5.5", "options": [{"id": "effort", "values": ["low", "medium", "high", "xhigh", "max"], "default": "high"}]}, {"id": "claude-haiku-5-5", "label": "Claude Haiku 5.5", "options": [{"id": "effort", "values": ["low", "medium", "high", "xhigh", "max"], "default": "high"}]}]}, {"providerInstanceId": "codex", "driverKind": "codex", "displayName": "Codex", "models": [{"id": "gpt-6.1-sol", "label": "GPT-6.1 Sol", "options": [{"id": "reasoningEffort", "values": ["low", "medium", "high", "xhigh", "max"], "default": "high"}, {"id": "serviceTier", "values": ["default", "priority"], "default": "default"}]}]}, {"providerInstanceId": "muse", "driverKind": "muse", "displayName": "Muse Code", "runtimeModes": ["approval-required", "full-access"], "models": [{"id": "muse-wonder-full", "label": "Muse Wonder Full", "options": [{"id": "reasoningEffort", "values": ["minimal", "low", "medium", "high", "xhigh", "max"], "default": "high"}]}]}, {"providerInstanceId": "grok", "driverKind": "grok", "displayName": "Grok", "models": [{"id": "grok-4.7", "label": "Grok 4.7", "options": []}]}]}}, "world": {"branch": "fix/session-stop", "commits": [{"sha": "3e8d1f0", "subject": "fix(server): stop clears an orphaned task row"}], "diff": "diff --git a/src/session.ts b/src/session.ts\n--- a/src/session.ts\n+++ b/src/session.ts\n@@ -10,1 +10,1 @@\n- if (task.status !== \"running\") return;\n+ if (task.status === \"cancelled\") return emitTaskRow(task);\n"}}, "prompt": "Have GPT-6.1 Sol and Muse Wonder Full each review the diff on this branch, independently. Tell me each review as soon as it comes in.", "expect": {"calls": [{"tool": "delegate_task", "args": {"target.model": "gpt-6.1-sol"}}, {"tool": "delegate_task", "args": {"target.model": "muse-wonder-full"}}], "notCalls": ["t3_workflow_run", "Workflow"]}, "maxSteps": 10} {"id": "workflow-run-object-stages-first-try", "area": "orchestration", "kind": "bad", "pattern": "workflow stages sent as strings", "experience": "Asked for two Haiku drafts and a GPT judge via t3_workflow_run, a Codex parent sent every stage as a JSON string on its first call in 3 of 3 trials. All were rejected with 'Expected object at [\"stages\"][0]', and one parent then reported a run that never started.", "rule": "Input schema: t3_workflow_run stages in apps/server/src/mcp/toolkits/orchestrator/tools.ts", "source": {"request": "T3 workflows v2 (EtanHey/t3code#8) shape probe: Codex parents sent string stages to t3_workflow_run"}, "privacy": "commit-safe", "setup": {"role": "top", "harness": "codex", "mocks": {"orchestrator_capabilities": {"parentThreadId": "33333333-3333-4333-8333-333333333333", "inheritedProviderInstanceId": "codex", "inheritedModel": "gpt-6.1-sol", "inheritedOptions": [{"id": "reasoningEffort", "value": "high"}], "runtimeMode": "full-access", "interactionMode": "default", "features": {"appOwnedSubagents": true, "asyncPolling": true, "cancellation": true, "batchThreadCreation": true, "threadManagement": true, "incrementalThreadRead": true, "scheduledTasks": true}, "providers": [{"providerInstanceId": "claudeAgent", "driverKind": "claudeAgent", "displayName": "Claude", "models": [{"id": "claude-haiku-5-5", "label": "Claude Haiku 5.5", "options": [{"id": "effort", "values": ["low", "medium", "high", "xhigh", "max"], "default": "high"}]}]}, {"providerInstanceId": "codex", "driverKind": "codex", "displayName": "Codex", "models": [{"id": "gpt-6.1-sol", "label": "GPT-6.1 Sol", "options": [{"id": "reasoningEffort", "values": ["low", "medium", "high", "xhigh", "max"], "default": "high"}, {"id": "serviceTier", "values": ["default", "priority"], "default": "default"}]}]}]}}, "world": {"files": {}}}, "prompt": "Use t3_workflow_run: two Haiku drafts of a haiku about rain, then a GPT-6.1 Sol judge that picks one. Use Haiku 5.5 at low effort and GPT-6.1 Sol at low reasoning effort with standard service. End your turn after starting it. When completion wakes you, report the winner.", "expect": {"calls": [{"tool": "t3_workflow_run", "args": {"stages": "~claude-haiku-5-5"}, "ok": true}], "maxCalls": {"t3_workflow_run": 1, "delegate_task": 0}, "notCalls": ["Workflow"]}, "notes": "maxCalls t3_workflow_run 1 makes a rejected first call fail the case even when a retry succeeds. The mock decodes the real tool parameters, then the spec, as T3 does.", "maxSteps": 8} +{"id":"workflow-run-repeat-first-try","area":"orchestration","kind":"bad","pattern":"repeat judge sent as an object or omitted","experience":"An unhinted Luna parent made two rejected calls: repeat.judge was an object, then absent. No workflow started.","rule":"Input schema: t3_workflow_run stages in apps/server/src/mcp/toolkits/orchestrator/tools.ts","source":{"request":"T3 workflows v2 P6 final check trial A (EtanHey/t3code#14 follow-up)"},"privacy":"commit-safe","setup":{"role":"top","harness":"codex","mocks":{"orchestrator_capabilities":{"parentThreadId":"33333333-3333-4333-8333-333333333333","inheritedProviderInstanceId":"codex","inheritedModel":"gpt-6.1-sol","inheritedOptions":[{"id":"reasoningEffort","value":"high"}],"runtimeMode":"full-access","interactionMode":"default","features":{"appOwnedSubagents":true,"asyncPolling":true,"cancellation":true,"batchThreadCreation":true,"threadManagement":true,"incrementalThreadRead":true,"scheduledTasks":true},"providers":[{"providerInstanceId":"claudeAgent","driverKind":"claudeAgent","displayName":"Claude","models":[{"id":"claude-haiku-5-5","label":"Claude Haiku 5.5","options":[{"id":"effort","values":["low","medium","high","xhigh","max"],"default":"high"}]}]},{"providerInstanceId":"codex","driverKind":"codex","displayName":"Codex","models":[{"id":"gpt-6.1-sol","label":"GPT-6.1 Sol","options":[{"id":"reasoningEffort","values":["low","medium","high","xhigh","max"],"default":"high"},{"id":"serviceTier","values":["default","priority"],"default":"default"}]}]}]}},"world":{"files":{}}},"prompt":"Use t3_workflow_run once for an inner loop about rain. First get two short haiku drafts from Haiku 5.5 in parallel. Then repeat a Haiku revision followed by a Haiku judge: revise using the drafts and prior feedback, output FIRST_DRAFT without feedback and FINAL_ACCEPTED otherwise. Give the judge a resultSchema requiring a verdict string; accept only a candidate containing FINAL_ACCEPTED, otherwise reject. Stop when verdict is accept, at most three rounds. Finally have Haiku polish the accepted revision. Use Haiku low effort. End your turn after starting; do not poll.","expect":{"calls":[{"tool":"t3_workflow_run","args":{"stages":"~repeat"},"ok":true}],"maxCalls":{"t3_workflow_run":1,"delegate_task":0},"notCalls":["Workflow"]},"notes":"The real tool parameter decoder rejects a non-string or missing judge. A rejected first call fails maxCalls even if repaired later. Existing staged-loop and ordinary delegation cases remain controls. Paid model eval not run; three live Luna trials provide the observed comparison.","maxSteps":8} diff --git a/packages/contracts/src/orchestratorMcp.ts b/packages/contracts/src/orchestratorMcp.ts index 21c1bf8f6c5f..54319c263689 100644 --- a/packages/contracts/src/orchestratorMcp.ts +++ b/packages/contracts/src/orchestratorMcp.ts @@ -196,8 +196,7 @@ export const OrchestratorMcpDelegateTaskInput = Schema.Struct({ interactionMode: Schema.optional(OrchestratorMcpInteractionMode), resultSchema: Schema.optional( OrchestrationV2ResultSchema.annotate({ - description: - "JSON Schema: type, properties, required, items, enum. The child ends with matching JSON, returned as `structuredResult`, or `invalidOutput` says why not.", + description: "JSON Schema subset.", }).check( Schema.makeFilter((schema) => JSON.stringify(schema).length <= 8_000 ? true : "resultSchema is over 8,000 characters.",