Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions test/test_autonudge_stop_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,16 @@ def test_autonudge_stop_short_circuits_for_non_nudgeable_session(monkeypatch):


class _FakeLoop:
"""Prompt-loop double.

``gate`` mirrors ``NudgeLoop.gate``: a prompt loop carries probe state in
``monitor`` only when it is gated, and ``is_structured_monitor_loop`` reads
``monitor is not None and not gate`` to tell a controller-owned structured
monitor apart from a prompt loop. A double that sets ``monitor`` without
``gate=True`` is therefore routed to the structured ``monitor_update`` path,
which refuses ``message``/``max_cycles``/``active`` as legacy fields.
"""

def __init__(
self,
loop_id,
Expand All @@ -244,6 +254,7 @@ def __init__(
stopped_reason="",
slot_key="",
monitor=None,
gate=False,
):
self.id = loop_id
self.cycle_count = cycle_count
Expand All @@ -254,6 +265,7 @@ def __init__(
self.stopped_reason = stopped_reason
self.slot_key = slot_key
self.monitor = monitor
self.gate = gate


class _FakeMonitor:
Expand Down Expand Up @@ -688,6 +700,7 @@ def test_applier_owed_terminal_turn_is_not_reported_as_a_spent_cap(monkeypatch):
stopped_reason="cycle_cap",
slot_key="slack:C123:170.5",
monitor=_FakeMonitor(terminal_pending="success"),
gate=True,
)
svc = _FakeSvc(loop)
_install_svc(monkeypatch, svc)
Expand Down Expand Up @@ -722,6 +735,7 @@ def test_applier_owed_blocked_turn_is_not_reported_as_a_merge(monkeypatch):
stopped_reason="cycle_cap",
slot_key="slack:C123:170.5",
monitor=_FakeMonitor(terminal_pending="blocked"),
gate=True,
)
svc = _FakeSvc(loop)
_install_svc(monkeypatch, svc)
Expand Down Expand Up @@ -753,6 +767,7 @@ def test_applier_settled_terminal_loop_is_not_reported_as_a_manual_pause(monkeyp
active=False,
stopped_reason=MONITOR_TERMINAL_REASON,
monitor=_FakeMonitor(outcome=MonitorOutcome.SUCCESS),
gate=True,
)
svc = _FakeSvc(loop)
_install_svc(monkeypatch, svc)
Expand Down Expand Up @@ -787,6 +802,7 @@ def test_applier_a_settled_outcome_outranks_a_stale_owed_turn(monkeypatch):
active=False,
stopped_reason="cycle_cap",
monitor=_FakeMonitor(terminal_pending="success", outcome=MonitorOutcome.BLOCKED),
gate=True,
)
svc = _FakeSvc(loop)
_install_svc(monkeypatch, svc)
Expand Down Expand Up @@ -817,6 +833,7 @@ def test_applier_a_spent_cap_with_no_terminal_news_still_revives(monkeypatch):
active=False,
stopped_reason="cycle_cap",
monitor=_FakeMonitor(),
gate=True,
)
svc = _FakeSvc(loop)
_install_svc(monkeypatch, svc)
Expand Down
Loading