From c4e7042430a53d6db86b4e253fcd1b5dccdaedeb Mon Sep 17 00:00:00 2001 From: Thomas SharedInbox Date: Fri, 22 May 2026 10:54:27 +0200 Subject: [PATCH] agent-loop: pick Prio/High issues first among Ready issues --- scripts/agent_loop.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/agent_loop.py b/scripts/agent_loop.py index 565ec1d..8cc0b4f 100755 --- a/scripts/agent_loop.py +++ b/scripts/agent_loop.py @@ -49,6 +49,7 @@ CLAUDE_PROJECTS_DIR = Path.home() / ".claude" / "projects" / ( LABEL_READY = "State/Ready" LABEL_IN_PROGRESS = "State/InProgress" LABEL_QUESTION = "State/Question" +LABEL_PRIO_HIGH = "Prio/High" # ── helpers ─────────────────────────────────────────────────────────────────── @@ -113,13 +114,16 @@ def _close_issue(issue: int) -> None: def _ready_issues() -> list[dict]: - """Return open issues with State/Ready, oldest first.""" + """Return open issues with State/Ready, Prio/High first, then oldest.""" data = _tea(f"repos/{REPO}/issues?state=open&type=issues&limit=50") or [] ready = [ i for i in data if any(lbl["name"] == LABEL_READY for lbl in i.get("labels", [])) ] - ready.sort(key=lambda i: i["number"]) + ready.sort(key=lambda i: ( + 0 if any(lbl["name"] == LABEL_PRIO_HIGH for lbl in i.get("labels", [])) else 1, + i["number"], + )) return ready