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(model-hub): edit routes directly and cancel changes in place (#1952)

Call White2bdbb05ded87
diff --git a/docs/plans/model-hub-routing-modes.md b/docs/plans/model-hub-routing-modes.md
index aa418c0e7..46fc8e908 100644
--- a/docs/plans/model-hub-routing-modes.md
+++ b/docs/plans/model-hub-routing-modes.md
@@ -186,11 +186,15 @@ Approved design: `avibe-docs/design.pen`, frames `bmi25` (dark), `ziils` (light)
- Rename Adjust priority to Default routing. It edits one backend's default
membership/order; manual routes are independent. Show affected inherited/manual
counts without implying historical authorship or runtime health.
-- Route dialog opens inherited state with Edit route. Manual editing preserves
- add/edit/remove/reorder and allows exact model ids missing from the source list.
+- Owner amendment 2026-09-08: route dialogs open directly editable. Only actual
+ edits or explicit Pin current route stage manual intent; opening/picker dismissal
+ and no-op edits preserve inheritance. Keep add/edit/remove/reorder and exact
+ API-key targets absent from inventory. No persistence occurs before Save.
- Restore automatic lives in the dialog footer and changes draft only. Call preview
with null override, show its actual target and origin, which may be Passthrough.
- Undo restore reinstates the prior manual draft. Cancel/close never writes.
+ Undo restore reinstates the prior draft and intent. Cancel changes keeps the
+ dialog open and rereads saved authority; Close dismisses. Neither writes.
+ Ready preview rows remain editable, and stale previews cannot replace edits.
Save uses DELETE for restored automatic, PUT for manual draft, consumes the full
canonical mutation result, and preserves existing guarded confirmation handling.
- Preserve the draft on failed Save, avoid stale preview overwriting newer edits,
@@ -415,7 +419,7 @@ Route details expose the complete source identity and exact model id as visible
text, including stale/missing source fallback identities. These detail fields
wrap at constrained widths, with long unbroken identifiers allowed to break;
hop rows retain their existing minimum height and grow with their content.
-This applies to editable, inherited read-only and restore-preview rows, including
+This applies to manual, inherited and restore-preview editable rows, including
manual sources outside defaults. It does not replace the approved compact
ellipsis behavior in overview/provider cards. Two values sharing a long prefix
must remain distinguishable without requiring hover, title text, or editing.
diff --git a/docs/plans/model-hub-ui-spec.md b/docs/plans/model-hub-ui-spec.md
index e87147eb5..8ff0523c5 100644
--- a/docs/plans/model-hub-ui-spec.md
+++ b/docs/plans/model-hub-ui-spec.md
@@ -1,5 +1,34 @@
# Model Hub — UI & Interaction Spec (gateway frames)
+## Direct route editing — 2026-09-08
+
+The owner-approved direct-edit revision removes the inherited read-only entry state.
+Every ready route uses the existing editable hop rows, picker, keyboard/pointer
+reordering and visual tokens. Opening, focusing, selecting without applying, or
+applying an unchanged pair does not create manual intent. A real local edit creates
+a manual draft; Pin current route explicitly stages the same effective pairs as
+manual. Neither action writes. Pending manual copy says that saving stops following
+defaults. Save is disabled for unchanged normalized intent.
+
+Cancel changes discards a reversible draft, keeps the same dialog mounted and reads
+the latest saved chain/intent; it never writes or reinstalls a stale snapshot. A
+failed read stays unread with Retry. The clean footer uses Close. Title-close,
+Escape and outside press remain dismissal, respecting nested selector/grab/guard
+precedence. Saving, unknown-attempt abandonment, rejection, committed impact and
+reconciliation keep their existing distinct lifecycle rules. Cancel changes is
+not a rollback action for an unknown or committed write.
+
+Restore/final-hop removal retains both prior pairs and intent for Undo, previews
+inheritance without writing, and saves only when normalized intent changes.
+Ready preview rows are editable; editing them replaces the local restore proposal.
+Keyboard grab cancellation restores its prior pairs, intent and restore/Undo
+state. Late reads cannot replace a newer edit or a canceled draft.
+The route header's existing height token is a minimum: long exact model identities
+wrap and grow the header rather than overlapping the editable body. The footer
+remains within the dialog and viewport; the existing body owns scrolling.
+This supersedes the earlier Edit route entry, ordinary Cancel-as-close and
+read-only preview row instructions below, not the persistence or error contracts.
+
## Save-first provider revision — 2026-09-08
The owner-approved `model-hub-save-first-testing.md` supersedes the automatic
@@ -57,11 +86,12 @@ opening the row editor. Escape/outside dismiss it; avoid nested buttons. Retain
helper text and complete EN/ZH pairs in design/locales. Recorded model-not-found keeps
Passthrough and uses the retained-turn detail surface below without marking the Source failed.
-Inherited dialogs open with Edit route. Manual editing retains add/edit/remove/reorder
+Dialogs open directly editable without changing saved intent. Editing retains add/edit/remove/reorder
and accepts exact API-key upstream ids absent from inventory; subscription targets retain
known-model admission. Restore automatic in the footer, or removing the final manual hop,
changes the draft to null and calls preview; its result may be Passthrough or Unconfigured.
-Undo restore reinstates the prior manual draft. Cancel/close never writes. Save sends
+Undo restore reinstates the prior draft and intent. Cancel changes stays in the
+dialog and rereads saved state; Close dismisses. Neither writes. Save sends
DELETE for inherited intent or PUT for nonempty manual hops, consuming the complete canonical
mutation result and exact-plan guards. Failed saves retain draft intent; stale preview
responses cannot replace newer edits; duplicate submissions are disabled.
@@ -2014,7 +2044,7 @@ what order?*
**Sparse manual intent replaces the historical stored-chain-only model.** The
server's effective projection owns Automatic, Manual, Passthrough or Unconfigured;
there is no `follow` / `custom` discriminator or client-side recommendation engine.
-Inherited routes enter editing through Edit route. Manual arrays execute as saved;
+Inherited routes are immediately editable without being pinned. Manual arrays execute as saved;
Restore automatic stages null, previews the effective plan, and removes the saved
override only on Save. The routing revision above owns the approved current frames.
@@ -2043,8 +2073,8 @@ while `route.sourceMissing` means the chain annotation and never the local join
**One held identity, one origin and one wire projection** `[contract]` `[derived]`.
Opening 02 holds `(backend, menu_model)` and reads
`GET /api/models/agents/<backend>/chain?model=<id>`. Hold `manual_override` separately
-from the effective `chain`. Edit route initializes a manual draft from effective exact
-pairs; Restore automatic stages null. Live `channel`, `health`, `runnable`, `reason`,
+from the effective `chain`. Actual edits or explicit Pin current route initialize
+manual intent from effective exact pairs; Restore automatic stages null. Live `channel`, `health`, `runnable`, `reason`,
`retry_at`, `current` and `supply_state` remain read annotations and are never echoed
into a write. The reversible origin includes saved intent as well as pairs, so equal
arrays cannot settle a lost response with different manual intent. Local edits operate
@@ -2471,6 +2501,7 @@ generation is ignored and cannot install authority, feedback or focus.
| ET-7e — cancel keyboard grab | Grabbed row + pre-grab order | Restore the exact snapshot; send/read nothing | Clear `aria-grabbed` and snapshot | Prior Ready, Dirty or Invalid class | `route.reorder.cancelled` plus registered prior invalid lines | Same row's restored grip | None |
| ET-7f — Tab from grabbed row | Grabbed row + current draft | Settle current order and re-run V5 before focus movement | Clear `aria-grabbed` and snapshot, then perform ordinary Tab/Shift+Tab | Ready, Dirty or Invalid by settled V5 result | `route.reorder.dropped` plus registered invalid lines | Ordinary next/previous enabled modal control | None |
| ET-8a — ordinary / terminal-rejected reversible exit | Loading route, Route unread, Ready, Dirty, Invalid after refresh or Route save rejected + latest installed authoritative page projection | Send no mutation; disown the current RL opening generation before close. A terminal rejection owns no D-36 generation | Close selector; restore/cancel any grab; discard local/submitted draft and terminal rejection evidence; ignore every late result from disowned opening reads | Reveal the latest installed page authority | Exact latest projection; retain its existing unresolved marker if any. No recovery read or false commit report follows | Preserve an FF-1-valid active page target, otherwise PF-1 after the modal target unmounts | None; an already-unresolved row retains D-35 |
+| ET-8c — Cancel changes | Ready or terminal-rejected + reversible local draft/restore proposal | Disown local preview and prior opening generations; acquire a fresh exact-chain GET without mutation | Drop selector, grab, local intent and rejected submission evidence; keep the dialog mounted | Loading then Ready from saved authority, or Route unread | Existing loading/read-failure copy; unchanged intent disables Save | Stable footer Close, then Retry on failed read | Dialog-owned chain GET; never a recovery PUT/DELETE |
| ET-8b — explicit unknown-attempt abandonment | Attempt settlement is `unknown`, owner is mounted editor, legality is Hub-observable or Direct-suspended, and the latest successful members are already installed | Send no mutation/read; explicitly abandon this old workflow and disown every mounted AR-D/RO generation before close | Close selector; restore/cancel any grab; discard submitted pairs/stage and all old-workflow rights. Ignore every later result from disowned generations | Reveal the latest installed authority, including an AgentSupply, Source or matching/nonmatching AgentChain installed before this edge | Exact latest projection with no old-attempt Retry. A later row open starts from current authority as a new workflow; it never resumes or replays this attempt | Preserve an FF-1-valid page target, otherwise PF-1 after modal close | None |
| ET-9a — first Route save | V5-valid nonempty manual draft or ready inherited preview | Freeze normalized intent and send nonempty PUT or inherited DELETE without `force` or plan echoes | Close selector; settle any grab | Saving | `route.saving` | Programmatically focusable progress status | One owned Route PUT or DELETE matching the immutable intent |
| ET-10 — R6 success with impact | Saving + exact R6 envelope with either array nonempty | Consume every R6 member, establish CF-R, mount its report and start AR-M with Agents acquired and Source/Route applicability deferred | Release mutation/refusal ownership; retain the entire envelope and held self-satisfying chain | Route impact reported with AR-M pending | Impact title/detail and each nonempty block | `route.impact.done` | Agents landing read; mode then acquires Sources under Direct or after CF-H under Hub and activates/drops the held Route evidence |
diff --git a/docs/plans/model-hub.md b/docs/plans/model-hub.md
index 60f40e32c..385f2e048 100644
--- a/docs/plans/model-hub.md
+++ b/docs/plans/model-hub.md
@@ -1455,8 +1455,11 @@ must not reject empty PUT/preview inputs or supported old config before normaliz
Reads are pure; the next ordinary save writes the normalized sparse map.
Restore automatic or removing the final manual hop changes the draft to inherited and
-previews its actual target/origin. Undo restores the previous unsaved manual draft;
-Cancel writes nothing. Save sends DELETE for inherited intent or PUT for nonempty manual,
+previews its actual target/origin. Undo restores the previous unsaved draft and intent.
+The dialog opens directly editable without pinning inheritance. Actual edits or
+explicit Pin current route stage manual intent. Cancel changes writes nothing,
+keeps the dialog mounted and rereads saved authority; Close dismisses. Unchanged
+normalized intent cannot Save. Save sends DELETE for inherited intent or PUT for nonempty manual,
consumes the authoritative mutation envelope, retains failed drafts and follows the
existing exact-plan guard/reconciliation protocol. Sources PUT and compatibility
chains/reorder update defaults only, preserving manual arrays and using effective
diff --git a/ui/e2e/d-routing.spec.ts b/ui/e2e/d-routing.spec.ts
index d0d19d21e..62cbb0d28 100644
--- a/ui/e2e/d-routing.spec.ts
+++ b/ui/e2e/d-routing.spec.ts
@@ -13,7 +13,7 @@ test.describe('D: inherited routes, manual editing, and default routing', () =>
await requireMockUpstream(mock);
});
- test('D: inherited inspection stays read-only until Edit route', async ({ api, hub, gateway, page }) => {
+ test('D: inherited routes are directly editable without pinning from inspection', async ({ api, hub, gateway, page }) => {
const original = await captureAgentChain(api, gateway);
try {
expect(await api.deleteAgentChain(gateway.backend, gateway.model)).toBe(true);
@@ -21,8 +21,9 @@ test.describe('D: inherited routes, manual editing, and default routing', () =>
await hub.openRoute(gateway.backend, gateway.model);
const dialog = hub.routeDialog;
await expect(dialog).toBeVisible();
- await expect(dialog.getByRole('button', { name: copy('routeDialog.addHop'), exact: true })).toHaveCount(0);
- await expect(dialog.getByRole('button', { name: copy('routeDialog.grip'), exact: true })).toHaveCount(0);
+ await expect(dialog.getByRole('button', { name: copy('routeDialog.addHop'), exact: true })).toBeVisible();
+ await expect(dialog.getByRole('button', { name: copy('routeDialog.grip'), exact: true }).first()).toBeVisible();
+ await expect(labelledButton(dialog, copy('routeDialog.save'))).toBeDisabled();
await labelledButton(dialog, copy('routing.close')).click();
await expect(dialog).toHaveCount(0);
@@ -57,12 +58,15 @@ test.describe('D: inherited routes, manual editing, and default routing', () =>
y: labelBox!.y + labelBox!.height / 2 - openerBox!.y,
} });
await expect(dialog).toBeVisible();
- await expect(dialog.getByRole('button', { name: copy('routeDialog.addHop'), exact: true })).toHaveCount(0);
- await labelledButton(dialog, copy('routing.editRoute')).click();
await expect(dialog.getByRole('button', { name: copy('routeDialog.addHop'), exact: true })).toBeVisible();
await expect(dialog.getByRole('button', { name: copy('routeDialog.grip'), exact: true }).first()).toBeVisible();
expect((await api.agentChain(gateway.backend, gateway.model)).manual_override).toBeNull();
- await labelledButton(dialog, copy('routeDialog.cancel')).click();
+ await labelledButton(dialog, copy('routing.pinRoute')).click();
+ await expect(labelledButton(dialog, copy('routeDialog.save'))).toBeEnabled();
+ await labelledButton(dialog, copy('routing.cancelChanges')).click();
+ await expect(dialog).toBeVisible();
+ await expect(labelledButton(dialog, copy('routeDialog.save'))).toBeDisabled();
+ await labelledButton(dialog, copy('routing.close')).click();
await expect(dialog).toHaveCount(0);
expect((await api.agentChain(gateway.backend, gateway.model)).manual_override).toBeNull();
} finally {
@@ -129,7 +133,10 @@ test.describe('D: inherited routes, manual editing, and default routing', () =>
await remove.focus();
await remove.press('Enter');
await expect(hops).toHaveCount(1);
- await labelledButton(dialog, copy('routeDialog.cancel')).click();
+ await labelledButton(dialog, copy('routing.cancelChanges')).click();
+ await expect(dialog).toBeVisible();
+ await expect(dialog.locator('.model-hub-route-hop-model')).toHaveText(arranged.map((hop) => hop.model_id));
+ await expect(labelledButton(dialog, copy('routeDialog.save'))).toBeDisabled();
expect((await api.agentChain(gateway.backend, gateway.model)).manual_override).toEqual({ hops: arranged });
} finally {
await restoreAgentChain(api, gateway, original);
@@ -156,7 +163,7 @@ test.describe('D: inherited routes, manual editing, and default routing', () =>
expect((await api.agentChain(gateway.backend, gateway.model)).manual_override).toEqual({ hops: manual });
await hub.openRoute(gateway.backend, gateway.model);
await expect(hub.routeDialog.locator('.model-hub-route-hop-name')).toHaveText(gateway.sources.map((source) => source.display_name));
- await labelledButton(hub.routeDialog, copy('routeDialog.cancel')).click();
+ await labelledButton(hub.routeDialog, copy('routing.close')).click();
} finally {
try {
await api.setDefaultSourceOrder(gateway.backend, originalOrder);
diff --git a/ui/e2e/model-catalog/README.md b/ui/e2e/model-catalog/README.md
index ba149e2cd..4562f08a9 100644
--- a/ui/e2e/model-catalog/README.md
+++ b/ui/e2e/model-catalog/README.md
@@ -30,3 +30,10 @@ collapsible Agent footer remain separate, and long identifiers wrap inside the
footer. Every localized route status fits the existing compact control, including
a wider fallback-font check. These are browser layout contracts, not live routing
or backend acceptance.
+
+`route-direct-edit.spec.ts` consumes `MH-ROUTING-007` through the production
+route dialog. All backends and origins open directly editable without writing;
+Cancel changes rereads saved intent in place, nested picker dismissal preserves
+the parent, and only Save persists the exact ordered pairs. Desktop/mobile EN/ZH
+screenshots also cover explicit pinning, long identities and light/dark footer
+geometry. Its in-memory route API is installed only for the route fixture view.
diff --git a/ui/e2e/model-catalog/fixture.tsx b/ui/e2e/model-catalog/fixture.tsx
index 1c5cc1fa7..e4c08cafb 100644
--- a/ui/e2e/model-catalog/fixture.tsx
+++ b/ui/e2e/model-catalog/fixture.tsx
@@ -11,6 +11,7 @@ import { blankBackendModel } from '../../src/components/settings/models/backendC
import { modelsApi } from '../../src/components/settings/models/modelsApi';
import type { AgentBackend, AgentSupply, BackendModel, BackendModelsPut } from '../../src/components/settings/models/types';
import { GatewayFixture } from './gatewayFixture';
+import { RouteFixture } from './routeFixture';
const params = new URLSearchParams(location.search);
const backend = params.get('backend') as AgentBackend;
@@ -55,4 +56,6 @@ export function Fixture() {
createRoot(document.getElementById('root')!).render(params.get('view') === 'gateway'
? <I18nextProvider i18n={language}><GatewayFixture /></I18nextProvider>
+ : params.get('view') === 'route'
+ ? <I18nextProvider i18n={language}><RouteFixture /></I18nextProvider>
: <Fixture />);
diff --git a/ui/e2e/model-catalog/route-direct-edit.spec.ts b/ui/e2e/model-catalog/route-direct-edit.spec.ts
new file mode 100644
index 000000000..e3e99bbe0
--- /dev/null
+++ b/ui/e2e/model-catalog/route-direct-edit.spec.ts
@@ -0,0 +1,107 @@
+import { expect, test } from '@playwright/test';
+import { hub } from '../support/copy';
+
+for (const backend of ['claude', 'codex', 'opencode']) {
+ for (const lang of ['en', 'zh'] as const) {
+ for (const origin of ['automatic', 'passthrough', 'manual']) {
+ test(`MH-ROUTING-007: direct editing and local cancel preserve intent (${backend}, ${lang}, ${origin})`, async ({ page }) => {
+ const copy = (key: string) => hub(key, {}, lang);
+ const apiRequests: string[] = [];
+ page.on('request', (request) => {
+ if (new URL(request.url()).pathname.startsWith('/api/')) apiRequests.push(request.url());
+ });
+ await page.goto(`/e2e/model-catalog/fixture.html?view=route&backend=${backend}&lang=${lang}&origin=${origin}`);
+ await page.getByRole('button', { name: 'Open route', exact: true }).click();
+ const dialog = page.locator('.model-hub-route-dialog');
+ const foot = dialog.locator('.model-hub-route-foot');
+ const save = foot.getByRole('button', { name: copy('routeDialog.save'), exact: true });
+ const state = async () => JSON.parse(await page.getByTestId('route-state').innerText());
+ const baseline = (await state()).saved;
+ await expect(dialog.getByRole('button', { name: copy('routeDialog.editHop'), exact: true })).toHaveCount(2);
+ await expect(save).toBeDisabled();
+
+ // Real nested portal/touch dismissal must leave the parent and intent intact.
+ await dialog.getByRole('button', { name: copy('routeDialog.editHop'), exact: true }).first().click();
+ await expect(page.locator('.model-hub-route-selector')).toBeVisible();
+ await page.keyboard.press('Escape');
+ await expect(page.locator('.model-hub-route-selector')).toHaveCount(0);
+ await expect(dialog).toBeVisible();
+ await expect(save).toBeDisabled();
+
+ await dialog.getByRole('button', { name: copy('routeDialog.removeHop'), exact: true }).first().click();
+ await expect(dialog.locator('.model-hub-route-hop-name')).toHaveText(['Provider B']);
+ await expect(save).toBeEnabled();
+ await foot.getByRole('button', { name: copy('routing.cancelChanges'), exact: true }).click();
+ await expect(dialog).toBeVisible();
+ await expect(dialog.locator('.model-hub-route-hop-name')).toHaveText(['Provider A', 'Provider B']);
+ await expect(save).toBeDisabled();
+ expect((await state()).reads).toBe(2);
+ expect((await state()).saved).toEqual(baseline);
+ expect((await state()).writes).toEqual([]);
+
+ await dialog.getByRole('button', { name: copy('routeDialog.editHop'), exact: true }).first().click();
+ const selector = page.locator('.model-hub-route-selector');
+ await selector.getByLabel(copy('routing.exactModel'), { exact: true }).fill('exact/model-中文');
+ await selector.getByRole('button', { name: copy('routeDialog.edit.confirm'), exact: true }).click();
+ await expect(dialog).toBeVisible();
+ await expect(dialog.locator('.model-hub-route-hop-model')).toHaveText(['exact/model-中文', 'gpt-test']);
+ expect((await state()).writes).toEqual([]);
+ await save.click();
+ await expect.poll(async () => (await state()).writes).toEqual([{
+ method: 'PUT',
+ hops: [{ source_id: 'src_a', model_id: 'exact/model-中文' }, { source_id: 'src_b', model_id: 'gpt-test' }],
+ }]);
+ await foot.getByRole('button', { name: copy('routeDialog.impact.done'), exact: true }).click();
+ await expect(dialog).toHaveCount(0);
+ expect(apiRequests).toEqual([]);
+ });
+ }
+ }
+}
+
+for (const lang of ['en', 'zh'] as const) {
+ for (const theme of ['light', 'dark']) {
+ test(`MH-ROUTING-007: direct editing geometry and explicit pin (${lang}, ${theme})`, async ({ page }) => {
+ const copy = (key: string) => hub(key, {}, lang);
+ await page.goto(`/e2e/model-catalog/fixture.html?view=route&backend=codex&lang=${lang}&long=1`);
+ await page.evaluate((value) => { document.documentElement.dataset.theme = value; }, theme);
+ await expect(page.locator('html')).toHaveAttribute('data-theme', theme);
+ await page.getByRole('button', { name: 'Open route', exact: true }).click();
+ const dialog = page.locator('.model-hub-route-dialog');
+ const foot = dialog.locator('.model-hub-route-foot');
+ const save = foot.getByRole('button', { name: copy('routeDialog.save'), exact: true });
+ await expect(dialog.locator('.model-hub-route-hop')).toHaveCount(2);
+ const checkGeometry = async () => {
+ const titleBox = await dialog.locator('.model-hub-route-title').boundingBox();
+ const headBox = await dialog.locator('.model-hub-route-head').boundingBox();
+ const bodyBox = await dialog.locator('.model-hub-route-body').boundingBox();
+ const footBox = await foot.boundingBox();
+ expect(titleBox!.y + titleBox!.height).toBeLessThanOrEqual(headBox!.y + headBox!.height);
+ expect(headBox!.y + headBox!.height).toBeLessThanOrEqual(bodyBox!.y + 1);
+ expect(footBox!.y + footBox!.height).toBeLessThanOrEqual(page.viewportSize()!.height);
+ const overflow = await dialog.evaluate((element) => {
+ const box = element.getBoundingClientRect();
+ return [...element.querySelectorAll<HTMLElement>('.model-hub-route-foot button, .model-hub-route-hop, .model-hub-route-origin-line, .model-hub-route-title')]
+ .filter((node) => {
+ const rect = node.getBoundingClientRect();
+ return rect.left < box.left - 1 || rect.right > box.right + 1
+ || node.scrollWidth > node.clientWidth + 1;
+ }).map((node) => node.textContent);
+ });
+ expect(overflow).toEqual([]);
+ expect(await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth)).toBe(true);
+ };
+ await checkGeometry();
+ await page.screenshot({ path: test.info().outputPath(`route-${lang}-${theme}-clean.png`), scale: 'css' });
+ await foot.getByRole('button', { name: copy('routing.pinRoute'), exact: true }).click();
+ await expect(save).toBeEnabled();
+ await checkGeometry();
+ await page.screenshot({ path: test.info().outputPath(`route-${lang}-${theme}-dirty.png`), scale: 'css' });
+ const state = async () => JSON.parse(await page.getByTestId('route-state').innerText());
+ const inheritedHops = (await state()).saved.chain.map(({ source_id, model_id }: { source_id: string; model_id: string }) => ({ source_id, model_id }));
+ expect((await state()).writes).toEqual([]);
+ await save.click();
+ await expect.poll(async () => (await state()).writes).toEqual([{ method: 'PUT', hops: inheritedHops }]);
+ });
+ }
+}
diff --git a/ui/e2e/model-catalog/routeFixture.tsx b/ui/e2e/model-catalog/routeFixture.tsx
new file mode 100644
index 000000000..95529dfc3
--- /dev/null
+++ b/ui/e2e/model-catalog/routeFixture.tsx
@@ -0,0 +1,65 @@
+import { useState } from 'react';
+import { RouteChainDialog } from '../../src/components/settings/models/RouteChainDialog';
+import { modelsApi } from '../../src/components/settings/models/modelsApi';
+import { readyRegion } from '../../src/components/settings/models/regionRead';
+import type { AgentBackend, AgentChain, AgentSupply, RouteHop, Source } from '../../src/components/settings/models/types';
+
+const params = new URLSearchParams(location.search);
+const backend = (params.get('backend') ?? 'codex') as AgentBackend;
+const origin = (params.get('origin') ?? 'automatic') as AgentChain['route_origin'];
+const modelId = params.has('long') ? `模型/${'long-model-identity/'.repeat(10)}gpt-test` : 'gpt-test';
+const sources: Source[] = ['a', 'b'].map((id) => ({
+ id: `src_${id}`, display_name: id === 'a' ? 'Provider A' : 'Provider B',
+ kind: 'api_key', vendor: 'openai', protocol: 'openai_responses',
+ supply_channel: 'hub', billing: 'metered', last_discovered_at: null,
+ state: { status: 'active', retry_at: null, detail_key: null },
+ models: [{ id: modelId, origin: 'discovered', reasoning_efforts: [], reasoning_efforts_source: null }],
+}));
+const inheritedHops = sources.map((source) => ({ source_id: source.id, model_id: modelId }));
+const supply: AgentSupply = {
+ backend, mode: 'hub', cli_present: true, menu_kind: 'fixed',
+ sources: { order: sources.map((source) => source.id), eligibility: sources.map((source) => ({ source_id: source.id, eligible: true })) },
+};
+const makeChain = (hops: RouteHop[], manual: boolean): AgentChain => ({
+ contract_version: 10, backend, model_id: modelId,
+ manual_override: manual ? { hops } : null,
+ route_origin: manual ? 'manual' : origin === 'passthrough' ? 'passthrough' : 'automatic',
+ current: hops[0] ?? null, supply_state: hops.length ? 'ok' : 'interrupted',
+ chain: hops.map((hop) => ({ ...hop, channel: 'hub', health: 'healthy', runnable: true, reason: null, retry_at: null })),
+});
+let saved = makeChain(inheritedHops, origin === 'manual');
+let reads = 0;
+const writes: Array<{ method: string; hops?: RouteHop[] }> = [];
+// This fixture calls production components and replaces only their API boundary.
+// It must not connect to the personal service or an Incus environment.
+if (params.get('view') === 'route') {
+ modelsApi.getAgentChain = async () => { reads += 1; return saved; };
+ modelsApi.getAgentProvenance = async () => null;
+ modelsApi.previewAgentChain = async () => makeChain(inheritedHops, false);
+ modelsApi.putAgentChain = async (target, model, input) => {
+ if (target !== backend || model !== modelId) throw new Error('Wrong route identity');
+ writes.push({ method: 'PUT', hops: input.hops });
+ saved = makeChain(input.hops, true);
+ return { chain: saved, removed_hops: [], interrupted: [] };
+ };
+ modelsApi.restoreAgentChain = async (target, model) => {
+ if (target !== backend || model !== modelId) throw new Error('Wrong route identity');
+ writes.push({ method: 'DELETE' });
+ saved = makeChain(inheritedHops, false);
+ return { chain: saved, removed_hops: [], interrupted: [] };
+ };
+}
+
+export function RouteFixture() {
+ const [open, setOpen] = useState(false);
+ const [, setRevision] = useState(0);
+ const observed = () => setRevision((revision) => revision + 1);
+ return <>
+ <button type="button" onClick={() => setOpen(true)}>Open route</button>
+ <output data-testid="route-state">{JSON.stringify({ saved, reads, writes })}</output>
+ <RouteChainDialog selection={open ? { agent: supply, modelId, read: readyRegion(saved) } : null}
+ sources={sources} onClose={() => setOpen(false)} onObserved={observed} onCommitted={observed}
+ readAgents={async () => ({ value: [supply], install: observed })}
+ readSources={async () => ({ value: sources, install: observed })} />
+ </>;
+}
diff --git a/ui/e2e/model-recorded-turn.spec.ts b/ui/e2e/model-recorded-turn.spec.ts
index ae4918755..69144d854 100644
--- a/ui/e2e/model-recorded-turn.spec.ts
+++ b/ui/e2e/model-recorded-turn.spec.ts
@@ -147,7 +147,7 @@ test('MH-ROUTING-011 recorded request error is independent of current route and
expect(JSON.parse(await details.locator('pre').innerText())).toEqual(recorded);
await details.press('Escape');
await expect(details).toHaveCount(0);
- await labelledButton(dialog, copy('routeDialog.cancel')).click();
+ await labelledButton(dialog, copy('routing.close')).click();
expect(await api.deleteAgentChain(backend, model)).toBe(true);
await mock.configure({ model_errors: {} });
diff --git a/ui/e2e/model-routing-origin.spec.ts b/ui/e2e/model-routing-origin.spec.ts
index 64feac07f..eda7ae7b7 100644
--- a/ui/e2e/model-routing-origin.spec.ts
+++ b/ui/e2e/model-routing-origin.spec.ts
@@ -78,7 +78,11 @@ test('MH-ROUTING-007 restore, undo, cancel, and save preserve explicit route int
await expect(dialog.locator('.model-hub-route-hop-name')).toHaveText([gateway.sources[0].display_name]);
await expect(dialog.locator('.model-hub-route-hop-model')).toHaveText([unsavedModel]);
await removeLast();
- await labelledButton(dialog, copy('routeDialog.cancel')).click();
+ await labelledButton(dialog, copy('routing.cancelChanges')).click();
+ await expect(dialog).toBeVisible();
+ await expect(dialog.locator('.model-hub-route-hop-model')).toHaveText([manual.hops[0].model_id]);
+ await expect(labelledButton(dialog, copy('routeDialog.save'))).toBeDisabled();
+ await labelledButton(dialog, copy('routing.close')).click();
await expect(dialog).not.toBeVisible();
expect((await api.agentChain(gateway.backend, gateway.model)).manual_override).toEqual(manual);
expect(mutations).toEqual([]);
@@ -120,7 +124,9 @@ test('MH-ROUTING-007 restore, undo, cancel, and save preserve explicit route int
expect(identities(reloaded)).toEqual(identities(inherited));
await expect(hub.routeRow(gateway.backend, gateway.model).locator('button.model-hub-route-origin')).toHaveText(copy(`routing.origin.${reloaded.route_origin}`));
await hub.openRoute(gateway.backend, gateway.model);
- await expect(labelledButton(dialog, copy('routing.editRoute'))).toBeVisible();
+ await expect(labelledButton(dialog, copy('routing.pinRoute'))).toBeVisible();
+ await expect(dialog.getByRole('button', { name: copy('routeDialog.editHop'), exact: true }).first()).toBeVisible();
+ await expect(labelledButton(dialog, copy('routeDialog.save'))).toBeDisabled();
await labelledButton(dialog, copy('routing.close')).click();
} finally {
try {
diff --git a/ui/e2e/support/hub.ts b/ui/e2e/support/hub.ts
index b2c9a210c..a622b5ced 100644
--- a/ui/e2e/support/hub.ts
+++ b/ui/e2e/support/hub.ts
@@ -381,8 +381,8 @@ export const pickerRowId = async (row: Locator): Promise<string> => {
* icon-only close carrying the same accessible name.
*
* Every Model Hub surface with a footer does this: the header X takes the
- * footer action's own label as its `aria-label` — `Cancel` on the route dialog
- * and the priority drawer, `Done` on the mutation report. That is right for a
+ * dismissal action's label as its `aria-label` — `Close` on the route dialog,
+ * `Cancel` on the priority drawer, `Done` on the mutation report. That is right for a
* screen reader, since the X genuinely does perform that action, and it means a
* name alone matches two elements, which Playwright refuses in strict mode. The
* visible one is the one whose own text is the label; the X has none.
diff --git a/ui/e2e/tsconfig.json b/ui/e2e/tsconfig.json
index e6931aa34..5da0a82dc 100644
--- a/ui/e2e/tsconfig.json
+++ b/ui/e2e/tsconfig.json
@@ -2,7 +2,7 @@
"//": "Standalone on purpose. `npm run build` runs `tsc -b`, which resolves the app and vite configs only — the browser bundle must not grow a dependency on a Playwright suite that never ships. Typecheck this project directly: `npx tsc -p e2e/tsconfig.json --noEmit`.",
"compilerOptions": {
"target": "ES2023",
- "lib": ["ES2023", "DOM"],
+ "lib": ["ES2023", "DOM", "DOM.Iterable"],
"module": "ESNext",
"types": ["node"],
"skipLibCheck": true,
diff --git a/ui/src/components/settings/models/RouteChainDialog.directEdit.test.tsx b/ui/src/components/settings/models/RouteChainDialog.directEdit.test.tsx
new file mode 100644
index 000000000..c51ad1a9a
--- /dev/null
+++ b/ui/src/components/settings/models/RouteChainDialog.directEdit.test.tsx
@@ -0,0 +1,218 @@
+// @vitest-environment jsdom
+import { act, cleanup, render, screen, waitFor, within } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { I18nextProvider } from 'react-i18next';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import i18n from '@/i18n';
+import { RouteChainDialog } from './RouteChainDialog';
+import { ApiCallError, modelsApi } from './modelsApi';
+import { readyRegion } from './regionRead';
+import type { AgentChain, AgentSupply, Source } from './types';
+
+const sources: Source[] = ['a', 'b'].map((id) => ({
+ id: `src_${id}`, display_name: `Provider ${id}`, kind: 'api_key',
+ vendor: 'openai', protocol: 'openai_responses', supply_channel: 'hub',
+ billing: 'metered', last_discovered_at: null,
+ state: { status: 'active', retry_at: null, detail_key: null }, models: [],
+}));
+const hops = sources.map((source) => ({ source_id: source.id, model_id: 'gpt-test' }));
+const makeChain = (backend: AgentSupply['backend'], routeOrigin: 'automatic' | 'passthrough' | 'manual'): AgentChain => ({
+ contract_version: 10, backend, model_id: 'gpt-test', route_origin: routeOrigin,
+ manual_override: routeOrigin === 'manual' ? { hops } : null,
+ current: hops[0], supply_state: 'ok',
+ chain: hops.map((hop) => ({ ...hop, channel: 'hub', health: 'healthy', runnable: true, reason: null, retry_at: null })),
+});
+const mount = (chain: AgentChain) => {
+ const close = vi.fn();
+ vi.spyOn(modelsApi, 'getAgentChain').mockResolvedValue(chain);
+ const agent: AgentSupply = {
+ backend: chain.backend, cli_present: true, mode: 'hub', menu_kind: 'fixed',
+ sources: { order: sources.map((source) => source.id), eligibility: sources.map((source) => ({ source_id: source.id, eligible: true })) },
+ };
+ render(<I18nextProvider i18n={i18n}><RouteChainDialog
+ selection={{ agent, modelId: chain.model_id, read: readyRegion(chain) }}
+ sources={sources} onClose={close} readAgents={vi.fn()} readSources={vi.fn()}
+ /></I18nextProvider>);
+ return close;
+};
+const footer = () => within(document.querySelector<HTMLElement>('.model-hub-route-foot')!);
+
+beforeEach(async () => {
+ await i18n.changeLanguage('en');
+ vi.spyOn(modelsApi, 'getAgentProvenance').mockResolvedValue(null);
+ vi.stubGlobal('ResizeObserver', class {
+ observe() {}
+ unobserve() {}
+ disconnect() {}
+ });
+ Element.prototype.scrollIntoView = vi.fn();
+});
+afterEach(() => { cleanup(); vi.restoreAllMocks(); vi.unstubAllGlobals(); });
+
+describe('direct route editing', () => {
+ it.each(['claude', 'codex', 'opencode'] as const)('%s opens every origin directly editable without changing intent', async (backend) => {
+ for (const origin of ['automatic', 'passthrough', 'manual'] as const) {
+ const put = vi.spyOn(modelsApi, 'putAgentChain');
+ const restore = vi.spyOn(modelsApi, 'restoreAgentChain');
+ mount(makeChain(backend, origin));
+ expect(await screen.findAllByRole('button', { name: 'Edit hop' })).toHaveLength(2);
+ expect(screen.queryByRole('button', { name: 'Edit route' })).toBeNull();
+ expect(footer().getByRole('button', { name: 'Save' })).toHaveProperty('disabled', true);
+ expect(put).not.toHaveBeenCalled();
+ expect(restore).not.toHaveBeenCalled();
+ cleanup();
+ vi.restoreAllMocks();
+ vi.spyOn(modelsApi, 'getAgentProvenance').mockResolvedValue(null);
+ }
+ });
+
+ it('cancels a changed inherited draft in place and observes current saved authority', async () => {
+ const user = userEvent.setup();
+ const chain = makeChain('codex', 'automatic');
+ const close = mount(chain);
+ const put = vi.spyOn(modelsApi, 'putAgentChain');
+ await user.click((await screen.findAllByRole('button', { name: 'Remove hop' }))[0]);
+ expect(footer().getByRole('button', { name: 'Save' })).toHaveProperty('disabled', false);
+ const latest = { ...chain, chain: [chain.chain[0]] };
+ vi.mocked(modelsApi.getAgentChain).mockResolvedValue(latest);
+ await user.click(footer().getByRole('button', { name: 'Cancel changes' }));
+ await waitFor(() => expect(modelsApi.getAgentChain).toHaveBeenCalledTimes(2));
+ expect(await screen.findByText('Provider a')).toBeTruthy();
+ expect(screen.queryByText('Provider b')).toBeNull();
+ expect(footer().getByRole('button', { name: 'Save' })).toHaveProperty('disabled', true);
+ expect(close).not.toHaveBeenCalled();
+ expect(put).not.toHaveBeenCalled();
+ });
+
+ it('pins identical inherited hops only through explicit Pin and Save', async () => {
+ const user = userEvent.setup();
+ const chain = makeChain('codex', 'automatic');
+ mount(chain);
+ const put = vi.spyOn(modelsApi, 'putAgentChain').mockResolvedValue({
+ chain: makeChain('codex', 'manual'), removed_hops: [], interrupted: [],
+ });
+ await user.click(await screen.findByRole('button', { name: 'Pin current route' }));
+ expect(put).not.toHaveBeenCalled();
+ await user.click(footer().getByRole('button', { name: 'Save' }));
+ await waitFor(() => expect(put).toHaveBeenCalledWith('codex', 'gpt-test', { hops }));
+ });
+
+ it('does not pin from a dismissed picker, identical candidate or unmoved keyboard grab', async () => {
+ const user = userEvent.setup();
+ const close = mount(makeChain('codex', 'passthrough'));
+ const put = vi.spyOn(modelsApi, 'putAgentChain');
+ const edit = (await screen.findAllByRole('button', { name: 'Edit hop' }))[0];
+ await user.click(edit);
+ await user.keyboard('{Escape}');
+ expect(close).not.toHaveBeenCalled();
+ await user.click(edit);
+ await user.type(screen.getByLabelText('Exact model ID'), 'gpt-test');
+ expect(screen.getByRole('button', { name: 'Replace' })).toHaveProperty('disabled', true);
+ await user.click(screen.getByRole('button', { name: 'Replace' }));
+ await user.keyboard('{Escape}');
+ const grip = (await screen.findAllByRole('button', { name: 'Reorder this hop' }))[0];
+ grip.focus();
+ await user.keyboard('{Space}{Space}');
+ expect(footer().getByRole('button', { name: 'Save' })).toHaveProperty('disabled', true);
+ expect(footer().queryByRole('button', { name: 'Cancel changes' })).toBeNull();
+ expect(put).not.toHaveBeenCalled();
+ });
+
+ it.each(['automatic', 'restore'] as const)('Escape restores %s intent after moving a grabbed row', async (origin) => {
+ const user = userEvent.setup();
+ mount(makeChain('codex', origin === 'restore' ? 'manual' : 'automatic'));
+ await screen.findAllByRole('button', { name: 'Edit hop' });
+ if (origin === 'restore') {
+ vi.spyOn(modelsApi, 'previewAgentChain').mockResolvedValue(makeChain('codex', 'automatic'));
+ await user.click(screen.getByRole('button', { name: 'Restore automatic' }));
+ await screen.findByRole('button', { name: 'Undo restore' });
+ }
+ screen.getAllByRole('button', { name: 'Reorder this hop' })[0].focus();
+ await user.keyboard('{Space}{ArrowDown}');
+ expect(footer().getByRole('button', { name: 'Save' })).toHaveProperty('disabled', false);
+ await user.keyboard('{Escape}');
+ expect([...document.querySelectorAll('.model-hub-route-hop-name')].map((row) => row.textContent))
+ .toEqual(['Provider a', 'Provider b']);
+ if (origin === 'restore') {
+ expect(screen.getByRole('button', { name: 'Undo restore' })).toBeTruthy();
+ expect(document.querySelector('.model-hub-route-preview')).not.toBeNull();
+ await user.click(screen.getByRole('button', { name: 'Undo restore' }));
+ } else {
+ expect(screen.getByRole('button', { name: 'Pin current route' })).toBeTruthy();
+ }
+ expect(footer().getByRole('button', { name: 'Save' })).toHaveProperty('disabled', true);
+ });
+
+ it('edits an inherited restore preview into a new manual draft and saves only that draft', async () => {
+ const user = userEvent.setup();
+ mount(makeChain('codex', 'manual'));
+ vi.spyOn(modelsApi, 'previewAgentChain').mockResolvedValue(makeChain('codex', 'automatic'));
+ const restore = vi.spyOn(modelsApi, 'restoreAgentChain');
+ const put = vi.spyOn(modelsApi, 'putAgentChain').mockResolvedValue({
+ chain: makeChain('codex', 'manual'), removed_hops: [], interrupted: [],
+ });
+ await user.click(await screen.findByRole('button', { name: 'Restore automatic' }));
+ await screen.findByRole('button', { name: 'Undo restore' });
+ await user.click(screen.getAllByRole('button', { name: 'Remove hop' })[0]);
+ expect(screen.queryByRole('button', { name: 'Undo restore' })).toBeNull();
+ expect(document.querySelector('.model-hub-route-preview')).toBeNull();
+ await user.click(footer().getByRole('button', { name: 'Save' }));
+ await waitFor(() => expect(put).toHaveBeenCalledWith('codex', 'gpt-test', { hops: [hops[1]] }));
+ expect(restore).not.toHaveBeenCalled();
+ });
+
+ it('invalidates a pending restore on Cancel changes, without closing or applying the late preview', async () => {
+ const user = userEvent.setup();
+ let resolve!: (chain: AgentChain) => void;
+ vi.spyOn(modelsApi, 'previewAgentChain').mockReturnValue(new Promise((accept) => { resolve = accept; }));
+ const close = mount(makeChain('codex', 'manual'));
+ await user.click(await screen.findByRole('button', { name: 'Restore automatic' }));
+ await user.click(footer().getByRole('button', { name: 'Cancel changes' }));
+ await screen.findAllByRole('button', { name: 'Edit hop' });
+ await act(async () => resolve({ ...makeChain('codex', 'automatic'), chain: [] }));
+ expect(screen.getAllByRole('button', { name: 'Edit hop' })).toHaveLength(2);
+ expect(screen.queryByRole('button', { name: 'Undo restore' })).toBeNull();
+ expect(footer().getByRole('button', { name: 'Save' })).toHaveProperty('disabled', true);
+ expect(close).not.toHaveBeenCalled();
+ });
+
+ it('shows an unread state if the fresh read on Cancel changes fails, then retries the read only', async () => {
+ const user = userEvent.setup();
+ const close = mount(makeChain('codex', 'automatic'));
+ const put = vi.spyOn(modelsApi, 'putAgentChain');
+ await user.click(await screen.findByRole('button', { name: 'Pin current route' }));
+ vi.mocked(modelsApi.getAgentChain).mockRejectedValueOnce(new Error('offline'));
+ await user.click(footer().getByRole('button', { name: 'Cancel changes' }));
+ expect(await screen.findByRole('button', { name: 'Retry' })).toBeTruthy();
+ expect(screen.queryByRole('button', { name: 'Edit hop' })).toBeNull();
+ expect(footer().getByRole('button', { name: 'Save' })).toHaveProperty('disabled', true);
+ await user.click(screen.getByRole('button', { name: 'Retry' }));
+ await screen.findByRole('button', { name: 'Pin current route' });
+ expect(modelsApi.getAgentChain).toHaveBeenCalledTimes(3);
+ expect(put).not.toHaveBeenCalled();
+ expect(close).not.toHaveBeenCalled();
+ });
+
+ it.each(['rejected', 'unknown'] as const)('offers local cancellation only for a known rejection, not an %s outcome', async (outcome) => {
+ const user = userEvent.setup();
+ const close = mount(makeChain('codex', 'automatic'));
+ const put = vi.spyOn(modelsApi, 'putAgentChain').mockRejectedValue(outcome === 'rejected'
+ ? new ApiCallError('invalid_route')
+ : new Error('response lost'));
+ await user.click(await screen.findByRole('button', { name: 'Pin current route' }));
+ await user.click(footer().getByRole('button', { name: 'Save' }));
+ await screen.findByRole('button', { name: 'Retry' });
+ if (outcome === 'rejected') {
+ await user.click(footer().getByRole('button', { name: 'Cancel changes' }));
+ await screen.findByRole('button', { name: 'Pin current route' });
+ expect(close).not.toHaveBeenCalled();
+ expect(modelsApi.getAgentChain).toHaveBeenCalledTimes(2);
+ } else {
+ expect(footer().queryByRole('button', { name: 'Cancel changes' })).toBeNull();
+ await user.click(footer().getByRole('button', { name: 'Close' }));
+ expect(close).toHaveBeenCalledTimes(1);
+ expect(modelsApi.getAgentChain).toHaveBeenCalledTimes(1);
+ }
+ expect(put).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/ui/src/components/settings/models/RouteChainDialog.test.tsx b/ui/src/components/settings/models/RouteChainDialog.test.tsx
index 8b4a183c5..b1a940385 100644
--- a/ui/src/components/settings/models/RouteChainDialog.test.tsx
+++ b/ui/src/components/settings/models/RouteChainDialog.test.tsx
@@ -235,15 +235,15 @@ describe("RouteChainDialog", () => {
}
});
const footer = within(document.querySelector<HTMLElement>('.model-hub-route-foot')!);
- const labels = state === 'inherited' ? ['Close', 'Edit route']
- : [state === 'preview' ? 'Undo restore' : 'Restore automatic', 'Cancel', 'Save'];
+ const labels = state === 'inherited' ? ['Pin current route', 'Close', 'Save']
+ : [state === 'preview' ? 'Undo restore' : 'Restore automatic', state === 'preview' ? 'Cancel changes' : 'Close', 'Save'];
expect(footer.getAllByRole('button').map((button) => button.textContent)).toEqual(labels);
for (const label of labels) expect(footer.getByRole('button', { name: label }).hasAttribute('hidden')).toBe(false);
expect(screen.getByRole('dialog').classList.contains('overflow-hidden')).toBe(true);
},
);
- it('closes inherited inspection with visible Close, not the icon-only Cancel command', async () => {
+ it('closes an unchanged inherited editor without creating manual intent', async () => {
const user = userEvent.setup();
const inherited: AgentChain = { ...chain, manual_override: null, route_origin: 'automatic' };
vi.spyOn(modelsApi, 'getAgentChain').mockResolvedValue(inherited);
@@ -255,20 +255,20 @@ describe("RouteChainDialog", () => {
sources={sources} onClose={close} readAgents={vi.fn()} readSources={vi.fn()}
/></I18nextProvider>);
- await screen.findByRole('button', { name: 'Edit route' });
+ await screen.findAllByRole('button', { name: 'Edit hop' });
const footer = within(document.querySelector<HTMLElement>('.model-hub-route-foot')!);
const dismiss = footer.getByRole('button', { name: 'Close' });
expect(dismiss.textContent).toBe('Close');
expect(footer.queryByRole('button', { name: 'Cancel' })).toBeNull();
- expect(screen.getByRole('button', { name: 'Cancel' }).textContent).toBe('');
- expect(screen.queryByRole('button', { name: 'Add a hop' })).toBeNull();
+ expect(screen.queryByRole('button', { name: 'Cancel changes' })).toBeNull();
+ expect(screen.getByRole('button', { name: 'Add a hop' })).toBeTruthy();
await user.click(dismiss);
expect(close).toHaveBeenCalledTimes(1);
expect(put).not.toHaveBeenCalled();
expect(restore).not.toHaveBeenCalled();
});
- it('uses visible Cancel after Edit and throughout restore preview and undo without writing', async () => {
+ it('cancels explicit pinning, restore preview and undo in place without writing', async () => {
const user = userEvent.setup();
const inherited: AgentChain = { ...chain, manual_override: null, route_origin: 'automatic' };
vi.spyOn(modelsApi, 'getAgentChain').mockResolvedValue(inherited);
@@ -281,25 +281,26 @@ describe("RouteChainDialog", () => {
sources={sources} onClose={close} readAgents={vi.fn()} readSources={vi.fn()}
/></I18nextProvider>);
- await user.click(await screen.findByRole('button', { name: 'Edit route' }));
+ await user.click(await screen.findByRole('button', { name: 'Pin current route' }));
const footer = within(document.querySelector<HTMLElement>('.model-hub-route-foot')!);
- expect(footer.getByRole('button', { name: 'Cancel' }).textContent).toBe('Cancel');
+ expect(footer.getByRole('button', { name: 'Cancel changes' }).textContent).toBe('Cancel changes');
expect(footer.queryByRole('button', { name: 'Close' })).toBeNull();
expect(screen.getAllByRole('button', { name: 'Remove hop' })).toHaveLength(2);
await user.click(screen.getByRole('button', { name: 'Restore automatic' }));
await screen.findByRole('button', { name: 'Undo restore' });
expect(preview).toHaveBeenCalledWith('claude', 'opus-5', { manual_override: null });
- expect(footer.getByRole('button', { name: 'Cancel' }).textContent).toBe('Cancel');
+ expect(footer.getByRole('button', { name: 'Cancel changes' }).textContent).toBe('Cancel changes');
expect(footer.queryByRole('button', { name: 'Close' })).toBeNull();
- expect(screen.queryByRole('button', { name: 'Remove hop' })).toBeNull();
+ expect(screen.getAllByRole('button', { name: 'Remove hop' })).toHaveLength(2);
await user.click(screen.getByRole('button', { name: 'Undo restore' }));
- expect(footer.getByRole('button', { name: 'Cancel' }).textContent).toBe('Cancel');
+ expect(footer.getByRole('button', { name: 'Cancel changes' }).textContent).toBe('Cancel changes');
expect(footer.queryByRole('button', { name: 'Close' })).toBeNull();
expect(screen.getAllByRole('button', { name: 'Remove hop' })).toHaveLength(2);
- await user.click(footer.getByRole('button', { name: 'Cancel' }));
- expect(close).toHaveBeenCalledTimes(1);
+ await user.click(footer.getByRole('button', { name: 'Cancel changes' }));
+ await screen.findByRole('button', { name: 'Pin current route' });
+ expect(close).not.toHaveBeenCalled();
expect(put).not.toHaveBeenCalled();
expect(restore).not.toHaveBeenCalled();
});
@@ -339,8 +340,7 @@ describe("RouteChainDialog", () => {
order: [alternateSubscription.id], eligibility: [{ source_id: alternateSubscription.id, eligible: true }],
} }, [alternateSubscription]);
- await user.click(await screen.findByRole('button', { name: 'Edit route' }));
- await user.click(screen.getByRole('button', { name: 'Add a hop' }));
+ await user.click(await screen.findByRole('button', { name: 'Add a hop' }));
await user.click(screen.getByRole('option', { name: /sonnet-5/ }));
await user.click(screen.getByRole('button', { name: 'Add' }));
await user.click(screen.getByRole('button', { name: 'Save' }));
@@ -359,8 +359,7 @@ describe("RouteChainDialog", () => {
order: [], eligibility: [{ source_id: sources[0].id, eligible: true }],
} }, [sources[0]]);
- await user.click(await screen.findByRole('button', { name: 'Edit route' }));
- await user.click(screen.getByRole('button', { name: 'Add a hop' }));
+ await user.click(await screen.findByRole('button', { name: 'Add a hop' }));
await user.type(screen.getByLabelText('Exact model ID'), hop.model_id);
await user.click(screen.getByRole('button', { name: 'Add' }));
await user.click(screen.getByRole('button', { name: 'Save' }));
@@ -381,7 +380,8 @@ describe("RouteChainDialog", () => {
await screen.findByRole('button', { name: 'Configure default routing' });
expect(screen.queryByRole('button', { name: 'Edit route' })).toBeNull();
- expect(screen.queryByRole('button', { name: 'Save' })).toBeNull();
+ expect(screen.getByRole('button', { name: 'Save' })).toHaveProperty('disabled', true);
+ expect(screen.queryByRole('button', { name: 'Add a hop' })).toBeNull();
expect(screen.queryByRole('button', { name: 'Restore automatic' })).toBeNull();
});
@@ -390,16 +390,15 @@ describe("RouteChainDialog", () => {
await screen.findByRole('button', { name: 'Configure default routing' });
expect(screen.getByText('Unconfigured')).toBeTruthy();
expect(screen.queryByRole('button', { name: 'Restore automatic' })).toBeNull();
- expect(screen.queryByRole('button', { name: 'Save' })).toBeNull();
+ expect(screen.getByRole('button', { name: 'Save' })).toHaveProperty('disabled', true);
expect(screen.queryByText(/saved route is empty/)).toBeNull();
});
it('cannot save an empty newly opened editor as Manual', async () => {
- const user = userEvent.setup();
renderEmptyRoute({ ...agent, sources: {
order: [], eligibility: [{ source_id: sources[0].id, eligible: true }],
} }, [sources[0]]);
- await user.click(await screen.findByRole('button', { name: 'Edit route' }));
+ await screen.findByRole('button', { name: 'Add a hop' });
expect((screen.getByRole('button', { name: 'Save' }) as HTMLButtonElement).disabled).toBe(true);
expect(screen.queryByText(/saved route is empty/)).toBeNull();
});
@@ -425,20 +424,21 @@ describe("RouteChainDialog", () => {
vi.mocked(modelsApi.getAgentChain).mockResolvedValue(inherited);
cleanup();
render(<I18nextProvider i18n={i18n}><RouteChainDialog selection={{ agent, modelId: 'opus-5', read: readyRegion(inherited) }} sources={sources} onClose={close} readAgents={vi.fn()} readSources={vi.fn()} /></I18nextProvider>);
- await user.click(await screen.findByRole('button', { name: 'Edit route' }));
+ await screen.findAllByRole('button', { name: 'Edit hop' });
}
await clear(user);
await screen.findByText('After restore: automatic matching');
expect(preview).toHaveBeenCalledWith('claude', 'opus-5', { manual_override: null });
- expect(screen.queryByRole('button', { name: 'Remove hop' })).toBeNull();
- expect((screen.getByRole('button', { name: 'Save' }) as HTMLButtonElement).disabled).toBe(false);
+ expect(screen.getAllByRole('button', { name: 'Remove hop' })).toHaveLength(2);
+ expect((screen.getByRole('button', { name: 'Save' }) as HTMLButtonElement).disabled).toBe(origin === 'automatic');
await user.click(screen.getByRole('button', { name: 'Undo restore' }));
expect(screen.getAllByRole('button', { name: 'Remove hop' })).toHaveLength(1);
expect(document.querySelector('.model-hub-route-hop-model')?.textContent).toBe('opus-5');
await user.click(screen.getByRole('button', { name: 'Remove hop' }));
await screen.findByText('After restore: automatic matching');
- await user.click(within(document.querySelector<HTMLElement>('.model-hub-route-foot')!).getByRole('button', { name: 'Cancel' }));
- expect(close).toHaveBeenCalledOnce();
+ await user.click(within(document.querySelector<HTMLElement>('.model-hub-route-foot')!).getByRole('button', { name: 'Cancel changes' }));
+ await screen.findAllByRole('button', { name: 'Remove hop' });
+ expect(close).not.toHaveBeenCalled();
expect(put).not.toHaveBeenCalled();
expect(restore).not.toHaveBeenCalled();
expect(chain.manual_override?.hops).toHaveLength(2);
@@ -504,7 +504,9 @@ describe("RouteChainDialog", () => {
await clear(user);
const footer = within(document.querySelector<HTMLElement>('.model-hub-route-foot')!);
expect((footer.getByRole('button', { name: 'Save' }) as HTMLButtonElement).disabled).toBe(true);
- await user.click(footer.getByRole('button', { name: action === 'undo' ? 'Undo restore' : 'Cancel' }));
+ await user.click(action === 'undo'
+ ? footer.getByRole('button', { name: 'Undo restore' })
+ : screen.getByRole('button', { name: 'Close' }));
await act(async () => pending.resolve(inherited));
expect(screen.queryByText('After restore: automatic matching')).toBeNull();
if (action === 'undo') {
@@ -553,7 +555,7 @@ describe("RouteChainDialog", () => {
await user.click(screen.getByRole('button', { name: copy.routeDialog.removeHop }));
expect(screen.getByText(copy.routing.previewLoading)).toBeTruthy();
const footer = within(document.querySelector<HTMLElement>('.model-hub-route-foot')!);
- expect(footer.getAllByRole('button').map((button) => button.textContent)).toEqual([copy.routing.undoRestore, copy.routeDialog.cancel, copy.routeDialog.save]);
+ expect(footer.getAllByRole('button').map((button) => button.textContent)).toEqual([copy.routing.undoRestore, copy.routing.cancelChanges, copy.routeDialog.save]);
expect((footer.getByRole('button', { name: copy.routeDialog.save }) as HTMLButtonElement).disabled).toBe(true);
await act(async () => pending.reject(new Error('offline')));
expect(screen.getByRole('alert').textContent).toContain(copy.routing.previewFailed);
@@ -593,7 +595,7 @@ describe("RouteChainDialog", () => {
const props = { selection: { agent, modelId: 'opus-5', read: readyRegion(inherited) }, sources, onClose: vi.fn(), readAgents: vi.fn(), readSources: vi.fn() };
const view = (covered: boolean) => <I18nextProvider i18n={i18n}><RouteChainDialog {...props} covered={covered} /></I18nextProvider>;
const { rerender } = render(view(false));
- await screen.findByRole('button', { name: 'Edit route' });
+ await screen.findByRole('button', { name: 'Pin current route' });
rerender(view(true));
rerender(view(false));
await waitFor(() => expect(read).toHaveBeenCalledTimes(2));
@@ -635,12 +637,13 @@ describe("RouteChainDialog", () => {
await user.click(screen.getByRole('button', { name: 'Restore automatic' }));
await screen.findByText('After restore: original-name passthrough');
expect(preview).toHaveBeenCalledWith('claude', 'opus-5', { manual_override: null });
- expect(screen.queryByRole('button', { name: 'Remove hop' })).toBeNull();
+ expect(screen.getAllByRole('button', { name: 'Remove hop' })).toHaveLength(2);
await user.click(screen.getByRole('button', { name: 'Undo restore' }));
expect(screen.getAllByRole('button', { name: 'Remove hop' })).toHaveLength(1);
expect(document.querySelector('.model-hub-route-hop-model')?.textContent).toBe('opus-5');
- await user.click(screen.getAllByRole('button', { name: 'Cancel' }).at(-1)!);
- expect(close).toHaveBeenCalled();
+ await user.click(screen.getByRole('button', { name: 'Cancel changes' }));
+ await screen.findAllByRole('button', { name: 'Remove hop' });
+ expect(close).not.toHaveBeenCalled();
expect(put).not.toHaveBeenCalled();
expect(restore).not.toHaveBeenCalled();
});
@@ -659,7 +662,7 @@ describe("RouteChainDialog", () => {
expect(put).not.toHaveBeenCalled();
});
- it('saving an explicit edit of identical inherited hops creates manual intent', async () => {
+ it('saving explicit pinning of identical inherited hops creates manual intent', async () => {
const user = userEvent.setup();
const inherited: AgentChain = { ...chain, manual_override: null, route_origin: 'automatic' };
renderDialog();
@@ -668,7 +671,7 @@ describe("RouteChainDialog", () => {
cleanup();
const put = vi.spyOn(modelsApi, 'putAgentChain').mockResolvedValue(mutation(chain));
render(<I18nextProvider i18n={i18n}><RouteChainDialog selection={{ agent, modelId: 'opus-5', read: readyRegion(inherited) }} sources={[]} onClose={vi.fn()} readAgents={vi.fn()} readSources={vi.fn()} /></I18nextProvider>);
- await user.click(await screen.findByRole('button', { name: 'Edit route' }));
+ await user.click(await screen.findByRole('button', { name: 'Pin current route' }));
await user.click(screen.getByRole('button', { name: 'Save' }));
await waitFor(() => expect(put).toHaveBeenCalledWith('claude', 'opus-5', { hops: chain.manual_override!.hops }));
});
diff --git a/ui/src/components/settings/models/RouteChainDialog.tsx b/ui/src/components/settings/models/RouteChainDialog.tsx
index 3b5f36ca5..46cd8cc1f 100644
--- a/ui/src/components/settings/models/RouteChainDialog.tsx
+++ b/ui/src/components/settings/models/RouteChainDialog.tsx
@@ -6,6 +6,7 @@ import {
ListOrdered,
LoaderCircle,
Pencil,
+ Pin,
Plus,
RefreshCw,
RotateCcw,
@@ -128,12 +129,18 @@ export const RouteChainDialog: React.FC<{
const [phase, setPhase] = React.useState<Phase>("loading");
const [origin, setOrigin] = React.useState<RouteHop[]>([]);
const [savedOverride, setSavedOverride] = React.useState<ManualRouteOverride | null>(null);
+ // This is draft routing intent, not whether the rows can be edited.
const [manualDraft, setManualDraft] = React.useState(false);
const [preview, setPreview] = React.useState<AgentChain | null>(null);
const [previewPending, setPreviewPending] = React.useState(false);
const [previewFailed, setPreviewFailed] = React.useState(false);
const previewGeneration = React.useRef(0);
- const restoreUndo = React.useRef<RouteHop[] | null>(null);
+ const restoreUndo = React.useRef<{ hops: RouteHop[]; manual: boolean } | null>(null);
+ const grabIntent = React.useRef<{
+ manual: boolean;
+ preview: AgentChain | null;
+ undo: { hops: RouteHop[]; manual: boolean } | null;
+ } | null>(null);
const submittedOverride = React.useRef<ManualRouteOverride | null>(null);
const interactionRef = React.useRef(createRouteChainInteraction());
const [interaction, setInteraction] = React.useState(interactionRef.current);
@@ -180,12 +187,30 @@ export const RouteChainDialog: React.FC<{
const grabbed = interaction.grab?.index ?? null;
const advanceInteraction = React.useCallback(
(action: RouteChainInteractionAction) => {
- const next = advanceRouteChainInteraction(interactionRef.current, action);
+ const previous = interactionRef.current;
+ const next = advanceRouteChainInteraction(previous, action);
+ if (action.type === "begin-grab") {
+ grabIntent.current = { manual: manualDraft, preview, undo: restoreUndo.current };
+ }
+ if (action.type === "cancel-grab" && previous.grab && grabIntent.current) {
+ setManualDraft(grabIntent.current.manual);
+ setPreview(grabIntent.current.preview);
+ restoreUndo.current = grabIntent.current.undo;
+ } else if (action.type !== "reset" && !sameRouteDraft(previous.draft, next.draft)) {
+ // Focusing or opening a picker is not a request to pin inherited routing.
+ setManualDraft(true);
+ previewGeneration.current += 1;
+ restoreUndo.current = null;
+ setPreview(null);
+ setPreviewPending(false);
+ setPreviewFailed(false);
+ }
+ if (!next.grab) grabIntent.current = null;
interactionRef.current = next;
setInteraction(next);
return next;
},
- [],
+ [manualDraft, preview],
);
const addCandidates = agent ? routeCandidates(agent, sources, draft) : [];
const targetSources = agent ? eligibleSources(sources, agent) : [];
@@ -201,7 +226,8 @@ export const RouteChainDialog: React.FC<{
: { invalidIndexes: [], valid: false };
const restoring = restoreUndo.current !== null;
const unresolvedPreview = restoring && preview === null;
- const dirty = manualDraft ? savedOverride === null || !sameRouteDraft(savedOverride.hops, draft) : restoring;
+ const dirty = manualDraft ? savedOverride === null || !sameRouteDraft(savedOverride.hops, draft) : savedOverride !== null;
+ const canDiscardDraft = (phase === "ready" || phase === "rejected") && (dirty || restoring);
const draftOrigin = manualDraft ? (draft.length ? 'manual' : null) : (preview ?? chain)?.route_origin ?? null;
const announce = (key: string, params?: Record<string, unknown>) =>
setAnnouncement({ key, params });
@@ -324,6 +350,18 @@ export const RouteChainDialog: React.FC<{
onClose();
}
};
+ const cancelChanges = () => {
+ if (!canDiscardDraft) return;
+ setSubmitted(null);
+ submittedOverride.current = null;
+ setSubmittedStage("initial");
+ setSelectorEpoch((current) => current + 1);
+ setAnnouncement(null);
+ // Cancel local intent, not server state. Defaults or saved overrides may
+ // have changed elsewhere; a failed read must stay visibly unread.
+ void readChain();
+ focusAfterRender(cancelButtonRef);
+ };
const remove = (index: number) => {
if (phase === "saving" || phase === "impact" || phase === "refreshing")
return;
@@ -682,7 +720,9 @@ export const RouteChainDialog: React.FC<{
if (!agent || previewPending || phase !== 'ready') return;
const token = ++previewGeneration.current;
// Record intent before reading: failure must not leave a saveable empty Manual draft.
- if (manualDraft) restoreUndo.current = draft.map((hop) => ({ ...hop }));
+ if (restoreUndo.current === null) {
+ restoreUndo.current = { hops: draft.map((hop) => ({ ...hop })), manual: manualDraft };
+ }
setManualDraft(false);
setPreview(null);
setPreviewPending(true);
@@ -722,13 +762,14 @@ export const RouteChainDialog: React.FC<{
setPreview(null);
setPreviewPending(false);
setPreviewFailed(false);
- setManualDraft(true);
- advanceInteraction({ type: 'reset', draft: restoreUndo.current ?? origin });
+ setManualDraft(restoreUndo.current?.manual ?? savedOverride !== null);
+ advanceInteraction({ type: 'reset', draft: restoreUndo.current?.hops ?? origin });
restoreUndo.current = null;
announce('settings.models.routing.undoDone');
};
const renderHop = (hop: RouteHop, index: number) => {
- const chainLink = chain?.chain.find((entry) =>
+ const visibleChain = preview ?? chain;
+ const chainLink = visibleChain?.chain.find((entry) =>
equalHopIdentity(entry, hop),
);
const missing = chainLink?.reason === "source_missing";
@@ -738,7 +779,7 @@ export const RouteChainDialog: React.FC<{
: joined
? sourceName(sources, hop.source_id)
: hop.source_id;
- const chainCurrent = chain ? chain.current : null;
+ const chainCurrent = visibleChain?.current ?? null;
const current = equalHopIdentity(chainCurrent, hop);
const replacementCandidates = agent
? routeCandidates(
@@ -1051,7 +1092,7 @@ export const RouteChainDialog: React.FC<{
<div className="model-hub-route-body flex flex-col">
{!unresolvedPreview && !(manualDraft && draft.length === 0) && <div className="model-hub-route-origin-line">
<RouteOriginBadge origin={draftOrigin} backend={agent!.backend} interactive={false} />
- <span>{t(manualDraft ? 'settings.models.routing.frozen' : 'settings.models.routing.follows', { backend })}</span>
+ <span>{t(manualDraft ? (dirty ? 'settings.models.routing.manualPending' : 'settings.models.routing.frozen') : 'settings.models.routing.follows', { backend })}</span>
</div>}
{unresolvedPreview && <div className="model-hub-route-preview" role="status">
{previewPending && <strong>{t('settings.models.routing.previewLoading')}</strong>}
@@ -1066,22 +1107,14 @@ export const RouteChainDialog: React.FC<{
</h3>
<div inert={previewPending} className="model-hub-route-list flex flex-col border border-border bg-background">
{draft.length ? (
- manualDraft ? draft.map(renderHop) : draft.map((hop, index) => (
- <div key={`${hop.source_id}:${hop.model_id}`} className="model-hub-route-hop model-hub-fill-08 flex items-center border border-border">
- <span className="model-hub-route-ordinal grid shrink-0 place-items-center font-mono" data-origin={draftOrigin ?? 'unconfigured'}>{index + 1}</span>
- <span className="model-hub-route-hop-copy flex min-w-0 flex-1 flex-col">
- <span className="model-hub-route-hop-name font-semibold" title={sourceName(sources, hop.source_id)}>{sourceName(sources, hop.source_id)}</span>
- <span className="model-hub-route-hop-model font-mono text-muted" title={hop.model_id}>{hop.model_id}</span>
- </span>
- </div>
- ))
+ draft.map(renderHop)
) : (
<div className="model-hub-route-empty text-xs text-muted">
<p>{t(manualDraft ? 'settings.models.routing.draftEmpty' : 'settings.models.routing.noDefaults')}</p>
{!manualDraft && onOpenDefaults && <Button variant="outline" onClick={onOpenDefaults}><ListOrdered aria-hidden />{t('settings.models.routing.configureDefaults')}</Button>}
</div>
)}
- {manualDraft && <RouteCandidatePopover
+ {canEditRoute && <RouteCandidatePopover
key={`add:${selectorEpoch}`}
candidates={addCandidates}
sources={targetSources}
@@ -1180,7 +1213,7 @@ export const RouteChainDialog: React.FC<{
? "settings.models.guard.cancel"
: phase === "impact" || phase === "refreshing"
? "settings.models.routeDialog.impact.done"
- : "settings.models.routeDialog.cancel",
+ : "settings.models.routing.close",
) as string
}
className="model-hub-route-close grid shrink-0 place-items-center"
@@ -1240,16 +1273,22 @@ export const RouteChainDialog: React.FC<{
{previewPending ? <LoaderCircle className="animate-spin" aria-hidden /> : restoreUndo.current ? <Undo2 aria-hidden /> : <RotateCcw aria-hidden />}
{t(restoreUndo.current ? 'settings.models.routing.undoRestore' : 'settings.models.routing.restoreAutomatic')}
</Button>}
+ {!manualDraft && !restoring && draft.length > 0 && <Button
+ variant="outline"
+ className="model-hub-dialog-action mr-auto"
+ disabled={phase !== 'ready' || !valid.valid}
+ onClick={() => setManualDraft(true)}
+ ><Pin aria-hidden />{t('settings.models.routing.pinRoute')}</Button>}
<Button
ref={cancelButtonRef}
type="button"
variant="outline"
className="model-hub-dialog-action"
- onClick={close}
+ onClick={canDiscardDraft ? cancelChanges : close}
>
- {t(manualDraft || restoring ? "settings.models.routeDialog.cancel" : 'settings.models.routing.close')}
+ {t(canDiscardDraft ? 'settings.models.routing.cancelChanges' : 'settings.models.routing.close')}
</Button>
- {!manualDraft && !restoring ? (canEditRoute && <Button variant="outline" className="model-hub-dialog-action" disabled={phase !== 'ready'} onClick={() => setManualDraft(true)}><Pencil aria-hidden />{t('settings.models.routing.editRoute')}</Button>) : <Button
+ <Button
ref={saveButtonRef}
type="button"
className="model-hub-dialog-action"
@@ -1267,7 +1306,7 @@ export const RouteChainDialog: React.FC<{
onClick={() => void submit()}
>
{t("settings.models.routeDialog.save")}
- </Button>}
+ </Button>
</>
)}
</footer>
diff --git a/ui/src/components/settings/models/modelHubSurface.css b/ui/src/components/settings/models/modelHubSurface.css
index 77be57133..904dc2ea0 100644
--- a/ui/src/components/settings/models/modelHubSurface.css
+++ b/ui/src/components/settings/models/modelHubSurface.css
@@ -1032,11 +1032,13 @@
border-color: var(--model-hub-wash-24);
box-shadow: var(--model-hub-dialog-shadow);
}
-.model-hub-route-head { height: var(--model-hub-route-head-height); flex-shrink: 0; padding: 16px 20px; gap: 4px; border-color: var(--model-hub-wash-14); }
+.model-hub-route-head { min-height: var(--model-hub-route-head-height); flex-shrink: 0; padding: 16px 20px; gap: 4px; border-color: var(--model-hub-wash-14); }
.model-hub-route-close { width: 26px; height: 26px; margin: -5px -5px -5px 0; color: var(--model-hub-ink-59); }
.model-hub-route-close > svg { width: 15px; height: 15px; }
.model-hub-route-title {
--model-hub-route-title-size: 15px;
+ min-width: 0;
+ overflow-wrap: anywhere;
font-size: var(--model-hub-route-title-size);
}
.model-hub-route-subtitle {
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index 2bf2d3943..5c014e005 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -1221,7 +1221,9 @@
"configureDefaults": "Configure default routing",
"defaultRouting": "Default routing",
"close": "Close",
- "editRoute": "Edit route",
+ "pinRoute": "Pin current route",
+ "cancelChanges": "Cancel changes",
+ "manualPending": "After saving, this model will use a manual route and no longer follow default routing.",
"exactModel": "Exact model ID",
"moveUp": "Move source up",
"moveDown": "Move source down",
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index 52039aa10..cefe412cf 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -1221,7 +1221,9 @@
"configureDefaults": "设置默认路由",
"defaultRouting": "默认路由",
"close": "关闭",
- "editRoute": "编辑路由",
+ "pinRoute": "固定当前路由",
+ "cancelChanges": "取消修改",
+ "manualPending": "保存后,此模型将使用手动路由,不再跟随默认路由。",
"exactModel": "准确模型 ID",
"moveUp": "上移供应商",
"moveDown": "下移供应商",