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(runtime): inherit default agent and run status
cyh980e1a8d8344
diff --git a/core/controller.py b/core/controller.pyindex 38bd57c13..c3aaf9f6b 100644--- a/core/controller.py+++ b/core/controller.py@@ -570,16 +570,19 @@ class Controller:settings_manager = self.get_settings_manager_for_context(context)routing = settings_manager.get_channel_routing(settings_key)agent_name = override_agent_name or (routing.agent_name if routing else None)- if not agent_name:- if not required:- return None- agent_name = "default"try:- return self.vibe_agent_store.require(agent_name)+ if agent_name:+ return self.vibe_agent_store.require(agent_name)+ default_agent = self.vibe_agent_store.get_default_agent()+ if default_agent is not None:+ return default_agent+ if required:+ return self.vibe_agent_store.require("default")+ return Noneexcept Exception as exc:if required:raise- logger.warning("Scope references Vibe Agent '%s' but it cannot be resolved: %s", agent_name, exc)+ logger.warning("Scope references Vibe Agent '%s' but it cannot be resolved: %s", agent_name or "default", exc)return Nonedef get_opencode_overrides(self, context: MessageContext) -> tuple[Optional[str], Optional[str], Optional[str]]:diff --git a/core/scheduled_tasks.py b/core/scheduled_tasks.pyindex 4109a7da8..a17668ce6 100644--- a/core/scheduled_tasks.py+++ b/core/scheduled_tasks.py@@ -49,6 +49,35 @@ def _path_signature(path: Path) -> Optional[tuple[int, int, int]]:return (stat.st_mtime_ns, stat.st_size, stat.st_ino)+def _run_file_state_for_status(status: Optional[str]) -> Optional[str]:+ if status in {None, ""}:+ return None+ return {+ "queued": "pending",+ "pending": "pending",+ "running": "processing",+ "processing": "processing",+ "succeeded": "completed",+ "failed": "completed",+ "completed": "completed",+ }.get(status, status)+++def _normalize_file_run_status(payload: dict[str, Any], state: str) -> str:+ raw_status = str(payload.get("status") or "").strip()+ if raw_status in {"queued", "running", "succeeded", "failed", "cancelled"}:+ return raw_status+ if state == "pending":+ return "queued"+ if state == "processing":+ return "running"+ if state == "completed":+ if payload.get("ok") is False or payload.get("error"):+ return "failed"+ return "succeeded"+ return raw_status or state++@dataclass(frozen=True)class ParsedSessionKey:platform: str@@ -741,13 +770,14 @@ class TaskExecutionStore:def list_runs(self, *, status: Optional[str] = None) -> list[dict[str, Any]]:if self._sqlite is not None:return self._sqlite.list_runs(status=status)+ status_filter = _run_file_state_for_status(status)runs: list[dict[str, Any]] = []for state, directory in {"pending": self.pending_dir,"processing": self.processing_dir,"completed": self.completed_dir,}.items():- if status and status != state:+ if status_filter and status_filter != state:continueif not directory.exists():continue@@ -757,7 +787,10 @@ class TaskExecutionStore:except Exception:continueif isinstance(payload, dict):- payload.setdefault("status", state)+ normalized_status = _normalize_file_run_status(payload, state)+ if status and normalized_status != status:+ continue+ payload["status"] = normalized_statusruns.append(payload)return sorted(runs, key=lambda item: (item.get("created_at") or "", item.get("id") or ""))diff --git a/tests/test_controller_vibe_agent_routing.py b/tests/test_controller_vibe_agent_routing.pynew file mode 100644index 000000000..89fb43cb9--- /dev/null+++ b/tests/test_controller_vibe_agent_routing.py@@ -0,0 +1,32 @@+from __future__ import annotations++from types import SimpleNamespace++from core.controller import Controller+from modules.im import MessageContext+++class _StubController(Controller):+ def __init__(self):+ pass+++def test_resolve_vibe_agent_for_context_uses_catalog_default_when_scope_has_no_agent() -> None:+ controller = _StubController()+ default_agent = SimpleNamespace(name="reviewer", backend="codex")+ controller.primary_platform = "slack"+ controller.vibe_agent_store = SimpleNamespace(+ require=lambda name: (_ for _ in ()).throw(ValueError(f"agent '{name}' not found")),+ get_default_agent=lambda: default_agent,+ )+ controller.get_settings_manager_for_context = lambda context: SimpleNamespace(+ get_channel_routing=lambda settings_key: SimpleNamespace(agent_name=None, agent_backend="opencode")+ )+ context = MessageContext(+ user_id="U123",+ channel_id="C123",+ platform="slack",+ platform_specific={"is_dm": False},+ )++ assert controller.resolve_vibe_agent_for_context(context, required=False) is default_agentdiff --git a/tests/test_scheduled_tasks.py b/tests/test_scheduled_tasks.pyindex 404b0d00c..5f9a4dc5c 100644--- a/tests/test_scheduled_tasks.py+++ b/tests/test_scheduled_tasks.py@@ -606,6 +606,28 @@ def test_request_store_enqueue_claim_and_complete(tmp_path: Path) -> None:assert not (store.processing_dir / f"{request.id}.json").exists()+def test_request_store_file_backend_filters_public_run_statuses(tmp_path: Path) -> None:+ store = TaskExecutionStore(tmp_path / "task_requests")+ queued = store.enqueue_hook_send(session_key="slack::channel::C123", prompt="queued")+ running = store.enqueue_hook_send(session_key="slack::channel::C123", prompt="running")+ failed = store.enqueue_hook_send(session_key="slack::channel::C123", prompt="failed")+ succeeded = store.enqueue_hook_send(session_key="slack::channel::C123", prompt="succeeded")++ claimed_running = store.claim(running.id)+ claimed_failed = store.claim(failed.id)+ claimed_succeeded = store.claim(succeeded.id)+ assert claimed_running is not None+ assert claimed_failed is not None+ assert claimed_succeeded is not None+ store.complete(claimed_failed, ok=False, error="boom")+ store.complete(claimed_succeeded, ok=True)++ assert [item["id"] for item in store.list_runs(status="queued")] == [queued.id]+ assert [item["id"] for item in store.list_runs(status="running")] == [running.id]+ assert [item["id"] for item in store.list_runs(status="failed")] == [failed.id]+ assert [item["id"] for item in store.list_runs(status="succeeded")] == [succeeded.id]++def test_request_store_constructor_does_not_requeue_processing_files(tmp_path: Path) -> None:root = tmp_path / "task_requests"store = TaskExecutionStore(root)