Skip to content

Commit 6856500

Browse files
MarcoDotIOclaudemaria-rcks
authored
fix(server): unlink_pull_request reports a dismissed stack PR as not linked (#25561)
Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: maria-rcks <[email protected]>
1 parent f482dc5 commit 6856500

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,20 @@ describe("pull request toolkit handlers", () => {
517517
}),
518518
);
519519

520+
it.effect("reports a dismissed stack member as not linked and leaves it dismissed", () =>
521+
Effect.gen(function* () {
522+
const harness = yield* makeHarness({
523+
thread: makeThread([makeLink(9, { source: "stack-dismissed" })]),
524+
});
525+
const result = yield* harness.call("unlink_pull_request", {
526+
repository: "t3tools/t3code",
527+
number: 9,
528+
});
529+
expect(result.wasLinked).toBe(false);
530+
expect(yield* Ref.get(harness.commands)).toEqual([]);
531+
}),
532+
);
533+
520534
it.effect("links several pull requests in one call", () =>
521535
Effect.gen(function* () {
522536
const harness = yield* makeHarness({

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,11 @@ const make = Effect.gen(function* () {
446446
const thread = yield* requireThread(PullRequestUnlinkFailedError, input.threadId);
447447
const project = yield* projectOf(thread, PullRequestUnlinkFailedError);
448448
const target = yield* resolveTarget(input, project);
449-
if (!threadPullRequestsOf(thread).some((link) => threadPullRequestKeysEqual(link, target)))
449+
if (
450+
!threadPullRequestsOf(thread).some(
451+
(link) => link.source !== "stack-dismissed" && threadPullRequestKeysEqual(link, target),
452+
)
453+
)
450454
return {
451455
host: target.host,
452456
repository: target.repository,

0 commit comments

Comments
 (0)