diff --git a/.github/scripts/agents_pr_meta_keepalive.js b/.github/scripts/agents_pr_meta_keepalive.js index 7a219753..10eab2c8 100644 --- a/.github/scripts/agents_pr_meta_keepalive.js +++ b/.github/scripts/agents_pr_meta_keepalive.js @@ -240,6 +240,11 @@ function extractIssueNumberFromPull(pull) { if (match.index > 0 && /\w/.test(bodyText[match.index - 1])) { continue; } + // Skip non-issue refs like "Run #123", "run #123", "attempt #2" + const preceding = bodyText.slice(Math.max(0, match.index - 20), match.index); + if (/\b(?:run|attempt|step|job|check|task|version|v)\s*$/i.test(preceding)) { + continue; + } candidates.push(match[1]); } diff --git a/.github/scripts/agents_pr_meta_update_body.js b/.github/scripts/agents_pr_meta_update_body.js index ec9a585a..3e987c10 100644 --- a/.github/scripts/agents_pr_meta_update_body.js +++ b/.github/scripts/agents_pr_meta_update_body.js @@ -404,7 +404,7 @@ function parseCheckboxStates(block) { if (inCodeBlock) { continue; } - const match = line.match(/^- \[(x| )\]\s*(.+)$/i); + const match = line.match(/^\s*- \[(x| )\]\s*(.+)$/i); if (match) { const checked = match[1].toLowerCase() === 'x'; const text = match[2].trim(); @@ -461,12 +461,13 @@ function mergeCheckboxStates(newContent, existingStates) { updated.push(line); continue; } - const match = line.match(/^- \[( )\]\s*(.+)$/); + const match = line.match(/^(\s*)- \[( )\]\s*(.+)$/); if (match) { - const text = match[2].trim(); + const indent = match[1]; + const text = match[3].trim(); const normalized = text.replace(/^-\s*/, '').trim().toLowerCase(); if (existingStates.has(normalized)) { - updated.push(`- [x] ${text}`); + updated.push(`${indent}- [x] ${text}`); continue; } }