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(activity): explain native searches cut off by an interrupted model response (#3073)
Call White475cc6dec59a
diff --git a/core/hosted_activity.py b/core/hosted_activity.pyindex 4772cfbf6..14e44d6ca 100644--- a/core/hosted_activity.py+++ b/core/hosted_activity.py@@ -186,6 +186,8 @@ class HostedActivity:switch: Optional[HostedSwitch] = None# Policy refusal: the service ids already sent this URL; empty means no forwarding.policy_sources: Optional[tuple[str, ...]] = None+ # Display-only category of the owning model response's failure, never provider text.+ interruption: Optional[Literal["overloaded", "disconnected", "upstream"]] = None@propertydef completed(self) -> bool:@@ -225,6 +227,7 @@ class HostedActivity:"duration_ms": self.duration_ms,"response_id": self.response_id,"executor_kind": self.executor_kind,+ "interruption": self.interruption,}payload.update({key: value for key, value in optional.items() if value is not None})if self.policy_sources is not None:@@ -307,13 +310,31 @@ def _image_payload(image: HostedImage) -> dict[str, Any]:def _subject(action: HostedAction) -> tuple[Optional[str], tuple[str, ...]]:if action.type == "search" and action.queries:return action.queries[0], tuple(action.queries[1:])- for name in ("query", "prompt", "pattern", "url", "ref", "name"):+ # ``other.name`` names a provider item type, not the subject of the action.+ for name in ("query", "prompt", "pattern", "url", "ref"):value = getattr(action, name)if value:return value, ()return None, ()+def response_interruption(message: AssistantMessage) -> Optional[Literal["overloaded", "disconnected", "upstream"]]:+ """A deliberately small, sanitized display vocabulary, not a retry decision.++ The model error belongs to pending calls only. Completed calls and Anthropic+ deferred exchanges keep their existing outcome. No provider diagnostic leaves+ this boundary, even when it contains URLs, request ids or credentials.+ """+ if message.stop_reason != "error":+ return None+ error = (message.error_message or "").lower()+ if "overloaded" in error or "overloaded_error" in error:+ return "overloaded"+ if "stream disconnected" in error or "stream ended" in error or "connection reset" in error:+ return "disconnected"+ return "upstream"++def native_activities(message: AssistantMessage,*,@@ -373,6 +394,7 @@ def native_activities(cost=summary.cost if last and summary is not None else None,cost_calls=len(blocks),response_id=response_id,+ interruption=response_interruption(message) if block.record.status == "pending" else None,))return activities@@ -792,6 +814,11 @@ def hosted_line(activity: HostedActivity, lang: str, *, escape: Callable[[str],parts[0] += " " + (subject if activity.fetch is not None else i18n_t("hostedTools.quoted", lang, subject=subject))if activity.completed:parts.extend(_ran(activity, lang, escape))+ elif activity.interruption is not None:+ parts.append(i18n_t(+ "hostedTools.interruption.message", lang,+ reason=i18n_t(f"hostedTools.interruption.{activity.interruption}", lang),+ ))elif activity.policy_sources is not None:names = {a.source_id: a.label for a in activity.attempts or ()}providers = i18n_t("hostedTools.listSeparator", lang).join(diff --git a/storage/agent_activity_service.py b/storage/agent_activity_service.pyindex 1e0962a43..93653ee20 100644--- a/storage/agent_activity_service.py+++ b/storage/agent_activity_service.py@@ -41,10 +41,11 @@ import jsonfrom datetime import datetime, timezonefrom typing import Any, Optional-from sqlalchemy import select+from sqlalchemy import func, selectfrom core.agent_core.hosted_continuations import pending_hostedfrom core.agent_core.messages import AssistantMessage, message_from_dict+from core.hosted_activity import native_activitiesfrom core.backend_failure import is_backend_failure_notificationfrom storage import agent_events_service, messages_servicefrom storage.models import message_deliveries, messages, session_turns@@ -250,11 +251,14 @@ def _event_emit_micros(event: dict[str, Any], ts: datetime) -> int:return anchor - 1 if isinstance(precedes, str) and precedes else anchor-def _without_deferred_traces(conn, session_id: str, events: list[dict[str, Any]]) -> list[dict[str, Any]]:- """Old releases emitted interrupted cards for calls Anthropic deferred, which never ran.+def _project_native_traces(+ conn, session_id: str, events: list[dict[str, Any]], retained_message_ids: tuple[str, ...],+) -> list[dict[str, Any]]:+ """Read-only repair of released pending cards, using their own committed response.- Suppress only that exact shape, using each trace's own response. No fragment- merging or position changes; every other pending/terminal card stays as written.+ Deferred calls still disappear (#2926). A later canonical response in the same+ Turn proves a retry; timestamps, narration and a new user Turn do not. Both+ reads seek bounded retained ids, never scan a Session's growing history."""candidates = {}for event in events:@@ -265,19 +269,47 @@ def _without_deferred_traces(conn, session_id: str, events: list[dict[str, Any]]candidates[event["id"]] = (response_id, card.get("call_id"))if not candidates:return events- deferred = set()- for row_id, owner_session, raw in conn.execute(select(messages.c.id, messages.c.session_id, messages.c.content_json).where(- messages.c.id.in_({owner for owner, _ in candidates.values()})+ latest: dict[str, int] = {}+ for turn_id, seq in conn.execute(select(+ func.json_extract(messages.c.metadata_json, "$.turn_id"), messages.c.context_seq,+ ).where(+ messages.c.id.in_(retained_message_ids), messages.c.session_id == session_id,+ messages.c.context_seq.is_not(None),+ func.json_extract(messages.c.content_json, "$.model.message.role") == "assistant",)):+ if isinstance(turn_id, str) and turn_id:+ latest[turn_id] = max(latest.get(turn_id, -1), seq)+ deferred = set()+ projected = {}+ for row_id, owner_session, raw, metadata, seq in conn.execute(select(+ messages.c.id, messages.c.session_id, messages.c.content_json, messages.c.metadata_json, messages.c.context_seq,+ ).where(messages.c.id.in_({owner for owner, _ in candidates.values()}))):if owner_session != session_id:continuetry:message = message_from_dict(json.loads(raw or "{}")["model"]["message"])- except (KeyError, TypeError, ValueError):+ turn_id = (json.loads(metadata or "{}") or {}).get("turn_id")+ except (KeyError, TypeError, ValueError, AttributeError):continueif isinstance(message, AssistantMessage):deferred.update((row_id, call_id) for call_id in pending_hosted(message))- return [event for event in events if candidates.get(event["id"]) not in deferred]+ for activity in native_activities(message, response_id=row_id):+ if activity.status == "pending":+ fields = {"action": activity.action, "subject": activity.subject, "interruption": activity.interruption}+ if activity.interruption and isinstance(turn_id, str) and seq is not None and latest.get(turn_id, -1) > seq:+ fields["retried"] = True+ projected[row_id, activity.call_id] = fields+ result = []+ for event in events:+ owner = candidates.get(event["id"])+ if owner in deferred:+ continue+ if owner in projected:+ content = event["content"]+ card = {**content["hosted"], **projected[owner]}+ event = {**event, "content": {**content, "hosted": {key: value for key, value in card.items() if value is not None}}}+ result.append(event)+ return resultdef _timeline(conn, session_id: str, *, include_text: bool) -> list[dict[str, Any]]:@@ -297,7 +329,7 @@ def _timeline(conn, session_id: str, *, include_text: bool) -> list[dict[str, Anlimit=EVENT_SCAN_LIMIT,newest_first=True,)- events = _without_deferred_traces(conn, session_id, events)+ events = _project_native_traces(conn, session_id, events, tuple(str(msg["id"]) for msg in msgs))message_ids = tuple(str(message["id"])for message in msgsdiff --git a/tests/test_agent_activity_service.py b/tests/test_agent_activity_service.pyindex 68bd14ec1..4545cde6e 100644--- a/tests/test_agent_activity_service.py+++ b/tests/test_agent_activity_service.py@@ -396,6 +396,49 @@ async def test_reload_omits_only_old_deferred_search_cards(isolated_state, stop_)[email protected]("later_turn", [None, "same", "different"])+def test_pending_native_trace_is_reprojected_from_its_response_without_rewriting_it(isolated_state, later_turn):+ """Old card text lost the response error; a same-Turn later response proves a retry, not a later user turn."""+ from core.agent_core.messages import AssistantMessage, HostedAction, HostedNative, HostedRecord, HostedSummary, HostedToolBlock, Origin, TextBlock, message_to_dict++ engine = create_sqlite_engine()+ sid = "ses_interrupted"+ partial = AssistantMessage(+ content=(HostedToolBlock(id="ws_cut", tool="web_search", action=HostedAction(type="other", name="web_search_call"),+ record=HostedRecord(status="pending"), native=HostedNative(source_id="src_relaygpt1", payload=({"type": "web_search_call"},))),),+ origin=Origin(provider="openai", api="openai_responses", model="test-model"), stop_reason="error",+ error_message="Our servers are currently overloaded. secret detail", hosted_summary=HostedSummary(),+ )+ with engine.begin() as conn:+ scope = _seed_session(conn, session_id=sid)+ _msg(conn, scope, sid, mid="m_user", mtype="user", author="user", created_at="2026-06-01T10:00:00Z", text="q", source="user")+ _msg(conn, scope, sid, mid="m_partial", mtype="assistant", author="agent", created_at="2026-06-01T10:00:01Z",+ metadata={"turn_id": "same"}, content={"model": {"message": message_to_dict(partial)}})+ conn.execute(messages.update().where(messages.c.id == "m_partial").values(context_seq=1))+ card = {"version": 1, "call_id": "ws_cut", "tool": "web_search", "mode": "native", "status": "pending",+ "action": "other", "subject": "web_search_call", "response_id": "m_partial", "sources": [], "images": []}+ conn.execute(agent_events.insert().values(+ id="e_cut", scope_id=scope, session_id=sid, platform="avibe", event_type="tool_call", visibility="trace",+ content_text="old interrupted line", content_json=json.dumps({"kind": "toolcall", "hosted": card}),+ metadata_json=json.dumps({"precedes_message_id": "m_partial"}), source="agent",+ created_at="2026-06-01T10:00:02Z", updated_at="2026-06-01T10:00:02Z",+ ))+ if later_turn:+ later = AssistantMessage(content=(TextBlock(text="done"),), origin=partial.origin, stop_reason="stop")+ _msg(conn, scope, sid, mid="m_later", mtype="result", author="agent", created_at="2026-06-01T10:00:03Z", text="done",+ metadata={"turn_id": later_turn}, content={"model": {"message": message_to_dict(later)}})+ conn.execute(messages.update().where(messages.c.id == "m_later").values(context_seq=2))+ with engine.connect() as conn:+ groups = agent_activity_service.list_turn_groups(conn, session_id=sid)["groups"]+ rows = [row for group in groups for row in agent_activity_service.get_turn_group(conn, session_id=sid, group_id=group["id"])["rows"]]+ [shown] = [row["hosted"] for row in rows if row.get("hosted")]+ assert not shown.get("subject")+ assert shown["interruption"] == "overloaded"+ assert bool(shown.get("retried")) == (later_turn == "same")+ assert "secret" not in json.dumps(shown)+ assert json.loads(conn.execute(select(agent_events.c.content_json).where(agent_events.c.id == "e_cut")).scalar())["hosted"] == card++def test_a_native_hosted_card_stays_with_its_response_at_the_scan_window_edge(isolated_state, monkeypatch):"""The card sorts just ahead of its response, but belongs to the window that response is in.diff --git a/tests/test_hosted_activity.py b/tests/test_hosted_activity.pyindex 6edde91ef..2d67a30e0 100644--- a/tests/test_hosted_activity.py+++ b/tests/test_hosted_activity.py@@ -246,6 +246,40 @@ def test_a_source_no_browser_should_open_is_named_but_not_linked():]+ ("error", "category", "en", "zh"),+ [+ ("Our servers are currently overloaded. Please try again later.", "overloaded", "upstream overloaded", "上游服务过载"),+ ("stream disconnected before completion", "disconnected", "stream disconnected", "连接中断"),+ ("private upstream error: https://secret.invalid/?token=private", "upstream", "upstream error", "上游服务异常"),+ ],+)+def test_pending_native_search_explains_response_interruption_without_a_provider_subject(error, category, en, zh):+ """MH-HOSTED-UI-014: pending calls inherit a sanitized response failure, not a fake query.++ Existing status tests cover only the call record, not an error on its owning response.+ """+ message = replace(+ _message(+ replace(_search("ws_cut", "unused", status="pending"), action=HostedAction(type="other", name="web_search_call")),+ summary=HostedSummary(),+ ),+ stop_reason="error", error_message=error,+ )+ [activity] = native_activities(message)+ assert activity.subject is None+ assert activity.to_payload() == {**FIXTURE["native_interrupted"], "interruption": category}+ assert error not in json.dumps(activity.to_payload())+ assert hosted_line(activity, "en") == f"🔎 Web search · Model response interrupted: {en}"+ assert hosted_line(activity, "zh") == f"🔎 网页搜索 · 模型回复中断:{zh}"+ # No reason is invented on success, and completed calls keep their own outcome.+ [successful] = native_activities(replace(message, stop_reason="stop", error_message=None))+ assert "interruption" not in successful.to_payload()+ [completed] = native_activities(replace(message, content=(_search("ws_done", "known query"),)))+ assert "interruption" not in completed.to_payload()+ assert completed.subject == "known query"++@pytest.mark.parametrize("stop_reason", ["tool_use", "error", "aborted"])async def test_deferred_search_has_no_card_or_share_of_an_earlier_search_cost(stop_reason):"""The producer omits only a deferred call; stream cuts keep interrupted cards.diff --git a/tests/test_vibey_agent.py b/tests/test_vibey_agent.pyindex df890b0b3..811738ab4 100644--- a/tests/test_vibey_agent.py+++ b/tests/test_vibey_agent.py@@ -1310,6 +1310,69 @@ async def test_a_transient_failure_continues_from_the_same_transcript_without_a_assert harness.controller.terminals[-1]["is_error"] is False[email protected]("platform", ["avibe", "telegram"])[email protected]("language", ["en", "zh"])+async def test_interrupted_native_search_emits_immediately_and_only_web_projects_a_proven_retry(+ engine, session, tmp_path, published, continuation_policy, monkeypatch, platform, language,+):+ """The real delivery path emits once before recovery; read-time evidence never rewrites IM or stored cards."""+ from core.agent_core.ai.provider import ProviderError+ from storage import agent_activity_service++ continuation_policy(initial_delay_s=0)+ monkeypatch.setattr("core.message_mirror._activity_streaming_enabled", lambda: True)+ partial = AssistantMessage(+ content=(HostedToolBlock(+ id="ws_cut", tool="web_search", action=HostedAction(type="other", name="web_search_call"),+ record=HostedRecord(status="pending"),+ native=HostedNative(source_id="src_relaygpt1", payload=({"type": "web_search_call", "status": "in_progress"},)),+ ),), origin=ORIGIN, stop_reason="error", error_message="Our servers are currently overloaded.",+ hosted_summary=HostedSummary(),+ )+ entered, release = asyncio.Event(), asyncio.Event()+ async def recover(request, cancel):+ entered.set()+ await release.wait()+ yield Done(assistant("recovered"))++ harness = _Harness(engine, tmp_path, platform, [+ [ProviderError("server", partial.error_message, False, partial=partial, continuable=True)], recover,+ ], language=language)+ harness.controller.im_client.supports_message_editing = lambda context=None: False+ running = asyncio.create_task(harness.agent.handle_message(harness.request("search")))+ def cards():+ with engine.connect() as conn:+ groups = agent_activity_service.list_turn_groups(conn, session_id=SESSION)["groups"]+ return [row["hosted"] for group in groups for row in agent_activity_service.get_turn_group(+ conn, session_id=SESSION, group_id=group["id"],+ )["rows"] if row.get("hosted")]+ try:+ await asyncio.wait_for(entered.wait(), timeout=5)+ [before] = cards()+ assert before["interruption"] == "overloaded" and not before.get("retried")+ assert not before.get("subject")+ finally:+ release.set()+ await asyncio.wait_for(running, timeout=10)+ [after] = cards()+ assert after["retried"] is True+ with engine.connect() as conn:+ traces = conn.execute(select(agent_events.c.content_json, agent_events.c.content_text).where(+ agent_events.c.session_id == SESSION, agent_events.c.event_type == "tool_call",+ )).all()+ [(raw, line)] = [(raw, line) for raw, line in traces if json.loads(raw).get("hosted")]+ stored = json.loads(raw)["hosted"]+ assert stored["interruption"] == "overloaded" and "retried" not in stored+ assert line == ("🔎 Web search · Model response interrupted: upstream overloaded" if language == "en"+ else "🔎 网页搜索 · 模型回复中断:上游服务过载")+ if platform == "telegram":+ assert harness.controller.im_client.sent.count(line) == 1+ else:+ live = [payload["content"]["hosted"] for name, payload in published+ if name == "message.new" and (payload.get("content") or {}).get("hosted")]+ assert live == [stored]++@pytest.mark.parametrize("output", ["text", "thinking", "tool", "complete-tool", "search"])@pytest.mark.parametrize("refusal", ["prefill", "encrypted"])@pytest.mark.parametrize("again", [False, True])diff --git a/ui/src/components/workbench/ChatPage.hydration.test.tsx b/ui/src/components/workbench/ChatPage.hydration.test.tsxindex 77a67ae6f..a75242bef 100644--- a/ui/src/components/workbench/ChatPage.hydration.test.tsx+++ b/ui/src/components/workbench/ChatPage.hydration.test.tsx@@ -990,6 +990,35 @@ describe('ChatPage transcript hydration', () => {expect(screen.getByText('second active step')).toBeTruthy();});+ it('refreshes live interrupted searches from the same durable projection used on reload', async () => {+ // SSE arrival itself is not retry evidence: only the read-side projection can add it.+ mocks.api.getSession.mockResolvedValue({ id: 'session-new' });+ mocks.api.getSessionBootstrap.mockResolvedValue({+ ...bootstrapPayload('session-new'), config: { ui: { show_agent_activity: true } },+ });+ render(<MemoryRouter initialEntries={['/chat/session-new']}><Routes>+ <Route path="/chat/:sessionId" element={<ChatPage />} />+ </Routes></MemoryRouter>);+ await waitFor(() => expect(mocks.api.getSessionActivity).toHaveBeenCalled());+ const hosted = { version: 1, call_id: 'ws_cut', tool: 'web_search', mode: 'native', status: 'pending',+ action: 'other', interruption: 'overloaded', sources: [], images: [] };+ act(() => {+ mocks.events?.onTurnStart({ session_id: 'session-new' });+ mocks.events?.onMessageNew({ ...projectedMessage('cut', 'cut off'), author: 'agent', type: 'tool_call',+ content: { hosted } });+ });+ expect(screen.getByText('chat.agentActivity.hosted.interruption.message')).toBeTruthy();+ mocks.api.getSessionActivity.mockClear();+ const group = { id: 'cut', anchor_message_id: null, anchor_position: 'after', open: true, status: 'interrupted', steps: 2, duration_ms: null };+ mocks.api.getSessionActivity.mockResolvedValue({ groups: [group] });+ mocks.api.getSessionActivityGroup.mockResolvedValue({ ...group, rows: [{+ id: 'cut', kind: 'tool_call', text: 'cut off', created_at: '2026-08-15T00:00:00Z', hosted: { ...hosted, retried: true },+ }] });+ act(() => mocks.events?.onMessageNew({ ...projectedMessage('later', 'continued'), author: 'agent', type: 'assistant' }));+ await waitFor(() => expect(mocks.api.getSessionActivity).toHaveBeenCalled());+ await waitFor(() => expect(screen.getByText(/chat.agentActivity.hosted.interruption.retried/)).toBeTruthy());+ });+describe.each([false, true])('restart notice with Activity enabled=%s', (activityEnabled) => {it.each(['live', 'bootstrap'])('keeps newer work thinking after a %s notice', async (delivery) => {// MESSAGE-DELIVERY-030: cover both message.new and a persisted reload.diff --git a/ui/src/components/workbench/ChatPage.tsx b/ui/src/components/workbench/ChatPage.tsxindex 7010baead..929c25e49 100644--- a/ui/src/components/workbench/ChatPage.tsx+++ b/ui/src/components/workbench/ChatPage.tsx@@ -145,6 +145,7 @@ import { ActivityCard, ActivityChip } from './AgentActivityGroup';import {activityGroupsForForeground,activityRowFromMessage,+ hasUnconfirmedHostedInterruption,groupFromWire,initialLiveActivity,isActivityMessageType,@@ -1740,6 +1741,7 @@ export const ChatPage: React.FC = () => {// activity buffer.if (showAgentActivityRef.current && isActivityMessageType(msg.type)) {if (!historicalWindowRef.current) ingestActivityRow(msg);+ if (hasUnconfirmedHostedInterruption(liveStateRef.current.rows)) scheduleActivityRefresh();return;}if (!isTranscriptMessage(msg)) return;diff --git a/ui/src/components/workbench/HostedToolRow.test.tsx b/ui/src/components/workbench/HostedToolRow.test.tsxindex 24b536300..3591c92f3 100644--- a/ui/src/components/workbench/HostedToolRow.test.tsx+++ b/ui/src/components/workbench/HostedToolRow.test.tsx@@ -53,6 +53,32 @@ const row = (callId: string) => document.querySelector(`[data-hosted-call="${calafterEach(() => cleanup());describe('hosted tool cards', () => {+ it.each(['en', 'zh'] as const)('explains interrupted responses without inventing a subject in %s, live and reloaded', (lng) => {+ for (const [interruption, reason] of [+ ['overloaded', lng === 'en' ? 'upstream overloaded' : '上游服务过载'],+ ['disconnected', lng === 'en' ? 'stream disconnected' : '连接中断'],+ ['upstream', lng === 'en' ? 'upstream error' : '上游服务异常'],+ ]) {+ for (const retried of [false, true]) {+ renderGroup([{+ ...fixture.native_interrupted, subject: 'web_search_call', interruption, retried,+ }], lng);+ const card = row('ws_cut');+ expect(card.textContent).not.toContain('web_search_call');+ within(card).getByText(`${lng === 'en' ? 'Model response interrupted: ' : '模型回复中断:'}${reason}`);+ expect(card.textContent?.includes(lng === 'en' ? 'retried automatically' : '已自动重试')).toBe(retried);+ fireEvent.click(within(card).getByRole('button'));+ expect(card.textContent).not.toMatch(/Ran natively|Native ·|原生|web_search_call/);+ cleanup();+ }+ }+ });++ it('suppresses a provider item type even when an old card has no action field', () => {+ renderGroup([{ ...fixture.native_interrupted, action: undefined, subject: 'web_search_call' }]);+ expect(row('ws_cut').textContent).not.toContain('web_search_call');+ });+it.each(['en', 'zh'] as const)('WF-1: historical fetch is readable, counted by characters and inert in %s', (lng) => {const content = 'Hello 😀';renderGroup([{@@ -104,6 +130,7 @@ describe('hosted tool cards', () => {within(native).getByText('2 sources');const proxy = row('call_x1');+ within(proxy).getByText('from:OpenAI within_time:7d');within(proxy).getByText('Via xAI proxy · grok-4.6');within(proxy).getByText('$0.11');within(proxy).getByText('2 posts');@@ -145,6 +172,7 @@ describe('hosted tool cards', () => {}]);const image = row('call_ig1');within(image).getByText('image_generate');+ within(image).getByText(fixture.direct_image.subject);within(image).getByText('gpt-image-2 · relay-gpt');within(image).getByText('1 image · 1536×1024');expect(image.textContent).not.toMatch(/\$/);diff --git a/ui/src/components/workbench/HostedToolRow.tsx b/ui/src/components/workbench/HostedToolRow.tsxindex e29c16416..1c9ff989d 100644--- a/ui/src/components/workbench/HostedToolRow.tsx+++ b/ui/src/components/workbench/HostedToolRow.tsx@@ -423,6 +423,12 @@ export const HostedToolRow: React.FC<{ card: HostedActivity }> = ({ card }) => {{count && <span className="hidden shrink-0 text-[11px] text-muted sm:inline">{count}</span>}<ChevronRight className={clsx('size-3.5 shrink-0 text-muted transition-transform', open && 'rotate-90')} aria-hidden="true" /></button>+ {card.interruption && (+ <p className="mx-1.5 mb-1 flex flex-wrap gap-x-2 px-1.5 text-[11px] text-muted" data-hosted-interruption={card.call_id}>+ <span>{t('chat.agentActivity.hosted.interruption.message', { reason: t(`chat.agentActivity.hosted.interruption.${card.interruption}`) })}</span>+ {card.retried && <span>{t('chat.agentActivity.hosted.interruption.retriedLabel')}</span>}+ </p>+ )}<HostedAttemptNotes card={card} /><FallbackNote card={card} />{open && <HostedDetail card={card} />}diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.jsonindex 1612056f0..d1fc006f7 100644--- a/ui/src/i18n/en.json+++ b/ui/src/i18n/en.json@@ -5390,6 +5390,14 @@"listSeparator": ", ","itemSeparator": "; ","switch": "{{failed}}; switched to {{provider}}",+ "interruption": {+ "message": "Model response interrupted: {{reason}}",+ "overloaded": "upstream overloaded",+ "disconnected": "stream disconnected",+ "upstream": "upstream error",+ "retried": "retried automatically",+ "retriedLabel": "· retried automatically"+ },"status": {"failed": "Failed","incomplete": "Incomplete",diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.jsonindex 8def6b80e..24278cd75 100644--- a/ui/src/i18n/zh.json+++ b/ui/src/i18n/zh.json@@ -5390,6 +5390,14 @@"listSeparator": "、","itemSeparator": ";","switch": "{{failed}},已改用 {{provider}}",+ "interruption": {+ "message": "模型回复中断:{{reason}}",+ "overloaded": "上游服务过载",+ "disconnected": "连接中断",+ "upstream": "上游服务异常",+ "retried": "已自动重试",+ "retriedLabel": "· 已自动重试"+ },"status": {"failed": "失败","incomplete": "未完成",diff --git a/ui/src/lib/agentActivity.ts b/ui/src/lib/agentActivity.tsindex b9f452d59..60bf98ca6 100644--- a/ui/src/lib/agentActivity.ts+++ b/ui/src/lib/agentActivity.ts@@ -128,6 +128,11 @@ export const activityRowFromMessage = (msg: WorkbenchMessage): ActivityRow => ({hosted: hostedActivityFrom((msg.content as { hosted?: unknown } | null | undefined)?.hosted),});+// A retry is never inferred from SSE order. Ask the durable projection to refresh+// interrupted native cards when subsequent activity arrives; reload uses it too.+export const hasUnconfirmedHostedInterruption = (rows: ActivityRow[]): boolean =>+ rows.some((row) => row.hosted?.interruption !== undefined && !row.hosted.retried);+// ===== Live running-card buffer: a pure state machine (state, not timing) =====// The live buffer drives ONLY the in-flight running card; all SETTLED groups come// from the durable endpoint. Each Activity phase is tagged with a monotonic GENERATION sodiff --git a/ui/src/lib/hostedActivity.fixture.json b/ui/src/lib/hostedActivity.fixture.jsonindex 160e255a2..1512638d7 100644--- a/ui/src/lib/hostedActivity.fixture.json+++ b/ui/src/lib/hostedActivity.fixture.json@@ -19,6 +19,20 @@"images": [],"cost": { "basis": "list", "usd": 0.01, "calls": 1 }},+ "native_interrupted": {+ "version": 1,+ "call_id": "ws_cut",+ "tool": "web_search",+ "mode": "native",+ "status": "pending",+ "action": "other",+ "provider": "anthropic",+ "source_id": "src_relayclaude",+ "model": "claude-opus-5-5",+ "sources": [],+ "images": [],+ "interruption": "overloaded"+ },"proxy_x_search": {"version": 1,"call_id": "call_x1",diff --git a/ui/src/lib/hostedActivity.ts b/ui/src/lib/hostedActivity.tsindex e83ea240b..498f977e7 100644--- a/ui/src/lib/hostedActivity.ts+++ b/ui/src/lib/hostedActivity.ts@@ -79,6 +79,10 @@ export type HostedActivity = {error?: string;/** The stable code of a reason Avibe worded itself, shown in the reader's language. */error_code?: string;+ /** Sanitized category of the owning response failure; not the search's own error. */+ interruption?: 'overloaded' | 'disconnected' | 'upstream';+ /** Read-time evidence: a later committed response in the same Turn. Never predicted by IM. */+ retried?: boolean;/** The query, prompt, page or thread the call named. */subject?: string;action?: string;@@ -142,6 +146,15 @@ const fetchFrom = (raw: unknown): WebFetchRecord | undefined => {return record as unknown as WebFetchRecord;};+const PROVIDER_ITEM_SUBJECTS = new Set([+ 'web_search_call', 'web_search_tool_result', 'server_tool_use', 'custom_tool_call',+]);+const nativeSubject = (card: Record<string, unknown>): string | undefined => {+ if (card.mode !== 'native') return typeof card.subject === 'string' ? card.subject : undefined;+ if (card.action === 'other' || PROVIDER_ITEM_SUBJECTS.has(card.subject as string)) return undefined;+ return typeof card.subject === 'string' ? card.subject : undefined;+};+/** The card a row carries, or undefined for anything that is not one this client reads. */export const hostedActivityFrom = (raw: unknown): HostedActivity | undefined => {if (!raw || typeof raw !== 'object') return undefined;@@ -152,6 +165,11 @@ export const hostedActivityFrom = (raw: unknown): HostedActivity | undefined =>if (typeof card.status !== 'string' || !STATUSES.includes(card.status)) return undefined;const projected = {...(card as unknown as HostedActivity),+ // Released native ``other`` cards used their provider item type as a fake subject.+ subject: nativeSubject(card),+ interruption: card.mode === 'native' && card.status === 'pending' && ['overloaded', 'disconnected', 'upstream'].includes(card.interruption as string)+ ? card.interruption as HostedActivity['interruption'] : undefined,+ retried: card.retried === true,sources: Array.isArray(card.sources) ? (card.sources as HostedActivitySource[]).filter((s) => typeof s?.url === 'string' || typeof s?.title === 'string') : [],images: Array.isArray(card.images) ? (card.images as HostedActivityImage[]).filter((i) => typeof i?.path === 'string') : [],attempts: Array.isArray(card.attempts) ? card.attempts.map(attemptFrom).filter((attempt): attempt is HostedActivityAttempt => attempt !== undefined) : undefined,diff --git a/vibe/i18n/en.json b/vibe/i18n/en.jsonindex b187a5695..578d67fbc 100644--- a/vibe/i18n/en.json+++ b/vibe/i18n/en.json@@ -1765,6 +1765,12 @@"listSeparator": ", ","itemSeparator": "; ","switch": "{failed}; switched to {provider}",+ "interruption": {+ "message": "Model response interrupted: {reason}",+ "overloaded": "upstream overloaded",+ "disconnected": "stream disconnected",+ "upstream": "upstream error"+ },"status": {"failed": "failed: {error}","incomplete": "incomplete: {error}",diff --git a/vibe/i18n/zh.json b/vibe/i18n/zh.jsonindex 2a1bfa8f0..02b4af02a 100644--- a/vibe/i18n/zh.json+++ b/vibe/i18n/zh.json@@ -1765,6 +1765,12 @@"listSeparator": "、","itemSeparator": ";","switch": "{failed},已改用 {provider}",+ "interruption": {+ "message": "模型回复中断:{reason}",+ "overloaded": "上游服务过载",+ "disconnected": "连接中断",+ "upstream": "上游服务异常"+ },"status": {"failed": "失败:{error}","incomplete": "未完成:{error}",