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.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(e2e): address 3 critical + 4 improvement findings from review
cyhb76aa44be8de
diff --git a/.dockerignore b/.dockerignoreindex f2caa52a9..95c6342d4 100644--- a/.dockerignore+++ b/.dockerignore@@ -13,6 +13,9 @@ build/.venv/venv/.env+.env.*+.env.e2e+.env.e2e.example# IDE.idea/diff --git a/.env.e2e.example b/.env.e2e.exampleindex 711c87896..8f1c3b095 100644--- a/.env.e2e.example+++ b/.env.e2e.example@@ -1,6 +1,6 @@# E2E Integration Test Environment Variables-# Copy to .env.e2e and fill in your tokens.-# This file must NEVER be committed.+# Copy this file to .env.e2e and fill in your tokens.+# .env.e2e contains secrets and must NEVER be committed (it is in .gitignore).# === Bot A (SUT - vibe-remote bot, runs inside Docker) ===diff --git a/tests/e2e/conftest.py b/tests/e2e/conftest.pyindex f48da3fba..22e0c9a03 100644--- a/tests/e2e/conftest.py+++ b/tests/e2e/conftest.py@@ -115,3 +115,94 @@ def vibe_container():def api_url(vibe_container):"""Convenience: returns the base URL string."""return vibe_container+++# =============================================================================+# Platform Integration Driver Fixtures+# Auto-skip when platform tokens are not configured.+# =============================================================================+++def _env(key: str) -> str:+ """Get env var or empty string."""+ return os.environ.get(key, "")+++def _has_slack_config() -> bool:+ return bool(_env("E2E_SLACK_BOT_B_TOKEN") and _env("E2E_SLACK_CHANNEL") and _env("E2E_SLACK_BOT_A_ID"))+++def _has_discord_config() -> bool:+ return bool(_env("E2E_DISCORD_BOT_B_TOKEN") and _env("E2E_DISCORD_CHANNEL") and _env("E2E_DISCORD_BOT_A_ID"))+++def _has_feishu_config() -> bool:+ return bool(+ _env("E2E_FEISHU_BOT_B_APP_ID")+ and _env("E2E_FEISHU_BOT_B_APP_SECRET")+ and _env("E2E_FEISHU_CHAT_ID")+ and _env("E2E_FEISHU_BOT_A_ID")+ )+++def _platform_enabled(platform: str) -> bool:+ """Check if a specific platform is selected for integration testing.++ If E2E_PLATFORM is not set, all configured platforms are enabled.+ If set (e.g. "slack"), only that platform runs.+ """+ selected = _env("E2E_PLATFORM")+ return not selected or selected.lower() == platform.lower()++[email protected](scope="session")+def slack_driver():+ """Session-scoped Slack driver. Skips if not configured."""+ if not _has_slack_config():+ pytest.skip("Slack E2E not configured (need E2E_SLACK_BOT_B_TOKEN, E2E_SLACK_CHANNEL, E2E_SLACK_BOT_A_ID)")+ if not _platform_enabled("slack"):+ pytest.skip(f"Slack skipped: E2E_PLATFORM={_env('E2E_PLATFORM')}")++ import asyncio+ from tests.e2e.drivers.slack_driver import SlackDriver++ driver = SlackDriver()+ asyncio.get_event_loop().run_until_complete(driver.setup())+ yield driver+ asyncio.get_event_loop().run_until_complete(driver.teardown())++[email protected](scope="session")+def discord_driver():+ """Session-scoped Discord driver. Skips if not configured."""+ if not _has_discord_config():+ pytest.skip(+ "Discord E2E not configured (need E2E_DISCORD_BOT_B_TOKEN, E2E_DISCORD_CHANNEL, E2E_DISCORD_BOT_A_ID)"+ )+ if not _platform_enabled("discord"):+ pytest.skip(f"Discord skipped: E2E_PLATFORM={_env('E2E_PLATFORM')}")++ import asyncio+ from tests.e2e.drivers.discord_driver import DiscordDriver++ driver = DiscordDriver()+ asyncio.get_event_loop().run_until_complete(driver.setup())+ yield driver+ asyncio.get_event_loop().run_until_complete(driver.teardown())++[email protected](scope="session")+def feishu_driver():+ """Session-scoped Feishu driver. Skips if not configured."""+ if not _has_feishu_config():+ pytest.skip("Feishu E2E not configured (need E2E_FEISHU_BOT_B_*, E2E_FEISHU_CHAT_ID, E2E_FEISHU_BOT_A_ID)")+ if not _platform_enabled("feishu"):+ pytest.skip(f"Feishu skipped: E2E_PLATFORM={_env('E2E_PLATFORM')}")++ import asyncio+ from tests.e2e.drivers.feishu_driver import FeishuDriver++ driver = FeishuDriver()+ asyncio.get_event_loop().run_until_complete(driver.setup())+ yield driver+ asyncio.get_event_loop().run_until_complete(driver.teardown())diff --git a/tests/e2e/conftest_integration.py b/tests/e2e/conftest_integration.pydeleted file mode 100644index e476d1163..000000000--- a/tests/e2e/conftest_integration.py+++ /dev/null@@ -1,79 +0,0 @@-"""Fixtures for platform integration E2E tests.--These tests require:-1. Docker container running in full mode (docker-compose.e2e-integration.yml)-2. Platform tokens configured in .env.e2e-3. Bot A and Bot B both present in the test channel-"""--import asyncio-import os--import pytest---def _env(key: str) -> str:- """Get required env var or empty string."""- return os.environ.get(key, "")---def _has_slack_config() -> bool:- return bool(_env("E2E_SLACK_BOT_B_TOKEN") and _env("E2E_SLACK_CHANNEL"))---def _has_discord_config() -> bool:- return bool(_env("E2E_DISCORD_BOT_B_TOKEN") and _env("E2E_DISCORD_CHANNEL"))---def _has_feishu_config() -> bool:- return bool(_env("E2E_FEISHU_BOT_B_APP_ID") and _env("E2E_FEISHU_BOT_B_APP_SECRET") and _env("E2E_FEISHU_CHAT_ID"))--[email protected](scope="session")-def event_loop():- """Create a session-scoped event loop for async fixtures."""- loop = asyncio.new_event_loop()- yield loop- loop.close()--[email protected](scope="session")-def slack_driver(event_loop):- """Session-scoped Slack driver. Skips if not configured."""- if not _has_slack_config():- pytest.skip("Slack E2E not configured (missing E2E_SLACK_BOT_B_TOKEN or E2E_SLACK_CHANNEL)")-- from tests.e2e.drivers.slack_driver import SlackDriver-- driver = SlackDriver()- event_loop.run_until_complete(driver.setup())- yield driver- event_loop.run_until_complete(driver.teardown())--[email protected](scope="session")-def discord_driver(event_loop):- """Session-scoped Discord driver. Skips if not configured."""- if not _has_discord_config():- pytest.skip("Discord E2E not configured (missing E2E_DISCORD_BOT_B_TOKEN or E2E_DISCORD_CHANNEL)")-- from tests.e2e.drivers.discord_driver import DiscordDriver-- driver = DiscordDriver()- event_loop.run_until_complete(driver.setup())- yield driver- event_loop.run_until_complete(driver.teardown())--[email protected](scope="session")-def feishu_driver(event_loop):- """Session-scoped Feishu driver. Skips if not configured."""- if not _has_feishu_config():- pytest.skip("Feishu E2E not configured (missing E2E_FEISHU_BOT_B_* or E2E_FEISHU_CHAT_ID)")-- from tests.e2e.drivers.feishu_driver import FeishuDriver-- driver = FeishuDriver()- event_loop.run_until_complete(driver.setup())- yield driver- event_loop.run_until_complete(driver.teardown())diff --git a/tests/e2e/drivers/discord_driver.py b/tests/e2e/drivers/discord_driver.pyindex e9bd0b6f7..4f1356169 100644--- a/tests/e2e/drivers/discord_driver.py+++ b/tests/e2e/drivers/discord_driver.py@@ -57,13 +57,13 @@ class DiscordDriver(PlatformDriver):async def send_message(self, text: str, thread_id: Optional[str] = None) -> str:assert self._session is not None, "Driver not set up"- payload: dict = {"content": text}- if thread_id:- # Discord uses message_reference for threads- payload["message_reference"] = {"message_id": thread_id}+ # Discord threads are separate channels. If thread_id is provided,+ # post to the thread channel directly instead of using message_reference.+ target_channel = thread_id if thread_id else self.channel_id+ payload = {"content": text}async with self._session.post(- f"{DISCORD_API}/channels/{self.channel_id}/messages",+ f"{DISCORD_API}/channels/{target_channel}/messages",headers=self._headers(),json=payload,) as resp:diff --git a/vibe/ui_server.py b/vibe/ui_server.pyindex 628aa94cc..5b4e0dbe9 100644--- a/vibe/ui_server.py+++ b/vibe/ui_server.py@@ -569,6 +569,11 @@ def setup_first_bind_code():import os as _osif _os.environ.get("E2E_TEST_MODE", "").lower() in ("true", "1", "yes"):+ logger.warning(+ "E2E_TEST_MODE is ENABLED. /e2e/* endpoints are registered. "+ "These endpoints allow unauthenticated config mutation. "+ "Do NOT enable in production."+ )@app.route("/e2e/simulate-interaction", methods=["POST"])def e2e_simulate_interaction():@@ -589,9 +594,6 @@ if _os.environ.get("E2E_TEST_MODE", "").lower() in ("true", "1", "yes"):action (str): "settings_submit" | "routing_submit" | "cwd_submit"modal_values (dict): the values to submit"""- from vibe import api as vibe_api- from config.v2_settings import SettingsStore-payload = request.json or {}action = payload.get("action", "")modal_values = payload.get("modal_values", {})@@ -601,9 +603,69 @@ if _os.environ.get("E2E_TEST_MODE", "").lower() in ("true", "1", "yes"):try:if action == "settings_submit":- # Write settings via the existing settings API- result = vibe_api.save_settings(modal_values)- return jsonify({"ok": True, "action": action, "result": result})+ # Merge settings into existing store (not wholesale replace)+ from config.v2_settings import SettingsStore, ChannelSettings, normalize_show_message_types+ from vibe.api import _parse_routing++ settings_key = modal_values.get("settings_key") or modal_values.get("channel_id")+ if not settings_key:+ return jsonify({"ok": False, "error": "settings_key or channel_id required in modal_values"}), 400++ store = SettingsStore.get_instance()+ store.maybe_reload()+ ch = store.settings.channels.get(settings_key)+ if not ch:+ ch = ChannelSettings(enabled=True)+ store.settings.channels[settings_key] = ch++ if "show_message_types" in modal_values:+ ch.show_message_types = normalize_show_message_types(modal_values["show_message_types"])+ if "custom_cwd" in modal_values:+ ch.custom_cwd = modal_values["custom_cwd"]+ if "require_mention" in modal_values:+ ch.require_mention = modal_values["require_mention"]+ if "routing" in modal_values:+ ch.routing = _parse_routing(modal_values["routing"])++ store.save()+ return jsonify({"ok": True, "action": action})++ elif action == "routing_submit":+ # Write routing config for a specific channel/user+ channel_id = modal_values.get("channel_id") or modal_values.get("settings_key")+ if not channel_id:+ return jsonify({"ok": False, "error": "channel_id required in modal_values"}), 400++ store = SettingsStore.get_instance()+ store.maybe_reload()+ ch = store.settings.channels.get(channel_id)+ if ch:+ from config.v2_settings import RoutingSettings++ ch.routing = RoutingSettings(+ agent_backend=modal_values.get("backend", "opencode"),+ opencode_agent=modal_values.get("opencode_agent"),+ opencode_model=modal_values.get("opencode_model"),+ opencode_reasoning_effort=modal_values.get("opencode_reasoning_effort"),+ claude_agent=modal_values.get("claude_agent"),+ claude_model=modal_values.get("claude_model"),+ codex_model=modal_values.get("codex_model"),+ codex_reasoning_effort=modal_values.get("codex_reasoning_effort"),+ )+ store.save()+ return jsonify({"ok": True, "action": action})+ else:+ return jsonify({"ok": False, "error": f"channel {channel_id} not found in settings"}), 404++ elif action == "cwd_submit":+ # Merge CWD into existing config (load → modify → save)+ from vibe import api as vibe_api++ current = vibe_api.config_to_payload(vibe_api.load_config())+ current.setdefault("runtime", {})+ current["runtime"]["default_cwd"] = modal_values.get("cwd", "/tmp")+ result = vibe_api.save_config(current)+ return jsonify({"ok": True, "action": action})elif action == "routing_submit":# Write routing config for a specific channel/user