fix(orchestrator): P7a NameError in P7 KEEP_OPEN guard
Some checks failed
Multi-MDX Regression (IMP-91) / multi-mdx-regression (push) Failing after 21s

P7 Patch B used `comments[-1]` at line 1868 but `comments` is defined
inside run_stage, not run_issue scope. The KEEP_OPEN guard runs after
run_stage returns, where `comments` is no longer in scope, causing
NameError crash after Stage 6 YES was already accepted and exit report
generated.

Fix: fetch comments fresh via get_comments(n) at the guard entry.
exit_path file check (fallback) still works as designed.

Refs: #84 (Stage 6 crash during normal close path)
This commit is contained in:
2026-05-26 14:30:21 +09:00
parent b9747c2f4a
commit ed391af2e8

View File

@@ -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