Skip to content

Commit 740bf1c

Browse files
committed
feat: improve GitHub Actions workflow reliability
- Added concurrency control to prevent duplicate workflow runs on the same PR - Replaced Claude-based comment cleanup with direct GitHub API deletion for better reliability - Enhanced code debugger instructions to handle Vite dev server restarts and config file restrictions
1 parent 40ab40e commit 740bf1c

File tree

2 files changed

+29
-39
lines changed

2 files changed

+29
-39
lines changed

.github/workflows/claude-reviews.yml

Lines changed: 27 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
pull_request_review_comment:
99
types: [created]
1010

11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
13+
cancel-in-progress: true
14+
1115
jobs:
1216
comprehensive-review:
1317
name: PR Description & Code Review
@@ -30,6 +34,29 @@ jobs:
3034
steps:
3135
- name: Checkout repository
3236
uses: actions/checkout@v4
37+
38+
- name: Delete Previous Claude Comments
39+
run: |
40+
echo "🧹 Deleting previous Claude comments from github-actions bot..."
41+
42+
# Get all comments from github-actions bot containing 'Claude'
43+
CLAUDE_COMMENTS=$(gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
44+
--jq '[.[] | select(.user.login == "github-actions[bot]") | select(.body | contains("Claude")) | .id]')
45+
46+
if [ "$CLAUDE_COMMENTS" = "[]" ] || [ -z "$CLAUDE_COMMENTS" ]; then
47+
echo "No previous Claude comments found"
48+
else
49+
echo "Found Claude comments to delete:"
50+
echo "$CLAUDE_COMMENTS" | jq -r '.[]' | while read comment_id; do
51+
echo "Deleting comment $comment_id"
52+
gh api repos/${{ github.repository }}/issues/comments/$comment_id -X DELETE || echo "Failed to delete comment $comment_id"
53+
done
54+
echo "✅ Deleted previous Claude comments"
55+
fi
56+
env:
57+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
continue-on-error: true
59+
3360
- name: Detect Critical Paths
3461
id: critical_paths
3562
run: |
@@ -147,41 +174,3 @@ jobs:
147174
--max-turns ${{ steps.critical_paths.outputs.is_critical == 'true' && '90' || '65' }}
148175
--model claude-sonnet-4-5-20250929
149176
150-
- name: Intelligent Comment Cleanup
151-
uses: anthropics/claude-code-action@v1
152-
if: always()
153-
with:
154-
github_token: ${{ secrets.GITHUB_TOKEN }}
155-
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
156-
prompt: |
157-
Clean up stale bot comments on PR #${{ github.event.pull_request.number }}.
158-
159-
**Task:**
160-
1. Fetch all comments on this PR
161-
2. Identify bot comments (users ending in [bot]) that are stale/outdated:
162-
- Old reviews superseded by newer ones
163-
- Old PR description suggestions
164-
- Previously collapsed/outdated markers
165-
- Progress/status comments from previous workflow runs
166-
3. Keep only the most recent comment per category per bot
167-
4. DELETE all stale comments (do not collapse)
168-
169-
**Get all comments:**
170-
```bash
171-
gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments --jq '.[] | {id, user: .user.login, body, created_at}'
172-
```
173-
174-
**Delete a comment:**
175-
```bash
176-
gh api repos/${{ github.repository }}/issues/comments/COMMENT_ID -X DELETE
177-
```
178-
179-
Be intelligent:
180-
- Preserve the newest useful comment in each category
181-
- Delete everything else that's redundant or stale
182-
- If unsure, keep the comment (conservative approach)
183-
184-
claude_args: |
185-
--allowed-tools "Bash(gh api repos/*/issues/*/comments:*),Bash(gh api repos/*/issues/comments/*:*)"
186-
--max-turns 8
187-
--model claude-haiku-4-5-20251001

worker/agents/assistants/codeDebugger.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ deploy_preview({ clearLogs: true })
360360
- Always check timestamps vs. your deploy times
361361
- Cross-reference with get_runtime_errors and actual code
362362
- Don't fix issues that were already resolved
363+
- Ignore server restarts - It is a vite dev server running, so it will restart on every source modification. This is normal.
363364
- **Before regenerate_file**: Read current code to confirm bug exists
364365
- **After regenerate_file**: Check diff to verify correctness
365366
@@ -396,7 +397,7 @@ deploy_preview({ clearLogs: true })
396397
- **React**: render loops (state-in-render, missing deps, unstable Zustand selectors)
397398
- **Import/export**: named vs default inconsistency
398399
- **Type safety**: maintain strict TypeScript compliance
399-
- **Configuration files**: Never try to edit wrangler.jsonc or package.json
400+
- **Configuration files**: Never try to edit wrangler.jsonc, vite.config.ts or package.json
400401
401402
**⚠️ CRITICAL: Do NOT "Optimize" Zustand Selectors**
402403
If you see this pattern - **LEAVE IT ALONE** (it's already optimal):

0 commit comments

Comments
 (0)