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(skills): stop forever watch on non-retryable errors

cyhf19cd73a54ca
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 c4bc6e6ce..eb89465b2 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
@@ -407,6 +407,11 @@ PY
continue
fi
+ if [[ "$cycle_status" -ne 1 ]]; then
+ echo "Forever watch stopped on non-retryable cycle failure: $cycle_status" >&2
+ exit "$cycle_status"
+ fi
+
if [[ "$cycle_status" -ne 0 ]]; then
echo "Forever watch cycle failed with status $cycle_status; retrying in ${retry_delay_seconds}s." >&2
sleep "$retry_delay_seconds"
diff --git a/tests/test_background_watch_hook_scripts.py b/tests/test_background_watch_hook_scripts.py
index 23ba393de..44adbcfed 100644
--- a/tests/test_background_watch_hook_scripts.py
+++ b/tests/test_background_watch_hook_scripts.py
@@ -305,3 +305,57 @@ PY
assert hook_calls.exists(), log_file.read_text(encoding="utf-8")
payload = json.loads(hook_calls.read_text(encoding="utf-8").splitlines()[-1])
assert payload["args"][:2] == ["hook", "send"]
+
+
+def test_forever_watch_exits_on_non_retryable_cycle_failure(tmp_path: Path) -> None:
+ source_script = (
+ Path(__file__).resolve().parents[1]
+ / "skills"
+ / "background-watch-hook"
+ / "scripts"
+ / "watch_github_pr_then_hook.sh"
+ )
+ script_dir = tmp_path / "scripts"
+ script_dir.mkdir()
+
+ watch_script = script_dir / "watch_github_pr_then_hook.sh"
+ shutil.copy2(source_script, watch_script)
+ watch_script.write_text(
+ watch_script.read_text(encoding="utf-8").replace("retry_delay_seconds=30", "retry_delay_seconds=0.1"),
+ encoding="utf-8",
+ )
+ watch_script.chmod(watch_script.stat().st_mode | stat.S_IXUSR)
+
+ _make_executable(
+ script_dir / "watch_then_hook.sh",
+ "#!/usr/bin/env bash\nset -euo pipefail\nexit 2\n",
+ )
+ _make_executable(
+ script_dir / "wait_for_github_pr_activity.py",
+ "#!/usr/bin/env python3\nraise SystemExit('should not be executed directly in this test')\n",
+ )
+
+ result = subprocess.run(
+ [
+ "bash",
+ str(watch_script),
+ "--foreground",
+ "--forever",
+ "--session-key",
+ "slack::channel::C123",
+ "--repo",
+ "cyhhao/vibe-remote",
+ "--pr",
+ "153",
+ ],
+ cwd=tmp_path,
+ capture_output=True,
+ text=True,
+ check=False,
+ timeout=10,
+ env={**os.environ, "PATH": os.environ.get("PATH", "")},
+ )
+
+ assert result.returncode == 2
+ assert "non-retryable" in result.stderr
+ assert "retrying" not in result.stderr