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): report timeout hooks by default

cyh359cf419523d
diff --git a/skills/background-watch-hook/SKILL.md b/skills/background-watch-hook/SKILL.md
index 642b17d02..e54f30e1d 100644
--- a/skills/background-watch-hook/SKILL.md
+++ b/skills/background-watch-hook/SKILL.md
@@ -163,7 +163,7 @@ Report:
Design waiters to follow this contract:
- `exit 0`: event detected; final summary printed to `stdout`
-- `exit 124`: timeout; no hook should be sent
+- `exit 124`: timeout; the wrapper sends a timeout hook with an error summary
- any other non-zero exit: failure; wrapper should exit without sending a hook
Good waiter output is compact and already useful to the next turn, for example:
@@ -227,6 +227,8 @@ nohup bash -lc '
## GitHub Example
`scripts/watch_github_pr_then_hook.sh` is a convenience wrapper for one specific waiter pair: `watch_then_hook.sh` plus `wait_for_github_pr_activity.py`.
+Its default timeout is 6 hours. Override it with `--timeout <seconds>` when the watch should end sooner or run longer.
+
```bash
nohup bash -lc '
scripts/watch_github_pr_then_hook.sh \
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 4e6414e79..e0247e036 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
@@ -192,7 +192,12 @@ def main() -> int:
parser.add_argument("--repo", required=True, help="GitHub repo in owner/name form")
parser.add_argument("--pr", required=True, type=int, help="Pull request number")
parser.add_argument("--interval", type=float, default=45.0, help="Polling interval in seconds")
- parser.add_argument("--timeout", type=float, default=0.0, help="Overall timeout in seconds; 0 means forever")
+ parser.add_argument(
+ "--timeout",
+ type=float,
+ default=21600.0,
+ help="Overall timeout in seconds; default 21600 (6 hours), 0 means forever",
+ )
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")
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 cdc0c6d13..900aefb2c 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
@@ -16,7 +16,7 @@ Options:
--pr <number> Required. Pull request number.
--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.
+ --timeout <seconds> Optional. Overall waiter timeout. Default: 21600 (6 hours).
--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.
@@ -152,6 +152,10 @@ if [[ -z "$prefix" ]]; then
prefix="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"
+fi
+
wrapper_args=("$WRAPPER" --session-key "$session_key" --prefix "$prefix")
if [[ -n "$post_to" ]]; then
diff --git a/skills/background-watch-hook/scripts/watch_then_hook.sh b/skills/background-watch-hook/scripts/watch_then_hook.sh
index 3e222a3f2..fffc40b5e 100755
--- a/skills/background-watch-hook/scripts/watch_then_hook.sh
+++ b/skills/background-watch-hook/scripts/watch_then_hook.sh
@@ -182,6 +182,8 @@ _run_hook_command() {
}
hook_runner="$(_resolve_hook_command)"
+started_at_epoch="$(date +%s)"
+timed_out=0
set +e
"$@" >"$output_file"
@@ -189,10 +191,15 @@ waiter_status=$?
set -e
if [[ "$waiter_status" -eq "$timeout_exit_code" ]]; then
- exit 0
+ timed_out=1
+ elapsed_seconds="$(( $(date +%s) - started_at_epoch ))"
+ {
+ printf 'Waiter timed out after %s second(s).\n' "$elapsed_seconds"
+ printf 'Timeout exit code: %s\n' "$timeout_exit_code"
+ } >"$output_file"
fi
-if [[ "$waiter_status" -ne 0 ]]; then
+if [[ "$waiter_status" -ne 0 && "$timed_out" -ne 1 ]]; then
echo "Waiter exited with status $waiter_status" >&2
exit "$waiter_status"
fi