Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
fix(ci): verify step drops issues when concurrency cancels initial run (#1519)
worktrunk-bot9d39b44508a7
diff --git a/.github/CLAUDE.md b/.github/CLAUDE.mdindex f56fa96dc..0d2f3fe24 100644--- a/.github/CLAUDE.md+++ b/.github/CLAUDE.md@@ -134,7 +134,7 @@ The mention workflow runs for any user who includes `@worktrunk-bot` — the mer- Formal review submitted on a `worktrunk-bot`-authored PR, with body or non-approval → `claude-review` responds- `@worktrunk-bot` mentioned in an issue body → `claude-mention` responds- `@worktrunk-bot` mentioned in any comment (issue or PR) → `claude-mention` responds-- Any comment on a PR or issue that `worktrunk-bot` has engaged with (authored, reviewed, or commented on) → `claude-mention` runs (verify step confirms engagement via API), but the prompt instructs Claude to only respond if the comment needs bot input — otherwise exit silently. When the bot authored the PR/issue, it leans toward responding since commenters expect the author to engage.+- Any comment on a PR or issue that `worktrunk-bot` has engaged with (authored, mentioned in the issue body, reviewed, or commented on) → `claude-mention` runs (verify step confirms engagement via API), but the prompt instructs Claude to only respond if the comment needs bot input — otherwise exit silently. When the bot authored the PR/issue, it leans toward responding since commenters expect the author to engage.- Editing a comment or issue body re-triggers the same response**Does not trigger:**diff --git a/.github/workflows/claude-mention.yaml b/.github/workflows/claude-mention.yamlindex d82a3af7b..6c5a80c44 100644--- a/.github/workflows/claude-mention.yaml+++ b/.github/workflows/claude-mention.yaml@@ -58,6 +58,27 @@ jobs:id-token: writeactions: read # Required for Claude to read CI results on PRssteps:+ # Verify bot engagement — gate for non-mention comments.+ #+ # Skipped (all subsequent steps run) when:+ # - Event is not a comment (issues opened/edited with @worktrunk-bot)+ # - Comment body contains @worktrunk-bot (explicit mention)+ #+ # When it runs, checks engagement in order (first match exits 0):+ #+ # Plain issues:+ # 1. Bot authored the issue+ # 2. Issue body mentions @worktrunk-bot (catches the race where+ # concurrency cancelled the initial run before the bot commented)+ # 3. Bot has commented on the issue+ #+ # PRs:+ # 1. Bot authored the PR+ # 2. Bot has left a review+ # 3. Bot has commented+ #+ # If none match → exit 1 (continue-on-error makes this non-fatal;+ # subsequent steps check `steps.verify.outcome != 'failure'`).- name: 🔍 Verify bot engagementid: verifycontinue-on-error: true@@ -67,11 +88,13 @@ jobs:ISSUE_NUMBER="${{ github.event.issue.number }}"if [ -z "${{ github.event.issue.pull_request.url }}" ]; then- # Plain issue — check if bot authored or commentedISSUE_AUTHOR="${{ github.event.issue.user.login }}"if [ "$ISSUE_AUTHOR" = "worktrunk-bot" ]; thenexit 0fi+ if echo "$ISSUE_BODY" | grep -qF '@worktrunk-bot'; then+ exit 0+ fiBOT_COMMENTS=$(gh api "repos/$GITHUB_REPOSITORY/issues/$ISSUE_NUMBER/comments" \--jq '[.[] | select(.user.login == "worktrunk-bot")] | length')if [ "$BOT_COMMENTS" -gt "0" ]; then@@ -107,6 +130,7 @@ jobs:exit 1env:GH_TOKEN: ${{ secrets.WORKTRUNK_BOT_TOKEN }}+ ISSUE_BODY: ${{ github.event.issue.body }}- name: 📂 Checkout codeif: steps.verify.outcome != 'failure'