From a0af59b52abefc0f24e94a603e53245e7d8ed292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Wed, 4 Mar 2026 16:44:46 +0000 Subject: [PATCH] Fixed a wrong issue number being used for "Implement Plan" links at times (#404) --- entry | 2 +- mcp/comment.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/entry b/entry index b4babbd..70f3531 100755 --- a/entry +++ b/entry @@ -141471,7 +141471,7 @@ async function reportProgress(ctx, { body }) { return { body, action: "skipped" }; } const existingCommentId = ctx.toolState.progressCommentId; - const issueNumber = ctx.toolState.issueNumber ?? ctx.payload.event.issue_number; + const issueNumber = ctx.payload.event.issue_number ?? ctx.toolState.issueNumber; const isPlanMode = ctx.toolState.selectedMode === "Plan"; if (existingCommentId) { const customParts = isPlanMode && issueNumber !== void 0 ? [buildImplementPlanLink(ctx.repo.owner, ctx.repo.name, issueNumber, existingCommentId)] : void 0; diff --git a/mcp/comment.ts b/mcp/comment.ts index 1956645..c0458a8 100644 --- a/mcp/comment.ts +++ b/mcp/comment.ts @@ -178,7 +178,11 @@ export async function reportProgress( } const existingCommentId = ctx.toolState.progressCommentId; - const issueNumber = ctx.toolState.issueNumber ?? ctx.payload.event.issue_number; + // Explicit issue_number from the payload wins here + // This is especially important for manually triggered workflows from trigger links. + // Without this, the created "Implement plan" would be created for the wrong issue + // if the run happens to research other issues (and thus overwrite the toolState.issueNumber). + const issueNumber = ctx.payload.event.issue_number ?? ctx.toolState.issueNumber; const isPlanMode = ctx.toolState.selectedMode === "Plan"; // if we already have a progress comment, update it