Skip to content

Commit 8365f89

Browse files
committed
fix(server): reject title generation without a message
1 parent eab70a0 commit 8365f89

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎apps/server/src/mcp/toolkits/project/handlers.test.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,13 @@ it.effect(
235235
});
236236
expect(titled.launched[0]).toMatchObject({ title: "Fix", generateTitle: true });
237237

238+
const idleTitled = yield* launchWith("full-access", "full-access", {
239+
title: "Fix",
240+
generateTitle: true,
241+
});
242+
expect(idleTitled.result).toMatchObject({ code: "invalid_request" });
243+
expect(idleTitled.launched).toHaveLength(0);
244+
238245
const aboveCeiling = yield* launchWith("auto-accept-edits", "full-access", {
239246
title: "Fix",
240247
hostedAppUrl: "https://t3.example.com",

‎apps/server/src/mcp/toolkits/project/handlers.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ export const layer = McpToolAccess.toLayer(ProjectToolkit, {
101101
const threadId = ThreadId.make(commandId);
102102
const messageId = MessageId.make(commandId);
103103
const attachments = input.attachments ?? [];
104+
if (input.generateTitle === true && input.message === undefined && attachments.length === 0)
105+
return yield* new OrchestratorMcpFailure({
106+
code: "invalid_request",
107+
message: "Title generation requires a message or attachments. No thread was created.",
108+
});
104109
if (attachments.some((attachment) => !Claims.attachmentIsPendingUpload(attachment)))
105110
return yield* new OrchestratorMcpFailure({
106111
code: "invalid_request",

0 commit comments

Comments
 (0)