diff --git a/cloud/tests/test_playwright_bridge.py b/cloud/tests/test_playwright_bridge.py index bdc4476..aad25c5 100644 --- a/cloud/tests/test_playwright_bridge.py +++ b/cloud/tests/test_playwright_bridge.py @@ -171,6 +171,12 @@ class BridgeTestCase(unittest.TestCase): self.assertEqual(effective_holder(self.tmp.name, state), "agent") write_control(self.tmp.name, "user") + # Gitea runner filesystem mtime lags wall clock by ~1ms + # (measured 0.2-1.0ms in runner container), so a + # back-to-back write can appear older than updated_at. + # Wait out the lag; the test's intent is "newer control + # wins", not "same-millisecond writes are ordered". + time.sleep(0.05) self.assertEqual(effective_holder(self.tmp.name, state), "user") # Once the MCP polls, the state file catches up and both diff --git a/cloud/tests/test_server_browser_proxy.py b/cloud/tests/test_server_browser_proxy.py index a252497..035736d 100644 --- a/cloud/tests/test_server_browser_proxy.py +++ b/cloud/tests/test_server_browser_proxy.py @@ -214,7 +214,19 @@ class BrowserProxyTestCase(unittest.TestCase): db.commit() finally: db.close() - line = resp.readline().decode("utf-8") + # Terminal status ends the stream, but a waiting + # heartbeat may fire first on a loaded runner; drain + # waiting frames until EOF instead of requiring the + # first line after the update to be EOF. + for _ in range(20): + line = resp.readline().decode("utf-8") + if line == "": + break + if line.strip() == "": + continue + payload = json.loads(line[6:]) if line.startswith("data: ") else {} + if not payload.get("waiting"): + break self.assertEqual(line, "") finally: conn.close()