Repository navigation
feat: auto-watch your PRs and review requests (prw watch --mine) - #16
Conversation
Agents that open PRs need to check and wait for CI and read which checks failed. Expose prw's CI aggregation as Model Context Protocol tools over stdio: - get_ci_status: state, check counts, failed checks with links. - wait_for_ci: blocks until CI finishes (default 10m, max 1h), fails fast, follows new pushes, emits notifications/progress when the call has a progressToken, and honors notifications/cancelled (no response is sent for a cancelled request, per the spec). A timeout is a normal result (pending, timed_out=true) so the agent can call again. - list_watched, watch_pr, unwatch_pr: manage the watch list via config.Update, so a running `prw run` picks changes up. The protocol subset (initialize with version negotiation, ping, tools/list, tools/call) is implemented directly: the official Go SDK needs Go 1.25 and the module targets 1.22. Tool calls run concurrently so pings and cancellations are handled during a long wait; on stdin EOF in-flight calls finish before exit. One GitHub client is shared so the ETag cache keeps repeated polling free. Verified end-to-end over stdio against the real API, with the token resolved from `gh auth token`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copying PR URLs into `prw watch` one by one was the main friction in day-to-day use. `prw watch --mine` and `prw watch --review-requested` subscribe to a GitHub search (author:@me / review-requested:@me, open, non-archived) instead of a fixed list: - Matches are added right away and tagged with their source; `prw run` (and `run --once`) re-runs the searches every 5 minutes, picking up subscriptions enabled while it is running. - Review-request PRs are dropped when the request goes away; "mine" PRs are left for `prw run` to notify about and drop when merged or closed. Incomplete or failed searches never remove anything. - PRs watched by hand are never touched; watching an auto-added PR by hand claims it. `prw unwatch --mine` disables the source and removes only the PRs it added. - `prw list` shows auto-watch and an ADDED BY column (`source` in --json); `prw config show` shows auto_watch. Also compare owner/repo case-insensitively, as GitHub does, so search results can't duplicate PRs watched with different casing. Verified live: 18 open PRs across 7 repos found and CI-checked, then cleanly removed by `unwatch --mine`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8cbc891856
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if pr.Source == source && !matches[prKey(pr.Owner, pr.Repo, pr.Number)] { | ||
| result.Removed = append(result.Removed, pr) | ||
| changed = true | ||
| continue |
There was a problem hiding this comment.
Preserve closed review requests for the lifecycle check
When a PR added by --review-requested is merged or closed while prw is stopped, the is:open search no longer returns it, so this removal path deletes it during startup synchronization. Watcher.Run and RunOnce reload the shortened list before checkAllPRs, meaning the PR is never fetched and its promised final merged/closed notification is lost. Distinguish withdrawn review requests from closed PRs, or retain absent entries until the lifecycle check confirms their state.
Useful? React with 👍 / 👎.
Description
Copying PR URLs into
prw watchone at a time was the main friction in daily use. Two new flags subscribe to a GitHub search instead of a fixed list:Changes
Client.SearchPullRequests(search API, paginated, capped at 300, skips issues, tracksincomplete_results).auto_watchlist + per-PRsource; bothomitempty, so existing configs are unchanged.watcher.SyncAutoWatch: adds matches (tagged with their source) under the config lock. Removal rules:review-requestedPRs that no longer match are dropped (request withdrawn/answered);minePRs are not dropped on absence — that means merged/closed, andprw runshould still send the final notification (fix: safe concurrent config writes, isolated tests, auto-drop merged/closed PRs #9 logic) before dropping them;prw runsyncs on startup and every 5 minutes (search API has its own 30/min limit), and picks upwatch --minerun in another terminal;run --oncesyncs too.prw unwatch --mine|--review-requesteddisables the source and removes only the PRs it added.prw list: auto-watch lines +ADDED BYcolumn (sourcein--json);config show:auto_watch.Testing
watch --minefound 18 open PRs across 7 repos,run --oncechecked all of them,unwatch --mineremoved all 18.Found while testing (not fixed here)
14 of those 18 PRs have no checks at all (repos without CI, and the stacked PRs in this series, whose base isn't
main). prw reports them aspendingforever, soprw wait/wait_for_ciwould block until the timeout. Tracked as #18 inTASKS.md.Checklist
go test -race ./...passesgo vet ./...passes🤖 Generated with Claude Code