From 3128a645ab6037554afa83a918972fc55e673667 Mon Sep 17 00:00:00 2001 From: Tosin Afolabi Date: Fri, 13 Feb 2026 10:15:19 -0500 Subject: [PATCH] fix: don't require bot ID match when header is present MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bot_id default (41898282 = github-actions[bot]) doesn't match claude[bot] (209825114) when using OIDC auth. This caused the sticky comment matching to always fail, creating new comments each run. Header-based matching is authoritative — if a comment has our specific header, that's sufficient for identification. Bot ID check is now only used for legacy comments without headers. Co-Authored-By: Claude Opus 4.6 --- src/github/operations/comments/create-initial.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/github/operations/comments/create-initial.ts b/src/github/operations/comments/create-initial.ts index a7fb4bd..02a3e18 100644 --- a/src/github/operations/comments/create-initial.ts +++ b/src/github/operations/comments/create-initial.ts @@ -50,10 +50,6 @@ export async function createInitialComment( ); const existingComment = comments.find((comment) => { - // Must be from the correct bot user - const idMatch = comment.user?.id === Number(context.inputs.botId); - if (!idMatch) return false; - if (botIdentifier) { // Check for our hidden header (case-insensitive, whitespace-tolerant) const headerPattern = new RegExp( @@ -67,12 +63,15 @@ export async function createInitialComment( comment.body || "", ); - // If comment has a header, ONLY match if it's ours + // Header match is authoritative — no bot ID check needed if (hasAnyHeader) { return hasOurHeader; } - // Legacy comments (no header): match if it looks like a Claude comment + // Legacy comments (no header): require bot ID + Claude content + const idMatch = comment.user?.id === Number(context.inputs.botId); + if (!idMatch) return false; + const isClaudeComment = comment.body?.includes("Claude Code is working") || comment.body?.includes("View job run"); @@ -80,11 +79,12 @@ export async function createInitialComment( return isClaudeComment; } - // Fallback when no botIdentifier: match any Claude-looking comment + // Fallback when no botIdentifier: match by bot user + const idMatch = comment.user?.id === Number(context.inputs.botId); const botNameMatch = comment.user?.type === "Bot" && comment.user?.login.toLowerCase().includes("claude"); - return botNameMatch; + return idMatch || botNameMatch; }); if (existingComment) {