fix: watchdog 게이트 훅이 동기 결과 끝의 하네스 꼬리(agentId 줄, usage)를 떼고 판정한다

동기 Agent 결과는 WATCHDOG 판정 뒤에 agentId·<usage> 줄이 붙어 "마지막 줄 = PASS" 판정이 항상 실패했다.
마지막 줄 규칙과 FIX 혼재 차단, 검토 1회 = 초안 1회 규칙은 그대로 둔다.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Haewon KamandClaude Opus 5.5 committed 2026-11-03 14:20:12 +09:00
1 parent 4c2152bfaa
commit d212038ce2
1 file changed
+8 -1
+8 -1
View File
@@ -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()]
# 백그라운드 알림은 <result> 뒤에 <usage>·</task-notification> 이 붙으므로 <result> 본문만 본다
text = text.replace("\\n", "\n")
m = re.search(r"<result>(.*?)</result>", text, re.S)
if m:
text = m.group(1)
# 동기 결과는 판정 뒤에 하네스 꼬리(agentId: … 줄, <usage>…</usage>)가 붙는다. 꼬리만 떼고 마지막 줄 규칙은 그대로 둔다
text = re.sub(r"<usage>.*?</usage>", "", 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()