Skip to content

Commit 22a453e

Browse files
committed
test(server): pull request tools given a bare thread uuid
Calls link_pull_request with the bare uuid of an mcp: thread. Every thread tool answers that miss with "Did you mean `mcp:<uuid>`?" since #22452; the pull request tools say only that the thread was not found, and fail here.
1 parent d1ec71e commit 22a453e

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ const makeHarness = Effect.fn("makePullRequestsToolkitHarness")(function* (
191191
}),
192192
Layer.mock(Orchestrator.OrchestratorV2)({
193193
getThreadShell: (id) =>
194-
Effect.succeed(id === THREAD_ID && thread ? v2PullRequestThread(thread) : null),
194+
Effect.succeed(id === thread?.id ? v2PullRequestThread(thread) : null),
195195
dispatch,
196196
}),
197197
Layer.succeed(SecureRandom.SecureRandom, testCrypto),
@@ -237,6 +237,21 @@ describe("pull request toolkit handlers", () => {
237237
}),
238238
);
239239

240+
it.effect("points a bare thread uuid at the mcp: thread it belongs to", () =>
241+
Effect.gen(function* () {
242+
const bareId = ThreadId.make("5d0b4a3e-8c1f-4a52-9d37-2f6c7e1b9a04");
243+
const harness = yield* makeHarness({
244+
thread: { ...makeThread([]), id: ThreadId.make(`mcp:${bareId}`) },
245+
});
246+
const error = yield* harness
247+
.call("link_pull_request", { threadId: bareId, number: 123 })
248+
.pipe(Effect.flip);
249+
expect(error.message).toBe(`Thread ${bareId} was not found. Did you mean \`mcp:${bareId}\`?`);
250+
expect(error).toMatchObject({ _tag: "OrchestratorMcpFailure", code: "thread_not_found" });
251+
expect(yield* Ref.get(harness.commands)).toEqual([]);
252+
}),
253+
);
254+
240255
it.effect("links by URL with source agent on the token's thread", () =>
241256
Effect.gen(function* () {
242257
const harness = yield* makeHarness();

0 commit comments

Comments
 (0)