diff --git a/.claude/hooks/watchdog_gate.py b/.claude/hooks/watchdog_gate.py index 6ff20b0..61e5c1f 100644 --- a/.claude/hooks/watchdog_gate.py +++ b/.claude/hooks/watchdog_gate.py @@ -39,7 +39,14 @@ def result_text(item): def verdict(text): # 판정은 결과의 마지막 비어 있지 않은 줄이 정확히 "WATCHDOG: PASS" 일 때만 인정한다 (본문 중간 인용·FIX 혼재 차단) - lines = [l.strip() for l in text.replace("\\n", "\n").splitlines() if l.strip()] + # 백그라운드 알림은 뒤에 · 이 붙으므로 본문만 본다 + text = text.replace("\\n", "\n") + m = re.search(r"(.*?)", text, re.S) + if m: + text = m.group(1) + # 동기 결과는 판정 뒤에 하네스 꼬리(agentId: … 줄, …)가 붙는다. 꼬리만 떼고 마지막 줄 규칙은 그대로 둔다 + text = re.sub(r".*?", "", text, flags=re.S) + lines = [l.strip() for l in text.splitlines() if l.strip() and not l.strip().startswith("agentId:")] if not lines: return False last = re.sub(r"[`*_<>/]|result", "", lines[-1]).strip()