Skip to content

armgit / avibe

Public Imported from GitHub
0

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.

fix(skill): classify closed draft pull requests correctly

cyh242dc1ff9b5e
diff --git a/skills/background-watch-hook/scripts/wait_pr.py b/skills/background-watch-hook/scripts/wait_pr.py
index a0aae8025..a8659d7b0 100755
--- a/skills/background-watch-hook/scripts/wait_pr.py
+++ b/skills/background-watch-hook/scripts/wait_pr.py
@@ -88,10 +88,12 @@ def _current_pr_status(pr: dict[str, Any] | None) -> str:
return "unknown"
if pr.get("merged_at"):
return "merged"
+ state = str(pr.get("state") or "").lower()
+ if state == "closed":
+ return "closed"
if pr.get("draft") is True:
return "draft"
- state = str(pr.get("state") or "").lower()
- if state in {"open", "closed"}:
+ if state == "open":
return state
return state or "unknown"
diff --git a/tests/test_wait_for_github_pr_activity.py b/tests/test_wait_for_github_pr_activity.py
index 270f89a10..a9f37d60e 100644
--- a/tests/test_wait_for_github_pr_activity.py
+++ b/tests/test_wait_for_github_pr_activity.py
@@ -309,6 +309,39 @@ def test_render_activity_reports_closed_to_open_transition() -> None:
assert pr_status == "open"
+def test_render_activity_prioritizes_closed_over_draft() -> None:
+ module = _load_module()
+ state = {
+ "pull_request": {
+ "number": 153,
+ "state": "closed",
+ "draft": True,
+ "html_url": "https://github.com/example/repo/pull/153",
+ },
+ "reviews": [],
+ "review_comments": [],
+ "issue_comments": [],
+ "reactions": [],
+ }
+
+ output, *_rest, pr_status = module._render_activity(
+ repo="cyhhao/vibe-remote",
+ pr_number=153,
+ state=state,
+ review_cursor=0,
+ review_comment_cursor=0,
+ issue_comment_cursor=0,
+ reaction_cursor=0,
+ pr_status="open",
+ event_limit=8,
+ )
+
+ assert output is not None
+ assert "pr_status #153 open -> closed" in output
+ assert "Pull request was closed without merge." in output
+ assert pr_status == "closed"
+
+
def test_render_activity_skips_unchanged_pr_status() -> None:
module = _load_module()
state = {