Skip to content

Use Claude Code, Codex, VSCode, Pi, and OpenCode (and 6 other harnesses) for free (1.3B+ free tokens) from your terminal, app, IDE, or phone, and now from the browser with native browser sessions (multi-harness + multi-model) like OpenClaw (voice supported + ToS friendly)

Python

Wait for Code storage readiness in shutdown tests (#2036)

Ali Khokhar1fe754b69d39
diff --git a/tests/cli/test_server_shutdown.py b/tests/cli/test_server_shutdown.py
index 3dac664d..86597067 100644
--- a/tests/cli/test_server_shutdown.py
+++ b/tests/cli/test_server_shutdown.py
@@ -68,6 +68,18 @@ async def test_supervisor_drains_admin_event_feed_without_forced_cancellation(
async with httpx.AsyncClient(timeout=3, trust_env=False) as client:
status_url = f"http://127.0.0.1:{port}/admin/api/status"
old_instance = (await client.get(status_url)).json()["instance_id"]
+ # HTTP startup precedes background Code storage initialization.
+ bootstrap_url = f"http://127.0.0.1:{port}/admin/api/code/bootstrap"
+ async with asyncio.timeout(30):
+ while True:
+ response = await client.get(bootstrap_url)
+ assert response.status_code == 200, response.text
+ storage = response.json()["storage"]
+ if storage["state"] == "ready":
+ break
+ assert storage["state"] == "starting", storage
+ assert thread.is_alive()
+ await asyncio.sleep(0.01)
events_url = f"http://127.0.0.1:{port}/admin/api/code/events"
async with (
client.stream("GET", events_url) as first,