From 6acab03eef97fd75080d0051bd7e51f0c02c1f25 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Mon, 23 Nov 2026 06:51:50 +0000 Subject: [PATCH 1/2] test(server): schedule_task should advertise webhook prompt templates (#41288) Fails on main: mergeTaggedObjects drops each union branch's description, so the webhook branch's {{body.path}} template text never reaches agents. Co-Authored-By: Claude Opus 5.5 --- apps/server/src/mcp/advertisedJsonSchema.test.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/server/src/mcp/advertisedJsonSchema.test.ts b/apps/server/src/mcp/advertisedJsonSchema.test.ts index 6ab74f96db69..3f8626cc6849 100644 --- a/apps/server/src/mcp/advertisedJsonSchema.test.ts +++ b/apps/server/src/mcp/advertisedJsonSchema.test.ts @@ -3,6 +3,7 @@ import * as Schema from "effect/Schema"; import { Tool } from "effect/ai"; import { advertisedJsonSchema } from "./advertisedJsonSchema.ts"; +import { OrchestratorToolkit } from "./toolkits/orchestrator/tools.ts"; import { ThemeToolkit } from "./toolkits/theme/tools.ts"; it("drops JSON noise, merges tagged unions, and keeps null where it is required", () => { @@ -59,3 +60,9 @@ it("advertises only string enum values, which Gemini requires", () => { expect(enumValues.filter((value) => typeof value !== "string")).toEqual([]); }); + +it("keeps a merged union branch's description, such as schedule_task's webhook prompt templates", () => { + const advertised = JSON.stringify(advertisedJsonSchema(OrchestratorToolkit.tools.schedule_task)); + + expect(advertised).toContain("{{body.path}}"); +}); From efcd890c7e875933eb7bab57da6944d6bf9d96cc Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Mon, 23 Nov 2026 06:57:07 +0000 Subject: [PATCH 2/2] fix(server): schedule_task advertises webhook prompt templates mergeTaggedObjects collapsed tagged unions into one object and dropped each branch's description, so the webhook branch's {{body.path}} prompt template text never reached agents. Carry branch descriptions onto the merged tag property, prefixed by the tag value they belong to. Co-Authored-By: Claude Opus 5.5 --- apps/server/src/mcp/advertisedJsonSchema.ts | 13 +++++++++++-- apps/server/src/provider/agentContextBudget.json | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/apps/server/src/mcp/advertisedJsonSchema.ts b/apps/server/src/mcp/advertisedJsonSchema.ts index 8b8737a52918..be8a8fe316a8 100644 --- a/apps/server/src/mcp/advertisedJsonSchema.ts +++ b/apps/server/src/mcp/advertisedJsonSchema.ts @@ -32,7 +32,7 @@ const tagOf = (branch: JsonObject, key: string): Json => { : undefined; }; -/** One object for a tagged union of objects: each property once, the tag listing every value. */ +/** One object for a tagged union of objects: each property once, the tag listing every value and branch description. */ const mergeTaggedObjects = (branches: ReadonlyArray): JsonObject | undefined => { if (branches.length < 2) return undefined; const objects = branches.filter( @@ -47,8 +47,17 @@ const mergeTaggedObjects = (branches: ReadonlyArray): JsonObject | undefin return values.every((value) => value !== undefined) && new Set(values).size === values.length; }); if (tag === undefined) return undefined; + const branchDescriptions = objects.flatMap((object) => + typeof object.description === "string" + ? [`${String(tagOf(object, tag))}: ${object.description}`] + : [], + ); const properties: JsonObject = { - [tag]: { type: "string", enum: objects.map((object) => tagOf(object, tag)) }, + [tag]: { + type: "string", + enum: objects.map((object) => tagOf(object, tag)), + ...(branchDescriptions.length > 0 && { description: branchDescriptions.join(" ") }), + }, }; for (const object of objects) { for (const [name, property] of Object.entries(object.properties)) { diff --git a/apps/server/src/provider/agentContextBudget.json b/apps/server/src/provider/agentContextBudget.json index 169fac6ce2a8..07e4bed5125b 100644 --- a/apps/server/src/provider/agentContextBudget.json +++ b/apps/server/src/provider/agentContextBudget.json @@ -1,5 +1,5 @@ { "claudeSystemAppendBytes": 6245, "codexAdditionalContextBytes": 7639, - "mcpToolListJsonBytes": 61724 + "mcpToolListJsonBytes": 61861 }