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
feat(skills): add forever github pr watching
cyh886c4fa22739
diff --git a/skills/background-watch-hook/SKILL.md b/skills/background-watch-hook/SKILL.mdindex e526ecd20..3d8a4fcaf 100644--- a/skills/background-watch-hook/SKILL.md+++ b/skills/background-watch-hook/SKILL.md@@ -2,7 +2,7 @@name: background-watch-hookslug: background-watch-hookdescription: Run a blocking watcher in the background and send a `vibe hook` back to the current IM session when it finishes. Use for GitHub reviews, CI, file completion, log matches, and process-exit follow-ups.-version: 0.2.0+version: 0.3.0---# Background Watch Hook@@ -141,6 +141,8 @@ For other use cases, either:Use `scripts/wait_for_github_pr_activity.py` only when the thing being watched is GitHub PR review activity. Use `scripts/watch_github_pr_then_hook.sh` if you want that common path pre-wired.+By default, the GitHub convenience wrapper is still one-shot: it waits for the next matching event, sends one hook, and exits. Use `--forever` only when you explicitly want a long-lived watcher that keeps re-arming itself after each detected event.+If the watcher should immediately surface activity that already exists at startup, add `--catch-up`. Without it, the included GitHub waiter snapshots current activity as the baseline and waits only for newer events.The included GitHub waiter expects GitHub authentication by default. It will use `GITHUB_TOKEN`, `GH_TOKEN`, or `gh auth token`. Only use `--allow-unauthenticated` for slower best-effort polling when authentication is not available.@@ -266,9 +268,26 @@ If authentication is unavailable and a quick one-off best-effort watch is still--pr 151 \--prefix "Best-effort unauthenticated GitHub watch fired. Inspect the latest PR state." \--allow-unauthenticated \- --interval 180+ --interval 180```+To keep watching a PR continuously instead of exiting after the next event, use `--forever`:++```bash+scripts/watch_github_pr_then_hook.sh \+ --session-key "slack::channel::C123::thread::171717.123" \+ --repo cyhhao/vibe-remote \+ --pr 151 \+ --forever+```++`--forever` is intentionally long-lived:++- it keeps the watcher process alive until you stop it+- it advances its cursors after each detected event and waits for the next one+- it must run with `--timeout 0`, so omit `--timeout` or pass `0` explicitly+- always mention the lifecycle to the user and surface the PID/log path from the startup message+## Failure Handling- If the waiter requires credentials, verify them before starting the background process.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.pyindex 276c7ba9b..c9d93840c 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@@ -195,6 +195,25 @@ def _render_activity()+def _write_cursor_output(+ path: str | None,+ *,+ review_cursor: int,+ review_comment_cursor: int,+ issue_comment_cursor: int,+) -> None:+ if not path:+ return++ payload = {+ "review_cursor": review_cursor,+ "review_comment_cursor": review_comment_cursor,+ "issue_comment_cursor": issue_comment_cursor,+ }+ with open(path, "w", encoding="utf-8") as handle:+ json.dump(payload, handle)++def main() -> int:parser = argparse.ArgumentParser(description=__doc__)parser.add_argument("--repo", required=True, help="GitHub repo in owner/name form")@@ -209,6 +228,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("--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("--catch-up",@@ -302,6 +322,12 @@ def main() -> int:event_limit=args.event_limit,)if initial_output is not None:+ _write_cursor_output(+ args.cursor_output,+ review_cursor=review_cursor,+ review_comment_cursor=review_comment_cursor,+ issue_comment_cursor=issue_comment_cursor,+ )print(initial_output)return 0@@ -363,6 +389,12 @@ def main() -> int:if output is None:continue+ _write_cursor_output(+ args.cursor_output,+ review_cursor=review_cursor,+ review_comment_cursor=review_comment_cursor,+ issue_comment_cursor=issue_comment_cursor,+ )print(output)return 0diff --git a/skills/background-watch-hook/scripts/watch_github_pr_then_hook.sh b/skills/background-watch-hook/scripts/watch_github_pr_then_hook.shindex adbcc75e8..9c17ae090 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@@ -2,6 +2,7 @@set -euo pipefailSCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"+SCRIPT_PATH="$SCRIPT_DIR/$(basename "${BASH_SOURCE[0]}")"WRAPPER="$SCRIPT_DIR/watch_then_hook.sh"WAITER="$SCRIPT_DIR/wait_for_github_pr_activity.py"@@ -17,6 +18,7 @@ Options:--prefix <value> Optional. Hook prefix. If omitted, a sensible default is used.--interval <seconds> Optional. Polling interval passed to the waiter.--timeout <seconds> Optional. Overall waiter timeout. Default: 21600 (6 hours).+ --forever Optional. Keep watching and re-arm after each detected event.--event-limit <count> Optional. Maximum rendered events.--catch-up Optional. Treat existing PR activity as pending immediately.--allow-unauthenticated Optional. Allow throttled best-effort polling without GitHub auth.@@ -40,6 +42,8 @@ pr=""prefix=""interval=""timeout=""+timeout_set=0+forever=0event_limit=""catch_up=0allow_unauthenticated=0@@ -78,8 +82,13 @@ while [[ $# -gt 0 ]]; do;;--timeout)timeout="${2:-}"+ timeout_set=1shift 2;;+ --forever)+ forever=1+ shift+ ;;--event-limit)event_limit="${2:-}"shift 2@@ -165,12 +174,174 @@ if [[ ! -x "$WAITER" ]]; thenexit 127fi+if [[ "$forever" -eq 1 ]]; then+ if [[ "$timeout_set" -eq 1 && "$timeout" != "0" ]]; then+ echo "--forever watcher must use --timeout 0; omit --timeout or pass 0 explicitly" >&2+ exit 2+ fi+ timeout="0"+elif [[ -z "$timeout" ]]; then+ timeout="21600"+fi+if [[ -z "$prefix" ]]; thenprefix="GitHub PR #$pr has new review activity. Fetch the latest review state, summarize actionable items, and continue handling them if needed."fi-if [[ -z "$timeout" ]]; then- timeout="21600"+if [[ "$forever" -eq 1 && "$foreground" -ne 1 ]]; then+ if [[ -z "$log_file" ]]; then+ log_file="/tmp/background-watch-github-pr-$(date +%Y%m%d%H%M%S)-$$.log"+ fi++ child_args=(+ "$SCRIPT_PATH"+ --foreground+ --forever+ --session-key "$session_key"+ --repo "$repo"+ --pr "$pr"+ --prefix "$prefix"+ --timeout "$timeout"+ )++ if [[ -n "$interval" ]]; then+ child_args+=(--interval "$interval")+ fi+ if [[ -n "$event_limit" ]]; then+ child_args+=(--event-limit "$event_limit")+ fi+ if [[ "$catch_up" -eq 1 ]]; then+ child_args+=(--catch-up)+ fi+ if [[ "$allow_unauthenticated" -eq 1 ]]; then+ child_args+=(--allow-unauthenticated)+ fi+ if [[ -n "$since_review_id" ]]; then+ child_args+=(--since-review-id "$since_review_id")+ fi+ if [[ -n "$since_review_comment_id" ]]; then+ child_args+=(--since-review-comment-id "$since_review_comment_id")+ fi+ if [[ -n "$since_issue_comment_id" ]]; then+ child_args+=(--since-issue-comment-id "$since_issue_comment_id")+ fi+ if [[ -n "$post_to" ]]; then+ child_args+=(--post-to "$post_to")+ fi+ if [[ -n "$deliver_key" ]]; then+ child_args+=(--deliver-key "$deliver_key")+ fi+ if [[ -n "$hook_bin" ]]; then+ child_args+=(--hook-bin "$hook_bin")+ fi+ if [[ -n "$hook_cmd" ]]; then+ child_args+=(--hook-cmd "$hook_cmd")+ fi++ nohup "${child_args[@]}" >"$log_file" 2>&1 </dev/null &+ child_pid=$!++ printf 'Started forever GitHub PR watch.\n'+ printf 'PID: %s\n' "$child_pid"+ printf 'Log file: %s\n' "$log_file"+ printf 'Lifecycle: this watcher stays alive until killed.\n'+ exit 0+fi++if [[ "$forever" -eq 1 ]]; then+ cursor_file="$(mktemp)"+ cleanup() {+ rm -f "$cursor_file"+ }+ trap cleanup EXIT++ 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_catch_up="$catch_up"++ while true; do+ rm -f "$cursor_file"++ cycle_wrapper_args=(+ "$WRAPPER"+ --foreground+ --session-key "$session_key"+ --prefix "$prefix"+ --timeout "$timeout"+ )++ if [[ -n "$post_to" ]]; then+ cycle_wrapper_args+=(--post-to "$post_to")+ fi+ if [[ -n "$deliver_key" ]]; then+ cycle_wrapper_args+=(--deliver-key "$deliver_key")+ fi+ if [[ -n "$hook_bin" ]]; then+ cycle_wrapper_args+=(--hook-bin "$hook_bin")+ fi+ if [[ -n "$hook_cmd" ]]; then+ cycle_wrapper_args+=(--hook-cmd "$hook_cmd")+ fi++ cycle_waiter_args=(+ "$WAITER"+ --repo "$repo"+ --pr "$pr"+ --timeout "$timeout"+ --cursor-output "$cursor_file"+ )++ if [[ -n "$interval" ]]; then+ cycle_waiter_args+=(--interval "$interval")+ fi+ if [[ -n "$event_limit" ]]; then+ cycle_waiter_args+=(--event-limit "$event_limit")+ fi+ if [[ "$allow_unauthenticated" -eq 1 ]]; then+ cycle_waiter_args+=(--allow-unauthenticated)+ fi+ if [[ -n "$current_since_review_id" ]]; then+ cycle_waiter_args+=(--since-review-id "$current_since_review_id")+ fi+ if [[ -n "$current_since_review_comment_id" ]]; then+ cycle_waiter_args+=(--since-review-comment-id "$current_since_review_comment_id")+ fi+ if [[ -n "$current_since_issue_comment_id" ]]; then+ cycle_waiter_args+=(--since-issue-comment-id "$current_since_issue_comment_id")+ fi+ if [[ "$current_catch_up" -eq 1 ]]; then+ cycle_waiter_args+=(--catch-up)+ fi++ "${cycle_wrapper_args[@]}" -- "${cycle_waiter_args[@]}"++ if [[ ! -s "$cursor_file" ]]; then+ echo "No cursor output written; re-arming with existing cursors." >&2+ current_catch_up=0+ continue+ fi++ cursor_values="$(+ python3 - "$cursor_file" <<'PY'+import json+import sys++with open(sys.argv[1], encoding="utf-8") as handle:+ payload = json.load(handle)+print(+ "%s\t%s\t%s"+ % (+ payload["review_cursor"],+ payload["review_comment_cursor"],+ payload["issue_comment_cursor"],+ )+)+PY+ )"+ IFS=$'\t' read -r current_since_review_id current_since_review_comment_id current_since_issue_comment_id <<<"$cursor_values"+ current_catch_up=0+ donefiwrapper_args=("$WRAPPER" --session-key "$session_key" --prefix "$prefix")