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(e2e): address review — exit code propagation, --keep coordination, path normalization

cyh74638f57956d
diff --git a/config/paths.py b/config/paths.py
index c9d912dc5..90dd3ab33 100644
--- a/config/paths.py
+++ b/config/paths.py
@@ -5,7 +5,7 @@ from pathlib import Path
def get_vibe_remote_dir() -> Path:
custom = os.environ.get("VIBE_REMOTE_HOME")
if custom:
- return Path(custom)
+ return Path(custom).expanduser().resolve()
return Path.home() / ".vibe_remote"
diff --git a/docker-compose.e2e.yml b/docker-compose.e2e.yml
index ea8365c10..bbd76dfa7 100644
--- a/docker-compose.e2e.yml
+++ b/docker-compose.e2e.yml
@@ -9,7 +9,7 @@ services:
- VIBE_REMOTE_HOME=/data/vibe_remote
- VIBE_UI_PORT=5123
healthcheck:
- test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:5123/health')"]
+ test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:5123/health', timeout=3)"]
interval: 3s
timeout: 5s
retries: 10
diff --git a/scripts/docker-entrypoint.sh b/scripts/docker-entrypoint.sh
index 8bd9a67c5..600cc4537 100755
--- a/scripts/docker-entrypoint.sh
+++ b/scripts/docker-entrypoint.sh
@@ -34,8 +34,12 @@ run_ui_server('0.0.0.0', ${VIBE_UI_PORT:-5123})
UI_PID=$!
echo "$UI_PID" > "$RUNTIME_DIR/vibe-ui.pid"
- # Wait for either process to exit
- wait -n "$SERVICE_PID" "$UI_PID" 2>/dev/null || true
+ # Wait for either process to exit; propagate its exit code
+ wait -n "$SERVICE_PID" "$UI_PID" 2>/dev/null
+ EXIT_CODE=$?
+ # Terminate the sibling process
+ kill "$SERVICE_PID" "$UI_PID" 2>/dev/null || true
+ exit "$EXIT_CODE"
;;
cli)
# Run a vibe CLI command (e.g., docker run ... cli doctor)
diff --git a/scripts/run_e2e.sh b/scripts/run_e2e.sh
index 24e22d6c6..6e7dc1977 100755
--- a/scripts/run_e2e.sh
+++ b/scripts/run_e2e.sh
@@ -16,11 +16,13 @@ export VIBE_E2E_PORT="${VIBE_E2E_PORT:-15123}"
KEEP=false
DOWN_ONLY=false
+PYTEST_ARGS=()
for arg in "$@"; do
case "$arg" in
--keep) KEEP=true ;;
--down) DOWN_ONLY=true ;;
+ *) PYTEST_ARGS+=("$arg") ;;
esac
done
@@ -38,6 +40,9 @@ if [ "$DOWN_ONLY" = true ]; then
exit 0
fi
+# Export KEEP flag so pytest fixture can respect it
+export VIBE_E2E_KEEP="$KEEP"
+
# Build
echo "Building Docker image..."
docker compose -f "$COMPOSE_FILE" build
@@ -66,7 +71,9 @@ done
echo "Running E2E tests..."
trap cleanup EXIT
-pytest tests/e2e/ -v --tb=short "$@" 2>&1 | grep -v "^--keep$\|^--down$" || true
-TEST_EXIT=${PIPESTATUS[0]}
+set +e
+pytest tests/e2e/ -v --tb=short "${PYTEST_ARGS[@]}"
+TEST_EXIT=$?
+set -e
-exit ${TEST_EXIT:-0}
+exit "$TEST_EXIT"
diff --git a/tests/e2e/conftest.py b/tests/e2e/conftest.py
index 4d3b3f523..cf0ffe8bb 100644
--- a/tests/e2e/conftest.py
+++ b/tests/e2e/conftest.py
@@ -15,11 +15,28 @@ E2E_BASE_URL = f"http://127.0.0.1:{E2E_PORT}"
# Compose file path (relative to repo root)
COMPOSE_FILE = os.path.join(os.path.dirname(__file__), "..", "..", "docker-compose.e2e.yml")
+# When true, skip container teardown (set by run_e2e.sh --keep)
+KEEP_CONTAINER = os.environ.get("VIBE_E2E_KEEP", "false").lower() == "true"
+
def _url(path: str) -> str:
return f"{E2E_BASE_URL}{path}"
+def _compose_env() -> dict:
+ env = os.environ.copy()
+ env["VIBE_E2E_PORT"] = str(E2E_PORT)
+ return env
+
+
+def _compose_down(compose_file: str, env: dict) -> None:
+ subprocess.run(
+ ["docker", "compose", "-f", compose_file, "down", "-v"],
+ env=env,
+ capture_output=True,
+ )
+
+
def _wait_for_healthy(timeout: int = 60) -> bool:
"""Poll /health until it responds or timeout."""
deadline = time.monotonic() + timeout
@@ -38,45 +55,41 @@ def _wait_for_healthy(timeout: int = 60) -> bool:
def vibe_container():
"""Start Vibe container for the entire test session, tear down after."""
compose_file = os.path.abspath(COMPOSE_FILE)
+ env = _compose_env()
- # Build and start
- env = os.environ.copy()
- env["VIBE_E2E_PORT"] = str(E2E_PORT)
-
- subprocess.run(
- ["docker", "compose", "-f", compose_file, "build"],
- check=True,
- env=env,
- capture_output=True,
- )
- subprocess.run(
- ["docker", "compose", "-f", compose_file, "up", "-d"],
- check=True,
- env=env,
- capture_output=True,
- )
-
- # Wait for healthy
- if not _wait_for_healthy(timeout=60):
- # Dump logs for debugging
- logs = subprocess.run(
- ["docker", "compose", "-f", compose_file, "logs"],
- capture_output=True,
- text=True,
+ try:
+ subprocess.run(
+ ["docker", "compose", "-f", compose_file, "build"],
+ check=True,
env=env,
)
- pytest.fail(
- f"Vibe container did not become healthy within 60s.\nSTDOUT:\n{logs.stdout}\nSTDERR:\n{logs.stderr}"
+ subprocess.run(
+ ["docker", "compose", "-f", compose_file, "up", "-d"],
+ check=True,
+ env=env,
)
+ # Wait for healthy
+ if not _wait_for_healthy(timeout=60):
+ logs = subprocess.run(
+ ["docker", "compose", "-f", compose_file, "logs"],
+ capture_output=True,
+ text=True,
+ env=env,
+ )
+ pytest.fail(
+ f"Vibe container did not become healthy within 60s.\nSTDOUT:\n{logs.stdout}\nSTDERR:\n{logs.stderr}"
+ )
+ except Exception:
+ # Always clean up on startup failure
+ _compose_down(compose_file, env)
+ raise
+
yield E2E_BASE_URL
- # Teardown
- subprocess.run(
- ["docker", "compose", "-f", compose_file, "down", "-v"],
- env=env,
- capture_output=True,
- )
+ # Teardown (skip if --keep)
+ if not KEEP_CONTAINER:
+ _compose_down(compose_file, env)
@pytest.fixture(scope="session")
diff --git a/tests/e2e/test_cli.py b/tests/e2e/test_cli.py
index 6a26d6bc4..3310cc462 100644
--- a/tests/e2e/test_cli.py
+++ b/tests/e2e/test_cli.py
@@ -3,8 +3,6 @@
import os
import subprocess
-import pytest
-
COMPOSE_FILE = os.path.join(os.path.dirname(__file__), "..", "..", "docker-compose.e2e.yml")