test(followups): F6 - the wrapper vanishes inside the second wait; the <= 60 s is the herdr wait's

delegate-job SKILL.md said a watcher outlives a killed wrapper by "one
wait, <= 60 s". That bound is the herdr wait's; a wrapper that goes while a
notice is being published is noticed when that publish ends. The text now
says both (PR #41 codex round 3).

"a wrapper gone during the wait" switched alive() by call count, so the
watcher saw the wrapper gone at the next loop head and never entered the
second wait (ticks == [1] with that band). The wrapper now vanishes inside
the second herdr wait (_during_notice's in_wait hook), and the test checks
that the second wait happened and that alive() was true until then. The
same test fails when the post-wait _wrapper_gone() check is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HCGpJXhSZasJLU38ksDghe
This commit is contained in:
GodopuandClaude Opus 5.5 committed 2026-10-02 08:23:31 +09:00
1 parent c252ac4d54
commit 1e92ddc563
2 files changed
+20 -8

No files matched your search

+17 -6
View File
@@ -329,9 +329,10 @@ def test_a_refused_idle_notice_withholds_the_nudge(tmp_path, monkeypatch):
# round-2 review (codex D1/D2) - the last gate sits between the notice and the keys
# ---------------------------------------------------------------------------
def _during_notice(tmp_path, monkeypatch, change, alive=lambda pid: True):
def _during_notice(tmp_path, monkeypatch, change, alive=lambda pid: True, in_wait=lambda tick: None):
"""Idle past S on the second tick; `change(rec)` runs inside the notice's
publish, as another actor would act while it waits on the wire."""
publish, as another actor would act while it waits on the wire, and
`in_wait(tick)` inside each herdr wait."""
from lib_py import stall_watch
import argparse
import uuid
@@ -343,6 +344,7 @@ def _during_notice(tmp_path, monkeypatch, change, alive=lambda pid: True):
def fake_wait_once(target, until=(), timeout_ms=None, session=None, run=None):
from lib_py.loop import watcher as w
ticks.append(1)
in_wait(len(ticks))
if len(ticks) == 1:
return w.WaitOutcome(w.MATCHED, agent={"agent_status": "idle", "state_change_seq": 1, "pane_id": "w1:p1"})
if len(ticks) > 2: # a watcher that did not stop: end the run through the record
@@ -416,10 +418,19 @@ def test_an_unreadable_record_at_the_last_gate_withholds_the_nudge(tmp_path, mon
def test_a_wrapper_gone_during_the_wait_gets_no_notice_and_no_nudge(tmp_path, monkeypatch):
"""Idle past S and the wrapper vanished during the same wait: the watcher
leaves before judging - no notice, no keys, the record untouched."""
calls = []
gone, seen = [], []
def alive(pid):
calls.append(pid)
return len(calls) <= 2 # alive at the first loop head and after the first wait, gone after
rc, prompts, notes = _during_notice(tmp_path, monkeypatch, lambda rec: None, alive=alive)
seen.append((len(ticks), not gone))
return not gone
ticks = []
def in_wait(tick):
ticks.append(tick)
if tick == 2:
gone.append(True) # inside the second wait, while the watcher is blocked in herdr
rc, prompts, notes = _during_notice(tmp_path, monkeypatch, lambda rec: None, alive=alive, in_wait=in_wait)
assert rc == 0 and notes == [] and prompts == [], (prompts, notes)
assert ticks == [1, 2], "the wrapper must vanish inside the second wait, not before it"
assert seen[-1] == (2, False) and all(ok for _, ok in seen[:-1]), seen