Repository navigation
fix(ci): resolve_linked_issue.sh no longer matches keywords mid-sentence - #230
Conversation
Live on PR #225: qa-agent.yml tried to verify it against issue #223's acceptance criteria, completely unrelated (#225 is a CI pipeline-infra fix; #223 is a separate feature closed by the separate PR #224). Root cause: PR #225's own body mentioned, in passing prose, "PR #224 (which fixes #223)" - background context, not PR #225's own closing keyword - and the shared regex matched it anyway. qa-agent caught the mismatch itself and evaluated the PR on its own merits, but flagged it as a process signal. Confirmed via the GitHub GraphQL API (closingIssuesReferences) that this isn't just our script being loose - GitHub's own real closing-keyword parser is exactly this naive too: it had linked PR #225 as a genuine closing reference for issue #223, meaning merging it would have auto-closed the wrong issue a second time. That's a footgun in GitHub's parser this script can't fix, but resolve_linked_issue.sh's actual job (telling dev-agent/qa-agent/principal-review which issue's acceptance criteria a PR should be judged against) is a stricter question than "what would GitHub technically auto-close" - matching GitHub's looser behavior here isn't worth keeping. Anchors the keyword to the start of its (trimmed) line, stripping optional markdown list/heading/blockquote markers first - matches how every real PR in this pipeline already writes it ("Closes #N" alone on its own line) and rejects mid-sentence mentions. Verified against real PR bodies: #224 still resolves to 223, #229 still resolves to 227, #221 (pre-existing pipeline PR) still resolves to 4, #225 now correctly resolves to nothing. Also cleaned up PR #225's own body to stop tripping this (both the original phrasing and, ironically, an early draft of this explanation itself re-triggered the same match). Closes #228 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
📱 iOS Build Status: PASSED✅ iOS Simulator Build & Unit Tests - success iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those. |
QA verification — PR #230 vs issue #228Issue #228 acceptance criteria (bug report; no explicit checklist, so
What I ran:
No regressions found in related areas — QA verdict: PASS |
Principal review — PR #230Risk label: CI: JVM Tests, iOS Simulator build, Android build, and QA Agent Correctness — verified by hand, not by reading the diff and believing it:
Minor nit (not blocking): the new comment block (lines 43-45) says the AGENTS.md test-coverage rule: No bats/pytest harness exists for No new networking dependency, no sensitive-path touches, no Verdict: auto-merge ( |
|
Auto-merge failed (see the workflow run log for the exact error) — routed to a human instead of leaving this stuck on status:approved-auto-merge. |
📱 iOS Build Status: PASSED✅ iOS Simulator Build & Unit Tests - success iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those. |
Rebased on top of #230, which already fixed #228's core bug (line-start anchoring instead of a bare \b match). This adds what #230 didn't cover: - resolve_linked_issue.sh now explicitly rejects PR bodies with more than one distinct closing-issue line, instead of silently taking the first match via `head -1` — every downstream caller only supports a single linked issue, so ambiguity now fails loudly (consistent with the script's existing "fail loudly, don't guess" stance on gh failures) rather than picking one guess and dropping the other. - Refactors the matching logic into resolve_from_body() so it can be tested without a live `gh` call; adds test_resolve_linked_issue.sh (13 cases: the real PR #225 false-positive, #230's synthetic cases bullet/heading/indented/blockquote, mid-sentence rejection, the disclosed/enclosed substring guard, and the new ambiguity rejection). No bats/pytest harness exists for .github/scripts/* in this repo — #230's own PR body noted the same gap — so this is a standalone script matching how the sibling scripts here are invoked. - Updates dev-agent.md's PR-body guidance and the two "Could not resolve..." operator-facing messages in dev-agent.yml/qa-agent.yml to say the closing line must stand on its own, so future dev-agent PRs don't unknowingly write it in prose and fall through to "no linked issue" (safe, just misses the automatic QA/review advance). Closes #228
…#232) Rebased on top of #230, which already fixed #228's core bug (line-start anchoring instead of a bare \b match). This adds what #230 didn't cover: - resolve_linked_issue.sh now explicitly rejects PR bodies with more than one distinct closing-issue line, instead of silently taking the first match via `head -1` — every downstream caller only supports a single linked issue, so ambiguity now fails loudly (consistent with the script's existing "fail loudly, don't guess" stance on gh failures) rather than picking one guess and dropping the other. - Refactors the matching logic into resolve_from_body() so it can be tested without a live `gh` call; adds test_resolve_linked_issue.sh (13 cases: the real PR #225 false-positive, #230's synthetic cases bullet/heading/indented/blockquote, mid-sentence rejection, the disclosed/enclosed substring guard, and the new ambiguity rejection). No bats/pytest harness exists for .github/scripts/* in this repo — #230's own PR body noted the same gap — so this is a standalone script matching how the sibling scripts here are invoked. - Updates dev-agent.md's PR-body guidance and the two "Could not resolve..." operator-facing messages in dev-agent.yml/qa-agent.yml to say the closing line must stand on its own, so future dev-agent PRs don't unknowingly write it in prose and fall through to "no linked issue" (safe, just misses the automatic QA/review advance). Closes #228
Summary
Closes #228.
Live on PR #225:
qa-agent.ymltried to verify it against issue 223'sacceptance criteria — completely unrelated (PR #225 is a CI pipeline-infra
change; issue 223 is a separate feature, actually addressed by the
separate PR #224). Root cause: PR #225's own body mentioned, in passing
prose, "PR #224 (which fixes issue 223)" — background context, not PR
#225's own closing keyword — and
resolve_linked_issue.sh's regex matchedit anyway, treating it as PR #225's linked issue.
qa-agentcaught theresulting mismatch itself and evaluated the PR on its own merits instead
of forcing an irrelevant checklist onto it, but flagged the pairing for a
human.
Confirmed: this isn't just our script being loose
Checked
closingIssuesReferencesvia the GitHub GraphQL API — GitHub'sown real closing-keyword parser is exactly this naive too. It had
genuinely linked PR #225 as a closing reference for issue 223, meaning
merging it as originally worded would have auto-closed the wrong issue a
second time. That's a footgun in GitHub's own parser this script can't
fix — but
resolve_linked_issue.sh's actual job (tellingdev-agent/qa-agent/principal-review which issue's acceptance criteria a
PR should be judged against) is a stricter question than "what would
GitHub technically auto-close," so matching GitHub's looser behavior here
isn't worth keeping.
Fix
Anchors the keyword to the start of its (trimmed) line, stripping
optional markdown list/heading/blockquote markers first — matches how
every real PR in this pipeline already writes it ("Closes #N" alone on
its own line) and rejects mid-sentence mentions.
Also cleaned up PR #225's own body to stop tripping this (an early draft
of that cleanup's own explanation ironically re-triggered the same match
— fixed too, by spelling out issue numbers as prose instead of
#Nwherethe sentence isn't an actual closing keyword).
Risk
.github/scripts/**is not inagent-policy.yml'ssensitive_paths—should classify
risk:low(small diff, no sensitive-path match). Sharedby all three pipeline workflows, so a regression here would affect every
future PR's issue-linking, not just this one; see test plan below for
what was actually checked.
Test plan
No bats/pytest harness exists for
.github/scripts/*in this repo (samegap principal review noted on PR #225) — verified by hand against real
PR bodies via
gh pr view, running the updated script directly:Closes #223on its own line) → still resolves to223.Closes #227on its own line) → still resolves to227.unrelated real case) → still resolves to
4, unchanged.before its body was cleaned up) → now correctly resolves to nothing.
- Closes #55), heading (## Fixes #77),indented plain text (
Resolves #88), blockquote (> Closes #12) allstill match; mid-sentence (
This PR (which fixes #99) does X) and thepre-existing disclosed/enclosed false-substring guard both still
correctly produce no match.
🤖 Generated with Claude Code
Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com