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(vibey): keep a reply a steer superseded as a visible output, so a silent final can make it the result (#2811)
Call Whited8c9fe184b0f
diff --git a/core/agent_core/agent/README.md b/core/agent_core/agent/README.mdindex 7421a28d4..d27e5fd66 100644--- a/core/agent_core/agent/README.md+++ b/core/agent_core/agent/README.md@@ -121,6 +121,10 @@ localize that error rather than deliver a silent success.`empty_response` and end as error. A received terminal is never retried.Empty non-final responses with queued inputs can still continue to a reply;tool calls, explicit hook end, and tool termination retain their contracts.+ A tool-free reply that queued input made non-final, and that did not stop at+ its output limit, is committed `superseded`: a completed reply, stored as one+ in the same transaction and shown as one, unlike narration beside tool calls,+ a stream error's partial, or a truncated reply.- A tool batch runs in groups (C-3 section 2): neighbouring calls to tools thatdeclare `concurrent` run at the same time, every other call runs alone, andeach group starts after the one before it has committed. Each group'sdiff --git a/core/agent_core/agent/events.py b/core/agent_core/agent/events.pyindex 313db4f8c..676384ef9 100644--- a/core/agent_core/agent/events.py+++ b/core/agent_core/agent/events.py@@ -69,6 +69,10 @@ class MessageCommitted:message_id: strcontext_seq: intfinal: bool+ #: A completed reply that queued input took the final word from: tool-free, not failed, a reply, and not cut off at+ #: its output limit, committed non-final only because a steer or follow-up was pending. Never narration beside tool+ #: calls, a stream error's partial, or a truncated reply.+ superseded: bool = False@dataclass(frozen=True)diff --git a/core/agent_core/agent/loop.py b/core/agent_core/agent/loop.pyindex d88b4e105..d0ead7639 100644--- a/core/agent_core/agent/loop.py+++ b/core/agent_core/agent/loop.py@@ -581,7 +581,9 @@ class Agent:except ProjectionError as error:raise ProviderProtocolViolation(f"Provider protocol violation: {error}") from error- async def _response(self, message: AssistantMessage, *, final: bool, replied: Optional[bool] = None) -> ContextEntry:+ async def _response(+ self, message: AssistantMessage, *, final: bool, replied: Optional[bool] = None, superseded: bool = False+ ) -> ContextEntry:self._validate_response(message)await self._save_state()# The attempt this response answered: the ledger's latest conversation attempt (the C-9 anchor).@@ -594,6 +596,7 @@ class Agent:final=final,replied=replied,images=tuple(self._generated_images) if final else (),+ superseded=superseded,**facts,),interruptible=False,@@ -1027,16 +1030,25 @@ class Agent:if not pending:pending = [(item, False) for item in self._follow_ups]final = not message.tool_calls and not pending and not failed+ # A completed reply the pending input took the final word from: one cut off at its output limit+ # never completed, as ``final_outcome`` holds for a final.+ superseded = bool(pending) and replied and message.stop_reason != "length"if final or failed:self._open = False- row = await self._response(message, final=final, replied=replied)+ row = await self._response(message, final=final, replied=replied, superseded=superseded)for item, is_steer in pending:await self._consume(item)(self._steers if is_steer else self._follow_ups).popleft()consumed.append((item, is_steer))finally:if row is not None and not self._consumer_closed:- await emit(MessageCommitted, message_id=row.row_id, context_seq=row.context_seq, final=final)+ await emit(+ MessageCommitted,+ message_id=row.row_id,+ context_seq=row.context_seq,+ final=final,+ superseded=superseded,+ )for item, is_steer in consumed:if is_steer:await emit(SteerApplied, message_id=item.message_id)diff --git a/core/agent_core/harness/store.py b/core/agent_core/harness/store.pyindex 19624fc7e..4ba9710ae 100644--- a/core/agent_core/harness/store.py+++ b/core/agent_core/harness/store.py@@ -57,6 +57,7 @@ class TranscriptStore(Protocol):request: Optional[Mapping[str, Any]] = None,replied: Optional[bool] = None,images: Sequence[HostedImage] = (),+ superseded: bool = False,) -> ContextEntry:"""Commit a response; ``request`` (C-9 ``ModelResponse.request``) is stored with it and read back in ``payload``.@@ -64,6 +65,8 @@ class TranscriptStore(Protocol):response replies (``has_reply``), which a final's row type takes as given; without one, the response alonedecides. ``images`` are those the run's committed tool results generated, which a final delivers with itsreply: its committed display carries them, so the row is a complete result even if delivery never runs.+ ``superseded``: a non-final response is a completed reply that pending input took the final word from, which+ commits as a visible reply (``output``), so it stays one even if delivery never runs."""...diff --git a/docs/plans/agent-core-contracts/agent-event.schema.json b/docs/plans/agent-core-contracts/agent-event.schema.jsonindex 8a4111c92..145ba81f3 100644--- a/docs/plans/agent-core-contracts/agent-event.schema.json+++ b/docs/plans/agent-core-contracts/agent-event.schema.json@@ -86,6 +86,11 @@"final": {"type": "boolean","description": "True for the run's final response (`result` row)."+ },+ "superseded": {+ "type": "boolean",+ "default": false,+ "description": "True for a non-final response that is a completed reply pending input took the final word from: tool-free, not failed, a reply (`has_reply`), not stopped at its output limit, and committed non-final only because a steer or follow-up was pending. Its row commits as `output`, a visible reply. Never true for narration beside tool calls, a stream error's partial, or a truncated reply."}}}diff --git a/docs/plans/agent-core-contracts/loop-control.md b/docs/plans/agent-core-contracts/loop-control.mdindex 6b9c859ea..eb2f34101 100644--- a/docs/plans/agent-core-contracts/loop-control.md+++ b/docs/plans/agent-core-contracts/loop-control.md@@ -78,8 +78,12 @@ as `replied`, with the images a final delivers as `images`. The row's type anddisplay at commit carry both, so the committed final is the complete terminalreply even if delivery never runs; live settlement takes the same values. This does notadd a model call, increase an output limit, or replay a task. Non-final responses-with pending steer/follow-up keep continuing normally; truncated tool calls keep-the existing bounded reissue path without executing their partial arguments.+with pending steer/follow-up keep continuing normally; a tool-free one that+replies and did not stop at its output limit is a completed reply that the+pending input superseded, which the loop passes to `append_response` as+`superseded`, so it commits as `output`, a visible reply, in the same+transaction. A truncated one stays narration, as it would fail as a final. Truncated tool calls keep the existing bounded reissue+path without executing their partial arguments.A final response with `stop_reason` `refusal` or `safety` and no text is still committed as the finalresponse, typed `error` ([`transcript.md`](transcript.md) §1); its commit-time display text is the localized@@ -173,7 +177,7 @@ sent with that request gets the error result `Tool <name> is not available.`| --- | --- || `run_started` | none; the Turn was opened by its delivery || `text_delta`, `thinking_delta` | dropped: no backend shows live partial text, and none will (owner decision, 2026-10-08), so progress comes from the committed narration and tool lines, as for the other backends |-| `message_committed` | the committed `messages` row is delivered: `assistant` as activity, `result` as the reply |+| `message_committed` | the committed `messages` row is delivered: `assistant` as activity, `output` (`superseded`, a reply pending input took the final word from) as a visible reply that a silent final makes the Turn's result, `result` as the reply || `tool_started` | `agent_events` `tool_call` trace row; IM progress line || `tool_progress` | dropped: no backend shows live tool output, and none will (owner decision, 2026-10-08), so a running tool shows its `tool_started` line, as for the other backends || `tool_finished` | the committed `tool_result` row; a handed-over job names its Watch |diff --git a/docs/plans/agent-core-contracts/transcript.md b/docs/plans/agent-core-contracts/transcript.mdindex 07a9ac00c..13fb938c1 100644--- a/docs/plans/agent-core-contracts/transcript.md+++ b/docs/plans/agent-core-contracts/transcript.md@@ -12,7 +12,7 @@ unique per Session across both tables (partial unique index on each table, plus| --- | --- | --- | --- | --- || user or steer input | `messages` | `user` | — | `content_json.model` = `ModelInput` || harness input | `messages` | `harness`, `agent_initiated`, `annotation` | — | `content_json.model` = `ModelInput` |-| model response | `messages` | `assistant` (not final), `result` or `error` (final) | — | `content_json.model` = `ModelResponse` |+| model response | `messages` | `assistant` or `output` (not final), `result` or `error` (final) | — | `content_json.model` = `ModelResponse` || tool result | `agent_events` | `tool_result` | `context` | `content_json` = `ToolResult` || checkpoint | `agent_events` | `context_compaction` | `context` | `content_json` = `Compaction` || cleared result | `agent_events` | `context_edit` | `context` | `content_json` = `ContextEdit` |@@ -23,10 +23,12 @@ A final response is `error` when it failed by itself (no text of its own: an empstop without an explanation), as the other backends' failed terminal rows are. A successful final with nothing to show(a silent reply) is the hidden response type `assistant`: context, but no transcript row, inbox reply, or unreadresult, as the other backends persist nothing visible for it; a terminal write at delivery (a run that failed after-the commit) types it `error`. Context loading accepts all three.+the commit) types it `error`. A non-final response is `output` when it is a reply pending input superseded and has+text to show (`superseded`, [`loop-control.md`](loop-control.md)): a visible reply, which a silent final can make the+Turn's `result`; every other non-final response is `assistant`. Context loading accepts all four.Display-only rows keep `context_seq` null: `interim`, `notify`, an `error` that reports a run failure, `vault`,-`output`, queued or removed inputs, and the `tool_call` trace row written at tool start (its `metadata_json` carries+an `output` that is not a committed response, queued or removed inputs, and the `tool_call` trace row written at tool start (its `metadata_json` carries`tool_call_id` and `job_id` so the activity panel can pair it with the result). Audit rows are never contexteither: `agent_events` with `visibility = 'audit'` and no `context_seq`, written by `append_audit`, as`fork_turn` (`ForkTurn`, C-10 `fork.md` §7: one side turn, such as a C-9 checkpoint, with its own attempts' partialsdiff --git a/modules/agents/vibey/agent.py b/modules/agents/vibey/agent.pyindex 2b740c765..d4b458a34 100644--- a/modules/agents/vibey/agent.py+++ b/modules/agents/vibey/agent.py@@ -776,7 +776,7 @@ class VibeyAgent(BaseAgent):# Delivered at the end of the run, which decides how the Turn settles.run.final_row = event.message_idelse:- await self._emit_narration(run, event.message_id)+ await self._emit_narration(run, event.message_id, superseded=event.superseded)elif isinstance(event, ToolStarted):run.tool_started[event.tool_call_id] = time.monotonic()await self._emit_tool_started(run, event)@@ -1347,8 +1347,14 @@ class VibeyAgent(BaseAgent):# --- output helpers ------------------------------------------------------- async def _emit_narration(self, run: _Run, row_id: str) -> None:- """A non-final response through the same process path as the other backends' narration."""+ async def _emit_narration(self, run: _Run, row_id: str, *, superseded: bool = False) -> None:+ """A non-final response through the same process path as the other backends' narration.++ A ``superseded`` response is a completed reply that later input took the final+ word from, not narration: like Claude's pre-steer phase, it is an ``output``+ boundary, transcript-visible whatever its length, which a silent final makes+ the Turn's result (#2803).+ """message = run.responses.get(row_id)body, citations = self._display_with_citations(message, final=False) if message is not None else ("", None)if not body.strip():@@ -1356,7 +1362,7 @@ class VibeyAgent(BaseAgent):try:await self.controller.emit_agent_message(run.request.context,- "assistant",+ "output" if superseded else "assistant",body,output=MessageOutput(completes_turn=False, completes_run=False, persisted_row_id=row_id),citations=citations,diff --git a/modules/agents/vibey/store.py b/modules/agents/vibey/store.pyindex 371a22a5b..9fcd49492 100644--- a/modules/agents/vibey/store.py+++ b/modules/agents/vibey/store.py@@ -140,6 +140,7 @@ class AdapterTranscriptStore:request: Optional[Mapping[str, Any]] = None,replied: Optional[bool] = None,images: Sequence[HostedImage] = (),+ superseded: bool = False,) -> ContextEntry:entry = await self._store.append_response(session_id,@@ -148,6 +149,7 @@ class AdapterTranscriptStore:request=request,replied=replied,images=images,+ superseded=superseded,agent_name=self._agents.get(session_id),turn_id=self._turns.get(session_id),)diff --git a/storage/agent_transcript.py b/storage/agent_transcript.pyindex d933b5314..667df4dc0 100644--- a/storage/agent_transcript.py+++ b/storage/agent_transcript.py@@ -97,9 +97,10 @@ INPUT_TYPES = ("user", "harness", "agent_initiated", "annotation")# the row carries its outcome, as the other backends' terminal rows do. A final with# nothing to show (a silent reply) is the hidden response type ``assistant``: context,# but no transcript row, inbox reply, or unread result, as the other backends persist-# nothing visible for it.+# nothing visible for it. A non-final reply that pending input superseded commits as+# ``output``, a visible reply, which a silent final can make the Turn's ``result``.FINAL_TYPES = ("result", "error")-RESPONSE_TYPES = ("assistant", *FINAL_TYPES)+RESPONSE_TYPES = ("assistant", "output", *FINAL_TYPES)CONTEXT_VISIBILITY = "context"AUDIT_VISIBILITY = "audit"AuditKind = Literal["attempt", "fork_turn"]@@ -141,9 +142,9 @@ def final_outcome(message: AssistantMessage, *, replied: Optional[bool] = None)return "completed" if replied and message.stop_reason != "length" else "failed"-def _response_type(message: AssistantMessage, *, final: bool, display_text: str, replied: bool) -> str:+def _response_type(message: AssistantMessage, *, final: bool, display_text: str, replied: bool, superseded: bool) -> str:if not final:- return "assistant"+ return "output" if superseded and display_text.strip() else "assistant"if final_outcome(message, replied=replied) == "failed":return "error"return "result" if display_text.strip() else "assistant"@@ -263,6 +264,7 @@ class SQLiteTranscriptStore:request: Optional[Mapping[str, Any]] = None,replied: Optional[bool] = None,images: Sequence[HostedImage] = (),+ superseded: bool = False,agent_name: Optional[str] = None,turn_id: Optional[str] = None,) -> ContextEntry:@@ -287,7 +289,9 @@ class SQLiteTranscriptStore:author="agent",source="agent",author_name=origin.agent_name,- message_type=_response_type(message, final=final, display_text=display_text, replied=replied),+ message_type=_response_type(+ message, final=final, display_text=display_text, replied=replied, superseded=superseded+ ),text=display_text,content={"model": model},metadata={"turn_id": origin.turn_id} if origin.turn_id else None,diff --git a/tests/agent_core/agent/test_loop.py b/tests/agent_core/agent/test_loop.pyindex e65da0ddd..4205b1fe3 100644--- a/tests/agent_core/agent/test_loop.py+++ b/tests/agent_core/agent/test_loop.py@@ -533,11 +533,13 @@ async def test_C4_pending_steer_prevents_finality_and_late_steer_is_refused_durisuper().__init__()self.final_entered, self.final_release = asyncio.Event(), asyncio.Event()- async def append_response(self, session_id, message, *, final, replied=None, images=()):+ async def append_response(self, session_id, message, *, final, replied=None, images=(), superseded=False):if final:self.final_entered.set()await self.final_release.wait()- return await super().append_response(session_id, message, final=final, replied=replied, images=images)+ return await super().append_response(+ session_id, message, final=final, replied=replied, images=images, superseded=superseded+ )entered, release = asyncio.Event(), asyncio.Event()@@ -893,7 +895,7 @@ async def test_retry_keeps_a_usage_only_partial_out_of_the_context():class _FailingResponses(InMemoryTranscriptStore):- async def append_response(self, session_id, message, *, final, request=None, replied=None, images=()):+ async def append_response(self, session_id, message, *, final, request=None, replied=None, images=(), superseded=False):raise RuntimeError("disk full")@@ -1487,7 +1489,7 @@ async def test_failed_queued_input_commit_keeps_pending_input_and_announces_prioasync def test_partial_response_commit_failure_still_emits_a_terminal_error():class Store(InMemoryTranscriptStore):- async def append_response(self, session_id, message, *, final, replied=None, images=()):+ async def append_response(self, session_id, message, *, final, replied=None, images=(), superseded=False):raise OSError("response persistence unavailable")provider = ScriptedProvider(diff --git a/tests/agent_core/fakes.py b/tests/agent_core/fakes.pyindex a022b5bb1..0d3b5011e 100644--- a/tests/agent_core/fakes.py+++ b/tests/agent_core/fakes.py@@ -166,7 +166,7 @@ class InMemoryTranscriptStore:return (await self._append(session_id, [("input", message, {}, message_id)]))[0]async def append_response(- self, session_id, message: AssistantMessage, *, final: bool, request=None, replied=None, images=()+ self, session_id, message: AssistantMessage, *, final: bool, request=None, replied=None, images=(), superseded=False) -> ContextEntry:payload = {"request": dict(request)} if request is not None else {}row = (await self._append(session_id, [("response", message, payload, None)]))[0]diff --git a/tests/scenarios/message_delivery/catalog.yaml b/tests/scenarios/message_delivery/catalog.yamlindex 95b4988dc..b00942429 100644--- a/tests/scenarios/message_delivery/catalog.yaml+++ b/tests/scenarios/message_delivery/catalog.yaml@@ -405,5 +405,13 @@ scenarios:- tests/test_message_dispatcher_silent_final.py::SilentFinalTurnResultTests::test_a_cancellation_during_the_promotion_still_commits_the_turn- tests/test_message_dispatcher_silent_final.py::SilentFinalTurnResultTests::test_nothing_else_promotes_earlier_text- tests/test_vibey_agent.py::test_a_silent_final_leaves_the_visible_reply_before_it_as_the_result+ - id: MESSAGE-DELIVERY-326+ name: A Vibey reply a steer superseded stays a visible reply whatever its length, and a silent final makes it the Turn's result+ status: covered+ kind: regression+ layer: contract+ test:+ - tests/test_vibey_agent.py::test_a_short_reply_a_steer_superseded_stays_a_visible_reply+ - tests/test_agent_transcript.py::test_a_reply_pending_input_superseded_commits_as_a_visible_replynext_priority:- - MESSAGE-DELIVERY-326+ - MESSAGE-DELIVERY-327diff --git a/tests/test_agent_transcript.py b/tests/test_agent_transcript.pyindex 919684c5e..ddcd45b6a 100644--- a/tests/test_agent_transcript.py+++ b/tests/test_agent_transcript.py@@ -510,6 +510,34 @@ async def test_a_final_commits_as_the_loops_reply_decision_says(engine, replied,assert committed == row_type and given == [(bool(replied), (image,))]+ ("superseded", "text", "row_type"),+ [(True, "4.", "output"), (True, "<silent>later</silent>", "assistant"), (False, "4.", "assistant")],+ ids=["superseded-reply", "superseded-silent", "narration"],+)+async def test_a_reply_pending_input_superseded_commits_as_a_visible_reply(engine, superseded, text, row_type) -> None:+ """MESSAGE-DELIVERY-326: the row is a visible reply from its commit, so it stays one if the process stops before+ its delivery; one with nothing to show stays hidden, as a silent final does."""+ with engine.begin() as conn:+ home = _scope(conn, "C-home")+ _session(conn, "ses_main", home)+ consumed = _row(conn, "ses_main", home, "2+2?")++ def render(message, *, final, replied, images):+ body = "".join(block.text for block in message.content if isinstance(block, TextBlock) and block.text)+ return "" if body.startswith("<silent>") else body++ store = SQLiteTranscriptStore(engine, render=render)+ await store.consume_input("ses_main", consumed, _user("2+2?"))+ reply = await store.append_response("ses_main", _assistant(text), final=False, superseded=superseded)++ with engine.connect() as conn:+ committed = conn.execute(select(messages.c.type).where(messages.c.id == reply.row_id)).scalar_one()+ assert committed == row_type+ # Whatever its type, it is context.+ assert [entry.row_id for entry in await store.load("ses_main") if entry.kind == "response"] == [reply.row_id]++async def test_a_call_instance_is_settled_once_whoever_writes(engine) -> None:with engine.begin() as conn:home = _scope(conn, "C-home")diff --git a/tests/test_vibey_agent.py b/tests/test_vibey_agent.pyindex 989dd522a..6e79c2e3e 100644--- a/tests/test_vibey_agent.py+++ b/tests/test_vibey_agent.py@@ -2185,6 +2185,74 @@ async def test_a_silent_final_leaves_the_visible_reply_before_it_as_the_result(assert harness.controller.terminals[-1]["is_error"] is False+ ("stop_reason", "final"),+ [("stop", "<silent>already answered</silent>"), ("stop", "You're welcome."), ("length", "<silent>noted</silent>")],+ ids=["silent", "visible", "truncated"],+)+async def test_a_short_reply_a_steer_superseded_stays_a_visible_reply(+ engine, session, tmp_path, published, monkeypatch, stop_reason, final+) -> None:+ """Scenario: MESSAGE-DELIVERY-326.++ A reply that a steer took the final word from is a completed reply, not narration: an+ ``output`` boundary whatever its length, kept in the context, and the Turn's result when+ the steered phase answers ``<silent>``. One cut off at its output limit was never completed,+ so it stays narration.+ """+ from core import web_push_notifications++ pushes: list[dict] = []++ class _Thread:+ def __init__(self, *, target, args, daemon):+ self.payload = args[0]++ def start(self) -> None:+ pushes.append(self.payload)++ monkeypatch.setattr(web_push_notifications, "threading", SimpleNamespace(Thread=_Thread))+ generating, steered = asyncio.Event(), asyncio.Event()++ async def answer(_request, _cancel):+ generating.set()+ await steered.wait()+ yield Done(assistant("4.", stop_reason=stop_reason))++ harness = _Harness(engine, tmp_path, "avibe", [answer, [Done(assistant(final))]])+ request = harness.request("2+2?")+ turn_id = _turn(request.context)+ running = asyncio.create_task(harness.agent.handle_message(request))+ await generating.wait()+ native = harness.controller.started[0]+ delivery_id, attempt_id = harness.open_steer("thanks", turn_id, native)+ receipt = await harness.agent.steer_active_turn(+ SteerRequest(SESSION, turn_id, native, "thanks", attempt_id=attempt_id),+ ActiveSteerTarget("runtime", turn_id, request.context, request, harness.agent),+ )+ assert receipt.outcome is SteerOutcome.ACCEPTED+ harness.accept_steer(delivery_id, attempt_id, turn_id)+ steered.set()+ await running++ rows = await harness.context_rows()+ assert [entry.kind for entry in rows] == ["input", "response", "input", "response"]+ assert harness.rows("interim") == [] and harness.controller.terminals[-1]["is_error"] is False+ if stop_reason == "length":+ assert harness.rows("output") == [] and harness.rows("result") == [] and pushes == []+ assert [row["id"] for row in harness.rows("assistant")][0] == rows[1].row_id+ return+ [result] = harness.rows("result")+ if final.startswith("<silent>"):+ assert result["id"] == rows[1].row_id and result["content_text"] == "4."+ assert harness.rows("output") == []+ else:+ [reply] = harness.rows("output")+ assert reply["id"] == rows[1].row_id and reply["content_text"] == "4."+ assert result["id"] == rows[3].row_id and result["content_text"] == final+ assert [push["message_id"] for push in pushes] == [result["id"]]++async def test_a_silent_final_whose_run_failed_after_its_commit_is_typed_by_its_row(engine, session, tmp_path, published) -> None: