Skip to content

Commit 84115e1

Browse files
detainclaude
andcommitted
feat(github-code-review): parallel workers, prompt override, feedback footer
Add concurrent review processing and two smaller review-worker features to scripts/github-code-review.php: - --parallel N / -p N: fork N workers that drain the shared queue at once. Each worker gets its OWN checkout root ({CHECKOUT_ROOT}/wN) and Redis checkout-cache namespace (wN:) so two workers reviewing the same repo:branch can never share a working tree or clobber each other's cache. Every log and stream line is tagged with the worker + queue entry it belongs to (e.g. "[w0 owner/repo#42 a1b2c3d4]"). Workers run in their own process groups; the parent forwards SIGINT/SIGTERM and reaps them. Single-worker output is byte-identical (empty prefix). - --prompt STR / --prompt-file FILE: replace the built-in review prompt with an inline string or a file's contents; audit-type scope still layers on top. --prompt wins if both are given. - Every posted comment (per-issue, --combine, --split-changes) now ends with a thumbs up/down feedback blurb via reviewFeedbackFooter(). Also harden the commit-hash baseline: setupCommitRangeBaseline() now verifies `git rev-parse HEAD` actually equals the requested SHA before the review runs, so a job can never silently review the wrong tree. Note: GitHub does not deliver reaction (thumbs) events via webhook, so web/github.php is unchanged; tracking reactions requires polling the reactions API on posted comment IDs. Adds tests/phpunit/unit/CodeReviewWorker/ParallelAndPromptTest.php. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 7aa8355 commit 84115e1

3 files changed

Lines changed: 476 additions & 23 deletions

File tree

CLAUDE.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ php scripts/github-code-review.php
1919
- **Core**: `src/GithubWebhook.php` · `src/GithubMessageBuilder.php` · `src/NotificationQueue.php` · `src/CodeReviewQueue.php` · `src/IgnoredEventException.php` · `src/NotImplementedException.php`
2020
- **Config**: `.env` (copied from `.env.dist`) — defines `GITHUB_WEBHOOKS_SECRET`, `NOTIF_QUEUE_ENABLED`, `NOTIF_QUEUE_KEY_PREFIX`, `REDIS_HOST`, `REDIS_PORT`, `LOG_LEVEL`, `RATE_LIMIT_WINDOW`, plus code-review queue keys. RocketChat / Teams webhook URLs live in `src/config.php` (gitignored) under `$chatChannels['rocketchat']` / `$chatChannels['teams']`
2121
- **Logs**: `log/Y/m/d/` — JSON files named `His_eventtype_action_user_repo.json` (verbosity controlled by `LOG_LEVEL`)
22-
- **Code review**: `src/CodeReviewQueue.php` enqueues push events for async review by `scripts/github-code-review.php`
22+
- **Code review**: `src/CodeReviewQueue.php` enqueues push events for async review by `scripts/github-code-review.php`; `scripts/github-code-review-list.php` lists queued review jobs
2323
- **Field analysis**: `scripts/analyze_fields.php`, `scripts/filter_webhook.php`, `scripts/filter_webhook_batch.php` produce reports under `field_analysis_full/` (per-group JSON, `frequency_matrix.json`, `FIELD_CATEGORIZATION.md`)
2424
- **Tests**: `tests/` via `phpunit.xml` · fixtures in `tests/events/{event_name}/`
2525
- **Quality**: `phpstan.neon` · `phpstan-bootstrap.php` · `.php-cs-fixer.dist.php` (PSR2 + PHP74Migration)
@@ -50,22 +50,26 @@ php -d phar.readonly=0 build/github-review.phar --version
5050
- **Entry point**: `bin/github-review`
5151
- **Application**: `src/Cli/Application.php`
5252
- **Commands**: `src/Cli/Command/`
53+
- `AbstractCommand.php` — Base command
5354
- `ListCommand.php` — List queued review jobs
5455
- `MetricsCommand.php` — Show queue statistics
5556
- `SubmitCommand.php` — Submit PR for review
5657
- `StatusCommand.php` — Check review status
5758
- `CancelCommand.php` — Cancel queued jobs
5859
- `ConfigCommand.php` — Manage configuration
60+
- `ActivityCommand.php` — GitHub activity view
5961
- **Services**: `src/Cli/Service/`
6062
- `CodeAnalyzer.php` — OpenCode integration
6163
- `CheckoutManager.php` — Git checkout management
6264
- `DiffGenerator.php` — Diff generation
6365
- `ReviewPoster.php` — GitHub API posting
66+
- `GithubActivityService.php` — GitHub activity fetching
6467
- **Config**: `src/Cli/Config/ConfigLoader.php`
68+
- **Exceptions**: `src/Cli/Exception/``ReviewCliException.php`, `ExceptionCodes.php`
6569
- **Renderers**: `src/Cli/Renderer/`
6670
- `JsonRenderer.php` — JSON output
6771
- `TableRenderer.php` — Table output
68-
- **Interactor**: `src/Cli/Interactor/InteractiveInteractor.php`
72+
- **Interactor**: `src/Cli/Interactor/``InteractiveInteractor.php`, `ActivityInteractor.php`, `InteractiveTui.php`, `TuiPane.php`, `TuiState.php`
6973

7074
### CLI Tests
7175

@@ -154,4 +158,4 @@ Pin your choice (`/model` in Claude Code, or `CALIBER_MODEL` when using Caliber
154158

155159
This project uses [Caliber](https://github.com/caliber-ai-org/ai-setup) to keep AI agent configs in sync across Claude Code, Cursor, Copilot, and Codex.
156160
Configs update automatically before each commit via `caliber refresh`.
157-
If the pre-commit hook is not set up, run `/setup-caliber` to configure everything automatically.
161+
If the pre-commit hook is not set up, run `/setup-caliber` to configure everything automatically.

0 commit comments

Comments
 (0)