fix(issue-34): merge review - a sub-job cancelled before injection keeps its reason in the review table; unattributed open jobs come with a verdict rule

- registry.get_feedback only returned the detail of the last completed or
  error event, so a sub-job the wrapper cancelled before injection
  (target_not_found, session_busy) reached the review table as a bare
  `cancelled` and its reason was lost (merge review, grok N1). get_feedback
  takes the event kinds to read (default unchanged); the table asks for
  cancelled too and shows NOT-DISPATCHED with the reason. Test T13, both
  reasons, fails without the fix.
- the [귀속되지 않은 열린 잡] line listed jobs registered without
  --parent-job but gave the reviewer no rule for them - the one case the
  table cannot show (claude K1). A rule sentence follows the line whenever
  such a job exists; without one the prompt is unchanged. T6 pins it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VCgu9Fa9iT7TbJUSzdq4Ff
This commit is contained in:
GodopuandClaude Fable 5.1 committed 2026-09-25 16:19:12 +09:00
1 parent ed293dcef4
commit 8a9101ed30
3 files changed
+49 -9

No files matched your search

+9 -1
View File
@@ -38,6 +38,8 @@ SUBJOB_RULE = ("규칙: 열린(OPEN)·미확인 종결(CLOSED-UNCONFIRMED)·실
"[VERDICT: NOT PASS] 를 내십시오. creator 리포트가 해당 부분의 대체 완료를 입증하면 예외입니다. "
"CLOSED-UNCONFIRMED 는 오케스트레이터가 마감으로 닫은 잡이며 그 에이전트는 계속 일하고 있을 수 있습니다. "
"리뷰 중 소스가 바뀌면 이 회차의 승인은 무효가 됩니다.")
STRAY_RULE = ("규칙: 귀속되지 않은 열린 잡은 --parent-job 없이 등록된 이 작업의 하위 위임일 수 있습니다. 그 잡의 산출물이 "
"작업 목표에 필요하다면 산출물을 미완으로 보고 [VERDICT: NOT PASS] 를 내십시오.")
SELF_REVIEW_PROMPT = ("작업 완료 상태에 대해 스스로 검증(Self-Review)하여 결함이 없음을 확인하고 종결해주세요. "
"리뷰 리포트 마지막에 단독 행으로 반드시 '[VERDICT: PASS]' 혹은 '[VERDICT: NOT PASS]' 태그를 명시해주세요.")
@@ -684,7 +686,9 @@ class LoopRunner:
status = str(r.get("status") or "?")
if status not in TERMINAL:
return "OPEN", "-"
reason = job_registry.get_feedback(str(r.get("job_id")), str(self.jobs_dir)) or ""
# merge review N1: a cancelled job's reason lives in its `cancelled` event
reason = job_registry.get_feedback(str(r.get("job_id")), str(self.jobs_dir),
events=("completed", "error", "cancelled")) or ""
if status == "completed":
return "completed", reason or "-"
if reason in ORCHESTRATOR_CLOSED or (status == "error" and not reason):
@@ -716,6 +720,10 @@ class LoopRunner:
stray_text = (" ".join(f"{r.get('job_id')}({r.get('agent_session', '?')}, {r.get('status')})" for r in stray)
if stray else "없음")
stray_line = f"[귀속되지 않은 열린 잡] (부모 미표기, 이 작업 중 등록됨): {stray_text}\n"
if stray:
# merge review K1: the case where --parent-job was left out is the one
# the table cannot show, so the rule has to name it explicitly
stray_line += STRAY_RULE + "\n"
if not rows and not stray:
return "" # no sub-delegation: the prompts stay byte-identical (Issue #34 requirement 3)
if not rows: