Skip to content
TypeScript

fix(server): unlink_pull_request reports a dismissed stack PR as not linked (#25561)

MarcoDotIO68565006359c
diff --git a/apps/server/src/mcp/toolkits/pullRequests/handlers.test.ts b/apps/server/src/mcp/toolkits/pullRequests/handlers.test.ts
index 52802bfbb10..714af0312b4 100644
--- a/apps/server/src/mcp/toolkits/pullRequests/handlers.test.ts
+++ b/apps/server/src/mcp/toolkits/pullRequests/handlers.test.ts
@@ -517,6 +517,20 @@ describe("pull request toolkit handlers", () => {
}),
);
+ it.effect("reports a dismissed stack member as not linked and leaves it dismissed", () =>
+ Effect.gen(function* () {
+ const harness = yield* makeHarness({
+ thread: makeThread([makeLink(9, { source: "stack-dismissed" })]),
+ });
+ const result = yield* harness.call("unlink_pull_request", {
+ repository: "t3tools/t3code",
+ number: 9,
+ });
+ expect(result.wasLinked).toBe(false);
+ expect(yield* Ref.get(harness.commands)).toEqual([]);
+ }),
+ );
+
it.effect("links several pull requests in one call", () =>
Effect.gen(function* () {
const harness = yield* makeHarness({
diff --git a/apps/server/src/mcp/toolkits/pullRequests/handlers.ts b/apps/server/src/mcp/toolkits/pullRequests/handlers.ts
index 581dc6708dc..7798ec11bff 100644
--- a/apps/server/src/mcp/toolkits/pullRequests/handlers.ts
+++ b/apps/server/src/mcp/toolkits/pullRequests/handlers.ts
@@ -446,7 +446,11 @@ const make = Effect.gen(function* () {
const thread = yield* requireThread(PullRequestUnlinkFailedError, input.threadId);
const project = yield* projectOf(thread, PullRequestUnlinkFailedError);
const target = yield* resolveTarget(input, project);
- if (!threadPullRequestsOf(thread).some((link) => threadPullRequestKeysEqual(link, target)))
+ if (
+ !threadPullRequestsOf(thread).some(
+ (link) => link.source !== "stack-dismissed" && threadPullRequestKeysEqual(link, target),
+ )
+ )
return {
host: target.host,
repository: target.repository,