Repository navigation
feat: auto-watch Bitbucket PRs (--mine / --review-requested) - #27
Conversation
Auto-watch now runs on every configured host through a Finder per host. GitHub keeps its search; the new BitbucketFinder lists your open PRs per workspace, and scans the repositories active in the last 30 days for open PRs listing you as a reviewer that you haven't approved or requested changes on yet, every 15 minutes, since Bitbucket can only filter reviewers per repository. Watch-list keys include the host, so the same owner/repo#N on both hosts stays apart. With dozens of Bitbucket PRs, checking each once a minute would exceed Bitbucket's 1,000 requests/hour, so `prw run` now spaces them out by the size of the list (18s per PR, at least a minute), about 600 requests an hour. Also drops two unused variables left in the dashboard view. 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: 6ea69d81fa
ℹ️ 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 len(cfg.AutoWatch) > 0 && !bitbucketConfigured(cfg) { | ||
| return true // auto-watch has nothing else to search | ||
| } |
There was a problem hiding this comment.
Allow Bitbucket-only auto-watch to start with an empty list
When Bitbucket credentials are configured, auto-watch is enabled, and no PRs are currently watched, this condition falls through to return len(cfg.WatchedPRs) == 0, which still returns true. Without a GitHub token, runCmd consequently returns errMissingToken before running Bitbucket discovery. This prevents Bitbucket-only users from starting the watcher while waiting for their first matching PR, or restarting it after all watched PRs have closed. Exempt configured Bitbucket auto-watch from the empty-list GitHub default while retaining the token requirement for explicitly watched GitHub PRs.
Useful? React with 👍 / 👎.
| f.reviewFound, f.lastReviewScan = found, f.now() | ||
| } | ||
| return f.reviewFound, nil |
There was a problem hiding this comment.
Prevent cached review results from resurrecting closed PRs
If a Bitbucket review-request PR closes after a review scan, checkAllPRs sends its final notification and removes it from the watch list. However, the next five-minute auto-watch sync receives this cached result until the fifteen-minute rescan and Sync unconditionally adds the closed PR again. Its next check then sends another final notification and removes it again, potentially repeating at both intervening syncs. Keep the scan throttling, but invalidate or filter cached entries after lifecycle cleanup so completed PRs are not re-added and notified repeatedly.
Useful? React with 👍 / 👎.
Stacked on #26 (release v0.5.0). Retarget to
mainonce #26 is merged.What
prw watch --mine/--review-requestedandprw runfind Bitbucket Cloud PRs too, when a Bitbucket token orbitbucket_useris set:bitbucket_workspaces), one request per workspace.Finderper host; watch-list keys include the host.prw runspaces out Bitbucket checks as the list grows (18s × number of Bitbucket PRs, min 1 minute), so ~30 PRs stay around 600 of the 1,000 requests/hour.Test plan
go test -race ./...,go vet ./...owner/repo#N, interval scalingprw watch --minewith a public Bitbucket user plus the owner's GitHub account added PRs from both hosts;prw run --onceread CI and merge state for both/user,/user/workspaces, review scan on private repositories🤖 Generated with Claude Code