fix: Prevent duplicate workflow runs on @codebot mentions
All checks were successful
Enterprise AI Code Review / ai-review (pull_request) Successful in 40s

Critical fix for workflow routing that was causing 3x duplication on every
@codebot mention. All three workflows (ai-chat, ai-comment-reply, ai-issue-triage)
were triggering simultaneously.

Changes:
- ai-issue-triage.yml: Only runs on '@codebot triage' (unchanged, already specific)
- ai-comment-reply.yml: Only runs on specific commands (help, explain, suggest, etc)
- ai-chat.yml: Only runs on free-form questions (excludes all specific commands)

Workflow routing logic:
1. '@codebot triage' → ai-issue-triage.yml ONLY
2. '@codebot <command>' → ai-comment-reply.yml ONLY
3. '@codebot <question>' → ai-chat.yml ONLY (fallback)

This prevents the massive duplication issue where every @codebot mention
triggered all three workflows simultaneously, causing 10+ redundant runs.

Updated documentation in CLAUDE.md with workflow routing architecture.
This commit is contained in:
2025-12-29 10:30:55 +00:00
parent 17302361e6
commit 21470c7a4a
4 changed files with 76 additions and 37 deletions

View File

@@ -186,14 +186,21 @@ Optional:
## Workflow Architecture
Workflows are located in `.gitea/workflows/`:
Workflows are located in `.gitea/workflows/` and are **mutually exclusive** to prevent duplicate runs:
- **ai-review.yml** / **enterprise-ai-review.yml** - Triggered on PR open/sync
- **ai-issue-triage.yml** - Triggered on `@codebot triage` mention in issue comments
- **ai-comment-reply.yml** - Triggered on issue comments with @bot mentions
- **ai-chat.yml** - Triggered on issue comments for chat (non-command mentions)
- **enterprise-ai-review.yml** - Triggered on PR open/sync
- **ai-issue-triage.yml** - Triggered ONLY on `@codebot triage` in comments
- **ai-comment-reply.yml** - Triggered on specific commands: `help`, `explain`, `suggest`, `security`, `summarize`, `review-again`, `setup-labels`
- **ai-chat.yml** - Triggered on `@codebot` mentions that are NOT specific commands (free-form questions)
- **ai-codebase-review.yml** - Scheduled weekly analysis
**Workflow Routing Logic:**
1. If comment contains `@codebot triage` → ai-issue-triage.yml only
2. If comment contains specific command (e.g., `@codebot help`) → ai-comment-reply.yml only
3. If comment contains `@codebot <question>` (no command) → ai-chat.yml only
This prevents the issue where all three workflows would trigger on every `@codebot` mention, causing massive duplication.
**Note**: Issue triage is now **opt-in** via `@codebot triage` command, not automatic on issue creation.
Key workflow pattern: