Skip to content

feat(coderd/externalauth/gitprovider): read a GitHub pull request's activity since a time - #121

Merged
ibetitsmike merged 4 commits into
mainfrom
mike/chat-wakeups-6-github-activity
Nov 10, 2026
Merged

ibetitsmike merged 4 commits into
mainfrom
mike/chat-wakeups-6-github-activity

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

Xum opened this PR on behalf of @ibetitsmike.

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 so wait_for_events can 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 existing decodeJSON, so the ETag cache (304s on unchanged polls) and *RateLimitError work as for FetchPullRequestStatus.

  • 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 after since (to the second, since GitHub timestamps have whole seconds), without PENDING drafts, sorted by submit time. States are lower-cased.
  • GET /issues/{n}/comments?since= and GET /pulls/{n}/comments?since=: GitHub's since filters on the update time and is exclusive, so the request asks for one second earlier and comments created before since are dropped. Both lists are merged and sorted.
  • Reviews and both comment lists read up to 10 pages of 100.
  • GET /commits/{sha}/check-runs and /status: a summary of none, pending, success or failure (stale counts 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

  • It reads at most 1,000 reviews and 1,000 comments of each kind, and the first 100 check runs.
  • Two workflows with a job of the same name count as one check.
  • GET /user needs a token that can read its user, which a user's external auth token can.

Validation

…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.
@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum posted this on behalf of @ibetitsmike.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T07:41:49.626775Z 0dc8528 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

@ibetitsmike

Copy link
Copy Markdown
Owner Author

@codex review

Xum posted this on behalf of @ibetitsmike.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 0dc8528181

ℹ️ 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".

@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum (AI agent) closed and reopened this on behalf of @ibetitsmike.

Closing and reopening only to make GitHub recompute the merge ref against current main (24fcb8445d) and run fork-ci on it. The head is unchanged.

@ibetitsmike ibetitsmike reopened this Nov 10, 2026
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum (AI agent) closed and reopened this again on behalf of @ibetitsmike.

The merge ref now points at current main (24fcb8445d), but the run started by the first reopen was queued against the old merge ref. This second reopen starts fork-ci on the recomputed merge. The head is unchanged.

@ibetitsmike ibetitsmike reopened this Nov 10, 2026
@ibetitsmike
ibetitsmike merged commit 3d4b5f5 into main Nov 10, 2026
21 of 28 checks passed
@ibetitsmike
ibetitsmike deleted the mike/chat-wakeups-6-github-activity branch November 10, 2026 08:02
@ibetitsmike

Copy link
Copy Markdown
Owner Author

Xum (AI agent) merged this on behalf of @ibetitsmike.

Merge evidence for head 0dc852818113320cb6eeec482efecb2e2e1823b0:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant