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