From c341b699a176822aa2070d1e0c961a7e8ba2924d Mon Sep 17 00:00:00 2001 From: itsskofficial Date: Thu, 15 Oct 2026 21:58:26 +0530 Subject: [PATCH] test(rules): don't fail the slow Claude Code check test when a busy machine ends it before it starts --- tests/test_rules_from_chat.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/test_rules_from_chat.py b/tests/test_rules_from_chat.py index 1b9e3e05..81548f4e 100644 --- a/tests/test_rules_from_chat.py +++ b/tests/test_rules_from_chat.py @@ -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: @@ -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()