From ecf68347dbda0e6801a2ed34d65eb5ccd91ca537 Mon Sep 17 00:00:00 2001 From: Dinakar Sarbada Date: Wed, 6 May 2026 16:39:38 -0700 Subject: [PATCH 1/2] fix: initialize OpenClaw poll timing once --- skills/last30days/scripts/lib/setup_wizard.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/skills/last30days/scripts/lib/setup_wizard.py b/skills/last30days/scripts/lib/setup_wizard.py index 4818a80..918c82c 100644 --- a/skills/last30days/scripts/lib/setup_wizard.py +++ b/skills/last30days/scripts/lib/setup_wizard.py @@ -335,8 +335,9 @@ def poll_device_auth( """ import sys - deadline = time.time() + timeout - last_reminder = time.time() + started_at = time.time() + deadline = started_at + timeout + last_reminder = started_at reminder_count = 0 max_reminders = 4 reminder_interval = 30 # seconds between reminders From 36c43d50b70f9db8bea3efb39d62542c5158129a Mon Sep 17 00:00:00 2001 From: Trevin Chow Date: Sat, 16 May 2026 23:39:14 -0700 Subject: [PATCH 2/2] test: drop side_effect padding to match collapsed time.time() call --- tests/test_setup_openclaw.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_setup_openclaw.py b/tests/test_setup_openclaw.py index 6dc1037..a8b6145 100644 --- a/tests/test_setup_openclaw.py +++ b/tests/test_setup_openclaw.py @@ -213,10 +213,10 @@ class TestPollDeviceAuth: @patch("lib.setup_wizard.urlopen") def test_timeout_returns_none(self, mock_urlopen, mock_time): """Returns None when timeout is exceeded.""" - # poll_device_auth calls time.time() for deadline init, last_reminder init, - # then once per while-loop iteration. Three values are enough for one check - # that exceeds the deadline. - mock_time.time = MagicMock(side_effect=[0, 0, 301]) + # poll_device_auth captures started_at once, derives deadline + last_reminder + # from it, then checks time.time() in the while-loop. Two values: started_at, + # then a value past the deadline so the loop exits immediately. + mock_time.time = MagicMock(side_effect=[0, 301]) mock_time.sleep = MagicMock() result = setup_wizard.poll_device_auth("dc-123", interval=5, timeout=300)