Skip to content

[From PR #937] catalog_ops lost across loop/recur iterations #1503

[From PR #937] catalog_ops lost across loop/recur iterations

[From PR #937] catalog_ops lost across loop/recur iterations #1503

name: Claude Issue Review
on:
issues:
types: [labeled]
jobs:
claude-issue-review:
# Only run when 'needs-review' label is added
# Skip quick-fix issues - they're handled by batch-fix workflow
if: |
github.event.label.name == 'needs-review' &&
!contains(github.event.issue.labels.*.name, 'quick-fix')
runs-on: ubuntu-latest
concurrency:
group: claude-automation
cancel-in-progress: false
permissions:
contents: read
issues: write
id-token: write
env:
MIX_ENV: test
steps:
- name: Check PAT availability
run: |
if [ -z "${{ secrets.PAT_WORKFLOW_TRIGGER }}" ]; then
echo "::warning::PAT_WORKFLOW_TRIGGER secret not set - @claude trigger won't work"
fi
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Setup Elixir environment
uses: ./.github/actions/setup-elixir
- name: Setup Claude Code
id: setup-claude
uses: ./.github/actions/setup-claude-code
- name: Run Claude Issue Review
uses: anthropics/claude-code-action@v1
env:
# Use PAT so that adding ready-for-implementation label triggers PM workflow
# Falls back to github.token if PAT not available (but PM trigger won't work)
GH_TOKEN: ${{ secrets.PAT_WORKFLOW_TRIGGER || github.token }}
with:
allowed_bots: "claude"
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
path_to_claude_code_executable: ${{ steps.setup-claude.outputs.executable-path }}
prompt: |
REPO: ${{ github.repository }}
ISSUE NUMBER: ${{ github.event.issue.number }}
ISSUE TITLE: ${{ github.event.issue.title }}
## Step 1: Get Context
1. Read the issue: `gh issue view ${{ github.event.issue.number }} --comments`
2. Check for `epic:*` label. If present, read the active epic for context:
```bash
gh issue list --label "type:epic" --label "status:active" --state open --json number,body --limit 1
```
3. Read `docs/guidelines/planning-guidelines.md` for review checklist
## Step 2: Review
1. Explore the codebase to verify proposed solutions work with existing code
2. Check for "Blocked by:" dependencies - verify blockers exist and are tracked
## Step 3: Update Issue
**Always update the issue body** with improvements:
- Fix unclear descriptions, add missing context
- Add edge cases, test scenarios, or acceptance criteria
- Ensure "Blocked by: #X, #Y" section exists if there are dependencies
- Structure the issue better (add sections if missing)
To update: write to /tmp/issue-body.md, then run:
`gh issue edit ${{ github.event.issue.number }} --body-file /tmp/issue-body.md`
## Step 4: Post Review Comment
Summarize:
- What you found and changed in the issue body
- Dependencies identified
- Your recommendation (ready, needs-clarification, or needs-breakdown)
## Step 5: Take Action
Based on your review, do ONE of:
**A. Already done** - If the work already exists in the codebase:
```bash
gh issue close ${{ github.event.issue.number }} --comment "Closing: functionality already exists. [brief explanation]"
```
**B. Ready and unblocked** - If issue is well-defined AND all blockers are closed:
- Add `ready-for-implementation` label
- Continue to Step 6
**C. Ready but blocked** - If issue is ready BUT has open blockers:
- Do NOT add `ready-for-implementation` to this issue
- For each open blocker, check if it has automation labels (`needs-review`, `ready-for-implementation`)
- If a blocker has no automation label, trigger it: `gh issue edit BLOCKER_NUM --add-label "needs-review"`
- This cascades the review through the dependency chain
- Watch for cycles: if blocker references this issue, don't trigger (would loop forever)
**D. Needs work** - Add appropriate label:
- `needs-clarification` if important details are missing
- `needs-breakdown` if issue should be split
Also add type labels: `bug` / `enhancement` / `documentation`
## Step 6: Trigger Implementation (if approved)
If you added `ready-for-implementation`:
```bash
gh issue comment ${{ github.event.issue.number }} --body "@claude Please implement this issue."
```
NEVER include "@claude" except in the trigger comment above.
claude_args: '--model claude-opus-4-6 --allowed-tools "Read,Write,Edit,MultiEdit,Glob,Grep,LS,Bash,WebSearch,WebFetch,Task,TodoWrite,TodoRead"'