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(workbench): round-25 Codex P2 — carry session_anchor, flush after Show-page dispatch, compaction as system log
cyh05392a1ec2d7
diff --git a/core/internal_server.py b/core/internal_server.pyindex 0838c4a1f..6871fad47 100644--- a/core/internal_server.py+++ b/core/internal_server.py@@ -308,12 +308,17 @@ def create_app(controller: "Controller") -> FastAPI:in_flight[session_id] = (task, context)async def _stream():+ saw_cancel = False+ reached_end = Falsetry:yield _sse_event("turn.start", {"session_id": session_id})while True:envelope = await chunk_queue.get()if envelope is None:+ reached_end = Truebreak+ if envelope.get("kind") == "cancelled":+ saw_cancel = Trueyield _sse_event("turn.chunk", envelope)yield _sse_event("turn.end", {"session_id": session_id})finally:@@ -324,6 +329,13 @@ def create_app(controller: "Controller") -> FastAPI:# disconnected mid-stream. ``pop`` is idempotent.if isinstance(session_id, str):in_flight.pop(session_id, None)+ # This endpoint shares ``in_flight`` with the session, so a Chat+ # send during a Show-page dispatch enqueues behind it. Drain that+ # queue on NATURAL completion (not a Stop / consumer disconnect,+ # mirroring _run_turn's no-flush-on-cancel rule) so the queued+ # Chat message isn't stranded until manual intervention (Codex P2).+ if reached_end and not saw_cancel:+ await _flush_queue(session_id)return StreamingResponse(_stream(),@@ -690,6 +702,11 @@ def _build_session_context("reasoning_effort": session_row.get("reasoning_effort"),"native_session_id": session_row.get("native_session_id"),"workdir": session_row.get("workdir"),+ # Carry the stored anchor so SessionHandler.get_base_session_id reuses it+ # instead of computing ``avibe_<id>`` — otherwise, after a restart, new+ # dispatches look up the native-session map under the wrong anchor and+ # start a fresh backend thread for the same Chat session (Codex P2).+ "session_anchor": session_row.get("session_anchor"),}platform_specific["agent_session_target"] = targetif session_row.get("agent_name"):diff --git a/modules/agents/codex/event_handler.py b/modules/agents/codex/event_handler.pyindex 486814e37..edd80f202 100644--- a/modules/agents/codex/event_handler.py+++ b/modules/agents/codex/event_handler.py@@ -470,9 +470,12 @@ class CodexEventHandler:passasync def _on_context_compacted(self, params: dict[str, Any], request: AgentRequest) -> None:+ # Routine status, not a turn outcome — emit as ``system`` (process log) so+ # it doesn't drive the per-session inbox preview/eligibility as if it were+ # a reply or terminal failure (Codex P2). Terminal failures stay ``notify``.await self._agent.controller.emit_agent_message(request.context,- "notify",+ "system","🗜️ Codex context was compacted to free up token space.",)diff --git a/storage/workbench_sessions_service.py b/storage/workbench_sessions_service.pyindex 8f9fe1994..5804547d9 100644--- a/storage/workbench_sessions_service.py+++ b/storage/workbench_sessions_service.py@@ -63,6 +63,10 @@ def _row_to_payload(row: dict[str, Any]) -> dict[str, Any]:"reasoning_effort": row.get("reasoning_effort"),"status": row.get("status"),"workdir": row.get("workdir"),+ # The reserved native-session anchor (workbench sessions self-anchor to+ # their id). Dispatch carries it so resume binds by the stored anchor+ # after a restart instead of a computed one (Codex P2).+ "session_anchor": row.get("session_anchor"),"native_session_id": row.get("native_session_id"),"created_at": row.get("created_at"),"updated_at": row.get("updated_at"),diff --git a/tests/test_internal_server.py b/tests/test_internal_server.pyindex 648f966d0..a748faae6 100644--- a/tests/test_internal_server.py+++ b/tests/test_internal_server.py@@ -273,6 +273,10 @@ def test_dispatch_forwards_session_routing_into_platform_specific(monkeypatch, tassert target.get("agent_backend") == "claude"assert target.get("model") == "claude-sonnet-4-6"assert target.get("reasoning_effort") == "high"+ # session_anchor is carried so resume binds by the stored anchor after a+ # restart instead of a computed avibe_<id> (Codex P2). Workbench sessions+ # self-anchor to their id.+ assert target.get("session_anchor") == session_iddef test_dispatch_async_starts_turn_and_returns_202(monkeypatch, tmp_path):