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): bound issue comment polling by cursor
cyhf838e9532d86
diff --git a/skills/background-watch-hook/scripts/wait_issue.py b/skills/background-watch-hook/scripts/wait_issue.pyindex f5ad514af..f67f88753 100644--- a/skills/background-watch-hook/scripts/wait_issue.py+++ b/skills/background-watch-hook/scripts/wait_issue.py@@ -76,11 +76,14 @@ def _fetch_issue_comment_state(repo: str,issue_number: int,token: str | None,+ *,+ stop_after_id: int | None = None,) -> tuple[dict[str, list[dict[str, Any]]], int]:encoded_repo = urllib.parse.quote(repo, safe="/")comments, request_count = list_paginated_with_count(f"https://api.github.com/repos/{encoded_repo}/issues/{issue_number}/comments",token,+ stop_after_id=stop_after_id,)return {"issue_comments": comments}, request_count@@ -216,7 +219,15 @@ def main() -> int:try:if args.issue is not None:- state, requests_per_poll_count = _fetch_issue_comment_state(args.repo, args.issue, token)+ initial_issue_comment_stop_after_id = None+ if args.since_issue_comment_id is not None and not args.catch_up:+ initial_issue_comment_stop_after_id = args.since_issue_comment_id+ state, requests_per_poll_count = _fetch_issue_comment_state(+ args.repo,+ args.issue,+ token,+ stop_after_id=initial_issue_comment_stop_after_id,+ )else:initial_raw_issue_stop_after_id = Noneif args.since_raw_issue_id is not None and not args.catch_up:@@ -323,7 +334,12 @@ def main() -> int:try:if args.issue is not None:- state, requests_per_poll_count = _fetch_issue_comment_state(args.repo, args.issue, token)+ state, requests_per_poll_count = _fetch_issue_comment_state(+ args.repo,+ args.issue,+ token,+ stop_after_id=issue_comment_cursor if issue_comment_cursor > 0 else None,+ )else:state, requests_per_poll_count = _fetch_new_issue_state(args.repo,diff --git a/tests/test_wait_for_github_issue_activity.py b/tests/test_wait_for_github_issue_activity.pyindex d53002c5c..520f7d20f 100644--- a/tests/test_wait_for_github_issue_activity.py+++ b/tests/test_wait_for_github_issue_activity.py@@ -102,6 +102,40 @@ def test_render_issue_comments_ignores_self_authored_comment_but_advances_cursorassert issue_comment_cursor == 302+def test_fetch_issue_comment_state_stops_after_cursor() -> None:+ module = _load_module()+ comments = [+ {+ "id": 305,+ "body": "Newest",+ "html_url": "https://github.com/example/repo/issues/24#issuecomment-305",+ "user": {"login": "reviewer"},+ },+ {+ "id": 302,+ "body": "Known",+ "html_url": "https://github.com/example/repo/issues/24#issuecomment-302",+ "user": {"login": "reviewer"},+ },+ ]++ def _fake_list_paginated_with_count(base_url, token, *, stop_after_id=None):+ assert "issues/24/comments" in base_url+ assert stop_after_id == 302+ return comments, 2++ with patch.object(module, "list_paginated_with_count", side_effect=_fake_list_paginated_with_count):+ state, request_count = module._fetch_issue_comment_state(+ "cyhhao/vibe-remote",+ 24,+ token="token",+ stop_after_id=302,+ )++ assert state["issue_comments"][0]["id"] == 305+ assert request_count == 2++def test_fetch_new_issue_state_tracks_raw_cursor_and_request_count() -> None:module = _load_module()raw_items = [@@ -245,6 +279,52 @@ def test_main_uses_since_raw_issue_cursor_for_initial_new_issue_fetch() -> None:assert "issue #41" in stdout.getvalue()+def test_main_uses_since_issue_comment_cursor_for_initial_issue_fetch() -> None:+ module = _load_module()+ calls: list[int | None] = []++ def _fake_fetch_issue_comment_state(repo, issue_number, token, *, stop_after_id=None):+ calls.append(stop_after_id)+ return (+ {+ "issue_comments": [+ {+ "id": 305,+ "body": "New comment",+ "html_url": "https://github.com/example/repo/issues/24#issuecomment-305",+ "user": {"login": "reviewer"},+ }+ ]+ },+ 1,+ )++ stdout = io.StringIO()+ with (+ patch.object(module, "_fetch_issue_comment_state", side_effect=_fake_fetch_issue_comment_state),+ patch.object(module, "get_token", return_value="token"),+ patch.object(module, "get_authenticated_login", return_value=None),+ patch(+ "sys.argv",+ [+ "wait_issue.py",+ "--repo",+ "cyhhao/vibe-remote",+ "--issue",+ "24",+ "--since-issue-comment-id",+ "302",+ ],+ ),+ redirect_stdout(stdout),+ ):+ rc = module.main()++ assert rc == 0+ assert calls == [302]+ assert "issue_comment #305" in stdout.getvalue()++def test_main_reduces_unauthenticated_new_issue_interval_after_bootstrap() -> None:module = _load_module()fetch_calls: list[int | None] = []