agent queue: re-run the check only after an accepted verification

The verify job re-ran the pull request check after any /verified
comment, including refused ones: the author's own, a non-verifier's, a
stale or unknown head or a malformed SHA. decide now marks only an
accepted verification of the current head, and the job re-runs the check
only when should-rerun confirms it. A test checks that what re-runs the
check is exactly what the check counts.

Replay decides a comment listed twice only once. Tests cover duplicate
and out-of-order listings, and every arrival order of a five-claim burst
grants exactly one of two overlapping claims.

Fixes #210, fixes #211

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
This commit is contained in:
elforeign committed 2026-11-24 00:56:00 -06:00
1 parent e37c8566c6
commit 9fda5aab18
8 files changed
+96 -5

No files matched your search

+14
View File
@@ -87,6 +87,20 @@ class Workflows(unittest.TestCase):
self.assertIn("--recent-commands", text, job)
self.assertNotIn("agent_queue decide", self.job("agent-claims.yml", "command"))
def test_rerun_needs_an_accepted_verification(self):
text = self.job("agent-pr-checks.yml", "verify")
gate = text.index("agent_queue should-rerun")
self.assertLess(gate, text.index("gh run rerun"))
self.assertIn('if ! python3 -m agent_queue should-rerun --actions "$RUNNER_TEMP/actions.json"; then exit 0; fi', text)
def test_should_rerun_exit_codes(self):
with tempfile.TemporaryDirectory() as d:
p = os.path.join(d, "a.json")
for actions, code in (([], 1), ([{"issue": 4, "add_labels": [], "remove_labels": [], "comment": "refused"}], 1),
([{"issue": 4, "add_labels": [], "remove_labels": [], "comment": "ok", "rerun_check": True}], 0)):
dump(actions, p)
self.assertEqual(Cli.run_cli(self, "should-rerun", "--actions", p).returncode, code, actions)
def test_verify_runs_one_at_a_time_per_pull_request(self):
text = self.job("agent-pr-checks.yml", "verify")
self.assertRegex(text, r"group: agent-verify-\$\{\{ github\.event\.issue\.number \}\}\n\s+cancel-in-progress: false")