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(sessions): keep each reply under its Agent, explain a held input, and free chat apps (#2950)

Call Whitee2828c945df0
diff --git a/core/handlers/message_handler.py b/core/handlers/message_handler.py
index 7a4501cde..6cd80cfb5 100644
--- a/core/handlers/message_handler.py
+++ b/core/handlers/message_handler.py
@@ -12,7 +12,12 @@ from core.audio_asr import (
format_audio_transcript_echo,
)
from core.agent_input import AgentInputMetadata, harness_label
-from core.backend_failure import CONTINUE_ON_VIBEY_NEXT_STEP, emit_backend_failure, output_with_next_step
+from core.backend_failure import (
+ CONTINUE_ON_VIBEY_NEXT_STEP,
+ emit_backend_failure,
+ harness_run_identity,
+ output_with_next_step,
+)
from core.delivery_target import routed_delivery_context
from core.message_output import HARNESS_PROMPT_ECHO_SPEC_KEY
from core.session_handoff import BACKEND_HANDOFF_TURN_KEY
@@ -20,8 +25,10 @@ from core.message_context import (
resolve_context_platform,
resolve_context_thread_id,
)
+from core.delivery_evidence import DeliveryEvidence
from core.native_dispatch_phase import (
DISPATCH_PHASE_PREWRITE,
+ mark_prewrite_input_retired,
mark_prewrite_recovery_required,
set_dispatch_phase,
)
@@ -971,29 +978,54 @@ class MessageHandler(BaseHandler):
chat app cannot change the session's Agent, so its notice says where to.
Nothing is offered when Vibey is what cannot run, or is not available.
Retrying on its own would fail the same way, so an input that never reached
- the backend waits for its owner: continue on Vibey, or Retry once it is back.
+ the backend waits for its owner in the Workbench: continue on Vibey, or Retry
+ once it is back. A chat app has no Retry, so once its notice (which says to
+ send the message again) is delivered, its input is retired instead of holding
+ every later message behind it. A Harness run's input is its Run's to settle,
+ and resending a generated prompt by hand would run it outside its Run, so a
+ chat app is told only that the Agent cannot run.
"""
- mark_prewrite_recovery_required(context, "agent_unavailable")
target = routed_delivery_context(context)
workbench = resolve_context_platform(target) == "avibe"
+ # A background session's notice stays in its local history: it is read in the
+ # Workbench, where the input waits like a Workbench one.
+ background = bool((context.platform_specific or {}).get("suppress_delivery"))
+ chat_input = not workbench and not background and not harness_run_identity(context, request)
if not workbench and escape_reason:
reason = self._get_formatter(target).escape_special_chars(reason)
# Catalog and Model Hub reads: off the controller loop.
offer = failing_backend != "vibey" and await asyncio.to_thread(self._builtin_vibey_available)
+ if workbench or background:
+ # The held input's hint names the notice's button only when there is one;
+ # otherwise the notice offers Retry, which the general hint already names.
+ mark_prewrite_recovery_required(context, "agent_unavailable" if offer else "agent_unavailable_no_alternative")
output = output_with_next_step(request, CONTINUE_ON_VIBEY_NEXT_STEP) if offer and workbench else None
text = f"❌ {reason}"
- if offer:
- text = f"{text}\n{self._t('error.continueOnVibey.workbench' if workbench else 'error.continueOnVibey.im')}"
- await emit_backend_failure(
- self.controller,
- context,
- str(failing_backend or getattr(request, "vibe_agent_backend", None) or "agent"),
- text,
- display_text=text,
- request=request,
- output=output,
- cause=cause,
- )
+ if offer and workbench:
+ text = f"{text}\n{self._t('error.continueOnVibey.workbench')}"
+ elif chat_input:
+ # Its input is retired below, so it will not run once the Agent is back.
+ next_step = "error.continueOnVibey.im" if offer else "error.agentUnavailable.resendLater"
+ text = f"{text}\n{self._t(next_step)}"
+ delivery = DeliveryEvidence() if chat_input else None
+ try:
+ await emit_backend_failure(
+ self.controller,
+ context,
+ str(failing_backend or getattr(request, "vibe_agent_backend", None) or "agent"),
+ text,
+ display_text=text,
+ request=request,
+ output=output,
+ delivery=delivery,
+ cause=cause,
+ )
+ finally:
+ # A chat app's input is retired only once the user was told to send it
+ # again, even if settling the turn then raised; an undelivered notice
+ # leaves it to the ordinary startup retries.
+ if delivery is not None and delivery.delivered:
+ mark_prewrite_input_retired(context, "agent_unavailable")
def _builtin_vibey_available(self) -> bool:
"""Whether a continuation on Vibey could run now: its built-in Agent exists and
diff --git a/core/message_mirror.py b/core/message_mirror.py
index 62c4746ae..59c137c73 100644
--- a/core/message_mirror.py
+++ b/core/message_mirror.py
@@ -283,6 +283,7 @@ def _session_row(conn, session_id: str) -> Optional[dict]:
row = conn.execute(
select(
agent_sessions.c.scope_id,
+ agent_sessions.c.agent_id,
agent_sessions.c.agent_name,
agent_sessions.c.agent_backend,
agent_sessions.c.visibility,
@@ -325,11 +326,37 @@ def _is_tool_call_type(canonical_type: str | None) -> bool:
def _agent_provenance_from_context(context: MessageContext, session_row: Optional[dict] = None) -> tuple[Optional[str], Optional[str]]:
spec = context.platform_specific or {}
target = spec.get("agent_session_target") or {}
- agent_name = spec.get("vibe_agent_name") or target.get("agent_name") or (session_row or {}).get("agent_name")
+ # The Agent that ran, when routing resolved one (a new chat-app session may name
+ # its Agent nowhere else).
+ resolved = spec.get("resolved_vibe_agent")
+ resolved = resolved if isinstance(resolved, dict) else {}
+ agent_name = (
+ spec.get("vibe_agent_name")
+ or resolved.get("name")
+ or target.get("agent_name")
+ or (session_row or {}).get("agent_name")
+ )
backend = spec.get("vibe_agent_backend") or target.get("agent_backend") or (session_row or {}).get("agent_backend")
return agent_name, backend
+def _author_identity(context: MessageContext, session_row: Optional[dict] = None) -> dict[str, str]:
+ """The Agent that wrote a reply, recorded with it (``metadata``): a session can
+ switch Agents, and its earlier replies keep the one that wrote them. The Agent that
+ ran (``resolved_vibe_agent``) is preferred over the session's routing."""
+ spec = context.platform_specific or {}
+ resolved = spec.get("resolved_vibe_agent")
+ resolved = resolved if isinstance(resolved, dict) else {}
+ target = spec.get("agent_session_target")
+ target = target if isinstance(target, dict) else {}
+ _name, routed_backend = _agent_provenance_from_context(context, session_row)
+ identity = {
+ "author_agent_id": resolved.get("id") or target.get("agent_id") or (session_row or {}).get("agent_id"),
+ "author_backend": resolved.get("backend") or routed_backend,
+ }
+ return {key: str(value) for key, value in identity.items() if isinstance(value, str) and value.strip()}
+
+
def _trace_ids_from_context(context: MessageContext) -> tuple[Optional[str], Optional[str]]:
spec = context.platform_specific or {}
trigger_kind = str(spec.get("task_trigger_kind") or "").strip()
@@ -527,6 +554,7 @@ def persist_agent_message(
# survives reload because it lives on the row, not in the delivery.
if citation_rows:
content = {**(content or {}), "citations": citation_rows}
+ metadata = {**_author_identity(context, session_row), **(metadata or {})}
if existing_row_id:
appended_row = _write_committed_row(
conn,
diff --git a/core/native_dispatch_phase.py b/core/native_dispatch_phase.py
index 22f7902f1..53f384ac3 100644
--- a/core/native_dispatch_phase.py
+++ b/core/native_dispatch_phase.py
@@ -82,6 +82,19 @@ def mark_prewrite_recovery_required(context: Any, reason: str) -> None:
evidence["failure"] = {"reason": reason, "requires_explicit_retry": True}
+def mark_prewrite_input_retired(context: Any, reason: str) -> None:
+ """Retire a definitive startup failure's input where nothing can retry it.
+
+ A chat app has no Retry: a held input would wait at the head of the session's
+ queue, and every later message behind it, until someone retried it elsewhere.
+ """
+
+ if backend_dispatch_attempted(context) is not False:
+ return
+ evidence = set_dispatch_phase(context, DISPATCH_PHASE_PREWRITE)
+ evidence["failure"] = {"reason": reason, "retire_input": True}
+
+
def prewrite_failure_evidence(context: Any) -> dict[str, Any]:
"""Copy adapter-owned failure evidence into the durable start receipt."""
diff --git a/core/session_turns.py b/core/session_turns.py
index a8399ac92..70f09b2c7 100644
--- a/core/session_turns.py
+++ b/core/session_turns.py
@@ -5588,6 +5588,7 @@ class SessionTurnManager:
*,
outcome: str,
failure_evidence: dict[str, Any] | None = None,
+ resume_successors: bool = True,
) -> dict[str, Any]:
"""Settle definitive no-write evidence at the terminal chokepoint.
@@ -5595,14 +5596,33 @@ class SessionTurnManager:
else runs it, so an exit before its rerun dispatched fails it instead. Any other
accepted Turn ignores the late claim, as before.
"""
+ retire_ids: set[str] | None = None
+ retire_session_id = ""
+ if (failure_evidence or {}).get("retire_input") is True:
+ # Its surface cannot retry it (``mark_prewrite_input_retired``).
+ with self._sqlite_engine().connect() as conn:
+ turn = delivery_store.get_turn(conn, turn_id)
+ retire_session_id = str((turn or {}).get("session_id") or "")
+ retire_ids = {
+ str(row["id"])
+ for row in delivery_store.initial_deliveries_for_turn(conn, turn_id)
+ if row["state"] == "claimed"
+ }
result = self._terminalize_durable_turn(
turn_id,
"not_written",
settled_by=outcome,
evidence_kind="definitive_prewrite_failure",
evidence={"reason": outcome, **(failure_evidence or {})},
+ retire_unwritten_delivery_ids=retire_ids,
+ retire_unwritten_attempt_outcome="not_written",
+ resume_successors=resume_successors,
)
if result.get("changed"):
+ if retire_ids and retire_session_id:
+ # A retired input leaves the queue without requeueing anything, so
+ # an open Workbench view learns of it here.
+ self._publish_queue_update(retire_session_id)
return result
with self._sqlite_engine().connect() as conn:
turn = delivery_store.get_turn(conn, turn_id)
@@ -5642,6 +5662,9 @@ class SessionTurnManager:
no-op; when it failed, the runner commits the same thing it would have.
"""
+ # The user was told to send this input again (``mark_prewrite_input_retired``),
+ # so however this runner ends, the input is retired rather than replayed.
+ told_to_resend = (failure_evidence or {}).get("retire_input") is True
try:
if terminal_commit is not None:
committed_settlement = (
@@ -5670,8 +5693,7 @@ class SessionTurnManager:
# provably absent, so it settles as such below rather than staying
# open, where it showed as running and recovery re-ran its input.
if not (
- definitive_prewrite_exit
- and not cancelled
+ (told_to_resend or (definitive_prewrite_exit and not cancelled))
and result.get("reason") == "start_acceptance_unproven"
):
if not resume:
@@ -5683,6 +5705,16 @@ class SessionTurnManager:
interruption == SETTLED_BY_STOPPED
and not cancel_defers_queue_resume
)
+ if told_to_resend:
+ result = self._settle_durable_prewrite_failure(
+ turn_id,
+ outcome=interruption,
+ failure_evidence=failure_evidence,
+ resume_successors=resume_after_cancel,
+ )
+ if not resume_after_cancel:
+ result["defer_queue_resume"] = True
+ return result
# Same map as every other Turn-outcome surface. This branch used
# to hardcode ``stopped``, so a rolling refresh landed ``failed``
# here while ``release_for_backend_refresh`` -- the very caller
diff --git a/tests/test_message_handler_missing_agent.py b/tests/test_message_handler_missing_agent.py
index 740779853..fae69531a 100644
--- a/tests/test_message_handler_missing_agent.py
+++ b/tests/test_message_handler_missing_agent.py
@@ -208,11 +208,13 @@ def test_an_agent_that_cannot_run_offers_to_continue_on_vibey(monkeypatch):
assert (handler._t("error.continueOnVibey.workbench") in call.kwargs["display_text"]) is offered
-def test_an_agent_that_cannot_run_holds_its_input_for_its_owner():
- """Retrying on its own would fail the same way, so an input that never reached the
- backend is held for an explicit retry: continue on Vibey, or Retry once the Agent
- is back. One that already reached it is not claimed as unwritten."""
- from unittest.mock import AsyncMock, patch
+def test_an_agent_that_cannot_run_holds_its_input_only_where_it_can_be_retried():
+ """Retrying on its own would fail the same way. In the Workbench an input that never
+ reached the backend is held for an explicit retry: continue on Vibey, or Retry once
+ the Agent is back. A chat app has no Retry, so once its notice is delivered its
+ input is retired rather than holding every later message behind it. One that
+ reached the backend is left alone."""
+ from unittest.mock import patch
from core.native_dispatch_phase import (
DISPATCH_PHASE_ATTEMPTING,
@@ -224,17 +226,169 @@ def test_an_agent_that_cannot_run_holds_its_input_for_its_owner():
from core.vibe_agents import AgentUnavailableError
controller = _StubController()
+ controller.im_client.formatter = SimpleNamespace(escape_special_chars=lambda text: text)
handler = MessageHandler(controller)
disabled = AgentUnavailableError("agent 'codex' is disabled", agent_name="codex", reason="disabled")
- contexts = {}
- for phase in (DISPATCH_PHASE_PREWRITE, DISPATCH_PHASE_ATTEMPTING):
- context = MessageContext(user_id="U1", channel_id="ses-1", platform="avibe")
+
+ def failed(platform, phase, *, delivered=True, settle_raises=False):
+ context = MessageContext(user_id="U1", channel_id="ses-1", platform=platform)
set_dispatch_phase(context, phase)
- contexts[phase] = context
- with patch.dict(MessageHandler._emit_agent_cannot_run.__globals__, emit_backend_failure=AsyncMock()):
+
+ async def notify(*_args, delivery=None, **_kwargs):
+ if delivered and delivery is not None:
+ delivery.delivered_id = "notice-1"
+ if settle_raises:
+ raise RuntimeError("turn settlement failed")
+ return False
+
+ with patch.dict(MessageHandler._emit_agent_cannot_run.__globals__, emit_backend_failure=notify):
+ try:
+ anyio.run(handler._emit_agent_dispatch_failure, context, None, disabled)
+ except RuntimeError:
+ assert settle_raises
+ return context
+
+ workbench = failed("avibe", DISPATCH_PHASE_PREWRITE)
+ assert backend_dispatch_attempted(workbench) is False
+ # This controller has no built-in Vibey, so nothing else is offered.
+ assert prewrite_failure_evidence(workbench) == {
+ "reason": "agent_unavailable_no_alternative",
+ "requires_explicit_retry": True,
+ }
+ chat_app = failed("telegram", DISPATCH_PHASE_PREWRITE)
+ assert prewrite_failure_evidence(chat_app) == {"reason": "agent_unavailable", "retire_input": True}
+ # Not told to send it again, so the input is left to the ordinary retries.
+ assert prewrite_failure_evidence(failed("telegram", DISPATCH_PHASE_PREWRITE, delivered=False)) == {}
+ # Told, then settling the turn raised: still retired, or it would run twice.
+ assert prewrite_failure_evidence(failed("telegram", DISPATCH_PHASE_PREWRITE, settle_raises=True)) == {
+ "reason": "agent_unavailable",
+ "retire_input": True,
+ }
+ for platform in ("avibe", "telegram"):
+ assert prewrite_failure_evidence(failed(platform, DISPATCH_PHASE_ATTEMPTING)) == {}
+
+
+def test_a_workbench_hold_records_whether_vibey_was_offered():
+ """The held input's hint names Continue on Vibey only when its notice has that
+ button; without it the notice offers Retry, which the general hint names."""
+ from unittest.mock import AsyncMock, patch
+
+ from core.native_dispatch_phase import DISPATCH_PHASE_PREWRITE, prewrite_failure_evidence, set_dispatch_phase
+ from core.vibe_agents import AgentUnavailableError
+
+ controller = _StubController()
+ disabled = AgentUnavailableError("agent 'codex' is disabled", agent_name="codex", reason="disabled")
+ reasons = {}
+ for available in (SimpleNamespace(name="vibey"), None):
+ controller.vibe_agent_store = SimpleNamespace(
+ get=lambda _name: None, get_builtin_default_agent_for_backend=lambda backend, a=available: a
+ )
+ handler = MessageHandler(controller)
+ context = MessageContext(user_id="U1", channel_id="ses-1", platform="avibe")
+ set_dispatch_phase(context, DISPATCH_PHASE_PREWRITE)
+ with patch("modules.agents.model_hub.hub_supply_refusal", lambda _controller, _backend, _lang: None), patch.dict(
+ MessageHandler._emit_agent_cannot_run.__globals__, emit_backend_failure=AsyncMock()
+ ):
anyio.run(handler._emit_agent_dispatch_failure, context, None, disabled)
+ reasons[available is not None] = prewrite_failure_evidence(context)
+ assert reasons[True] == {"reason": "agent_unavailable", "requires_explicit_retry": True}
+ assert reasons[False] == {"reason": "agent_unavailable_no_alternative", "requires_explicit_retry": True}
+
+
+def test_a_background_chat_app_session_holds_its_input_without_a_resend_promise():
+ """A background session's notice is never sent out, only kept in its history, so
+ its input waits for a retry as a Workbench one does and nothing says to resend."""
+ from core.native_dispatch_phase import DISPATCH_PHASE_PREWRITE, prewrite_failure_evidence, set_dispatch_phase
+ from core.vibe_agents import AgentUnavailableError
+ from unittest.mock import patch
+
+ controller = _StubController()
+ controller.im_client.formatter = SimpleNamespace(escape_special_chars=lambda text: text)
+ handler = MessageHandler(controller)
+ context = MessageContext(
+ user_id="U1", channel_id="C1", platform="telegram", platform_specific={"suppress_delivery": True}
+ )
+ set_dispatch_phase(context, DISPATCH_PHASE_PREWRITE)
+ seen = {}
- held = contexts[DISPATCH_PHASE_PREWRITE]
- assert backend_dispatch_attempted(held) is False
- assert prewrite_failure_evidence(held) == {"reason": "agent_unavailable", "requires_explicit_retry": True}
- assert prewrite_failure_evidence(contexts[DISPATCH_PHASE_ATTEMPTING]) == {}
+ async def notify(*_args, delivery=None, display_text=None, **_kwargs):
+ seen.update(text=display_text, delivery=delivery)
+ return False
+
+ disabled = AgentUnavailableError("agent 'codex' is disabled", agent_name="codex", reason="disabled")
+ with patch.dict(MessageHandler._emit_agent_cannot_run.__globals__, emit_backend_failure=notify):
+ anyio.run(handler._emit_agent_dispatch_failure, context, None, disabled)
+ assert seen["text"] == f"❌ {handler._t('error.agentUnavailable.disabled', agent='Codex')}"
+ assert seen["delivery"] is None
+ assert prewrite_failure_evidence(context) == {
+ "reason": "agent_unavailable_no_alternative",
+ "requires_explicit_retry": True,
+ }
+
+
+def test_a_chat_app_is_told_to_resend_when_vibey_is_not_offered():
+ """Its input is retired, so with nothing to continue on it must be sent again."""
+ from unittest.mock import AsyncMock, patch
+
+ from core.vibe_agents import AgentUnavailableError
+
+ controller = _StubController()
+ controller.im_client.formatter = SimpleNamespace(escape_special_chars=lambda text: text)
+ controller.vibe_agent_store = SimpleNamespace(
+ get=lambda _name: None, get_builtin_default_agent_for_backend=lambda backend: None
+ )
+ handler = MessageHandler(controller)
+ disabled = AgentUnavailableError("agent 'codex' is disabled", agent_name="codex", reason="disabled")
+ calls = {}
+ for platform in ("telegram", "avibe"):
+ emitted = AsyncMock()
+ with patch.dict(MessageHandler._emit_agent_cannot_run.__globals__, emit_backend_failure=emitted):
+ anyio.run(
+ handler._emit_agent_dispatch_failure,
+ MessageContext(user_id="U1", channel_id="C1", platform=platform),
+ None,
+ disabled,
+ )
+ calls[platform] = emitted.await_args.kwargs["display_text"]
+ resend = handler._t("error.agentUnavailable.resendLater")
+ assert calls["telegram"].endswith(f"\n{resend}")
+ # The Workbench holds the input for Retry, so it says nothing of the kind.
+ assert resend not in calls["avibe"]
+
+
+def test_a_harness_run_in_a_chat_app_is_not_told_to_resend_its_prompt():
+ """A scheduled task, Watch, or Agent run settles its own input: its chat-app notice
+ names only the Agent that cannot run, and its input is not retired by the notice."""
+ from unittest.mock import patch
+
+ from core.native_dispatch_phase import DISPATCH_PHASE_PREWRITE, prewrite_failure_evidence, set_dispatch_phase
+ from core.vibe_agents import AgentUnavailableError
+
+ controller = _StubController()
+ controller.im_client.formatter = SimpleNamespace(escape_special_chars=lambda text: text)
+ vibey = SimpleNamespace(name="vibey")
+ for available in (vibey, None):
+ controller.vibe_agent_store = SimpleNamespace(
+ get=lambda _name: None, get_builtin_default_agent_for_backend=lambda backend, a=available: a
+ )
+ handler = MessageHandler(controller)
+ context = MessageContext(
+ user_id="U1", channel_id="C1", platform="telegram",
+ platform_specific={"task_execution_id": "run-1", "task_trigger_kind": "scheduled"},
+ )
+ set_dispatch_phase(context, DISPATCH_PHASE_PREWRITE)
+ seen = {}
+
+ async def notify(*_args, delivery=None, display_text=None, **_kwargs):
+ seen["text"] = display_text
+ if delivery is not None:
+ delivery.delivered_id = "notice-1"
+ return False
+
+ disabled = AgentUnavailableError("agent 'codex' is disabled", agent_name="codex", reason="disabled")
+ with patch("modules.agents.model_hub.hub_supply_refusal", lambda _controller, _backend, _lang: None), patch.dict(
+ MessageHandler._emit_agent_cannot_run.__globals__, emit_backend_failure=notify
+ ):
+ anyio.run(handler._emit_agent_dispatch_failure, context, None, disabled)
+ assert seen["text"] == f"❌ {handler._t('error.agentUnavailable.disabled', agent='Codex')}"
+ assert prewrite_failure_evidence(context) == {}
diff --git a/tests/test_message_mirror.py b/tests/test_message_mirror.py
index 9c0294026..ca3125ad5 100644
--- a/tests/test_message_mirror.py
+++ b/tests/test_message_mirror.py
@@ -1053,6 +1053,64 @@ def test_persist_agent_sets_source_and_agent_name(isolated_state):
assert agent_row["author_name"] == "Atlas"
+def test_persist_agent_records_the_agent_that_wrote_the_reply(isolated_state):
+ """A session can switch Agents; each reply keeps the id and backend of the Agent
+ that ran it, preferring that over the session's routing."""
+ ctx = MessageContext(
+ user_id="U",
+ channel_id="C_general",
+ platform="slack",
+ platform_specific={
+ "agent_session_target": {"agent_id": "agt-routed", "agent_backend": "claude"},
+ "resolved_vibe_agent": {"id": "agt-atlas", "name": "Atlas", "backend": "codex"},
+ },
+ )
+ mirror_inbound(ctx, "ping")
+ persist_agent_message(ctx, "result", "pong", metadata={"turn_id": "trn-1"})
+
+ engine = create_sqlite_engine()
+ with engine.connect() as conn:
+ agent_row = conn.execute(
+ select(messages).where(messages.c.author == "agent")
+ ).mappings().first()
+ # A new chat-app session may name its Agent only in the resolved selection.
+ assert agent_row["author_name"] == "Atlas"
+ assert json.loads(agent_row["metadata_json"]) == {
+ "author_agent_id": "agt-atlas",
+ "author_backend": "codex",
+ "turn_id": "trn-1",
+ }
+
+
+def test_persist_agent_falls_back_to_the_session_agent_id(isolated_state):
+ """An output persisted with only its session (an Agent-initiated or detached one)
+ still records the session's Agent, so a later same-backend switch tells it apart."""
+ engine = create_sqlite_engine()
+ now = "2026-05-30T12:00:00Z"
+ session_id = "ses_author"
+ with engine.begin() as conn:
+ scope_id = upsert_scope(conn, platform="avibe", scope_type="project", native_id="proj_author", now=now)
+ conn.execute(
+ agent_sessions.insert().values(
+ id=session_id, scope_id=scope_id, agent_id="agt-first", agent_name="first",
+ agent_backend="vibey", agent_variant="default", session_anchor="anchor_ses_author",
+ native_session_id="", title="Author", status="active", metadata_json="{}",
+ created_at=now, updated_at=now, last_active_at=now,
+ )
+ )
+ ctx = MessageContext(
+ user_id="U", channel_id=session_id, platform="avibe",
+ platform_specific={"agent_session_id": session_id},
+ )
+ persist_agent_message(ctx, "result", "done")
+ with engine.connect() as conn:
+ agent_row = conn.execute(
+ select(messages).where(messages.c.author == "agent", messages.c.session_id == session_id)
+ ).mappings().first()
+ metadata = json.loads(agent_row["metadata_json"])
+ assert (metadata["author_agent_id"], metadata["author_backend"]) == ("agt-first", "vibey")
+
+
def test_harness_inbound_avibe_session_scoped(isolated_state):
"""A scheduled/watch turn on an avibe session lands an author/type='harness'
row attributed to the session — with author_name = the trigger kind and
diff --git a/tests/test_model_hub_inference_wait.py b/tests/test_model_hub_inference_wait.py
index ea16f5964..599258773 100644
--- a/tests/test_model_hub_inference_wait.py
+++ b/tests/test_model_hub_inference_wait.py
@@ -40,6 +40,12 @@ WIRE = {
}
+# Only the local connection to the fixture engine: a busy CI runner can take longer
+# than a few milliseconds to accept it, which failed this suite with a connect
+# timeout before the request reached the fixture. Inference itself has no deadline.
+CONNECT_TIMEOUT_SECONDS = 1.0
+
+
@pytest.mark.parametrize("protocol", WIRE)
@pytest.mark.parametrize("phase", ["headers", "first_byte", "prelude", "stream_body", "buffered_body"])
@pytest.mark.parametrize("cancel", [False, True], ids=["complete", "cancel"])
@@ -70,7 +76,7 @@ def test_connected_inference_waits_for_its_owner(
# Gateway Sources name their vendor; the bare client fixture is a custom vendor.
idle_bounded = streaming and entrypoint == "gateway" and protocol in {"anthropic", "openai_responses"}
assert timeout.sock_read == (client_module._STREAM_IDLE_TIMEOUT_SECONDS if idle_bounded else None)
- assert timeout.connect == timeout.sock_connect == 0.02
+ assert timeout.connect == timeout.sock_connect == CONNECT_TIMEOUT_SECONDS
session = real_session(**kwargs)
sessions.append(session)
return session
@@ -124,7 +130,7 @@ def test_connected_inference_waits_for_its_owner(
)
client = EngineClient(
EngineConnection(f"http://127.0.0.1:{port}", "fixture-management", "fixture-gateway"),
- timeout=0.02,
+ timeout=CONNECT_TIMEOUT_SECONDS,
)
gateway = None
adapter = None
diff --git a/tests/test_queued_image_delivery.py b/tests/test_queued_image_delivery.py
index fde13d3a4..71d8af0bd 100644
--- a/tests/test_queued_image_delivery.py
+++ b/tests/test_queued_image_delivery.py
@@ -295,3 +295,15 @@ def test_uploaded_image_survives_real_queue_admission_and_send_now(isolated_stat
else:
assert [(row["id"], row["state"]) for row in rows] == [(delivery_id, "queued")]
assert rows[0]["content"]["attachments"] == [attachment]
+
+
+def test_bootstrap_lists_disabled_agents_so_old_replies_keep_their_author(isolated_state, tmp_path):
+ """A session moved off a disabled Agent still names that Agent's earlier replies."""
+ from vibe.ui_server import app
+
+ _scope_id, session_id = _make_session(tmp_path)
+ with patch(
+ "vibe.api.get_vibe_agents", return_value={"agents": [], "default_agent_name": None}
+ ) as get_agents:
+ assert app.test_client().get(f"/api/sessions/{session_id}/bootstrap").status_code == 200
+ assert get_agents.call_args.kwargs == {"include_disabled": True, "include_archived": True}
diff --git a/tests/test_session_delivery_fsm.py b/tests/test_session_delivery_fsm.py
index 2b222d1d9..c3452123c 100644
--- a/tests/test_session_delivery_fsm.py
+++ b/tests/test_session_delivery_fsm.py
@@ -19,6 +19,7 @@ from core.services.dispatch import TurnDispatchOutcome
from core.native_dispatch_phase import (
DISPATCH_PHASE_ATTEMPTING,
DISPATCH_PHASE_PREWRITE,
+ mark_prewrite_input_retired,
mark_prewrite_recovery_required,
prewrite_user_stop_requested,
set_dispatch_phase,
@@ -5213,17 +5214,18 @@ def test_definite_handler_prewrite_exit_requeues_through_terminal_boundary(
assert turn["settled_by"] == "no_terminal_result"
[email protected]("held", [True, False])
[email protected]("input_fate", ["held", "requeued", "retired"])
def test_a_prewrite_failure_notice_settles_its_turn_as_unwritten(
managers,
monkeypatch,
- held,
+ input_fate,
) -> None:
"""A failure reported before the backend was reached (its Agent is disabled) ends
with a failure notice, whose terminal write cannot land on a start never accepted.
The Turn still settles as unwritten: left open, it showed the session running and
re-ran the input on every recovery pass. An input that needs its owner's decision
- is held for an explicit retry rather than retried on its own."""
+ is held for an explicit retry rather than retried on its own; one whose surface
+ cannot retry it (a chat app) is retired, so it holds no later input behind it."""
manager, _other, engine, _engine_b, _starts = managers
manager._run = SessionTurnManager._run.__get__(manager, SessionTurnManager)
delivery_id = delivery_store.new_delivery_id()
@@ -5257,8 +5259,10 @@ def test_a_prewrite_failure_notice_settles_its_turn_as_unwritten(
async def failure_notice_before_backend(_controller, context, *_args, **_kwargs):
set_dispatch_phase(context, DISPATCH_PHASE_PREWRITE)
- if held:
+ if input_fate == "held":
mark_prewrite_recovery_required(context, "agent_unavailable")
+ elif input_fate == "retired":
+ mark_prewrite_input_retired(context, "agent_unavailable")
# What the notice's terminal emit hands its runner.
context.platform_specific[TERMINAL_COMMIT_KEY] = {
"settled_by": SETTLED_BY_TERMINAL_RESULT,
@@ -5274,6 +5278,8 @@ def test_a_prewrite_failure_notice_settles_its_turn_as_unwritten(
"core.session_turns.dispatch_turn_with_outcome",
failure_notice_before_backend,
)
+ queue_updates: list[str] = []
+ monkeypatch.setattr(SessionTurnManager, "_publish_queue_update", staticmethod(queue_updates.append))
async def run() -> None:
await manager._run(
@@ -5289,8 +5295,84 @@ def test_a_prewrite_failure_notice_settles_its_turn_as_unwritten(
asyncio.run(run())
row = _row(engine, delivery_id)
- assert row["state"] == "queued"
- assert delivery_store.requires_explicit_start_retry(row) is held
+ assert row["state"] == ("retired" if input_fate == "retired" else "queued")
+ # An open Workbench view drops a retired input from its queue strip.
+ if input_fate == "retired":
+ assert "ses_fsm" in queue_updates
+ assert delivery_store.requires_explicit_start_retry(row) is (input_fate == "held")
+ with engine.connect() as conn:
+ turn = delivery_store.get_turn(conn, turn_id)
+ assert turn is not None
+ assert (turn["state"], turn["terminal_outcome"]) == ("terminal", "not_written")
+
+
[email protected]("with_terminal_commit", [True, False])
+def test_an_input_the_user_was_told_to_resend_is_retired_when_its_runner_is_cancelled(
+ managers,
+ monkeypatch,
+ with_terminal_commit,
+) -> None:
+ """A chat app's notice told the user to send the message again, then the runner was
+ cancelled (a shutdown) before the Turn settled. The input is retired all the same:
+ left for restart to replay, it could run twice."""
+ manager, _other, engine, _engine_b, _starts = managers
+ manager._run = SessionTurnManager._run.__get__(manager, SessionTurnManager)
+ delivery_id = delivery_store.new_delivery_id()
+ turn_id = delivery_store.new_turn_id()
+ with engine.begin() as conn:
+ delivery = delivery_store.insert_delivery(
+ conn,
+ delivery_id=delivery_id,
+ session_id="ses_fsm",
+ priority="p3",
+ state="queued",
+ snapshot=delivery_store.message_snapshot(
+ scope_id=None,
+ session_id="ses_fsm",
+ platform="slack",
+ author="user",
+ source="user",
+ message_type="user",
+ text="hello",
+ ),
+ dispatch_text="hello",
+ )
+ delivery_store.claim_start_batch(
+ conn,
+ turn_id=turn_id,
+ session_id="ses_fsm",
+ backend="codex",
+ deliveries=[delivery],
+ dispatch_text="hello",
+ )
+
+ async def told_then_cancelled(_controller, context, *_args, **_kwargs):
+ set_dispatch_phase(context, DISPATCH_PHASE_PREWRITE)
+ mark_prewrite_input_retired(context, "agent_unavailable")
+ if with_terminal_commit:
+ context.platform_specific[TERMINAL_COMMIT_KEY] = {
+ "settled_by": SETTLED_BY_TERMINAL_RESULT,
+ "evidence": {"result_text": "", "terminal_error": "agent 'codex' is disabled"},
+ }
+ raise asyncio.CancelledError
+
+ monkeypatch.setattr("core.session_turns.dispatch_turn_with_outcome", told_then_cancelled)
+
+ async def run() -> None:
+ await manager._run(
+ "ses_fsm",
+ _context(),
+ "hello",
+ logical_turn_id=turn_id,
+ delivery_id=delivery_id,
+ durable_preallocated=True,
+ )
+ with pytest.raises(asyncio.CancelledError):
+ await manager.in_flight["ses_fsm"].task
+
+ asyncio.run(run())
+
+ assert _row(engine, delivery_id)["state"] == "retired"
with engine.connect() as conn:
turn = delivery_store.get_turn(conn, turn_id)
assert turn is not None
diff --git a/ui/src/components/workbench/ChatArchivedReadOnly.test.tsx b/ui/src/components/workbench/ChatArchivedReadOnly.test.tsx
index 24fd1cd99..a7ceeb864 100644
--- a/ui/src/components/workbench/ChatArchivedReadOnly.test.tsx
+++ b/ui/src/components/workbench/ChatArchivedReadOnly.test.tsx
@@ -13,7 +13,7 @@ import type { VaultRequest, VibeAgentBrief, WorkbenchMessage, WorkbenchSession }
import { ToastProvider } from '../../context/ToastProvider';
import { isVoiceControlDisabled } from '../../lib/voiceRecording';
import { ChatHeaderBar, MessageRow, ThinkingBubble } from './ChatPage';
-import { sessionAgentBackend, sessionAgentDisplayName } from './sessionAgentName';
+import { messageAuthorAgent, sessionAgentBackend, sessionAgentDisplayName } from './sessionAgentName';
import { BACKEND_BRAND_MARKS } from '../visual/backendBrandMarks';
import { Composer } from './Composer';
import { QuickReplies } from './QuickReplies';
@@ -271,6 +271,25 @@ describe('chat avatars', () => {
expect(sessionAgentBackend(session({ agent_backend: 'claude' }), [claude, vibey], 'vibey')).toBe('claude');
});
+ it('keeps a reply under the Agent that wrote it after the session switches', () => {
+ const reviewer = { ...archivedPm, id: 'agt-reviewer', name: 'reviewer', display_name: 'Reviewer', backend: 'claude' };
+ const reply = (author_name: string | null, metadata: Record<string, unknown> = {}) => ({ author_name, metadata });
+ const byReviewer = reply('reviewer', { author_agent_id: reviewer.id, author_backend: 'claude' });
+ // A reply that records no Agent (written before replies did) reads as the session's.
+ expect(messageAuthorAgent(reply('codex'), [vibey])).toBeNull();
+ // Named from the catalog by the recorded id, drawn with the recorded backend.
+ expect(messageAuthorAgent(byReviewer, [vibey, reviewer])).toEqual({ displayName: 'Reviewer', backend: 'claude' });
+ // No catalog (a read-only viewer, whatever the session routes to now), or a new
+ // Agent that took the old name: the recorded name and backend still stand.
+ const taker = { ...reviewer, id: 'agt-new', display_name: 'Someone else', backend: 'opencode' };
+ for (const agents of [[], [vibey, taker]]) {
+ expect(messageAuthorAgent(byReviewer, agents)).toEqual({ displayName: 'reviewer', backend: 'claude' });
+ }
+ // The session's own Agent resolves to the same name the session shows.
+ expect(messageAuthorAgent(reply('vibey', { author_agent_id: vibey.id, author_backend: 'vibey' }), [vibey]))
+ .toEqual({ displayName: 'vibey', backend: 'vibey' });
+ });
+
it('draws Vibey in the thinking and transcript bubbles of a session that inherits it', () => {
const inherits = session({ agent_id: null, agent_name: null, agent_backend: null });
const thinking = render(<ThinkingBubble session={inherits} agentDisplayName={null} agentBackend="vibey" />);
diff --git a/ui/src/components/workbench/ChatPage.tsx b/ui/src/components/workbench/ChatPage.tsx
index eeb4a8ff7..104e5bafa 100644
--- a/ui/src/components/workbench/ChatPage.tsx
+++ b/ui/src/components/workbench/ChatPage.tsx
@@ -159,7 +159,7 @@ import {
} from '../../lib/agentActivity';
import { errorMessage } from '@/lib/errorMessage';
import { pendingInitialMessageHandoff } from '@/lib/chatInitialMessage';
-import { sessionAgentBackend, sessionAgentDisplayName } from './sessionAgentName';
+import { messageAuthorAgent, sessionAgentBackend, sessionAgentDisplayName } from './sessionAgentName';
import { useModelHubRecovery } from '../../lib/modelHubRecovery';
import { getBackendUiMeta } from '@/lib/agentBackends';
@@ -2993,6 +2993,7 @@ export const ChatPage: React.FC = () => {
session={session}
agentDisplayName={agentDisplayName}
agentBackend={agentBackend}
+ agents={agents}
working={working}
modelRecovery={runtimeState.model_recovery}
hasOlder={!!olderCursor}
@@ -3497,7 +3498,13 @@ export const QueueStrip: React.FC<{
}> = ({ queue, onRemove, onRecall, onSendNow, sendingNow = false }) => {
const { t } = useTranslation();
if (queue.length === 0) return null;
- const retryRequired = queue.some((item) => item.requires_explicit_retry === true);
+ const held = queue.filter((item) => item.requires_explicit_retry === true);
+ const retryRequired = held.length > 0;
+ // An input held because its Agent cannot run, whose notice offers Continue on Vibey
+ // (``agent_unavailable``), is continued there rather than by fixing a startup error.
+ // Any other hold keeps the general guidance, so the special copy needs every hold to
+ // share the reason.
+ const agentUnavailable = retryRequired && held.every((item) => item.retry_reason === 'agent_unavailable');
const headFenced = isQueueDeliveryFenced(queue[0]);
const reconciling = queue[0].state === 'reconciling_steer';
const busy = sendingNow || headFenced;
@@ -3536,7 +3543,11 @@ export const QueueStrip: React.FC<{
{reconciling && (
<p role="status" className="px-1 pb-1.5 text-[11px] text-muted">{t('chat.queue.sendReconciling')}</p>
)}
- {retryRequired && <p className="px-1 pb-1.5 text-[11px] text-muted">{t('chat.queue.retryHint')}</p>}
+ {retryRequired && (
+ <p className="px-1 pb-1.5 text-[11px] text-muted">
+ {t(agentUnavailable ? 'chat.queue.retryHintAgentUnavailable' : 'chat.queue.retryHint')}
+ </p>
+ )}
<div
data-queue-batch="true"
className="flex max-h-32 flex-col overflow-y-auto rounded-lg bg-surface-2"
@@ -3948,12 +3959,16 @@ function transcriptOwnsUpwardInput(target: EventTarget, root: HTMLElement): bool
return true;
}
+const NO_AGENTS: VibeAgentBrief[] = [];
+
interface TranscriptProps {
messages: WorkbenchMessage[];
session: WorkbenchSession;
agentDisplayName: string | null;
/** The backend the replies come from, resolved through an inherited default. */
agentBackend?: string | null;
+ /** The Agents a reply's recorded author is resolved against (``messageAuthorAgent``). */
+ agents?: VibeAgentBrief[];
working: boolean;
modelRecovery?: SessionRuntimeState['model_recovery'];
hasOlder: boolean;
@@ -4019,6 +4034,7 @@ export const Transcript: React.FC<TranscriptProps> = ({
session,
agentDisplayName,
agentBackend = null,
+ agents = NO_AGENTS,
working,
modelRecovery,
hasOlder,
@@ -4559,14 +4575,16 @@ export const Transcript: React.FC<TranscriptProps> = ({
// just below the turn's trigger).
const before = activity?.enabled ? activity.beforeAnchor.get(message.id) : undefined;
const after = activity?.enabled ? activity.afterAnchor.get(message.id) : undefined;
+ // A reply keeps the Agent that wrote it, which a switch may have replaced.
+ const author = message.author === 'agent' ? messageAuthorAgent(message, agents) : null;
return (
<Fragment key={message.id}>
{before?.map((group) => renderActivityChip(group))}
<MessageRow
message={message}
session={session}
- agentDisplayName={agentDisplayName}
- agentBackend={agentBackend}
+ agentDisplayName={author ? author.displayName : agentDisplayName}
+ agentBackend={author?.backend ?? agentBackend}
messageFontSize={messageFontSize}
onQuickReply={onQuickReply}
onFailureRetry={onFailureRetry}
diff --git a/ui/src/components/workbench/ChatQueueRow.test.tsx b/ui/src/components/workbench/ChatQueueRow.test.tsx
index de8eb9779..cca6420c4 100644
--- a/ui/src/components/workbench/ChatQueueRow.test.tsx
+++ b/ui/src/components/workbench/ChatQueueRow.test.tsx
@@ -190,6 +190,36 @@ describe('QueueStrip — compatible queued messages read as one batch', () => {
expect(screen.getByText('Queued · 1')).toBeTruthy();
});
+ it('says how to continue an input held because its Agent cannot run', () => {
+ render(
+ <I18nextProvider i18n={i18n}>
+ <QueueStrip
+ queue={[queued({ requires_explicit_retry: true, retry_reason: 'agent_unavailable' })]}
+ onRemove={vi.fn()} onRecall={vi.fn()} onSendNow={vi.fn()}
+ />
+ </I18nextProvider>,
+ );
+ expect(screen.getByText('Retry needed · 1')).toBeTruthy();
+ expect(screen.getByText(/The Agent can't run/)).toBeTruthy();
+ expect(screen.queryByText(/Automatic startup retries stopped/)).toBeNull();
+ });
+
+ it('keeps the general hint while another hold needs a different fix', () => {
+ render(
+ <I18nextProvider i18n={i18n}>
+ <QueueStrip
+ queue={[
+ queued({ id: 'agent-held', requires_explicit_retry: true, retry_reason: 'agent_unavailable' }),
+ queued({ id: 'startup-held', requires_explicit_retry: true, retry_reason: 'no_terminal_result' }),
+ ]}
+ onRemove={vi.fn()} onRecall={vi.fn()} onSendNow={vi.fn()}
+ />
+ </I18nextProvider>,
+ );
+ expect(screen.getByText(/Automatic startup retries stopped/)).toBeTruthy();
+ expect(screen.queryByText(/The Agent can't run/)).toBeNull();
+ });
+
it('gives immediate feedback and blocks duplicate sends while flushing', () => {
render(
<I18nextProvider i18n={i18n}>
diff --git a/ui/src/components/workbench/sessionAgentName.ts b/ui/src/components/workbench/sessionAgentName.ts
index cb200211d..ea0335e83 100644
--- a/ui/src/components/workbench/sessionAgentName.ts
+++ b/ui/src/components/workbench/sessionAgentName.ts
@@ -3,7 +3,7 @@
// under the current display name while a stale catalog entry cannot claim it.
// Pure so the precedence is asserted without mounting the page
// (see ChatArchivedReadOnly.test.tsx).
-import type { VibeAgentBrief, WorkbenchSession } from '../../context/ApiContext';
+import type { VibeAgentBrief, WorkbenchMessage, WorkbenchSession } from '../../context/ApiContext';
export function sessionAgentDisplayName(
session: Pick<WorkbenchSession, 'agent_id' | 'agent_name'>,
@@ -34,3 +34,26 @@ export function sessionAgentBackend(
: defaultAgentName ? agents.find((candidate) => candidate.name === defaultAgentName) : undefined;
return agent?.backend ?? null;
}
+
+// Which Agent wrote one reply. A reply records that Agent's id and backend
+// (``author_agent_id``, ``author_backend`` in its metadata), so a session switched to
+// another Agent (say from Codex to Vibey) keeps its earlier replies under the Agent
+// that wrote them. The recorded identity is authoritative: the name comes from the
+// catalog by that id, else the name recorded with the reply, so neither a reused name
+// nor a missing catalog or route (a read-only viewer) can misattribute it. ``null``
+// for a reply that records neither (written before replies recorded it), which reads
+// as the session's Agent, as before.
+export function messageAuthorAgent(
+ message: Pick<WorkbenchMessage, 'author_name' | 'metadata'>,
+ agents: VibeAgentBrief[],
+): { displayName: string; backend: string | null } | null {
+ const metadata = (message.metadata ?? {}) as Record<string, unknown>;
+ const text = (value: unknown) => (typeof value === 'string' ? value.trim() : '');
+ const agentId = text(metadata.author_agent_id);
+ const backend = text(metadata.author_backend);
+ if (!agentId && !backend) return null;
+ const agent = agentId ? agents.find((candidate) => candidate.id === agentId) : undefined;
+ const displayName = agent?.display_name?.trim() || text(message.author_name) || agent?.name || backend;
+ if (!displayName) return null;
+ return { displayName, backend: backend || agent?.backend || null };
+}
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index 268746c1c..bbb0f374f 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -5224,6 +5224,7 @@
"title": "Queued · {{count}}",
"retryRequired": "Retry needed · {{count}}",
"retryHint": "Automatic startup retries stopped after failure. Your input is retained. Resolve the error, then use Send now or Retry on the failure notice.",
+ "retryHintAgentUnavailable": "The Agent can't run, so your input is kept. Use Continue on Vibey on the failure notice, or Send now once the Agent is back.",
"sendNow": "Send now",
"sendingNow": "Sending…",
"confirmingNow": "Send status not confirmed",
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index 1d7782379..5b9a61036 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -5223,6 +5223,7 @@
"queue": {
"retryRequired": "等待手动重试 · {{count}}",
"retryHint": "启动失败,自动重试已停止,原输入已保留。排查错误后,点击“立即发送”或失败提示上的“重试”。",
+ "retryHintAgentUnavailable": "Agent 无法运行,原输入已保留。可以点失败提示上的“切换到 Vibey 继续”,或在 Agent 恢复后点“立即发送”。",
"title": "排队中 · {{count}}",
"sendNow": "立即发送",
"sendingNow": "发送中…",
diff --git a/vibe/i18n/en.json b/vibe/i18n/en.json
index f3174c1d2..a26a07fda 100644
--- a/vibe/i18n/en.json
+++ b/vibe/i18n/en.json
@@ -469,11 +469,12 @@
"processMessageFailed": "Error: {error}",
"agentUnavailable": {
"disabled": "{agent} is turned off, so this session can't continue on it.",
- "missing": "{agent} was deleted, so this session can't continue on it."
+ "missing": "{agent} was deleted, so this session can't continue on it.",
+ "resendLater": "This message won't run later; send it again once the Agent is back."
},
"continueOnVibey": {
"workbench": "Switch to Vibey to pick up right where you left off.",
- "im": "Open this session in the Avibe Workbench and switch it to Vibey to keep going."
+ "im": "Switch this session to Vibey in the Avibe Workbench, then send this message again."
},
"streamTurnInProgress": "⚠️ A reply is already streaming for this session — wait for it to finish, then try again.",
"sessionReset": "Session error detected. Session has been reset. Please try your message again.",
diff --git a/vibe/i18n/zh.json b/vibe/i18n/zh.json
index 5904581a3..2537aa6e5 100644
--- a/vibe/i18n/zh.json
+++ b/vibe/i18n/zh.json
@@ -469,11 +469,12 @@
"processMessageFailed": "出错:{error}",
"agentUnavailable": {
"disabled": "{agent} 已停用,这个会话没法再用它继续。",
- "missing": "{agent} 已被删除,这个会话没法再用它继续。"
+ "missing": "{agent} 已被删除,这个会话没法再用它继续。",
+ "resendLater": "这条消息不会自动重发,Agent 恢复后请重新发送。"
},
"continueOnVibey": {
"workbench": "可以一键切换到 Vibey,无缝接着做。",
- "im": "可以在 Avibe 工作台打开这个会话,切换到 Vibey 接着做。"
+ "im": "可以在 Avibe 工作台把这个会话切换到 Vibey,再重新发送这条消息。"
},
"streamTurnInProgress": "⚠️ 这个会话已经有一条回复在生成中,请等它完成后再试。",
"sessionReset": "检测到会话错误。会话已重置,请重试。",
diff --git a/vibe/ui_server.py b/vibe/ui_server.py
index d154fffb9..c97ce0a02 100644
--- a/vibe/ui_server.py
+++ b/vibe/ui_server.py
@@ -10092,8 +10092,11 @@ async def sessions_bootstrap(session_id: str):
agents_payload = {"agents": [], "default_agent_name": None}
if can_chat:
try:
+ # Disabled and archived Agents too: a reply keeps the name of the Agent
+ # that wrote it, which may have been disabled since. Pickers offer only
+ # enabled ones.
agents_payload = vibe_api.get_vibe_agents(
- include_disabled=False,
+ include_disabled=True,
include_archived=True,
)
except Exception: