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(regression): isolate archive recipe exits from login hooks (#1892)

Call White1ee2e1973ee8
diff --git a/scripts/incus_regression.py b/scripts/incus_regression.py
index 5a5697560..5b4ea00a7 100644
--- a/scripts/incus_regression.py
+++ b/scripts/incus_regression.py
@@ -2359,7 +2359,7 @@ def restart_and_verify(runner: Runner, target: RegressionTarget, *, remote: str
def show_runtime_archive_script() -> str:
"""Build one exact upstream revision, or reuse its verified local artifact."""
- return textwrap.dedent(r'''
+ script = textwrap.dedent(r'''
set -euo pipefail
if [ "${VIBE_SHOW_RUNTIME_SOURCE:-}" != "archive" ]; then exit 0; fi
: "${VIBE_SHOW_RUNTIME_ARCHIVE_PATH:?VIBE_SHOW_RUNTIME_ARCHIVE_PATH is required for archive runtime source}"
@@ -2413,6 +2413,8 @@ def show_runtime_archive_script() -> str:
mv -f -- "$receipt_temp" "$receipt"
printf 'Show Runtime archive built from %s.\n' "$revision"
''').strip()
+ # Early exits must not run the service user's login-shell logout hooks.
+ return "(\n" + script + "\n)"
def prepare_show_runtime(runner: Runner, target: RegressionTarget, *, remote: str | None) -> None:
diff --git a/tests/test_incus_regression.py b/tests/test_incus_regression.py
index 5b5a5b6d8..13c0237ec 100644
--- a/tests/test_incus_regression.py
+++ b/tests/test_incus_regression.py
@@ -5000,8 +5000,9 @@ def show_archive_builder(tmp_path, monkeypatch):
"upstream=https://github.com/avibe-bot/vibe-show-runtime.git", "upstream=" + shlex.quote(str(upstream)),
)
- def run(recipe=None, *, check=True):
- return subprocess.run(["bash", "-c", recipe or script], check=check, capture_output=True, text=True)
+ def run(recipe=None, *, check=True, login=False):
+ options = ["--noprofile", "--norc", "--login"] if login else []
+ return subprocess.run(["bash", *options, "-c", recipe or script], check=check, capture_output=True, text=True)
return run, commit, archive, build_log, script
@@ -5028,6 +5029,34 @@ def test_show_archive_reuses_verified_artifact_without_rewriting(show_archive_bu
assert log.read_text().splitlines() == ["ci", "run build", "run bundle:vibe-remote"]
[email protected]("outcome", ["cache-hit", "non-archive", "build-failure"])
+def test_show_archive_recipe_does_not_exit_the_login_shell(show_archive_builder, tmp_path, monkeypatch, outcome):
+ run, commit, _archive, _log, _script = show_archive_builder
+ run()
+ home = tmp_path / "login-home"
+ home.mkdir()
+ logout_log = tmp_path / "logout.log"
+ (home / ".bash_logout").write_text('printf "logout\\n" >> "$LOGOUT_LOG"\nfalse\n')
+ monkeypatch.setenv("HOME", str(home))
+ monkeypatch.setenv("LOGOUT_LOG", str(logout_log))
+ # Reproduce Ubuntu's failing noninteractive clear_console logout hook.
+ assert run("set -euo pipefail; exit 0", check=False, login=True).returncode != 0
+ assert logout_log.read_text() == "logout\n"
+ logout_log.unlink()
+ if outcome == "non-archive":
+ monkeypatch.setenv("VIBE_SHOW_RUNTIME_SOURCE", "manifest-cache")
+ elif outcome == "build-failure":
+ commit("revision whose build fails")
+ monkeypatch.setenv("FAIL_BUILD", "1")
+
+ result = run(check=False, login=True)
+
+ assert result.returncode == (19 if outcome == "build-failure" else 0)
+ assert not logout_log.exists()
+ if outcome == "cache-hit":
+ assert "reusing verified build" in result.stdout
+
+
@pytest.mark.parametrize("change", ["revision", "node", "npm", "recipe", "missing", "corrupt", "receipt"])
def test_show_archive_rebuilds_when_reuse_proof_changes(show_archive_builder, monkeypatch, change):
run, commit, archive, log, script = show_archive_builder