diff --git a/orchestrator.py b/orchestrator.py index e0c6d0e..4e48405 100644 --- a/orchestrator.py +++ b/orchestrator.py @@ -1865,7 +1865,12 @@ def run_issue(n, until=None): r"NO\s+close\s+signal", ] keep_open = False - last_body = comments[-1].get("body", "") if comments else "" + # P7a (2026-05-26) — fetch comments fresh; `comments` is loop-local in stage block + # and not in scope at run_issue post-stage update. NameError fix. + try: + _cs = get_comments(n) + last_body = _cs[-1].get("body", "") if _cs else "" + except: last_body = "" for p in keep_open_patterns: if re.search(p, last_body, re.IGNORECASE | re.MULTILINE): keep_open = True; break