Files
betterxen/scripts/agent_queue/config.py
elforeign e35df04069 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>
2026-11-24 00:09:38 -06:00

35 lines
964 B
Python

# SPDX-License-Identifier: GPL-3.0-or-later
import json
AREAS = ("cpu", "gpu", "runtime", "shared", "qa")
PRIORITIES = ("critical", "high", "medium", "low")
DEFAULT = {"lease_hours": 24, "maintainers": [], "contributors": {}, "upstream": ""}
def parse(text):
data = json.loads(text)
cfg = dict(DEFAULT)
cfg.update({k: data[k] for k in DEFAULT if k in data})
if not isinstance(cfg["lease_hours"], (int, float)) or cfg["lease_hours"] <= 0:
raise ValueError("lease_hours must be a positive number")
return cfg
def load(path):
with open(path, encoding="utf-8") as fh:
return parse(fh.read())
def is_maintainer(cfg, login):
return login in cfg["maintainers"]
def may_work_on(cfg, login, area):
if is_maintainer(cfg, login):
return True
return area in cfg["contributors"].get(login, [])
def is_verifier(cfg, login):
return is_maintainer(cfg, login) or "qa" in cfg["contributors"].get(login, [])