Expand the agent task queue to cpu/gpu/runtime/shared/qa with deterministic checks

The queue now has three engineering tracks plus shared and qa work. Queue
rules move from shell/awk in workflows into a standard-library Python package
so they are testable offline: claim decisions (dependencies, cycles, file
overlap, area permission), leases renewed only by the holder, reassign and
release, acceptance-command approval by hash, pull request ownership/overlap/
stale/verification checks and a machine-readable summary. Workflows apply the
decisions with minimal permissions, never put user text in run blocks and
never check out pull request code. The sync script fetches the real upstream
so interface changes during work are reported.

Not yet run on GitHub.

Signed-off-by: elforeign <324243036+elforeign@users.noreply.github.com>
This commit is contained in:
elforeign committed 2026-11-24 00:09:38 -06:00
1 parent a89f9d8d06
commit e35df04069
28 files changed
+1822 -164

No files matched your search

+52
View File
@@ -0,0 +1,52 @@
# SPDX-License-Identifier: GPL-3.0-or-later
"""Pull request checks computed from data only. PR code is never fetched or run."""
from . import config as cfgmod
from . import lease as L
from .patterns import path_matches, patterns_overlap
from .decide import task_index
def verified_by(pr, comments, tasks, cfg):
"""Eligible verifier logins whose /verified comment names the current head SHA."""
head, out = pr.get("head_sha", ""), []
holders = {tasks[i]["holder"] for i in L.linked_issues(pr.get("body")) if i in tasks}
for c in comments:
parts = c["body"].strip().split("\n", 1)[0].split()
if len(parts) < 2 or parts[0] != "/verified" or len(parts[1]) < 7:
continue
who = c["user"]
if (head.startswith(parts[1]) and who != pr.get("author") and who not in holders
and cfgmod.is_verifier(cfg, who) and who not in out):
out.append(who)
return out
def check_pr(state, cfg, now):
pr, comments = state["pr"], state.get("pr_comments", [])
tasks = task_index(state)
problems = []
links = [i for i in L.linked_issues(pr.get("body")) if i in tasks]
if not links:
problems.append("no linked task: the pull request body must contain `Closes #N` for a claimed task")
for n in links:
t = tasks[n]
if "agent:claimed" not in t["labels"]:
problems.append("task #%d is not claimed" % n)
continue
if t["holder"] != pr["author"]:
problems.append("task #%d is held by %s, not the pull request author" % (n, t["holder"] or "nobody"))
outside = [f for f in pr.get("files", []) if not any(path_matches(f, p) for p in t["files"])]
if outside:
problems.append("files outside task #%d ownership: %s" % (n, ", ".join(outside[:10])))
if L.lapsed(t, state.get("task_comments", {}).get(str(n), []), [pr], cfg, now):
problems.append("task #%d claim has lapsed and the head has not been pushed within %s hours" % (n, cfg["lease_hours"]))
for other in state.get("prs", []):
if other["number"] == pr["number"]:
continue
shared = sorted(set(pr.get("files", [])) & set(other.get("files", [])))
if shared:
problems.append("overlaps open PR #%d on: %s" % (other["number"], ", ".join(shared[:10])))
ok_by = verified_by(pr, comments, tasks, cfg)
if not ok_by:
problems.append("independent verification missing: an eligible verifier must comment `/verified %s`" % pr.get("head_sha", "")[:12])
return {"pr": pr["number"], "ok": not problems, "problems": problems, "verified_by": ok_by}