Skip to content

Reply when an org member pings the reviewer account - #210

Merged
bbondy merged 1 commit into
masterfrom
reply-to-pings
Nov 2, 2026
Merged

bbondy merged 1 commit into
masterfrom
reply-to-pings

Conversation

@netzenbot

Copy link
Copy Markdown
Collaborator

Closes #207

User impact: an org member who mentions the reviewer account in a comment on an issue or PR now gets a written reply within about five minutes; before, only a review request reached it and a mention went unanswered.

The problem

The reviewer account can only be reached by requesting its review on a PR. A comment such as "what do you think @netzenbot-reviewer?" on an issue, where no review can be requested, or on a PR, is never seen, because the five-minute poll asks GitHub only for review requests. brave/bravebot#3630 has had exactly that question unanswered since 2026-11-01 16:12 UTC.

Reproduce

  1. On a machine where the loop is configured for bravebot, with no review requested of the reviewer account, run the gate that the five-minute cron runs: ./scripts/check-review-requests.sh
  2. Observed on master (d12537a): it prints the line below and exits 1, so no job starts, although an org member's question to the reviewer account sits unanswered on Add an opt-in image_generate tool that writes a generated or edited picture to a path a person approved, since bravebot has no tool that produces images brave/bravebot#3630.
  3. Expected: the gate opens and the question is answered.
No review requests for netzenbot-reviewer in brave/bravebot — nothing to do.

With this change the question is found:

$ python3 scripts/lib/pings.py queue --login netzenbot-reviewer --self netzenbot --self netzenbot-reviewer --repo brave/bravebot
brave/bravebot	3630	comment	6560484158	AliShahin

tests/test_pings.py is new; its gate and job tests fail without the change.

The fix

The same five-minute poll now also looks for pings: an org member's mention of the reviewer account, in an open issue or PR in either of the project's repositories, that neither of our two accounts has commented after. The gate opens for a ping when no review is waiting, and the job answers pings before reviews, because a reply is a short session and a review can take hours. Three properties are deliberate:

  • Members only. The pinger is looked up in the org-member list with no model involved. Anyone else never opens the gate, starts a session or gets a post, and a list that cannot be read does nothing.
  • The model sees a filtered copy. The thread is rendered with everyone else's words left out, and the session has no GitHub token and can write only its reply file.
  • A separate step posts. It checks the reply's length, breaks every mention except the pinger's, and looks once more for an answer that landed in the meantime.

Caps on attempts, on replies per day and on a ping's age keep it bounded; docs/ping-replies.md has the numbers.

Test plan

Not covered: when I re-ran the gate after the change it opened for a review newly requested on #3660, which is checked first, so the gate's ping branch is shown by the tests and not by that run. Nothing has been posted to GitHub by this code. The call that posts was checked only for how gh passes a body on stdin, and the first real reply will be to brave/bravebot#3630 after this is deployed, if it is still inside the 72 hour window. In the real run the session reported Bash and Grep unavailable, so it answered from the specification documents and said so. A mention of the bot account when a separate reviewer account is configured is not a ping, and a reply never changes code.

The review-request poll only looked for PRs where the reviewer account was
asked to review. A comment that @-mentions it ("what do you think ...?"), on
an issue or on a PR, was never seen, so nothing answered it.

The same five-minute poll now also looks for those pings. The gate opens when
a review is requested or an org member's newest mention has no later comment
from either of our accounts, and the job answers pings before reviews. A ping
from anyone outside the org-member list never opens the gate, starts a session
or gets a post.

The model reads a thread rendered with only members' and our own words, in a
session with no GitHub token that can write only into its work directory. A
separate step checks the reply, breaks every @-mention but the pinger's, looks
again for an answer that landed meanwhile, and posts one comment.

Closes #207
@bbondy
bbondy merged commit 8343f70 into master Nov 2, 2026
3 checks passed
@bbondy
bbondy deleted the reply-to-pings branch November 2, 2026 02:20
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.

Support replying to pings

2 participants