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): allow guarded source state refresh (#764)

Call White5f4b46da9da2
diff --git a/scripts/incus_regression.py b/scripts/incus_regression.py
index 248edcc6f..b84b3068e 100644
--- a/scripts/incus_regression.py
+++ b/scripts/incus_regression.py
@@ -506,6 +506,7 @@ def regression_service_unit() -> str:
Environment=HOME={SERVICE_HOME}
Environment=AVIBE_HOME=
Environment=VIBE_DEPLOYMENT_ENV=regression
+ Environment=AVIBE_ALLOW_DEV_STATE_MIGRATION=1
Environment=VIBE_INTERNAL_DISPATCH_SOCKET=/tmp/vibe_remote/dispatch.sock
Environment=PYTHONUNBUFFERED=1
Environment=PATH={VENV_DIR}/bin:{SERVICE_HOME}/.local/bin:/usr/local/bin:/usr/bin:/bin
@@ -666,6 +667,7 @@ def ensure_project_and_instance(
def tenant_exec(target: RegressionTarget, command: str, *args: str, remote: str | None = None) -> list[str]:
bash_command = (
"set -a; [ ! -f /etc/avibe-regression.env ] || . /etc/avibe-regression.env; "
+ "VIBE_DEPLOYMENT_ENV=regression; AVIBE_ALLOW_DEV_STATE_MIGRATION=1; "
f"set +a; cd {shlex.quote(SOURCE_DIR)} && {command}"
)
return incus(
@@ -844,6 +846,7 @@ def runtime_env_payload(repo_root: Path | None = None) -> bytes:
"SETUPTOOLS_SCM_PRETEND_VERSION": scm_version,
"SETUPTOOLS_SCM_PRETEND_VERSION_FOR_AVIBE_OS": scm_version,
"REGRESSION_UI_HOST": CONTAINER_UI_HOST,
+ "AVIBE_ALLOW_DEV_STATE_MIGRATION": "1",
"VIBE_SHOW_RUNTIME_SOURCE": regression_env("SHOW_RUNTIME_SOURCE", "github-source"),
"VIBE_SHOW_RUNTIME_GITHUB_REPO": regression_env("SHOW_RUNTIME_GITHUB_REPO", "https://github.com/avibe-bot/vibe-show-runtime.git"),
"VIBE_SHOW_RUNTIME_GITHUB_REF": regression_env("SHOW_RUNTIME_GITHUB_REF", "main"),
diff --git a/tests/test_dev_state_migration_guard.py b/tests/test_dev_state_migration_guard.py
index 1e0caffd2..7330505f7 100644
--- a/tests/test_dev_state_migration_guard.py
+++ b/tests/test_dev_state_migration_guard.py
@@ -153,3 +153,11 @@ def test_runtime_ensure_config_guard_blocks_before_default_workdir(monkeypatch,
assert not (home / "work").exists()
assert not db_path.exists()
assert not db_path.parent.exists()
+
+
+def test_regression_deployment_env_alone_does_not_bypass_default_state_guard(monkeypatch, tmp_path: Path) -> None:
+ db_path = _set_default_home_guard(monkeypatch, tmp_path)
+ monkeypatch.setenv("VIBE_DEPLOYMENT_ENV", "regression")
+
+ with pytest.raises(UnsafeDefaultStateMigrationError):
+ migrations.guard_source_checkout_default_state_migration(db_path)
diff --git a/tests/test_incus_regression.py b/tests/test_incus_regression.py
index 86793c51d..171581ab3 100644
--- a/tests/test_incus_regression.py
+++ b/tests/test_incus_regression.py
@@ -244,6 +244,7 @@ def test_cloud_init_configures_systemd_service_without_source_code() -> None:
assert "name: avibe" in data
assert "Description=Avibe regression service" in data
assert "Environment=VIBE_DEPLOYMENT_ENV=regression" in data
+ assert "Environment=AVIBE_ALLOW_DEV_STATE_MIGRATION=1" in data
assert "EnvironmentFile=-/etc/avibe-regression.env" in data
assert "ExecStart=/opt/avibe/venv/bin/python scripts/incus_regression_supervisor.py" in data
assert "Delegate=yes" in data
@@ -271,6 +272,24 @@ def test_project_config_marks_regression_target() -> None:
assert "user.avibe_regression.host_port=15200" in config
+def test_tenant_exec_exports_regression_guard_override() -> None:
+ target = incus_regression.RegressionTarget(
+ target="master",
+ slug="master",
+ project="avr-master",
+ instance="avibe-master",
+ host_port=15130,
+ ui_host="127.0.0.1",
+ ui_port=5123,
+ )
+
+ command = " ".join(incus_regression.tenant_exec(target, "/opt/avibe/venv/bin/vibe status"))
+
+ assert "[ ! -f /etc/avibe-regression.env ] || . /etc/avibe-regression.env" in command
+ assert "VIBE_DEPLOYMENT_ENV=regression" in command
+ assert "AVIBE_ALLOW_DEV_STATE_MIGRATION=1" in command
+
+
def test_remote_ref_prefixes_resource_names_only() -> None:
assert incus_regression.remote_ref("lab", "demo") == "lab:demo"
assert incus_regression.remote_ref(None, "demo") == "demo"
@@ -514,6 +533,7 @@ def test_runtime_env_payload_maps_show_runtime_and_llm_env(monkeypatch: pytest.M
assert "SETUPTOOLS_SCM_PRETEND_VERSION=0.0.0.dev0" in payload
assert "SETUPTOOLS_SCM_PRETEND_VERSION_FOR_AVIBE_OS=0.0.0.dev0" in payload
+ assert "AVIBE_ALLOW_DEV_STATE_MIGRATION=1" in payload
assert "VIBE_SHOW_RUNTIME_SOURCE=github-source" in payload
assert "VIBE_SHOW_RUNTIME_GITHUB_REF=main" in payload
assert "REGRESSION_SLACK_CHANNEL=C123" in payload