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(codex): skip invalid rollout preview paths

cyhcb1e97ad7429
diff --git a/modules/agents/native_sessions/codex.py b/modules/agents/native_sessions/codex.py
index 8686be0a0..0758877b5 100644
--- a/modules/agents/native_sessions/codex.py
+++ b/modules/agents/native_sessions/codex.py
@@ -59,8 +59,9 @@ class CodexNativeSessionProvider(NativeSessionProvider):
def hydrate_preview(self, item: NativeResumeSession) -> NativeResumeSession:
preview = ""
- rollout_path = Path(str(item.locator.get("rollout_path") or ""))
- if rollout_path.exists():
+ rollout_path_raw = str(item.locator.get("rollout_path") or "").strip()
+ rollout_path = Path(rollout_path_raw) if rollout_path_raw else None
+ if rollout_path and rollout_path.is_file():
rows = read_json_lines(rollout_path)
for row in reversed(rows):
if row.get("type") != "response_item":
diff --git a/tests/test_native_session_providers.py b/tests/test_native_session_providers.py
index 4954d792e..73e675e59 100644
--- a/tests/test_native_session_providers.py
+++ b/tests/test_native_session_providers.py
@@ -5,6 +5,8 @@ import json
from modules.agents.native_sessions.base import build_resume_preview, build_tail_preview
from modules.agents.native_sessions import claude as claude_module
from modules.agents.native_sessions.claude import ClaudeNativeSessionProvider, encode_project_path
+from modules.agents.native_sessions import codex as codex_module
+from modules.agents.native_sessions.codex import CodexNativeSessionProvider
from modules.agents.native_sessions.service import AgentNativeSessionService
from modules.agents.native_sessions.types import NativeResumeSession
@@ -125,6 +127,35 @@ def test_claude_provider_uses_global_index_fallback_without_scanning_all_jsonl(t
assert "indexed session" in hydrated.last_agent_tail
+def test_codex_provider_skips_empty_rollout_path(monkeypatch) -> None:
+ provider = CodexNativeSessionProvider(db_path="/tmp/does-not-matter.sqlite")
+ item = NativeResumeSession(
+ agent="codex",
+ agent_prefix="cx",
+ native_session_id="thread_1",
+ working_path="/tmp/project",
+ created_at=None,
+ updated_at=None,
+ sort_ts=1.0,
+ locator={"title": "Fallback title", "rollout_path": ""},
+ )
+
+ called = False
+
+ def _unexpected_read_json_lines(_path: Path) -> list[dict]:
+ nonlocal called
+ called = True
+ return []
+
+ monkeypatch.setattr(codex_module, "read_json_lines", _unexpected_read_json_lines)
+
+ hydrated = provider.hydrate_preview(item)
+
+ assert called is False
+ assert hydrated.last_agent_message == "Fallback title"
+ assert hydrated.last_agent_tail == "Fallback title"
+
+
def test_native_session_service_preserves_agent_visibility_when_limited() -> None:
def _item(agent: str, prefix: str, session_id: str, sort_ts: float) -> NativeResumeSession:
return NativeResumeSession(