Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
test(watches): wait for a retry inside one watch run, not any second cycle
cyh36253441913d
diff --git a/tests/test_watches.py b/tests/test_watches.pyindex 544a3dcb2..35d17332b 100644--- a/tests/test_watches.py+++ b/tests/test_watches.py@@ -929,7 +929,10 @@ def test_managed_watch_service_forever_timeout_disables_and_enqueues_failure(tmpassert saved.last_exit_code == 124-def test_managed_watch_service_forever_timeout_retries_when_explicitly_allowed(tmp_path: Path) -> None:+def test_managed_watch_service_forever_timeout_retries_when_explicitly_allowed(+ tmp_path: Path,+ monkeypatch: pytest.MonkeyPatch,+) -> None:store = ManagedWatchStore(tmp_path / "watches.json")request_store = TaskExecutionStore(tmp_path / "task_requests")runtime_store = WatchRuntimeStateStore(tmp_path / "watch_runtime.json")@@ -955,20 +958,44 @@ def test_managed_watch_service_forever_timeout_retries_when_explicitly_allowed(truntime_store=runtime_store,)+ cycles = 0+ watch_runs = 0+ run_cycle = service._run_cycle+ run_watch = service._run_watch++ async def counting_run_cycle(*args, **kwargs):+ nonlocal cycles+ cycles += 1+ return await run_cycle(*args, **kwargs)++ async def counting_run_watch(*args, **kwargs):+ nonlocal watch_runs+ watch_runs += 1+ return await run_watch(*args, **kwargs)++ monkeypatch.setattr(service, "_run_cycle", counting_run_cycle)+ monkeypatch.setattr(service, "_run_watch", counting_run_watch)+async def _run() -> None:await _start_watch_service(service)# A fixed sleep bets that a real interpreter spawn, its 50ms deadline and# the write-back all land inside one window; on a contended runner they do# not, and the assertion samples ``last_exit_code`` while it is still None.- # Wait for the recorded outcome instead, so a genuinely wrong code still fails.+ #+ # Wait for the retry this test is named for instead, and name it as the+ # invariant that separates one from a restart: a *second waiter inside the+ # same watch run*. A watch that recorded the retryable timeout and then+ # returned would be started again by reconciliation and reach two waiters+ # too, so the second waiter alone does not distinguish the two.try:- for _ in range(250):- recorded = store.get_watch(watch.id)- if recorded is not None and recorded.last_exit_code is not None:+ for _ in range(500):+ if cycles >= 2 and watch_runs == 1:breakawait asyncio.sleep(0.02)else:- raise AssertionError("waiter timeout outcome was never recorded")+ raise AssertionError(+ f"waiter never retried inside one watch run (cycles={cycles}, runs={watch_runs})"+ )finally:await service.stop()@@ -976,6 +1003,7 @@ def test_managed_watch_service_forever_timeout_retries_when_explicitly_allowed(tsaved = store.get_watch(watch.id)assert saved is not None+ assert watch_runs == 1assert saved.enabled is Trueassert saved.last_exit_code == 124assert request_store.list_pending() == []