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.

feat(skills): detect codex pass reactions on PRs

cyhf81b02078878
diff --git a/skills/background-watch-hook/SKILL.md b/skills/background-watch-hook/SKILL.md
index fddd79487..e9d100c5e 100644
--- a/skills/background-watch-hook/SKILL.md
+++ b/skills/background-watch-hook/SKILL.md
@@ -170,6 +170,7 @@ GitHub-specific notes:
- `--catch-up` reports activity that already exists at startup
- without `--catch-up`, the waiter snapshots current PR activity as the baseline
+- PR activity also includes the special case where `chatgpt-codex-connector[bot]` leaves a `+1` reaction on the PR body instead of posting a comment
- authentication is preferred; unauthenticated polling is slower and more fragile
## Practical Advice
diff --git a/skills/background-watch-hook/scripts/wait_for_github_pr_activity.py b/skills/background-watch-hook/scripts/wait_for_github_pr_activity.py
index c9d93840c..e51cac0b0 100755
--- a/skills/background-watch-hook/scripts/wait_for_github_pr_activity.py
+++ b/skills/background-watch-hook/scripts/wait_for_github_pr_activity.py
@@ -16,6 +16,9 @@ import urllib.parse
import urllib.request
from typing import Any
+CODEX_REVIEW_PASS_REACTION_USER = "chatgpt-codex-connector[bot]"
+CODEX_REVIEW_PASS_REACTION_CONTENT = "+1"
+
def _get_token() -> str | None:
for env_name in ("GITHUB_TOKEN", "GH_TOKEN"):
@@ -126,6 +129,23 @@ def _format_issue_comment(comment: dict[str, Any]) -> str:
return f"- issue_comment #{comment_id} by {author}\n {body}\n {url}"
+def _is_codex_pass_reaction(reaction: dict[str, Any]) -> bool:
+ author = ((reaction.get("user") or {}).get("login")) or ""
+ content = str(reaction.get("content") or "")
+ return author == CODEX_REVIEW_PASS_REACTION_USER and content == CODEX_REVIEW_PASS_REACTION_CONTENT
+
+
+def _format_reaction(reaction: dict[str, Any]) -> str:
+ reaction_id = reaction.get("id")
+ author = ((reaction.get("user") or {}).get("login")) or "unknown"
+ content = str(reaction.get("content") or "")
+ created_at = str(reaction.get("created_at") or "")
+ return (
+ f"- pr_reaction #{reaction_id} by {author} ({content})\n"
+ f" Codex review completed without comments and reacted on the PR body at {created_at}."
+ )
+
+
def _fetch_state(repo: str, pr_number: int, token: str | None) -> dict[str, list[dict[str, Any]]]:
encoded_repo = urllib.parse.quote(repo, safe="/")
reviews = _list_paginated(f"https://api.github.com/repos/{encoded_repo}/pulls/{pr_number}/reviews", token)
@@ -137,16 +157,21 @@ def _fetch_state(repo: str, pr_number: int, token: str | None) -> dict[str, list
f"https://api.github.com/repos/{encoded_repo}/issues/{pr_number}/comments",
token,
)
+ reactions = _list_paginated(
+ f"https://api.github.com/repos/{encoded_repo}/issues/{pr_number}/reactions",
+ token,
+ )
return {
"reviews": reviews,
"review_comments": review_comments,
"issue_comments": issue_comments,
+ "reactions": reactions,
}
def _requests_per_poll(state: dict[str, list[dict[str, Any]]]) -> int:
requests = 0
- for key in ("reviews", "review_comments", "issue_comments"):
+ for key in ("reviews", "review_comments", "issue_comments", "reactions"):
item_count = len(state[key])
requests += max(1, (item_count // 100) + 1)
return requests
@@ -160,24 +185,32 @@ def _render_activity(
review_cursor: int,
review_comment_cursor: int,
issue_comment_cursor: int,
+ reaction_cursor: int,
event_limit: int,
-) -> tuple[str | None, int, int, int]:
+) -> tuple[str | None, int, int, int, int]:
new_reviews = _filter_new(state["reviews"], review_cursor)
new_review_comments = _filter_new(state["review_comments"], review_comment_cursor)
new_issue_comments = _filter_new(state["issue_comments"], issue_comment_cursor)
+ new_reactions = [
+ reaction
+ for reaction in _filter_new(state["reactions"], reaction_cursor)
+ if _is_codex_pass_reaction(reaction)
+ ]
- if not (new_reviews or new_review_comments or new_issue_comments):
- return None, review_cursor, review_comment_cursor, issue_comment_cursor
+ if not (new_reviews or new_review_comments or new_issue_comments or new_reactions):
+ return None, review_cursor, review_comment_cursor, issue_comment_cursor, reaction_cursor
next_review_cursor = max(review_cursor, _max_id(new_reviews))
next_review_comment_cursor = max(review_comment_cursor, _max_id(new_review_comments))
next_issue_comment_cursor = max(issue_comment_cursor, _max_id(new_issue_comments))
+ next_reaction_cursor = max(reaction_cursor, _max_id(state["reactions"]))
lines = [f"GitHub PR activity detected for {repo}#{pr_number}"]
rendered_events: list[str] = []
rendered_events.extend(_format_review(review) for review in new_reviews)
rendered_events.extend(_format_review_comment(comment) for comment in new_review_comments)
rendered_events.extend(_format_issue_comment(comment) for comment in new_issue_comments)
+ rendered_events.extend(_format_reaction(reaction) for reaction in new_reactions)
visible_limit = max(event_limit, 1)
for entry in rendered_events[:visible_limit]:
@@ -192,6 +225,7 @@ def _render_activity(
next_review_cursor,
next_review_comment_cursor,
next_issue_comment_cursor,
+ next_reaction_cursor,
)
@@ -201,6 +235,7 @@ def _write_cursor_output(
review_cursor: int,
review_comment_cursor: int,
issue_comment_cursor: int,
+ reaction_cursor: int,
) -> None:
if not path:
return
@@ -209,6 +244,7 @@ def _write_cursor_output(
"review_cursor": review_cursor,
"review_comment_cursor": review_comment_cursor,
"issue_comment_cursor": issue_comment_cursor,
+ "reaction_cursor": reaction_cursor,
}
with open(path, "w", encoding="utf-8") as handle:
json.dump(payload, handle)
@@ -228,6 +264,7 @@ def main() -> int:
parser.add_argument("--since-review-id", type=int, default=None, help="Existing review cursor")
parser.add_argument("--since-review-comment-id", type=int, default=None, help="Existing review comment cursor")
parser.add_argument("--since-issue-comment-id", type=int, default=None, help="Existing PR conversation comment cursor")
+ parser.add_argument("--since-reaction-id", type=int, default=None, help="Existing PR-body reaction cursor")
parser.add_argument("--cursor-output", help=argparse.SUPPRESS)
parser.add_argument("--event-limit", type=int, default=8, help="Maximum number of new events to include in stdout")
parser.add_argument(
@@ -303,22 +340,36 @@ def main() -> int:
if args.since_issue_comment_id is not None
else (0 if args.catch_up else _max_id(state["issue_comments"]))
)
+ reaction_cursor = (
+ args.since_reaction_id
+ if args.since_reaction_id is not None
+ else (0 if args.catch_up else _max_id(state["reactions"]))
+ )
print(
(
- "Watching GitHub PR %s#%s from cursors: review=%s review_comment=%s issue_comment=%s catch_up=%s"
- % (args.repo, args.pr, review_cursor, review_comment_cursor, issue_comment_cursor, args.catch_up)
+ "Watching GitHub PR %s#%s from cursors: review=%s review_comment=%s issue_comment=%s reaction=%s catch_up=%s"
+ % (
+ args.repo,
+ args.pr,
+ review_cursor,
+ review_comment_cursor,
+ issue_comment_cursor,
+ reaction_cursor,
+ args.catch_up,
+ )
),
file=sys.stderr,
)
- initial_output, review_cursor, review_comment_cursor, issue_comment_cursor = _render_activity(
+ initial_output, review_cursor, review_comment_cursor, issue_comment_cursor, reaction_cursor = _render_activity(
repo=args.repo,
pr_number=args.pr,
state=state,
review_cursor=review_cursor,
review_comment_cursor=review_comment_cursor,
issue_comment_cursor=issue_comment_cursor,
+ reaction_cursor=reaction_cursor,
event_limit=args.event_limit,
)
if initial_output is not None:
@@ -327,6 +378,7 @@ def main() -> int:
review_cursor=review_cursor,
review_comment_cursor=review_comment_cursor,
issue_comment_cursor=issue_comment_cursor,
+ reaction_cursor=reaction_cursor,
)
print(initial_output)
return 0
@@ -377,13 +429,14 @@ def main() -> int:
)
effective_interval = unauthenticated_min
- output, review_cursor, review_comment_cursor, issue_comment_cursor = _render_activity(
+ output, review_cursor, review_comment_cursor, issue_comment_cursor, reaction_cursor = _render_activity(
repo=args.repo,
pr_number=args.pr,
state=state,
review_cursor=review_cursor,
review_comment_cursor=review_comment_cursor,
issue_comment_cursor=issue_comment_cursor,
+ reaction_cursor=reaction_cursor,
event_limit=args.event_limit,
)
if output is None:
@@ -394,6 +447,7 @@ def main() -> int:
review_cursor=review_cursor,
review_comment_cursor=review_comment_cursor,
issue_comment_cursor=issue_comment_cursor,
+ reaction_cursor=reaction_cursor,
)
print(output)
return 0
diff --git a/skills/background-watch-hook/scripts/watch_github_pr_then_hook.sh b/skills/background-watch-hook/scripts/watch_github_pr_then_hook.sh
index 2103f397c..9121110a2 100755
--- a/skills/background-watch-hook/scripts/watch_github_pr_then_hook.sh
+++ b/skills/background-watch-hook/scripts/watch_github_pr_then_hook.sh
@@ -26,6 +26,7 @@ Options:
--since-review-id <id> Optional. Review cursor.
--since-review-comment-id <id> Optional. Review-comment cursor.
--since-issue-comment-id <id> Optional. PR conversation comment cursor.
+ --since-reaction-id <id> Optional. PR-body reaction cursor.
--log-file <path> Optional. Background log file path.
--foreground Optional. Run inline instead of detaching.
--post-to <thread|channel> Optional. Passed through to the wrapper.
@@ -51,6 +52,7 @@ allow_unauthenticated=0
since_review_id=""
since_review_comment_id=""
since_issue_comment_id=""
+since_reaction_id=""
log_file=""
foreground=0
post_to=""
@@ -132,6 +134,10 @@ while [[ $# -gt 0 ]]; do
since_issue_comment_id="${2:-}"
shift 2
;;
+ --since-reaction-id)
+ since_reaction_id="${2:-}"
+ shift 2
+ ;;
--log-file)
log_file="${2:-}"
shift 2
@@ -252,6 +258,9 @@ if [[ "$forever" -eq 1 && "$foreground" -ne 1 ]]; then
if [[ -n "$since_issue_comment_id" ]]; then
child_args+=(--since-issue-comment-id "$since_issue_comment_id")
fi
+ if [[ -n "$since_reaction_id" ]]; then
+ child_args+=(--since-reaction-id "$since_reaction_id")
+ fi
if [[ -n "$post_to" ]]; then
child_args+=(--post-to "$post_to")
fi
@@ -316,6 +325,7 @@ if [[ "$forever" -eq 1 ]]; then
current_since_review_id="$since_review_id"
current_since_review_comment_id="$since_review_comment_id"
current_since_issue_comment_id="$since_issue_comment_id"
+ current_since_reaction_id="$since_reaction_id"
current_catch_up="$catch_up"
while true; do
@@ -349,7 +359,7 @@ PY
)"
send_status_hook \
"GitHub PR watch stopped after reaching its lifetime timeout." \
- "Lifetime timeout reached after ${elapsed_seconds} second(s) for ${repo}#${pr}. Last cursors: review=${current_since_review_id:-0} review_comment=${current_since_review_comment_id:-0} issue_comment=${current_since_issue_comment_id:-0}."
+ "Lifetime timeout reached after ${elapsed_seconds} second(s) for ${repo}#${pr}. Last cursors: review=${current_since_review_id:-0} review_comment=${current_since_review_comment_id:-0} issue_comment=${current_since_issue_comment_id:-0} reaction=${current_since_reaction_id:-0}."
exit 0
fi
@@ -417,6 +427,9 @@ PY
if [[ -n "$current_since_issue_comment_id" ]]; then
cycle_waiter_args+=(--since-issue-comment-id "$current_since_issue_comment_id")
fi
+ if [[ -n "$current_since_reaction_id" ]]; then
+ cycle_waiter_args+=(--since-reaction-id "$current_since_reaction_id")
+ fi
if [[ "$current_catch_up" -eq 1 ]]; then
cycle_waiter_args+=(--catch-up)
fi
@@ -454,16 +467,17 @@ import sys
with open(sys.argv[1], encoding="utf-8") as handle:
payload = json.load(handle)
print(
- "%s\t%s\t%s"
+ "%s\t%s\t%s\t%s"
% (
payload["review_cursor"],
payload["review_comment_cursor"],
payload["issue_comment_cursor"],
+ payload.get("reaction_cursor", 0),
)
)
PY
)"
- IFS=$'\t' read -r current_since_review_id current_since_review_comment_id current_since_issue_comment_id <<<"$cursor_values"
+ IFS=$'\t' read -r current_since_review_id current_since_review_comment_id current_since_issue_comment_id current_since_reaction_id <<<"$cursor_values"
current_catch_up=0
done
fi
@@ -521,5 +535,8 @@ fi
if [[ -n "$since_issue_comment_id" ]]; then
waiter_args+=(--since-issue-comment-id "$since_issue_comment_id")
fi
+if [[ -n "$since_reaction_id" ]]; then
+ waiter_args+=(--since-reaction-id "$since_reaction_id")
+fi
"${wrapper_args[@]}" -- "${waiter_args[@]}"
diff --git a/tests/test_wait_for_github_pr_activity.py b/tests/test_wait_for_github_pr_activity.py
new file mode 100644
index 000000000..a372435c5
--- /dev/null
+++ b/tests/test_wait_for_github_pr_activity.py
@@ -0,0 +1,91 @@
+from __future__ import annotations
+
+import importlib.util
+from pathlib import Path
+
+
+def _load_module():
+ script_path = (
+ Path(__file__).resolve().parents[1]
+ / "skills"
+ / "background-watch-hook"
+ / "scripts"
+ / "wait_for_github_pr_activity.py"
+ )
+ spec = importlib.util.spec_from_file_location("wait_for_github_pr_activity", script_path)
+ module = importlib.util.module_from_spec(spec)
+ assert spec is not None and spec.loader is not None
+ spec.loader.exec_module(module)
+ return module
+
+
+def test_render_activity_includes_codex_pr_body_reaction() -> None:
+ module = _load_module()
+ state = {
+ "reviews": [],
+ "review_comments": [],
+ "issue_comments": [],
+ "reactions": [
+ {
+ "id": 123,
+ "content": "+1",
+ "created_at": "2026-04-02T13:05:42Z",
+ "user": {"login": "chatgpt-codex-connector[bot]"},
+ }
+ ],
+ }
+
+ output, review_cursor, review_comment_cursor, issue_comment_cursor, reaction_cursor = 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,
+ event_limit=8,
+ )
+
+ assert output is not None
+ assert "pr_reaction #123" in output
+ assert "chatgpt-codex-connector[bot]" in output
+ assert reaction_cursor == 123
+ assert review_cursor == 0
+ assert review_comment_cursor == 0
+ assert issue_comment_cursor == 0
+
+
+def test_render_activity_ignores_non_codex_or_non_plus_one_reactions() -> None:
+ module = _load_module()
+ state = {
+ "reviews": [],
+ "review_comments": [],
+ "issue_comments": [],
+ "reactions": [
+ {
+ "id": 124,
+ "content": "heart",
+ "created_at": "2026-04-02T13:05:42Z",
+ "user": {"login": "chatgpt-codex-connector[bot]"},
+ },
+ {
+ "id": 125,
+ "content": "+1",
+ "created_at": "2026-04-02T13:05:42Z",
+ "user": {"login": "someone-else"},
+ },
+ ],
+ }
+
+ output, *_rest = 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,
+ event_limit=8,
+ )
+
+ assert output is None