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(agents): preserve effort choices during catalog refresh (#2914)

Call White72045ca14eeb
diff --git a/tests/scenarios/model_hub/catalog.yaml b/tests/scenarios/model_hub/catalog.yaml
index f8b15879b..a154c4a47 100644
--- a/tests/scenarios/model_hub/catalog.yaml
+++ b/tests/scenarios/model_hub/catalog.yaml
@@ -344,7 +344,7 @@ scenarios:
- ui/src/components/workbench/AgentRoutePicker.test.tsx::MH-EFFORT-MENU-003
- ui/src/components/workbench/AgentsPage.test.tsx::MH-EFFORT-MENU-003
- id: MH-EFFORT-MENU-004
- name: While an effort-menu read is in flight, the route picker and the Agents page hold the controls that can write an effort, and the New Agent dialog reads again at Create, creating only an effort the answer still offers and nothing when Model Hub cannot answer
+ name: While an effort-menu read is in flight, the route picker holds controls and the Agents page holds model changes while retaining the latest effort choice for validation before saving; the New Agent dialog reads again at Create, creating only an effort the answer still offers and nothing when Model Hub cannot answer
status: covered
kind: observation
layer: unit
diff --git a/ui/src/components/workbench/AgentsPage.test.tsx b/ui/src/components/workbench/AgentsPage.test.tsx
index 62e999461..2e47cc02c 100644
--- a/ui/src/components/workbench/AgentsPage.test.tsx
+++ b/ui/src/components/workbench/AgentsPage.test.tsx
@@ -1,6 +1,7 @@
/* @vitest-environment jsdom */
import { act, cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
import { afterEach, describe, expect, it, vi } from 'vitest';
import { MemoryRouter, useLocation } from 'react-router-dom';
@@ -53,6 +54,7 @@ type FakeModelCatalog = {
reasoningOptions?: Record<string, { value: string; label: string }[]>;
effortMenus?: Record<string, { omitted: string[]; not_on: Record<string, string[]> }>;
hubUnread?: true;
+ catalogRefreshPending?: boolean;
};
let modelCatalog: FakeModelCatalog = { models: [] };
let modelCatalogReads = 0;
@@ -1731,7 +1733,77 @@ describe('AgentsPage reconnect reconciliation', () => {
await waitFor(() => expect(screen.queryByRole('button', { name: 'xhigh', exact: true })).toBeNull());
});
- it('MH-EFFORT-MENU-004: holds the effort buttons while that read is out, so a click cannot write an effort its answer removes', async () => {
+ it.each(['settled hover', 'pending hover', 'keyboard', 'touch'] as const)(
+ 'saves a single effort choice after %s without losing it to catalog refresh',
+ async (interaction) => {
+ const user = userEvent.setup();
+ modelCatalog = {
+ models: [],
+ reasoningOptions: { 'reasoning-model': [{ value: 'medium', label: 'Medium' }, { value: 'high', label: 'High' }] },
+ effortMenus: { 'reasoning-model': { omitted: [], not_on: {} } },
+ };
+ const initial = { ...brief('agent-a', 'description'), model: 'reasoning-model', reasoning_effort: 'medium' };
+ const saved = { ...initial, reasoning_effort: 'high' };
+ const updateVibeAgent = vi.fn().mockResolvedValue({ ok: true });
+ const api = makeApi(
+ vi.fn().mockResolvedValue(listResult(initial)),
+ vi.fn().mockResolvedValueOnce(fullAgent(initial, 'prompt')).mockResolvedValue(fullAgent(saved, 'prompt')),
+ undefined, undefined, updateVibeAgent,
+ );
+ renderPage(api, { canManageAgents: true });
+ const high = await screen.findByRole('button', { name: 'high', exact: true });
+ const reads = modelCatalogReads;
+ deferModelReads = true;
+
+ if (interaction === 'keyboard') {
+ act(() => high.focus());
+ await user.keyboard('{Enter}');
+ } else if (interaction === 'touch') {
+ await user.pointer([{ keys: '[TouchA>]', target: high }, { keys: '[/TouchA]' }]);
+ } else {
+ await user.hover(high);
+ if (interaction === 'settled hover') act(() => pendingModelReads.shift()!());
+ // Unlike fireEvent.click, this includes the pointer-induced focus that
+ // used to start another read and disable the button before its click.
+ await user.click(high);
+ }
+
+ if (interaction !== 'settled hover') {
+ expect(updateVibeAgent).not.toHaveBeenCalled();
+ act(() => pendingModelReads.shift()!());
+ }
+ await waitFor(() => expect(updateVibeAgent).toHaveBeenCalledWith('agent-a', { reasoning_effort: 'high' }));
+ expect(updateVibeAgent).toHaveBeenCalledTimes(1);
+ expect(modelCatalogReads).toBe(reads + 1);
+ await waitFor(() => expect(screen.getByRole('button', { name: 'high', exact: true }).className).toContain('bg-mint-soft'));
+ },
+ );
+
+ it('keeps only the latest effort choice while the catalog read is pending', async () => {
+ const user = userEvent.setup();
+ modelCatalog = {
+ models: [],
+ reasoningOptions: { 'reasoning-model': [{ value: 'medium', label: 'Medium' }, { value: 'high', label: 'High' }] },
+ effortMenus: { 'reasoning-model': { omitted: [], not_on: {} } },
+ };
+ const initial = { ...brief('agent-a', 'description'), model: 'reasoning-model', reasoning_effort: 'medium' };
+ const updateVibeAgent = vi.fn().mockResolvedValue({ ok: true });
+ const api = makeApi(
+ vi.fn().mockResolvedValue(listResult(initial)), vi.fn().mockResolvedValue(fullAgent(initial, 'prompt')),
+ undefined, undefined, updateVibeAgent,
+ );
+ renderPage(api, { canManageAgents: true });
+ const high = await screen.findByRole('button', { name: 'high', exact: true });
+ deferModelReads = true;
+ await user.click(high);
+ await user.click(screen.getByRole('button', { name: 'medium', exact: true }));
+ expect(updateVibeAgent).not.toHaveBeenCalled();
+ act(() => pendingModelReads.shift()!());
+ await waitFor(() => expect(updateVibeAgent).toHaveBeenCalledWith('agent-a', { reasoning_effort: 'medium' }));
+ expect(updateVibeAgent).toHaveBeenCalledTimes(1);
+ });
+
+ it('MH-EFFORT-MENU-004: validates a queued effort choice against the refreshed menu before writing', async () => {
modelCatalog = {
models: [],
reasoningOptions: { 'reasoning-model': [{ value: 'medium', label: 'Medium' }, { value: 'xhigh', label: 'xhigh' }] },
@@ -1755,7 +1827,7 @@ describe('AgentsPage reconnect reconciliation', () => {
deferModelReads = true;
fireEvent.pointerEnter(document.querySelector('[data-effort-field]') as HTMLElement);
const xhigh = screen.getByRole('button', { name: 'xhigh', exact: true }) as HTMLButtonElement;
- expect(xhigh.disabled).toBe(true);
+ expect(xhigh.disabled).toBe(false);
fireEvent.click(xhigh);
// A model choice keeps or falls back from the effort, so it waits for the answer too.
expect((screen.getByRole('combobox') as HTMLButtonElement).disabled).toBe(true);
@@ -1763,6 +1835,8 @@ describe('AgentsPage reconnect reconciliation', () => {
act(() => pendingModelReads.shift()!());
expect(screen.queryByRole('button', { name: 'xhigh', exact: true })).toBeNull();
+ expect(updateVibeAgent).not.toHaveBeenCalled();
+ expect(showToast).toHaveBeenCalledWith('agents.detail.effortUnavailable:{"effort":"xhigh"}', 'error');
expect((screen.getByRole('button', { name: 'medium', exact: true }) as HTMLButtonElement).disabled).toBe(false);
});
@@ -1801,6 +1875,87 @@ describe('AgentsPage reconnect reconciliation', () => {
expect(modelCatalogReads).toBe(directReads);
});
+ it('does not let an older catalog retry drain a choice waiting for a newer refresh', async () => {
+ const hub = {
+ models: [],
+ reasoningOptions: { 'reasoning-model': [{ value: 'medium', label: 'Medium' }, { value: 'high', label: 'High' }] },
+ effortMenus: { 'reasoning-model': { omitted: [], not_on: {} } },
+ };
+ modelCatalog = hub;
+ const initial = { ...brief('agent-a', 'description'), model: 'reasoning-model', reasoning_effort: 'medium' };
+ const updateVibeAgent = vi.fn().mockResolvedValue({ ok: true });
+ const api = makeApi(
+ vi.fn().mockResolvedValue(listResult(initial)), vi.fn().mockResolvedValue(fullAgent(initial, 'prompt')),
+ undefined, undefined, updateVibeAgent,
+ );
+ renderPage(api, { canManageAgents: true });
+ const high = await screen.findByRole('button', { name: 'high', exact: true });
+ const field = document.querySelector('[data-effort-field]') as HTMLElement;
+ deferModelReads = true;
+ modelCatalog = {
+ models: [], reasoningOptions: hub.reasoningOptions, hubUnread: true, catalogRefreshPending: true,
+ };
+ fireEvent.pointerEnter(field);
+ // A native fallback settles the approach but its loader can answer again
+ // after a catalogRefreshPending retry. Retain that same loader callback.
+ const oldAnswer = pendingModelReads.shift()!;
+ act(() => oldAnswer());
+
+ modelCatalog = {
+ models: [],
+ reasoningOptions: { 'reasoning-model': [{ value: 'medium', label: 'Medium' }] },
+ effortMenus: { 'reasoning-model': { omitted: ['high'], not_on: {} } },
+ };
+ fireEvent.pointerLeave(field);
+ fireEvent.pointerEnter(field);
+ fireEvent.click(high);
+ expect(updateVibeAgent).not.toHaveBeenCalled();
+
+ // A retry from the older approach must not settle the new read or submit
+ // its queued choice using an older menu that still offers high.
+ await act(async () => oldAnswer());
+ expect(updateVibeAgent).not.toHaveBeenCalled();
+ expect(field.getAttribute('aria-busy')).toBe('true');
+ act(() => pendingModelReads.shift()!());
+ expect(updateVibeAgent).not.toHaveBeenCalled();
+ expect(screen.queryByRole('button', { name: 'high', exact: true })).toBeNull();
+ expect(showToast).toHaveBeenCalledWith('agents.detail.effortUnavailable:{"effort":"high"}', 'error');
+ });
+
+ it('validates a queued choice against the last Hub menu when the refresh falls back to a native list', async () => {
+ modelCatalog = {
+ models: [],
+ reasoningOptions: { 'reasoning-model': [{ value: 'medium', label: 'Medium' }, { value: 'high', label: 'High' }] },
+ effortMenus: { 'reasoning-model': { omitted: [], not_on: {} } },
+ };
+ const initial = { ...brief('agent-a', 'description'), model: 'reasoning-model', reasoning_effort: 'medium' };
+ const saved = { ...initial, reasoning_effort: 'high' };
+ const updateVibeAgent = vi.fn().mockResolvedValue({ ok: true });
+ const api = makeApi(
+ vi.fn().mockResolvedValue(listResult(initial)),
+ vi.fn().mockResolvedValueOnce(fullAgent(initial, 'prompt')).mockResolvedValue(fullAgent(saved, 'prompt')),
+ undefined, undefined, updateVibeAgent,
+ );
+ renderPage(api, { canManageAgents: true });
+ const high = await screen.findByRole('button', { name: 'high', exact: true });
+ // The native fallback does not know about high, but an unread Hub cannot
+ // revoke what its last accepted answer offered.
+ modelCatalog = {
+ models: [],
+ reasoningOptions: { 'reasoning-model': [{ value: 'medium', label: 'Medium' }] },
+ hubUnread: true,
+ };
+ deferModelReads = true;
+ fireEvent.pointerEnter(high);
+ fireEvent.click(high);
+ expect(api.updateVibeAgent).not.toHaveBeenCalled();
+ act(() => pendingModelReads.shift()!());
+ await waitFor(() => expect(updateVibeAgent).toHaveBeenCalledWith('agent-a', { reasoning_effort: 'high' }));
+ expect(updateVibeAgent).toHaveBeenCalledTimes(1);
+ await waitFor(() => expect(screen.getByRole('button', { name: 'high', exact: true }).className).toContain('bg-mint-soft'));
+ expect(showToast).not.toHaveBeenCalledWith(expect.stringContaining('agents.detail.effortUnavailable'), 'error');
+ });
+
it('reads the effort menu once per approach to the field, not on every focus move inside it', async () => {
modelCatalog = {
models: [],
@@ -1828,7 +1983,68 @@ describe('AgentsPage reconnect reconciliation', () => {
expect(modelCatalogReads).toBe(reads + 1);
});
- it('drops an effort-menu read still out when Settings covers the page', async () => {
+ it('drops a queued effort choice if reconciliation changes the model before the menu answers', async () => {
+ modelCatalog = {
+ models: ['old-model', 'new-model'],
+ reasoningOptions: {
+ 'old-model': [{ value: 'medium', label: 'Medium' }, { value: 'high', label: 'High' }],
+ 'new-model': [],
+ },
+ effortMenus: { 'old-model': { omitted: [], not_on: {} }, 'new-model': { omitted: [], not_on: {} } },
+ };
+ const initial = { ...brief('agent-a', 'description'), model: 'old-model', reasoning_effort: 'medium' };
+ const getVibeAgent = vi.fn().mockResolvedValue(fullAgent(initial, 'prompt'));
+ const api = makeApi(vi.fn().mockResolvedValue(listResult(initial)), getVibeAgent);
+ renderPage(api, { canManageAgents: true });
+ const high = await screen.findByRole('button', { name: 'high', exact: true });
+ deferModelReads = true;
+ fireEvent.pointerEnter(high);
+ fireEvent.click(high);
+ expect(api.updateVibeAgent).not.toHaveBeenCalled();
+
+ getVibeAgent.mockResolvedValue(fullAgent({ ...initial, model: 'new-model' }, 'prompt'));
+ act(() => handlers?.onConnected?.());
+ await waitFor(() => expect(screen.getByRole('combobox').textContent).toContain('new-model'));
+ expect(document.querySelector('[data-effort-field]')).toBeNull();
+ act(() => pendingModelReads.shift()!());
+ expect(api.updateVibeAgent).not.toHaveBeenCalled();
+
+ // Removing a hovered field sends no pointerleave. If it returns, keyboard
+ // entry must still refresh rather than inheriting that old pointer presence.
+ getVibeAgent.mockResolvedValue(fullAgent(initial, 'prompt'));
+ act(() => handlers?.onConnected?.());
+ const restoredHigh = await screen.findByRole('button', { name: 'high', exact: true });
+ const reads = modelCatalogReads;
+ act(() => restoredHigh.focus());
+ expect(modelCatalogReads).toBe(reads + 1);
+ act(() => pendingModelReads.shift()!());
+ expect(api.updateVibeAgent).not.toHaveBeenCalled();
+ });
+
+ it('drops a queued effort choice when another Agent is selected', async () => {
+ modelCatalog = {
+ models: [],
+ reasoningOptions: { 'reasoning-model': [{ value: 'medium', label: 'Medium' }, { value: 'high', label: 'High' }] },
+ effortMenus: { 'reasoning-model': { omitted: [], not_on: {} } },
+ };
+ const a = { ...brief('agent-a', 'first description'), model: 'reasoning-model', reasoning_effort: 'medium' };
+ const b = { ...brief('agent-b', 'second description'), model: 'reasoning-model', reasoning_effort: 'medium' };
+ const api = makeApi(
+ vi.fn().mockResolvedValue(listResult([a, b])),
+ vi.fn((name: string) => Promise.resolve(fullAgent(name === a.name ? a : b, 'prompt'))),
+ );
+ renderPage(api, { canManageAgents: true });
+ const high = await screen.findByRole('button', { name: 'high', exact: true });
+ deferModelReads = true;
+ fireEvent.pointerEnter(high);
+ fireEvent.click(high);
+ fireEvent.click(screen.getByText('agent-b'));
+ await screen.findByDisplayValue('second description');
+ act(() => pendingModelReads.splice(0).forEach((answer) => answer()));
+ expect(api.updateVibeAgent).not.toHaveBeenCalled();
+ });
+
+ it('drops an effort-menu read and queued choice when Settings covers the page', async () => {
modelCatalog = {
models: [],
reasoningOptions: { 'reasoning-model': [{ value: 'medium', label: 'Medium' }, { value: 'xhigh', label: 'xhigh' }] },
@@ -1855,6 +2071,8 @@ describe('AgentsPage reconnect reconciliation', () => {
// turn elsewhere records that every hop refuses `xhigh`.
deferModelReads = true;
fireEvent.pointerEnter(document.querySelector('[data-effort-field]') as HTMLElement);
+ fireEvent.click(screen.getByRole('button', { name: 'xhigh', exact: true }));
+ expect(api.updateVibeAgent).not.toHaveBeenCalled();
modelCatalog = {
models: [],
reasoningOptions: { 'reasoning-model': [{ value: 'medium', label: 'Medium' }] },
@@ -1868,6 +2086,7 @@ describe('AgentsPage reconnect reconciliation', () => {
// The read from before the visit lands last, and must not bring `xhigh` back.
act(() => stale());
expect(screen.queryByRole('button', { name: 'xhigh', exact: true })).toBeNull();
+ expect(api.updateVibeAgent).not.toHaveBeenCalled();
});
it('keeps a still-valid effort untouched when the model changes', async () => {
diff --git a/ui/src/components/workbench/AgentsPage.tsx b/ui/src/components/workbench/AgentsPage.tsx
index 6a4e5e37f..5efa9a708 100644
--- a/ui/src/components/workbench/AgentsPage.tsx
+++ b/ui/src/components/workbench/AgentsPage.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
+import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useSearchParams } from 'react-router-dom';
import {
@@ -2152,29 +2152,41 @@ const AgentDetailPanel: React.FC<DetailProps> = ({ agent, isDefault, canEdit, ca
// A Hub catalog's effort menu follows capability evidence, which a turn in any
// session can change while this panel stays open. Like the route picker, which
// reads it as its menu opens, read it again as the user turns to the effort
- // field, the moment it is chosen from; the last answer shows until it lands,
- // and the controls that can write an effort are held while the read is in
- // flight (`readHubBackendModels`).
+ // field. Keep the buttons focusable while the read is out: disabling them
+ // during pointer entry/focus swallows the click. A choice made during the
+ // read waits for its answer and is validated before it can write an effort.
const effortRefreshRef = useRef<(() => void) | null>(null);
+ const effortPointerInsideRef = useRef(false);
+ const effortFieldRef = useCallback((node: HTMLDivElement | null) => {
+ // A model with no efforts removes the field without a pointerleave event.
+ if (!node) effortPointerInsideRef.current = false;
+ }, []);
+ const pendingEffortChoiceRef = useRef<{ model: string; value: string } | null>(null);
+ const settleEffortChoiceRef = useRef<(result?: BackendModels) => void>(() => {});
// One read per approach: a read still out answers for this one too. Dropping a
// read does not stop its request, so restarting would only add requests.
const effortRefreshOutRef = useRef(false);
const [effortRefreshOut, setEffortRefreshOut] = useState(false);
const refreshEffortMenus = useCallback(() => {
if (!surfaceActive || !hubKnownRef.current || effortRefreshOutRef.current) return;
+ // A settled native fallback can still have catalog retries pending. Retire
+ // its loader so no older answer can settle this approach's queued choice.
+ effortRefreshRef.current?.();
effortRefreshOutRef.current = true;
setEffortRefreshOut(true);
const backend = agent.backend;
- const settle = () => {
+ const settle = (result?: BackendModels) => {
effortRefreshOutRef.current = false;
setEffortRefreshOut(false);
+ settleEffortChoiceRef.current(result);
};
effortRefreshRef.current = loadBackendModelsWithRefresh(
api,
backend,
(result) => {
- settle();
+ const accepted = supersedesHubAnswer(result, hubKnownRef.current);
takeModelCatalog(backend, result);
+ settle(accepted ? result : undefined);
},
settle,
);
@@ -2185,6 +2197,8 @@ const AgentDetailPanel: React.FC<DetailProps> = ({ agent, isDefault, canEdit, ca
effortRefreshRef.current?.();
effortRefreshRef.current = null;
effortRefreshOutRef.current = false;
+ effortPointerInsideRef.current = false;
+ pendingEffortChoiceRef.current = null;
setEffortRefreshOut(false);
// A new activation or backend starts without knowing which catalog serves it.
hubKnownRef.current = false;
@@ -2279,6 +2293,30 @@ const AgentDetailPanel: React.FC<DetailProps> = ({ agent, isDefault, canEdit, ca
void operation.catch(() => undefined);
};
+ const submitEffortChoice = (value: string) => {
+ markFieldEdit('effort');
+ markFieldSubmitted('effort');
+ setEffort(value);
+ consumeBackgroundMutation(submitFields({ reasoning_effort: value }, ['effort']));
+ };
+ useLayoutEffect(() => {
+ settleEffortChoiceRef.current = (result) => {
+ const choice = pendingEffortChoiceRef.current;
+ pendingEffortChoiceRef.current = null;
+ if (!choice || !surfaceActive || !canEdit || choice.model !== model) return;
+ // An unread Hub must not replace its last accepted menu with the native
+ // ladder. A failed read retains the same last-answer policy as the picker.
+ const options = resolveEffortOptions(agent.backend, model, result ? result.reasoningOptions ?? {} : reasoningOptions);
+ if (!options.includes(choice.value)) {
+ showToast(t('agents.detail.effortUnavailable', {
+ effort: choice.value === 'none' ? t('chat.picker.effortOptions.none') : choice.value,
+ }), 'error');
+ return;
+ }
+ submitEffortChoice(choice.value);
+ };
+ });
+
// Only user Agents can be renamed; the backend moves every durable name
// reference in the same transaction.
const commitRename = async () => {
@@ -2527,15 +2565,25 @@ const AgentDetailPanel: React.FC<DetailProps> = ({ agent, isDefault, canEdit, ca
no efforts has nothing to choose, so the field is absent rather than an
empty outline the user would read as a control that failed to load. */}
{(effortOptions.length > 0 || refusedEffort) && (
- <Field label={t('agents.detail.effort')}>
+ <Field
+ label={t('agents.detail.effort')}
+ labelRight={effortRefreshOut ? <Loader2 aria-label={t('common.loading')} className="size-3 animate-spin text-muted" /> : undefined}
+ >
<div
className="grid gap-0.5 rounded-lg border border-border-strong bg-surface-2 p-0.5"
style={{ gridTemplateColumns: 'repeat(auto-fit, minmax(3.25rem, 1fr))' }}
data-effort-field
- onPointerEnter={refreshEffortMenus}
- // Focus coming into the field, not moving between its buttons.
+ ref={effortFieldRef}
+ aria-busy={effortRefreshOut}
+ onPointerEnter={() => {
+ effortPointerInsideRef.current = true;
+ refreshEffortMenus();
+ }}
+ onPointerLeave={() => { effortPointerInsideRef.current = false; }}
+ // Pointer-induced focus belongs to the approach already refreshed,
+ // even if that read finished before the pointer was pressed.
onFocusCapture={(event) => {
- if (!event.currentTarget.contains(event.relatedTarget as Node | null)) refreshEffortMenus();
+ if (!effortPointerInsideRef.current && !event.currentTarget.contains(event.relatedTarget as Node | null)) refreshEffortMenus();
}}
>
{refusedEffort && (
@@ -2552,13 +2600,14 @@ const AgentDetailPanel: React.FC<DetailProps> = ({ agent, isDefault, canEdit, ca
<button
key={opt}
type="button"
- disabled={!canEdit || !effortsAnswered || effortRefreshOut}
+ disabled={!canEdit || !effortsAnswered}
title={canEdit ? undefined : t('agents.remoteReadOnlyHint')}
onClick={() => {
- markFieldEdit('effort');
- markFieldSubmitted('effort');
- setEffort(opt);
- consumeBackgroundMutation(submitFields({ reasoning_effort: opt }, ['effort']));
+ if (effortRefreshOutRef.current) {
+ pendingEffortChoiceRef.current = { model, value: opt };
+ return;
+ }
+ submitEffortChoice(opt);
}}
className={clsx(
'truncate rounded-md px-1 py-1.5 text-[11px] capitalize transition disabled:cursor-not-allowed',
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index 0db5c196e..a6667bb22 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -4428,6 +4428,7 @@
"modelPlaceholder": "Pick or type a model",
"modelEmpty": "No matches — you can type a custom value.",
"effort": "Reasoning effort",
+ "effortUnavailable": "{{effort}} is no longer available for this model. Your setting was not changed.",
"systemPrompt": "System prompt",
"systemPromptCount": "~{{count}} tokens",
"systemPromptExpand": "Expand editor",
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index a4683cece..c76cbd103 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -4428,6 +4428,7 @@
"modelPlaceholder": "选择或输入模型",
"modelEmpty": "找不到匹配的模型,可以直接输入。",
"effort": "推理强度",
+ "effortUnavailable": "此模型已不再支持 {{effort}},你的设置未更改。",
"systemPrompt": "系统提示词",
"systemPromptCount": "~{{count}} tokens",
"systemPromptExpand": "展开编辑器",
diff --git a/ui/src/lib/backendModels.ts b/ui/src/lib/backendModels.ts
index cbc92b3e5..a9cca770c 100644
--- a/ui/src/lib/backendModels.ts
+++ b/ui/src/lib/backendModels.ts
@@ -90,9 +90,10 @@ export const supersedesHubAnswer = (result: BackendModels, knownHub: boolean): b
*
* A Hub effort menu follows capability evidence that any turn can change
* (#2606). The route picker and the Agents page read it again as their menu
- * opens or the effort field is approached, and while that read is in flight the
- * controls that can write an effort (an effort, or a model that keeps or clears
- * one) are held. The New Agent dialog writes on Create, so Create reads this
+ * opens or the effort field is approached. The route picker holds controls
+ * while that read is in flight; the Agents page holds model changes and queues
+ * the latest effort choice, validating it against the answer before saving.
+ * The New Agent dialog writes on Create, so Create reads this
* answer again and creates only an effort it still offers, and nothing when Hub
* cannot answer. A write made outside those (a model changed before any read
* started, or after a read that came back unread) uses the last answer; a stale