Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(model-hub): restore compact default routing controls (#1907)
Call Whiteb930160edceb
diff --git a/docs/plans/model-hub-routing-modes.md b/docs/plans/model-hub-routing-modes.mdindex 3885b5c32..8e662421a 100644--- a/docs/plans/model-hub-routing-modes.md+++ b/docs/plans/model-hub-routing-modes.md@@ -434,6 +434,29 @@ after long-body scrolling and Save performs the intended mutation. Verify EN/ZH,light/dark and manual/restore-preview states. Existing required case identities,baseline gaps and screenshot stages do not change; add assertions within them.+## Default Routing Action Fidelity++The approved Default Routing frame `ztAos` uses Lucide arrow-up, arrow-down,+minus and plus icons at 13px within 26px controls, with 6px corner radii and+3px spacing inside the ordered row's action group. The implementation must not+inherit the global Button icon size (36px) or the SVG library's default size.+Retain a subtle theme-token surface and border without the generic outline+button shadow. Reuse the existing Button primitive and Model Hub scoped styling;+do not resize unrelated controls or remove the equivalent pointer/keyboard+ordering paths. Icon controls retain accessible names, hover hints, disabled+boundaries and visible keyboard focus. Their group does not shrink or displace+the source identity outside the row at narrow widths. The held-out plus action+uses the same visual treatment. Scope excludes unrelated drawer typography,+section composition, source order, inventory, and route persistence changes.++The user's local Codex inspection found saved empty overrides taking precedence+over otherwise eligible default sources. A read-only restore preview correctly+returns automatic matching or passthrough. This is an upgrade-experience gap,+not permission to reinterpret or delete persisted empty overrides. Preserve the+existing compatibility contract and actual local state during this visual fix;+the interface distinction and any explicit restoration require their own scope+decision. Do not make acceptance green by changing the user's route intent.+## Delivery OwnershipOne feature PR is intentional: executable schema/type/mirror closure needs alldiff --git a/ui/src/components/settings/models/SourceOrderDrawer.test.tsx b/ui/src/components/settings/models/SourceOrderDrawer.test.tsxindex 39bb8f684..ff9d9222d 100644--- a/ui/src/components/settings/models/SourceOrderDrawer.test.tsx+++ b/ui/src/components/settings/models/SourceOrderDrawer.test.tsx@@ -1,5 +1,5 @@// @vitest-environment jsdom-import { act, cleanup, render, screen, waitFor } from '@testing-library/react';+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';@@ -69,6 +69,58 @@ beforeEach(() => {});describe('SourceOrderDrawer keyboard ordering', () => {+ it('uses the same compact action owner for ordered controls and held-out include without losing hints or boundaries', async () => {+ const available = [...sources, source('src_c', 'Manual only')];+ const codex: AgentSupply = { ...agent, backend: 'codex', sources: {+ order: ['src_a', 'src_b'], eligibility: available.map((item) => ({ source_id: item.id, eligible: true })),+ } };+ vi.spyOn(modelsApi, 'getAgentSources').mockResolvedValue(codex);+ vi.mocked(modelsApi.listSources).mockResolvedValue(available);+ renderDrawer({ agent: codex, sources: available });+ await screen.findByRole('button', { name: 'Add to order' });++ const rows = [...document.querySelectorAll<HTMLElement>('.model-hub-order-row')];+ expect(rows).toHaveLength(3);+ const labels = [['Move source up', 'Move source down', 'Remove from order'], ['Move source up', 'Move source down', 'Remove from order'], ['Add to order']];+ rows.forEach((row, index) => {+ const actions = row.querySelector<HTMLElement>('.model-hub-order-row-actions');+ expect(actions).not.toBeNull();+ expect(within(actions!).getAllByRole('button').map((button) => button.getAttribute('aria-label'))).toEqual(labels[index]);+ for (const label of labels[index]) {+ const button = within(actions!).getByRole('button', { name: label });+ expect(button.classList.contains('model-hub-route-action')).toBe(true);+ expect(button.classList.contains('model-hub-order-row-action')).toBe(true);+ expect(button.getAttribute('title')).toBe(label);+ expect(button.classList.contains('focus-visible:ring-2')).toBe(true);+ expect([...button.classList].filter((name) => name.startsWith('shadow-'))).toEqual([]);+ expect(button.querySelector('svg')?.getAttribute('aria-hidden')).toBe('true');+ }+ expect(row.querySelector('.model-hub-order-name')?.textContent).toBe(available[index].display_name);+ });+ expect(within(rows[0]).getByRole('button', { name: 'Move source up' }).hasAttribute('disabled')).toBe(true);+ expect(within(rows[0]).getByRole('button', { name: 'Move source down' }).hasAttribute('disabled')).toBe(false);+ expect(within(rows[1]).getByRole('button', { name: 'Move source up' }).hasAttribute('disabled')).toBe(false);+ expect(within(rows[1]).getByRole('button', { name: 'Move source down' }).hasAttribute('disabled')).toBe(true);+ });++ it('moves with arrow actions, preserves focus after membership changes, and saves the exact draft', async () => {+ const user = userEvent.setup();+ vi.spyOn(modelsApi, 'getAgentSources').mockResolvedValue(agent);+ renderDrawer();+ await user.click((await screen.findAllByRole('button', { name: 'Move source down' }))[0]);+ await waitFor(() => expect(document.activeElement?.closest('li')?.textContent).toContain('Primary'));+ expect(screen.getAllByRole('button', { name: 'Reorder source' })[1].closest('li')?.textContent).toContain('Primary');+ await user.click(screen.getAllByRole('button', { name: 'Move source up' })[1]);+ expect(screen.getAllByRole('button', { name: 'Reorder source' })[0].closest('li')?.textContent).toContain('Primary');+ await user.click(screen.getAllByRole('button', { name: 'Remove from order' })[0]);+ const include = await screen.findByRole('button', { name: 'Add to order' });+ await waitFor(() => expect(document.activeElement).toBe(include));+ await user.keyboard('{Enter}');+ await waitFor(() => expect(document.activeElement).toBe(screen.getAllByRole('button', { name: 'Reorder source' })[1]));+ await user.click(screen.getByRole('button', { name: 'Save default routing' }));+ await waitFor(() => expect(modelsApi.putAgentSources).toHaveBeenCalledWith('claude', { order: ['src_b', 'src_a'] }));+ });+it('echoes the exact effective-removal guard before saving default membership', async () => {const user = userEvent.setup();const hops = [{ backend: 'claude' as const, menu_model: 'model-a', position: 1, source_id: 'src_a', model_id: 'model-a' }];diff --git a/ui/src/components/settings/models/SourceOrderDrawer.tsx b/ui/src/components/settings/models/SourceOrderDrawer.tsxindex 245c03136..06c2a8b6c 100644--- a/ui/src/components/settings/models/SourceOrderDrawer.tsx+++ b/ui/src/components/settings/models/SourceOrderDrawer.tsx@@ -75,11 +75,13 @@ const OrderedRow: React.FC<{</button><span className={cn('model-hub-order-ordinal', index === 0 && 'is-first')}>{index + 1}</span><SourceIdentity source={source} />- <Button type="button" variant="outline" size="icon" aria-label={t('settings.models.routing.moveUp')} disabled={busy || index === 0} onClick={() => onMove(-1)}><ArrowUp aria-hidden /></Button>- <Button type="button" variant="outline" size="icon" aria-label={t('settings.models.routing.moveDown')} disabled={busy || index === count - 1} onClick={() => onMove(1)}><ArrowDown aria-hidden /></Button>- <Button type="button" variant="outline" size="icon" aria-label={t('settings.models.order.action.exclude')} disabled={busy} onClick={onExclude}>- <Minus aria-hidden />- </Button>+ <span className="model-hub-order-row-actions">+ <Button type="button" variant="ghost" size="icon" className="model-hub-route-action model-hub-order-row-action" aria-label={t('settings.models.routing.moveUp')} disabled={busy || index === 0} onClick={() => onMove(-1)}><ArrowUp aria-hidden /></Button>+ <Button type="button" variant="ghost" size="icon" className="model-hub-route-action model-hub-order-row-action" aria-label={t('settings.models.routing.moveDown')} disabled={busy || index === count - 1} onClick={() => onMove(1)}><ArrowDown aria-hidden /></Button>+ <Button type="button" variant="ghost" size="icon" className="model-hub-route-action model-hub-order-row-action" aria-label={t('settings.models.order.action.exclude')} disabled={busy} onClick={onExclude}>+ <Minus aria-hidden />+ </Button>+ </span></Reorder.Item>);};@@ -395,24 +397,26 @@ export const SourceOrderDrawer: React.FC<{<div key={source.id} className="model-hub-order-row model-hub-order-row--held"><Minus className="model-hub-order-held-icon" /><SourceIdentity source={source} />- <Button- ref={(node) => {- if (node) heldOutActions.current.set(source.id, node);- else heldOutActions.current.delete(source.id);- }}- type="button"- variant="outline"- size="icon"- aria-label={t('settings.models.order.action.include')}- className="model-hub-order-row-action"- disabled={saving}- onClick={() => {- persist([...order, source.id]);- focusHandleAfterRender(source.id);- }}- >- <Plus className="size-3.5" />- </Button>+ <span className="model-hub-order-row-actions">+ <Button+ ref={(node) => {+ if (node) heldOutActions.current.set(source.id, node);+ else heldOutActions.current.delete(source.id);+ }}+ type="button"+ variant="ghost"+ size="icon"+ aria-label={t('settings.models.order.action.include')}+ className="model-hub-route-action model-hub-order-row-action"+ disabled={saving}+ onClick={() => {+ persist([...order, source.id]);+ focusHandleAfterRender(source.id);+ }}+ >+ <Plus aria-hidden />+ </Button>+ </span></div>))}</div>diff --git a/ui/src/components/settings/models/modelHubStylePolicy.test.ts b/ui/src/components/settings/models/modelHubStylePolicy.test.tsindex 3346a6322..761ad4153 100644--- a/ui/src/components/settings/models/modelHubStylePolicy.test.ts+++ b/ui/src/components/settings/models/modelHubStylePolicy.test.ts@@ -37,6 +37,30 @@ describe('Model Hub theme token policy', () => {});describe('Model Hub visual token policy', () => {+ it('keeps Default Routing actions at the shared compact size after drawer styles apply', () => {+ const root = postcss.parse(surfaceCss);+ const declarations = (...selectors: string[]) => {+ const result: Record<string, string> = {};+ root.walkRules((rule) => {+ if (rule.parent?.type === 'root' && rule.selectors.some((selector) => selectors.includes(selector))) {+ rule.walkDecls((decl) => { result[decl.prop] = decl.value; });+ }+ });+ return result;+ };+ // Equal-specificity scoped rules, in source order. Browser geometry is a separate gate.+ expect(declarations('.model-hub-route-action', '.model-hub-order-row-action')).toMatchObject({+ width: '26px', height: '26px', 'min-height': '0', padding: '0',+ 'border-radius': '6px', flex: 'none', border: '1px solid var(--border)',+ background: 'var(--model-hub-wash-0a)',+ });+ expect(declarations('.model-hub-route-action > svg', '.model-hub-order-row-action > svg')).toMatchObject({ width: '13px', height: '13px' });+ expect(declarations('.model-hub-order-row-actions')).toMatchObject({+ display: 'flex', flex: 'none', 'align-items': 'center', gap: '3px',+ });+ expect(declarations('.model-hub-order-identity')).toMatchObject({ flex: '1', 'min-width': '0' });+ });+it('lets the actual narrow footer grow after the complete surface cascade while preserving body scroll', () => {// This checks CSS ownership and source order, not browser geometry.const root = postcss.parse(surfaceCss);diff --git a/ui/src/components/settings/models/modelHubSurface.css b/ui/src/components/settings/models/modelHubSurface.cssindex c5a5d1802..0e771b154 100644--- a/ui/src/components/settings/models/modelHubSurface.css+++ b/ui/src/components/settings/models/modelHubSurface.css@@ -1873,17 +1873,20 @@font-size: var(--model-hub-order-tag-size);font-weight: 600;}+.model-hub-order-row-actions {+ display: flex;+ flex: none;+ align-items: center;+ gap: 3px;+}.model-hub-order-row-action {- --model-hub-order-action-size: 11.5px;- --model-hub-order-action-radius: 8px;- --model-hub-order-action-padding-x: 12px;- --model-hub-order-action-padding-y: 9px;- min-height: 31px;- padding: var(--model-hub-order-action-padding-y) var(--model-hub-order-action-padding-x);- border-radius: var(--model-hub-order-action-radius);- font-size: var(--model-hub-order-action-size);- font-weight: 700;+ min-height: 0;+ padding: 0;+ flex: none;+ border: 1px solid var(--border);+ background: var(--model-hub-wash-0a);}+.model-hub-order-row-action:hover { background: var(--model-hub-wash-14); }.model-hub-order-held-icon { width: var(--model-hub-order-grip-size); height: var(--model-hub-order-grip-size); flex: none; color: var(--model-hub-order-grip-dim); }.model-hub-order-empty,.model-hub-order-state {