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
fix(skill): relax unauthenticated polling after bootstrap
cyhaf44400520cb
diff --git a/skills/background-watch-hook/scripts/wait_issue.py b/skills/background-watch-hook/scripts/wait_issue.pyindex 7441ce0c4..f5ad514af 100644--- a/skills/background-watch-hook/scripts/wait_issue.py+++ b/skills/background-watch-hook/scripts/wait_issue.py@@ -210,7 +210,8 @@ def main() -> int:)return 2- effective_interval = max(args.interval, 1.0)+ base_interval = max(args.interval, 1.0)+ effective_interval = base_intervalstart = time.monotonic()try:@@ -238,17 +239,18 @@ def main() -> int:requests_per_poll_count,bootstrap_requests=bootstrap_requests,)- if effective_interval < unauthenticated_min:+ startup_interval = max(base_interval, unauthenticated_min)+ if effective_interval < startup_interval:print(("No GitHub token detected; clamping polling interval from %.1fs to %.1fs ""for %s request(s) per poll plus %s bootstrap request(s) to avoid ""unauthenticated rate-limit lockout.")- % (effective_interval, unauthenticated_min, requests_per_poll_count, bootstrap_requests),+ % (effective_interval, startup_interval, requests_per_poll_count, bootstrap_requests),file=sys.stderr,)- effective_interval = unauthenticated_min+ effective_interval = startup_intervalelse:bootstrap_requests = 0@@ -345,20 +347,28 @@ def main() -> int:continueif token is None:- unauthenticated_min = min_interval_for_unauthenticated(- requests_per_poll_count,- bootstrap_requests=bootstrap_requests,- )- if effective_interval < unauthenticated_min:- print(- (- "GitHub unauthenticated polling now needs %.1fs minimum for %s request(s) "- "per poll plus %s bootstrap request(s); increasing interval."+ unauthenticated_min = min_interval_for_unauthenticated(requests_per_poll_count)+ target_interval = max(base_interval, unauthenticated_min)+ if target_interval != effective_interval:+ if target_interval > effective_interval:+ print(+ (+ "GitHub unauthenticated polling now needs %.1fs minimum for %s request(s) "+ "per poll; increasing interval."+ )+ % (target_interval, requests_per_poll_count),+ file=sys.stderr,)- % (unauthenticated_min, requests_per_poll_count, bootstrap_requests),- file=sys.stderr,- )- effective_interval = unauthenticated_min+ else:+ print(+ (+ "GitHub unauthenticated polling now needs only %.1fs minimum for %s request(s) "+ "per poll; reducing interval."+ )+ % (target_interval, requests_per_poll_count),+ file=sys.stderr,+ )+ effective_interval = target_intervalif args.issue is not None:output, issue_comment_cursor = _render_issue_comments(diff --git a/skills/background-watch-hook/scripts/wait_pr.py b/skills/background-watch-hook/scripts/wait_pr.pyindex 8d72eb8ee..b37743340 100755--- a/skills/background-watch-hook/scripts/wait_pr.py+++ b/skills/background-watch-hook/scripts/wait_pr.py@@ -314,7 +314,8 @@ def main() -> int:)return 2- effective_interval = max(args.interval, 1.0)+ base_interval = max(args.interval, 1.0)+ effective_interval = base_intervalstart = time.monotonic()@@ -343,17 +344,18 @@ def main() -> int:requests_per_poll_count,bootstrap_requests=bootstrap_requests,)- if effective_interval < unauthenticated_min:+ startup_interval = max(base_interval, unauthenticated_min)+ if effective_interval < startup_interval:print(("No GitHub token detected; clamping polling interval from %.1fs to %.1fs ""for %s request(s) per poll plus %s bootstrap request(s) to avoid ""unauthenticated rate-limit lockout.")- % (effective_interval, unauthenticated_min, requests_per_poll_count, bootstrap_requests),+ % (effective_interval, startup_interval, requests_per_poll_count, bootstrap_requests),file=sys.stderr,)- effective_interval = unauthenticated_min+ effective_interval = startup_intervalelse:bootstrap_requests = 0@@ -471,20 +473,28 @@ def main() -> int:continueif token is None:- unauthenticated_min = min_interval_for_unauthenticated(- requests_per_poll_count,- bootstrap_requests=bootstrap_requests,- )- if effective_interval < unauthenticated_min:- print(- (- "GitHub unauthenticated polling now needs %.1fs minimum for %s request(s) "- "per poll plus %s bootstrap request(s); increasing interval."+ unauthenticated_min = min_interval_for_unauthenticated(requests_per_poll_count)+ target_interval = max(base_interval, unauthenticated_min)+ if target_interval != effective_interval:+ if target_interval > effective_interval:+ print(+ (+ "GitHub unauthenticated polling now needs %.1fs minimum for %s request(s) "+ "per poll; increasing interval."+ )+ % (target_interval, requests_per_poll_count),+ file=sys.stderr,)- % (unauthenticated_min, requests_per_poll_count, bootstrap_requests),- file=sys.stderr,- )- effective_interval = unauthenticated_min+ else:+ print(+ (+ "GitHub unauthenticated polling now needs only %.1fs minimum for %s request(s) "+ "per poll; reducing interval."+ )+ % (target_interval, requests_per_poll_count),+ file=sys.stderr,+ )+ effective_interval = target_intervalif args.pr is not None:output, review_cursor, review_comment_cursor, issue_comment_cursor, reaction_cursor = _render_activity(diff --git a/tests/test_wait_for_github_issue_activity.py b/tests/test_wait_for_github_issue_activity.pyindex 4a172a9de..d53002c5c 100644--- a/tests/test_wait_for_github_issue_activity.py+++ b/tests/test_wait_for_github_issue_activity.py@@ -243,3 +243,65 @@ def test_main_uses_since_raw_issue_cursor_for_initial_new_issue_fetch() -> None:assert rc == 0assert calls == [401]assert "issue #41" in stdout.getvalue()+++def test_main_reduces_unauthenticated_new_issue_interval_after_bootstrap() -> None:+ module = _load_module()+ fetch_calls: list[int | None] = []+ sleep_calls: list[float] = []++ def _fake_fetch_new_issue_state(repo, token, *, stop_after_id=None):+ fetch_calls.append(stop_after_id)+ if len(fetch_calls) == 1:+ return ({"issues": [], "raw_issue_cursor": 0}, 50)+ if len(fetch_calls) == 2:+ return ({"issues": [], "raw_issue_cursor": 0}, 1)+ return (+ {+ "issues": [+ {+ "id": 405,+ "number": 41,+ "title": "New issue",+ "state": "open",+ "html_url": "https://github.com/example/repo/issues/41",+ "user": {"login": "someone"},+ }+ ],+ "raw_issue_cursor": 406,+ },+ 1,+ )++ def _fake_min_interval(requests_per_poll, *, bootstrap_requests=0):+ if bootstrap_requests:+ return 3600.0+ return 60.0++ stdout = io.StringIO()+ with (+ patch.object(module, "_fetch_new_issue_state", side_effect=_fake_fetch_new_issue_state),+ patch.object(module, "get_token", return_value=None),+ patch.object(module, "get_authenticated_login", return_value=None),+ patch.object(module, "min_interval_for_unauthenticated", side_effect=_fake_min_interval),+ patch.object(module.time, "sleep", side_effect=lambda seconds: sleep_calls.append(seconds)),+ patch(+ "sys.argv",+ [+ "wait_issue.py",+ "--repo",+ "cyhhao/vibe-remote",+ "--new-issues",+ "--allow-unauthenticated",+ "--interval",+ "1",+ ],+ ),+ redirect_stdout(stdout),+ ):+ rc = module.main()++ assert rc == 0+ assert sleep_calls == [3600.0, 60.0]+ assert fetch_calls == [None, None, None]+ assert "issue #41" in stdout.getvalue()diff --git a/tests/test_wait_for_github_pr_activity.py b/tests/test_wait_for_github_pr_activity.pyindex 3c1d15b14..76fb16c7f 100644--- a/tests/test_wait_for_github_pr_activity.py+++ b/tests/test_wait_for_github_pr_activity.py@@ -259,3 +259,64 @@ def test_main_uses_since_pr_cursor_for_initial_new_pr_fetch() -> None:assert rc == 0assert calls == [405]assert "pull_request #158" in stdout.getvalue()+++def test_main_reduces_unauthenticated_new_pr_interval_after_bootstrap() -> None:+ module = _load_module()+ fetch_calls: list[int | None] = []+ sleep_calls: list[float] = []++ def _fake_fetch_new_pr_state(repo, token, *, stop_after_id=None):+ fetch_calls.append(stop_after_id)+ if len(fetch_calls) == 1:+ return ({"pull_requests": []}, 50)+ if len(fetch_calls) == 2:+ return ({"pull_requests": []}, 1)+ return (+ {+ "pull_requests": [+ {+ "id": 410,+ "number": 158,+ "title": "New PR",+ "state": "open",+ "html_url": "https://github.com/example/repo/pull/158",+ "user": {"login": "cyhhao"},+ }+ ]+ },+ 1,+ )++ def _fake_min_interval(requests_per_poll, *, bootstrap_requests=0):+ if bootstrap_requests:+ return 3600.0+ return 60.0++ stdout = io.StringIO()+ with (+ patch.object(module, "_fetch_new_pr_state", side_effect=_fake_fetch_new_pr_state),+ patch.object(module, "get_token", return_value=None),+ patch.object(module, "get_authenticated_login", return_value=None),+ patch.object(module, "min_interval_for_unauthenticated", side_effect=_fake_min_interval),+ patch.object(module.time, "sleep", side_effect=lambda seconds: sleep_calls.append(seconds)),+ patch(+ "sys.argv",+ [+ "wait_pr.py",+ "--repo",+ "cyhhao/vibe-remote",+ "--new-prs",+ "--allow-unauthenticated",+ "--interval",+ "1",+ ],+ ),+ redirect_stdout(stdout),+ ):+ rc = module.main()++ assert rc == 0+ assert sleep_calls == [3600.0, 60.0]+ assert fetch_calls == [None, None, None]+ assert "pull_request #158" in stdout.getvalue()