From 91c86d72efa1f7b49d994d2b81331527bfd81548 Mon Sep 17 00:00:00 2001 From: Thomas SharedInbox Date: Thu, 28 May 2026 05:45:53 +0200 Subject: [PATCH] fix: check issue state not labels in merged-PR catch-up Closed issues can still have labels; the old `if not labels` guard never fired for issue #272, so the loop retried the no-op close every minute and never reached the ToPlan/Ready issue logic. Co-Authored-By: Claude Sonnet 4.6 --- scripts/agent_loop.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/agent_loop.py b/scripts/agent_loop.py index 7c49db5..f473e0b 100755 --- a/scripts/agent_loop.py +++ b/scripts/agent_loop.py @@ -912,9 +912,11 @@ def _run_loop() -> int: if not m: continue issue_num = int(m.group(1)) - labels = _get_issue_labels(issue_num) - if not labels: - # Issue is likely already closed — skip. + try: + issue_data = _tea_get(f"/repos/{REPO}/issues/{issue_num}") + except RuntimeError: + continue + if issue_data.get("state") != "open": continue pr_number = pr["number"] print(f"Catch-up (merged PR): PR #{pr_number} for issue #{issue_num} was merged — closing.")