Repository navigation
feat(coderd/externalauth/gitprovider): read a GitHub pull request's activity since a time - #121
Conversation
…ctivity since a time
…lusive since bound The activity fixture now lists a draft review submitted after a newer one, and puts a review and a comment exactly at since, so removing the review sort or making since exclusive fails the test.
|
@codex review
|
Codex Review Summary: ✅ CompletedThis 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: 3cac0c0f94
ℹ️ 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".
…second events, fail stale checks
|
@codex review
|
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Closing and reopening only to make GitHub recompute the merge ref against current main ( |
The merge ref now points at current main ( |
Merge evidence for head
|
Part of #11. Based on
main, independent of the wake-up stack (#91, #93, #106, #115).Adds
gitprovider.FetchPullRequestActivity, which reads what happened on a GitHub pull request since a time: new reviews and comments, the PR state and the CI state of its head commit. The next W5 PR uses it sowait_for_eventscan wake a chat on a review, a comment, a merge or a CI result, by polling. Nothing calls it yet.What it reads
One fork file,
coderd/externalauth/gitprovider/fork_github_activity.go. Every request goes through the existingdecodeJSON, so the ETag cache (304s on unchanged polls) and*RateLimitErrorwork as forFetchPullRequestStatus.GET /user: the token's own user. Its reviews and comments are left out, so an agent that comments with the owner's token does not wake itself.GET /pulls/{n}: state (merged wins) and head SHA.GET /pulls/{n}/reviews: reviews submitted at or aftersince(to the second, since GitHub timestamps have whole seconds), withoutPENDINGdrafts, sorted by submit time. States are lower-cased.GET /issues/{n}/comments?since=andGET /pulls/{n}/comments?since=: GitHub'ssincefilters on the update time and is exclusive, so the request asks for one second earlier and comments created beforesinceare dropped. Both lists are merged and sorted.GET /commits/{sha}/check-runsand/status: a summary ofnone,pending,successorfailure(stalecounts as failed). Only the newest run of each check name and app counts, so a check that was cancelled and then run again counts by its new result, as in GitHub's status rollup. The combined commit status counts only when the commit has statuses.Other providers return
ErrPullRequestActivityUnsupported.Known limits
GET /userneeds a token that can read its user, which a user's external auth token can.Validation
go build ./coderd/...,go vet, gofmt, andgo testwith and without-racefor./coderd/externalauth/gitprovider/.sincebound, thePENDINGfilter, the comment and review order, the cancelled-rerun handling, the combined status, the second-precisionsince, the pagination and thestaleconclusion.gh apiand GitHub's GraphQL status rollup. The first round found that cancelled reruns made green CI reportfailure, which the second commit fixes. The second round matched GitHub on every PR. The last commit only answers Codex review.