-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Amber automatic code reviews with memory system (Phase 2) #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add workflow run links to amber-issue-handler and claude-code-review workflows, enabling users to see complete AI decision-making process. Changes: - amber-issue-handler.yml: Add links to 3 comment locations * "Report no changes" comment * "Validate changes" comment * "Create Pull Request" issue comment - claude-code-review.yml: Add post-processing step to append link All bot comments now include workflow run link with 90-day retention note, allowing users to inspect files read, search patterns, and AI reasoning. Part of Phase 1: Add Transparency (non-breaking, additive changes) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Create amber-auto-review.yml for automatic PR reviews using memory system - Loads CLAUDE.md + 6 memory files (context + patterns) for repository-aware reviews - Disable automatic trigger in claude-code-review.yml (now @claude mentions only) - Adds transparency links showing which memory files were loaded - Result: Automatic reviews use Amber (repository-aware), @claude stays lightweight Related to Phase 2 of Amber workflow transparency initiative. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Claude Code ReviewSummaryThis PR implements Phase 2 of the Amber workflow transparency initiative by adding automatic code reviews on all pull requests. The implementation loads repository-specific standards from the memory system (7 context files) and posts comprehensive reviews. Overall Assessment: Well-structured with strong transparency features. However, several critical issues must be addressed before merge, particularly around security and error handling. Issues by SeverityBlocker Issues1. Security Risk: Unrestricted Repository Access in pull_request_target Location: .github/workflows/amber-auto-review.yml:12-13 Issue: Using pull_request_target without restrictions allows code from untrusted forks to execute with write permissions. Recommendation: Add this safety check at line 16: Reference: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ Critical Issues2. Workflow Will Fail Silently When Memory Files Don't Exist Location: .github/workflows/amber-auto-review.yml:83-91 Issue: Prompt assumes all memory files exist. The PR description mentions PRs ambient-code#359 and ambient-code#360 which weren't found in this repository, suggesting files may not exist yet. Recommendation: Add file existence validation or update prompt to handle missing files gracefully. 3. Comment Minimization Will Fail on High-Volume PRs Location: .github/workflows/amber-auto-review.yml:35-67 Issues:
Recommendation: Add retry logic with exponential backoff and rate limiting. 4. Missing Pull Request Number Extraction Location: .github/workflows/claude-code-review.yml:165-168 Issue: Workflow triggers on issue_comment events but code expects context.payload.pull_request.number (undefined for issue comments). Fix: Use optional chaining: const prNumber = context.payload.pull_request?.number || context.payload.issue?.number Major Issues5. Workflow Code Duplication Both workflows have nearly identical Add workflow link steps (~70 lines each). Recommendation: Extract to composite action for maintainability. 6. No Handling for Review Timeouts or Failures Location: .github/workflows/amber-auto-review.yml:70-127 Recommendation: Add timeout-minutes: 15 and failure notification step. 7. Memory System Visibility Could Be More Actionable Transparency section lists files but doesn't link to them. Add table with clickable links. Minor Issues8. Memory System File List Duplication - File list appears in 3 places 9. Missing Workflow Documentation - No header comments explaining triggers 10. Hardcoded Bot Username - Make configurable via env var Positive Highlights
RecommendationsPriority 1 (Must Fix Before Merge)
Priority 2 (Should Fix Before Merge)
Priority 3 (Address in Follow-up)
Final Recommendation: Excellent work on workflow transparency. The security issue and critical bugs must be addressed before merge. Fix these issues and this will be a model implementation. |
## Summary Implements Phase 2 of the Amber workflow transparency initiative: automatic PR reviews using the memory system from PRs #359 and #360. ## Changes ### New Workflow: `.github/workflows/amber-auto-review.yml` **Automatic PR reviews with repository intelligence:** - **Trigger**: Automatic on PR open/synchronize - **Memory System**: Loads 7 files for comprehensive repository context - CLAUDE.md (master project instructions) - backend-development.md (Go backend, K8s patterns) - frontend-development.md (NextJS, Shadcn UI, React Query) - security-standards.md (Auth, RBAC, token handling) - k8s-client-usage.md (User token vs service account) - error-handling.md (Consistent error patterns) - react-query-usage.md (Data fetching patterns) - **Transparency**: Every review includes: - Link to workflow run (90-day log retention) - Collapsible section showing which memory files were loaded - Clear explanation of how Amber applies repository standards - **Comment Management**: Minimizes old review comments before posting new one ### Modified Workflow: `.github/workflows/claude-code-review.yml` **Changed from automatic to manual-only:** - **Before**: Triggered automatically on all PRs - **After**: Only triggers on `@claude` mentions in comments - **Reason**: Separate automatic reviews (Amber) from manual reviews (Claude) ## Three-Tier AI Integration This completes the separation of AI review types: 1. **`@claude`** (Lightweight) - Manual, quick interactions - No repository wrapping, fastest response - Use for: questions, exploration, explanations 2. **Automatic PR Reviews** (Amber-Wrapped) - NEW with this PR - Applies CLAUDE.md + memory system standards - Shows decision process via workflow logs - Trigger: Every PR open/sync (automatic) 3. **`@amber` mentions** (Repository-Aware) - Future Phase 3 - Planned: Manual `@amber` mentions for specific tasks - Will apply same memory system as automatic reviews ## Testing Tested on fork with PR: jeremyeder#33 After merge, every new PR will trigger `amber-auto-review.yml`. To verify immediately: 1. Merge this PR 2. The workflow should trigger on this PR itself (meta!) 3. Verify review comment appears with transparency section 4. Check workflow logs via the link in the review ## Design Decisions ### Why Direct File Loading (No Shell Script) **Rejected approach**: Shell script prompt builder using sed/grep/perl to extract CLAUDE.md sections **Chosen approach**: Direct file loading via Claude's Read tool - Simpler implementation - More maintainable (change memory files, workflow stays the same) - Leverages built-in Claude Code capabilities - No fragile shell script parsing ### Why Memory System Over CLAUDE.md Extraction The memory system (PRs #359, #360) provides: - Curated, focused context for specific domains - Easier to maintain and update - Better separation of concerns - Loadable on-demand for targeted work ## Impact **Users will see**: Every PR automatically gets a repository-aware code review showing: - Issues categorized by severity (Blocker/Critical/Major/Minor) - Positive highlights - Prioritized recommendations - Full transparency into AI decision-making **Developers will benefit from**: - Consistent application of project standards - Early detection of anti-patterns - Confidence in AI reviews (visible decision process) - Reduced review burden on human reviewers ## Related - **Builds on**: PRs #359, #360 (Memory System) - **Part of**: Amber Workflow Transparency Initiative - **Documentation**: Will be updated in follow-up PR --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
Summary
Implements Phase 2 of the Amber workflow transparency initiative: automatic PR reviews using the memory system from PRs ambient-code#359 and ambient-code#360.
Changes
New Workflow:
.github/workflows/amber-auto-review.ymlAutomatic PR reviews with repository intelligence:
Modified Workflow:
.github/workflows/claude-code-review.ymlChanged from automatic to manual-only:
@claudementions in commentsThree-Tier AI Integration
This completes the separation of AI review types:
@claude(Lightweight) - Manual, quick interactionsAutomatic PR Reviews (Amber-Wrapped) - NEW with this PR
@ambermentions (Repository-Aware) - Future Phase 3@ambermentions for specific tasksTesting
After merge, every new PR will trigger
amber-auto-review.yml. To test immediately:Design Decisions
Why Direct File Loading (No Shell Script)
Rejected approach: Shell script prompt builder using sed/grep/perl to extract CLAUDE.md sections
Chosen approach: Direct file loading via Claude's Read tool
Why Memory System Over CLAUDE.md Extraction
The memory system (PRs ambient-code#359, ambient-code#360) provides:
Impact
Users will see: Every PR automatically gets a repository-aware code review showing:
Developers will benefit from:
Related
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com