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
7 changes: 5 additions & 2 deletions tests/test_rules_from_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,13 @@ async def test_a_slow_claude_code_check_stops_instead_of_running_on(config, isol
"""ADR 0022: Claude Code works on the check only while the reply waits for it, never in the background."""
import asyncio

started: list[bool] = []
stopped: list[bool] = []

class Slow(_FastRefuses):
async def stream(self, role, messages, tools=None, *, model=None):
if tools is None: # the check
started.append(True)
try:
await asyncio.sleep(30)
except asyncio.CancelledError:
Expand All @@ -280,11 +282,12 @@ async def stream(self, role, messages, tools=None, *, model=None):

llm = Slow(replies=["Got it."], primary="claude-code/sonnet")
s = await _start(config, isolated_home, llm, [])
s.chat_rules.attended_s = 0.05
# long enough to reach Claude Code on a busy CI machine; a check that runs out before it starts is fine too
s.chat_rules.attended_s = 0.5
try:
sid = await s.store.create_session(channel="cli")
_, events = await _turn(s, sid, "never delete my emails")
assert stopped == [True] and not s.chat_rules._checking
assert stopped == started and not s.chat_rules._checking # every check Claude Code started was stopped
assert events[-1].type == "done" and await s.chat_rules.list(sid, None) == []
finally:
await s.stop()
Expand Down
Loading