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:
1 parent
ed293dcef4
commit
8a9101ed30
3 files changed
+49
-9
No files matched your search
@@ -224,6 +224,33 @@ def test_t2b_the_wait_is_bounded_in_time_and_in_size(tmp_path, monkeypatch, caps
|
||||
assert "over MAM_JOB_TREE_MAX=1" in capsys.readouterr().err
|
||||
|
||||
|
||||
def _cancel_before_injection(env: dict, reg: Path, jid: str, reason: str) -> None:
|
||||
"""What the wrapper's finalize_unfinished does when the preflight cannot
|
||||
see the target (target_not_found) or the session is busy."""
|
||||
tok = _record(reg, jid)["dispatch_token"]
|
||||
res = subprocess.run([sys.executable, str(REGISTRY), "--registry-dir", str(reg), "close", "--job", jid,
|
||||
"--request", "cancelled", "--detail", reason, "--expect-dispatch-token", tok],
|
||||
capture_output=True, text=True, env=env, timeout=120)
|
||||
assert res.returncode == 0, res.stderr
|
||||
_publish(env, reg, jid, "cancelled", reason)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("reason", ["target_not_found", "session_busy"])
|
||||
def test_t13_a_sub_job_cancelled_before_injection_is_not_dispatched_in_the_table(tmp_path, monkeypatch, reason):
|
||||
"""Merge review N1: get_feedback ignored `cancelled` events, so the table
|
||||
showed a bare `cancelled` and the reason (never dispatched vs. the agent
|
||||
failing) was lost."""
|
||||
env = _env(tmp_path)
|
||||
reg = tmp_path / "reg"
|
||||
p = _jid(_submit(env, reg))
|
||||
c = _jid(_submit(env, reg, "--parent-job", p))
|
||||
_cancel_before_injection(env, reg, c, reason)
|
||||
assert _record(reg, c)["status"] == "cancelled"
|
||||
block = _runner(tmp_path, monkeypatch)._subjobs_block([p])
|
||||
assert f"| {c} | " in block, block
|
||||
assert f"| NOT-DISPATCHED | {reason} |" in block, block
|
||||
|
||||
|
||||
def test_t7_a_job_without_children_is_waited_for_as_before(tmp_path, monkeypatch):
|
||||
env = _env(tmp_path)
|
||||
reg = tmp_path / "reg"
|
||||
@@ -458,6 +485,8 @@ def test_t6_an_unattributed_open_job_is_shown_and_waited_for_only_on_request(tmp
|
||||
prompt = _review_prompt(ctl)
|
||||
assert "[하위 위임 잡] 없음" in prompt
|
||||
assert re.search(rf"\[귀속되지 않은 열린 잡\] .*: {uid}\(herdr:img, pending\)", prompt), prompt
|
||||
# merge review K1: the reviewer gets a rule for that job, not only the fact
|
||||
assert "귀속되지 않은 열린 잡은 --parent-job 없이" in prompt and "[VERDICT: NOT PASS]" in prompt
|
||||
|
||||
ctl2 = _loop_ctl(tmp_path / "strict")
|
||||
res2 = _run_loop(ctl2, _loop_env(ctl2, FAKE_WORKER="stray", MAM_CHILD_WAIT_S="3"),
|
||||
|
||||
Reference in new issue
Block a user