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(hosted-tools): name a compatible endpoint by its Source on hosted tool cards (#2883)

Call White6c85269c30d1
diff --git a/core/hosted_activity.py b/core/hosted_activity.py
index c02d2f5ae..6f990f622 100644
--- a/core/hosted_activity.py
+++ b/core/hosted_activity.py
@@ -322,12 +322,22 @@ def _chain_cost(execution: Optional[ProxyExecution]) -> tuple[Optional[HostedCos
return HostedCost(basis=basis, usd=round(sum(cost.usd or 0.0 for cost in priced), 6)), unpriced
-def _vendor_label(provider: Optional[str]) -> Optional[str]:
- if not provider:
+def _runner_label(activity: HostedActivity, escape: Callable[[str], str]) -> Optional[str]:
+ """Who ran a call, as the IM line names it: its vendor's catalog label, else the Source's own name.
+
+ A Source added as a compatible endpoint has the vendor id ``custom``, which names no vendor, so its name is the
+ only thing that tells the reader where the call ran. A Source name is the user's text, so it is made inert. A
+ vendor id with neither stays as it is, as for a row stored without a Source.
+ """
+
+ if not activity.provider:
return None
from vibe.model_hub_runtime.api_key_vendors import catalog_api_key_vendor_label
- return catalog_api_key_vendor_label(provider) or provider
+ label = catalog_api_key_vendor_label(activity.provider)
+ if label:
+ return label
+ return _untrusted(activity.source_name, escape) if activity.source_name else activity.provider
def _usd(value: float) -> str:
@@ -362,7 +372,7 @@ def _ran(activity: HostedActivity, lang: str, escape: Callable[[str], str]) -> l
size = f"{first.width}×{first.height}" if first is not None and first.width and first.height else None
more = _count(activity, lang) if len(activity.images) > 1 else None
return [_untrusted(activity.model, escape) if activity.model else None, size, more]
- vendor = _vendor_label(activity.provider)
+ vendor = _runner_label(activity, escape)
if not vendor:
mode = None
elif activity.mode == "proxy" and activity.fallback_source_id is not None:
diff --git a/docs/plans/vibey-hosted-tools.md b/docs/plans/vibey-hosted-tools.md
index c346ce065..6650cbc73 100644
--- a/docs/plans/vibey-hosted-tools.md
+++ b/docs/plans/vibey-hosted-tools.md
@@ -780,6 +780,10 @@ when metered, sources, failure reason); citations through the existing citation
`🔎 Web search "query" · native (xAI) · 6 sources · $0.01`. The image card shows the prompt, the image, the model
used and the cost; IM attaches the file.
+Who ran a call is its vendor's catalog label. A Source whose vendor the catalog does not name, as a compatible
+endpoint's `custom` does not, is named by its Source name in the vendor's place on both surfaces, and is not repeated
+beside it (amended 2026-10-20, #2873).
+
**When a search ran by proxy because the turn's own Source refused it** (`hosted.fallback_from`, set by Vibey on a
hop whose C-6 facts say `refused`), both surfaces say so, so the switch is never silent:
- the Web card keeps a note in view, collapsed or expanded: "relay-gpt 不支持网页搜索,已改用 Anthropic(relay-claude)"
diff --git a/tests/test_hosted_activity.py b/tests/test_hosted_activity.py
index 08630b561..e09db2f69 100644
--- a/tests/test_hosted_activity.py
+++ b/tests/test_hosted_activity.py
@@ -304,6 +304,23 @@ def test_a_response_scoped_summary_is_shown_once():
# A proxy that ran because the turn's own Source refused the tool says so, in place of how it ran.
(proxy_fallback, "zh", "🔎 网页搜索 “Anthropic announcements October 2026” · relay-gpt 不支持,已改用 Anthropic · 1 个来源 · ≈ $0.01"),
(proxy_fallback, "en", "🔎 Web search “Anthropic announcements October 2026” · relay-gpt doesn't support it, now using Anthropic · 1 source · ≈ $0.01"),
+ # A compatible endpoint's vendor id is custom, which names no vendor: its Source names who ran it (#2873).
+ (
+ lambda: replace(native_web_search(), provider="custom", source_name="My relay"),
+ "en",
+ "🔎 Web search “OpenAI announcements October 2026” · native (My relay) · 2 sources · ≈ $0.01",
+ ),
+ (
+ lambda: replace(proxy_x_search(), provider="custom", source_name="My relay"),
+ "zh",
+ "🔎 X 搜索 “from:OpenAI within_time:7d” · 由 My relay 代理(grok-4.6) · 2 条帖子 · $0.11",
+ ),
+ (
+ lambda: replace(proxy_fallback(), provider="custom", source_name="My relay"),
+ "en",
+ "🔎 Web search “Anthropic announcements October 2026” · relay-gpt doesn't support it, now using My relay"
+ " · 1 source · ≈ $0.01",
+ ),
],
)
def test_the_im_line_states_tool_query_mode_count_and_known_cost(build, lang, line):
@@ -416,11 +433,14 @@ def _slots(text: str):
"fallback source": fallback,
"executor model": replace(proxy_x_search(), model=text),
"image model": replace(direct_image(), model=text),
+ "compatible endpoint": replace(native_web_search(), provider="custom", source_name=text),
}
@pytest.mark.parametrize("text", HOSTILE)
[email protected]("slot", ["subject", "error", "fallback source", "executor model", "image model"])
+ "slot", ["subject", "error", "fallback source", "executor model", "image model", "compatible endpoint"],
+)
def test_the_im_line_leaves_no_mention_or_masked_link_live_in_untrusted_text(slot, text):
"""MH-HOSTED-UI-010: a query, a provider's error, and a user's Source or model name are not Avibe's words. The
line neutralizes their mentions and masked links before the platform escape, which alone leaves Discord's
diff --git a/ui/src/components/workbench/HostedToolRow.test.tsx b/ui/src/components/workbench/HostedToolRow.test.tsx
index ab8c494f8..b3f49184f 100644
--- a/ui/src/components/workbench/HostedToolRow.test.tsx
+++ b/ui/src/components/workbench/HostedToolRow.test.tsx
@@ -149,6 +149,21 @@ describe('hosted tool cards', () => {
expect(document.querySelector('[data-hosted-fallback]')).toBeNull();
});
+ it('MH-HOSTED-UI-008: names a compatible endpoint by its Source, not by the vendor id custom', () => {
+ // A Source added as a compatible endpoint has the vendor id `custom`, which names no vendor (#2873).
+ const relay = { provider: 'custom', source_id: 'src_myrelay01', source_name: 'My relay' };
+ renderGroup([
+ { ...fixture.native_web_search, ...relay },
+ { ...fixture.proxy_fallback, ...relay, model: 'gpt-6-luna' },
+ ]);
+ within(row('srvtoolu_01')).getByText('Native · My relay');
+ const proxy = row('call_w7');
+ within(proxy).getByText('Via My relay proxy · gpt-6-luna');
+ // Named in its vendor's place, the Source is not repeated in parentheses.
+ within(proxy).getByText("relay-gpt doesn't support web search, so My relay ran it");
+ expect(document.body.textContent).not.toMatch(/\bcustom\b/);
+ });
+
it.each([
['pending', undefined, 'Cut off'],
['failed', 'upstream timeout', 'Failed'],
diff --git a/ui/src/components/workbench/HostedToolRow.tsx b/ui/src/components/workbench/HostedToolRow.tsx
index 3588ec2fe..2df18dde3 100644
--- a/ui/src/components/workbench/HostedToolRow.tsx
+++ b/ui/src/components/workbench/HostedToolRow.tsx
@@ -25,8 +25,15 @@ const RAN_KEY: Record<HostedActivity['mode'], 'ranNative' | 'ranProxy' | 'ranDir
direct: 'ranDirect',
};
-const vendorLabel = (provider: string | undefined): string | null =>
- provider ? apiKeyVendorPreset(provider)?.label ?? provider : null;
+/** The catalog label of the vendor that ran a call; none for an id the catalog does not name, such as `custom`. */
+const presetLabel = (provider: string | undefined): string | null =>
+ provider ? apiKeyVendorPreset(provider)?.label ?? null : null;
+
+/** Who ran a call: its vendor's catalog label, else the Source's own name. A compatible endpoint's
+ * vendor id is `custom`, which names no vendor, so its name is the only thing that says where the
+ * call ran. A vendor id with neither stays as it is, as for a row stored without a Source. */
+const runnerLabel = (card: HostedActivity): string | null =>
+ presetLabel(card.provider) ?? card.source_name ?? card.provider ?? null;
// Small per-call figures keep their first significant digits: $0.006, not $0.01.
const formatUsd = (usd: number): string => {
@@ -94,7 +101,7 @@ export const HostedModeChip: React.FC<{ card: HostedActivity }> = ({ card }) =>
</span>
);
}
- const vendor = vendorLabel(card.provider);
+ const vendor = runnerLabel(card);
if (card.mode === 'direct') {
// An image call names the model it picked and where it ran, not a vendor: the model is the choice.
const where = card.source_name ?? vendor;
@@ -159,7 +166,7 @@ export const HostedImageFigure: React.FC<{ card: HostedActivity; image: HostedAc
<ImageIcon className="size-3" aria-hidden="true" />
{image.width && image.height ? `${card.model} · ${image.width}×${image.height}` : card.model}
</span>
- {(card.source_name ?? vendorLabel(card.provider)) && <span>{card.source_name ?? vendorLabel(card.provider)}</span>}
+ {(card.source_name ?? runnerLabel(card)) && <span>{card.source_name ?? runnerLabel(card)}</span>}
</>
)
: <HostedModeChip card={card} />}
@@ -191,7 +198,7 @@ const HostedDetail: React.FC<{ card: HostedActivity }> = ({ card }) => {
const { t } = useTranslation();
const cost = useHostedCost(card);
const completed = hostedCompleted(card);
- const where = completed ? [card.source_name ?? vendorLabel(card.provider), card.model].filter(Boolean).join(' · ') : '';
+ const where = completed ? [card.source_name ?? runnerLabel(card), card.model].filter(Boolean).join(' · ') : '';
const facts = [
where && t(`chat.agentActivity.hosted.${RAN_KEY[card.mode]}`, { where }),
completed && card.duration_ms !== undefined && t('chat.agentActivity.hosted.duration', { seconds: Math.max(1, Math.round(card.duration_ms / 1000)) }),
@@ -260,16 +267,18 @@ const FallbackNote: React.FC<{ card: HostedActivity }> = ({ card }) => {
// Only an instance manager reaches Models › Tools; anyone else is told who can clear it.
const { capabilities } = useInstanceAuthorization();
const from = card.fallback_from;
- const vendor = vendorLabel(card.provider);
+ const vendor = runnerLabel(card);
if (!from || !hostedCompleted(card) || !vendor) return null;
const refusedBy = from.source_name ?? from.source_id;
const toolInline = t(`settings.models.tools.tool.${card.tool}.inline`);
+ // The Source in parentheses only beside a vendor's label: a Source named in its vendor's place is not repeated.
+ const besideVendor = presetLabel(card.provider) ? card.source_name : undefined;
return (
<p className="mx-1.5 mb-1 mt-0.5 flex flex-wrap items-center gap-x-3 gap-y-0.5 rounded-md border border-gold/40 bg-gold/10 px-2.5 py-1.5 text-[11px]" data-hosted-fallback={card.call_id}>
<span className="inline-flex min-w-0 items-center gap-1.5 text-foreground">
<TriangleAlert className="size-3 shrink-0 text-gold-ink" aria-hidden="true" />
- {card.source_name
- ? t('chat.agentActivity.hosted.fallback.ranOn', { from: refusedBy, toolInline, provider: vendor, source: card.source_name })
+ {besideVendor
+ ? t('chat.agentActivity.hosted.fallback.ranOn', { from: refusedBy, toolInline, provider: vendor, source: besideVendor })
: t('chat.agentActivity.hosted.fallback.ran', { from: refusedBy, toolInline, provider: vendor })}
</span>
<span className="ml-auto text-muted">{t(capabilities.can_manage_instance ? 'chat.agentActivity.hosted.fallback.kept' : 'chat.agentActivity.hosted.fallback.keptManager')}</span>