@devries-cameron20 / t3code Mirror · read-only / commits / 7bdcb1e5ff
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 03:15 UTC

fix(server): pull request tools point a bare thread uuid at its mcp: thread (#30375)

spoukyii committed Nov 5, 2026 at 20:29 UTC 7bdcb1e5ff82345a1a0c2e1581c53e7fcbd86d28
3 files changed +18 -13
apps/server/src/mcp/toolkits/pullRequests/handlers.test.ts
+16 -1
@@ -191,7 +191,7 @@ const makeHarness = Effect.fn("makePullRequestsToolkitHarness")(function* (
191 }),
192 Layer.mock(Orchestrator.OrchestratorV2)({
193 getThreadShell: (id) =>
194 - Effect.succeed(id === THREAD_ID && thread ? v2PullRequestThread(thread) : null),
194 + Effect.succeed(id === thread?.id ? v2PullRequestThread(thread) : null),
195 dispatch,
196 }),
197 Layer.succeed(SecureRandom.SecureRandom, testCrypto),
@@ -237,6 +237,21 @@ describe("pull request toolkit handlers", () => {
237 }),
238 );
239
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 +
255 it.effect("links by URL with source agent on the token's thread", () =>
256 Effect.gen(function* () {
257 const harness = yield* makeHarness();
apps/server/src/mcp/toolkits/pullRequests/handlers.ts
+2 -2
@@ -27,6 +27,7 @@ import {
27 } from "../../../sourceControl/threadPullRequests.ts";
28 import * as McpInvocationContext from "../../McpInvocationContext.ts";
29 import * as McpToolAccess from "../../McpToolAccess.ts";
30 +import { threadNotFound } from "../../threadAccess.ts";
31 import {
32 type ListThreadPullRequestsResult,
33 PullRequestLinkFailedError,
@@ -40,7 +41,6 @@ import {
41 type PullRequestTargetInput,
42 PullRequestWatchFailedError,
43 PullRequestWatchFromSubagentError,
43 - PullRequestThreadNotFoundError,
44 PullRequestThreadRequiredError,
45 PullRequestGuideFailedError,
46 PullRequestProjectNotFoundError,
@@ -226,7 +226,7 @@ const make = Effect.gen(function* () {
226 Effect.mapError((cause) => new Failure({ cause })),
227 );
228 if (Option.isNone(thread) || thread.value.deletedAt !== null) {
229 - return yield* new PullRequestThreadNotFoundError({ threadId });
229 + return yield* threadNotFound(engine, threadId, `Thread ${threadId} was not found.`);
230 }
231 return thread.value;
232 });
apps/server/src/mcp/toolkits/pullRequests/tools.ts
-10
@@ -104,15 +104,6 @@ export class PullRequestThreadRequiredError extends Schema.TaggedError<PullReque
104 }
105 }
106
107 -export class PullRequestThreadNotFoundError extends Schema.TaggedError<PullRequestThreadNotFoundError>()(
108 - "PullRequestThreadNotFoundError",
109 - { threadId: Schema.String },
110 -) {
111 - override get message(): string {
112 - return `Thread ${this.threadId} was not found.`;
113 - }
114 -}
115 -
107 export class PullRequestLinkFailedError extends Schema.TaggedError<PullRequestLinkFailedError>()(
108 "PullRequestLinkFailedError",
109 { cause: Schema.Defect() },
@@ -193,7 +184,6 @@ export const PullRequestToolError = Schema.Union([
184 PullRequestHostRequiredError,
185 PullRequestUrlUnavailableError,
186 PullRequestThreadRequiredError,
196 - PullRequestThreadNotFoundError,
187 PullRequestLinkFailedError,
188 PullRequestUnlinkFailedError,
189 PullRequestListFailedError,