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(setup): require a provider before assistant selection (#2265)

Max62db3444ddb2
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 8cbd459e4..c1b1a48a5 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -84,7 +84,7 @@ jobs:
npx playwright install --with-deps chromium webkit
npm run test:model-catalog
npm run test:model-provider
- npm run test:onboarding-fidelity -- hub-ownership.spec.ts
+ npm run test:onboarding-fidelity -- hub-ownership.spec.ts provider-gate.spec.ts
npm run test:project-order
npm run test:inbox-return
npm run test:badge-triggers
diff --git a/docs/INSTALL_FOR_AI.md b/docs/INSTALL_FOR_AI.md
index 7b3a59bf7..74d714221 100644
--- a/docs/INSTALL_FOR_AI.md
+++ b/docs/INSTALL_FOR_AI.md
@@ -104,6 +104,14 @@ vibe
This starts the local service and opens the Web UI setup wizard. If a browser does not open automatically, check the terminal output for the local URL.
+On **Add model providers**, add a subscription or API key, or complete migration
+of an existing key. At least one usable source must appear in Model Hub before
+**Continue to assistants** becomes available. Declining migration keeps the
+**Add subscription or API Key** action. If sources disappear before assistant
+setup completes, use **Add model source** to return to this step.
+Subscriptions added during setup connect through Model Hub so the assistant
+selection step can use them.
+
In the wizard, help the user install or detect Claude Code, Codex, or OpenCode,
then connect one assistant with a subscription or API key. Existing valid
credentials count; starting another login preserves them until the new login
diff --git a/docs/plans/setup-provider-gate.md b/docs/plans/setup-provider-gate.md
new file mode 100644
index 000000000..525cbb99c
--- /dev/null
+++ b/docs/plans/setup-provider-gate.md
@@ -0,0 +1,80 @@
+# Require a provider before assistant setup
+
+## Problem and contract
+
+An empty provider inventory could advance to assistant setup through the footer
+hint or a declined migration. Assistant entry then required a model connection
+that none of its controls could establish.
+
+- The provider screen can continue only after its source read confirms an
+ `active` or `standby` Hub source. Native CLI subscriptions cannot supply
+ setup's Hub route and do not satisfy this prerequisite.
+- Without a source, the primary action opens the subscription/API-key dialog.
+ Declining migration preserves the dismissal and keeps the Add action.
+- A detected key is an import offer, not a connected source. Reading failures
+ retain Retry; pending writes and readbacks cannot advance.
+- If a current source read on the assistant screen finds no usable source,
+ entry stays disabled even when a direct backend reports itself eligible;
+ the hint offers Add model source and returns to providers.
+- Each return to providers requires a fresh source read. An inventory from
+ the previous visit or a write that settled while hidden cannot enable Continue.
+
+## Scope and validation
+
+Reuse the existing provider action state machine and setup navigation. Remove
+the bypass rather than adding another navigation or persistence mechanism.
+Backend entry readiness, migration consent, source validation and completion
+remain owned by their existing flows.
+
+AUTH-SETUP-126 covers the provider component, registered Wizard, assistant
+recovery and a browser journey in English and Chinese with controlled network
+responses. AUTH-SETUP-111 also checks the real source API's empty/created
+inventory readback. These layers do not establish packaged desktop acceptance
+against a live instance.
+
+Required checks: affected component files, source API scenario harness, browser
+provider/assistant journeys, UI lint, TypeScript checks and production build.
+
+## Review diagnosis and scope decision
+
+The full PR #2265 review inventory contains two findings-bearing heads:
+`c48088e37b` and `e67a2aafd1`. Both exposed the same entry-admission class:
+backend eligibility was treated as sufficient when provider evidence was empty
+or unknown. The second head also exposed a retry handler that bypassed the
+button's guard and a native-CLI source incorrectly admitted as Hub supply.
+This triggered the review-loop circuit breaker before another implementation edit.
+
+Inspection of both screen actions, their handlers, the retained-screen lifecycle,
+the source projection and `entryGate.routeRunnable` confirms a local ownership
+gap, not a missing persistence model. Completion already requires Hub mode.
+The smallest complete fix is to require a successful current inventory with a
+usable Hub source for all setup entry actions, including retry; display an
+inventory-read retry for failed reads; and apply the same Hub-source predicate
+to the provider diagram and its Continue action. Pending/failed reads must never
+be mistaken for a confirmed empty list or successful provider evidence.
+
+The existing route-read epoch/token, provider read authority and completion gate
+remain the owners. No parallel state store or new backend policy is needed.
+Consumer validation covers pending/failing reads and retry recovery, native-only
+inventory, stale completion retry, current-visit readback and ordinary Hub entry.
+
+Review of `8dd1e03926` found the remaining producer side of the same custody
+boundary: setup still opened the general subscription chooser, whose Anthropic
+default creates native CLI custody. The full inventory now has three
+findings-bearing heads; the custody class repeats on the latter two. Before
+editing again, the producer-to-consumer audit confirmed that the existing OAuth
+API already supports Hub custody for both setup subscription vendors. Constrain
+only setup's create flow to that supported custody in the shared OAuth dialog,
+retaining its explicit sign-in and disclosure step. Settings and reauthentication
+keep their existing channel choice. Validate real dialog composition through
+the browser, including the outgoing OAuth channel and post-login inventory gate.
+
+The fourth findings-bearing head, `d71d1e68fe`, repeated the evidence-lifecycle
+class at a different boundary: completion performs fresh server reads, but a
+refusal did not invalidate the assistant screen's earlier inventory. The full
+inventory still has one unresolved finding. Inspection of `Wizard.complete` and
+all entry-handler call sites confirms that its thrown refusal is the existing
+handoff boundary. Refresh the existing route/source reader after that refusal,
+without retrying completion or any write automatically. A registered-Wizard case
+removes supply while the assistant screen stays mounted, holds the recovery read,
+and then verifies the provider recovery action with no completion writes.
diff --git a/tests/scenarios/auth_setup/catalog.yaml b/tests/scenarios/auth_setup/catalog.yaml
index eadf25123..e4d207413 100644
--- a/tests/scenarios/auth_setup/catalog.yaml
+++ b/tests/scenarios/auth_setup/catalog.yaml
@@ -441,4 +441,26 @@ scenarios:
- ui/src/App.remoteAuth.test.tsx
- ui/src/components/settings/SettingsLayout.test.tsx
- ui/src/components/DesktopSettingsCommand.test.tsx
+ - id: AUTH-SETUP-126
+ name: Setup requires a usable provider before assistants and offers recovery when sources disappear
+ status: partial
+ kind: historical_regression
+ layer: scenario
+ missing_layer: ui-e2e
+ backend: web
+ reason: >-
+ the real source API is exercised by the Python harness, while the registered
+ Wizard and browser journey use controlled API responses. Packaged desktop
+ verification against a live instance remains separate.
+ owning_layer: L4 integrated acceptance (packaged desktop against a live instance)
+ partial_evidence:
+ covers: empty inventory, observation without persistence, usable source creation and HTTP readback
+ test: tests/scenarios/auth_setup/test_auth_setup_scenarios.py::test_catalog_api_key_setup_observe_then_create_closed_loop
+ supporting_tests:
+ - ui/src/components/onboarding/providers/ProvidersScreen.test.tsx
+ - ui/src/components/onboarding/providers/AddSourceDialog.test.tsx
+ - ui/src/components/settings/models/OAuthConnectDialog.test.ts
+ - ui/src/components/onboarding/WizardCompletion.test.tsx
+ - ui/src/components/onboarding/AssistantSetup.test.tsx
+ - ui/e2e/onboarding-fidelity/provider-gate.spec.ts
next_priority: []
diff --git a/tests/scenarios/auth_setup/test_auth_setup_scenarios.py b/tests/scenarios/auth_setup/test_auth_setup_scenarios.py
index 65a1aa5f7..0ff20be8a 100644
--- a/tests/scenarios/auth_setup/test_auth_setup_scenarios.py
+++ b/tests/scenarios/auth_setup/test_auth_setup_scenarios.py
@@ -3365,7 +3365,7 @@ class CodexRelayRoundTripScenarioTests(unittest.IsolatedAsyncioTestCase):
def test_catalog_api_key_setup_observe_then_create_closed_loop(monkeypatch, tmp_path):
- """Scenario: AUTH-SETUP-111"""
+ """Scenarios: AUTH-SETUP-111; AUTH-SETUP-126 source-inventory producer."""
monkeypatch.setenv("AVIBE_HOME", str(tmp_path))
monkeypatch.setenv("VIBE_MODEL_HUB_ENABLED", "1")
_save_config(tmp_path)
@@ -3394,6 +3394,19 @@ def test_catalog_api_key_setup_observe_then_create_closed_loop(monkeypatch, tmp_
runner = ScenarioRunner(harness)
monkeypatch.setattr(ui_server, "_model_hub_service", lambda: harness.service)
+ def read_empty_inventory(h) -> None:
+ response = h.client.get("/api/models/sources", base_url=h.base_url)
+ assert response.status_code == 200
+ assert response.get_json()["sources"] == []
+
+ def read_created_inventory(h) -> None:
+ response = h.client.get("/api/models/sources", base_url=h.base_url)
+ assert response.status_code == 200
+ sources = response.get_json()["sources"]
+ assert len(sources) == 1
+ assert sources[0]["id"] == h.store.config.sources[0].id
+ assert sources[0]["state"]["status"] in {"active", "standby"}
+
def observe_catalog_pin(h) -> None:
response = h.client.post(
"/api/models/sources/observe",
@@ -3506,20 +3519,28 @@ def test_catalog_api_key_setup_observe_then_create_closed_loop(monkeypatch, tmp_
asyncio.run(
runner.run(
+ ScenarioStep("read_empty_inventory", read_empty_inventory),
ScenarioStep("observe_catalog_pin", observe_catalog_pin),
+ ScenarioStep("observation_is_not_supply", read_empty_inventory),
ScenarioStep("create_catalog_pin", create_catalog_pin),
+ ScenarioStep("read_created_inventory", read_created_inventory),
ScenarioStep("observe_auth_failure", observe_auth_failure),
ScenarioStep("create_auth_failure", create_auth_failure),
+ ScenarioStep("failed_create_preserves_inventory", read_created_inventory),
)
)
ScenarioExpect.step_history(
runner,
[
+ "read_empty_inventory",
"observe_catalog_pin",
+ "observation_is_not_supply",
"create_catalog_pin",
+ "read_created_inventory",
"observe_auth_failure",
"create_auth_failure",
+ "failed_create_preserves_inventory",
],
)
diff --git a/ui/e2e/onboarding-fidelity/provider-gate.spec.ts b/ui/e2e/onboarding-fidelity/provider-gate.spec.ts
new file mode 100644
index 000000000..8a85040fc
--- /dev/null
+++ b/ui/e2e/onboarding-fidelity/provider-gate.spec.ts
@@ -0,0 +1,136 @@
+import { expect, test } from '@playwright/test';
+import en from '../../src/i18n/en.json' with { type: 'json' };
+import zh from '../../src/i18n/zh.json' with { type: 'json' };
+import { openOnboarding, openSetup, serveModelHub, serveProduct } from './support';
+
+for (const [lang, copy, width] of [['en', en, 1440], ['zh', zh, 390]] as const) {
+ test(`AUTH-SETUP-126: subscription creation satisfies the setup provider gate (${lang})`, async ({ page }) => {
+ await page.setViewportSize({ width, height: 900 });
+ const denied = await serveProduct(page);
+ const vendor = lang === 'en' ? 'anthropic' : 'openai';
+ const source = {
+ id: 'src_subscription_fixture', vendor, display_name: '测试订阅', kind: 'subscription',
+ protocol: vendor === 'anthropic' ? 'anthropic' : 'openai_responses',
+ supply_channel: 'hub', billing: 'monthly', state: { status: 'standby' },
+ models: [], last_discovered_at: null,
+ };
+ let sources: typeof source[] = [];
+ const starts: { vendor: string; channel: string }[] = [];
+ const flow = {
+ flow_id: 'oaf_setup_fixture', vendor, channel: 'hub', state: 'success',
+ presentation: { expects: 'none' }, expires_at: '2099-01-01T00:00:00Z',
+ };
+ await page.route('**/api/agents?*', (route) => route.fulfill({ json: { ok: true, agents: [], default_agent_name: null } }));
+ await page.route('**/api/models/sources', (route) => route.fulfill({ json: { sources } }));
+ await page.route('**/api/models/oauth/start', (route) => {
+ const body = route.request().postDataJSON();
+ starts.push({ vendor: body.vendor, channel: body.channel });
+ return route.fulfill({ json: { flow } });
+ });
+ await page.route('**/api/models/oauth/status/oaf_setup_fixture', (route) => {
+ sources = [source];
+ return route.fulfill({ json: { flow, source, added_to: [], adopted_by: [] } });
+ });
+ await page.route('**/api/models/oauth/cancel', (route) => {
+ expect(route.request().postDataJSON().flow_id).toBe(flow.flow_id);
+ return route.fulfill({ json: { ok: true } });
+ });
+ await openOnboarding(page, { lang, realTime: true });
+ await page.getByRole('button', { name: lang === 'zh' ? '立即开始' : 'Get started' }).click();
+ const primary = page.locator('.onboarding-primary-action');
+ await expect(primary).toHaveText(copy.onboarding.providers.actionAdd);
+ await page.locator(`.setup-provider-card[data-provider="${vendor}"]`).click();
+ await page.getByRole('dialog').getByRole('contentinfo').getByRole('button', {
+ name: copy.onboarding.providers.addFooterSignInNamed.replace('{{name}}', vendor === 'anthropic' ? 'Claude' : 'ChatGPT'), exact: true,
+ }).click();
+ const chooser = page.getByRole('dialog').filter({ has: page.getByRole('heading', {
+ name: copy.settings.models.addSub.title.replace('{{vendor}}', vendor === 'anthropic' ? 'Claude' : 'ChatGPT'), exact: true,
+ }) });
+ await expect(chooser.getByRole('radio')).toHaveCount(1);
+ await expect(chooser.getByRole('radio')).toContainText(copy.settings.models.addSub.opt.hub.label);
+ expect(starts).toEqual([]);
+ await chooser.getByRole('button', { name: copy.settings.models.addSub.signIn, exact: true }).click();
+ await expect(page.getByRole('dialog')).toHaveCount(0);
+ expect(starts).toEqual([{ vendor, channel: 'hub' }]);
+ await expect(page.locator(`.setup-provider-card[data-provider="${vendor}"]`)).toHaveAttribute('data-state', 'connected');
+ await expect(primary).toHaveText(copy.onboarding.providers.actionContinue);
+ await expect(primary).toBeEnabled();
+ await primary.click();
+ await expect(page.locator('[data-setup-screen]')).toHaveAttribute('data-setup-screen', 'assistants');
+ expect(denied).toEqual([]);
+ });
+
+ test(`AUTH-SETUP-126: assistant fixture can decline migration with an existing source (${lang})`, async ({ page }) => {
+ await serveProduct(page);
+ const applied = await serveModelHub(page);
+ await openOnboarding(page, { lang });
+ await openSetup(page, lang);
+ await expect(page.locator('[data-setup-screen]')).toHaveAttribute('data-setup-screen', 'assistants');
+ expect(applied).toEqual([]);
+ });
+
+ test(`AUTH-SETUP-126: provider gate, add failure and lost-source recovery (${lang})`, async ({ page }) => {
+ await page.setViewportSize({ width, height: 900 });
+ const denied = await serveProduct(page);
+ const source = {
+ id: 'src_fixture', vendor: 'custom', display_name: '测试模型来源', kind: 'api_key',
+ protocol: 'openai_chat', supply_channel: 'hub', billing: 'metered',
+ state: { status: 'active' }, models: [], last_discovered_at: null,
+ };
+ const initialSources = lang === 'zh'
+ ? [{ ...source, kind: 'subscription', supply_channel: 'native_cli' }] : [];
+ let sources: typeof source[] = initialSources;
+ let creates = 0;
+ await page.route('**/api/agents?*', (route) => route.fulfill({ json: { ok: true, agents: [], default_agent_name: null } }));
+ await page.route('**/api/models/sources', (route) => {
+ if (route.request().method() === 'GET') return route.fulfill({ json: { sources } });
+ expect(route.request().method()).toBe('POST');
+ creates += 1;
+ if (creates === 1) return route.fulfill({ status: 422, json: { error: 'discovery_failed', message: 'Fixture authentication rejected' } });
+ sources = [source];
+ return route.fulfill({ status: 201, json: { source, added_to: [], adopted_by: [] } });
+ });
+ await openOnboarding(page, { lang, realTime: true });
+ await page.getByRole('button', { name: lang === 'zh' ? '立即开始' : 'Get started' }).click();
+ const step = page.locator('[data-setup-screen]');
+ const primary = page.locator('.onboarding-primary-action');
+ await expect(step).toHaveAttribute('data-setup-screen', 'providers');
+ await expect(primary).toHaveText(copy.onboarding.providers.actionAdd);
+ await expect(primary).toBeEnabled();
+ await expect(page.getByRole('button', { name: copy.onboarding.providers.actionContinue })).toHaveCount(0);
+ await primary.click();
+ const dialog = page.getByRole('dialog');
+ await expect(dialog).toBeVisible();
+ await expect(step).toHaveAttribute('data-setup-screen', 'providers');
+ await dialog.getByRole('button', { name: 'API Key', exact: true }).click();
+ await dialog.getByLabel(copy.settings.models.addKey.field.baseUrl, { exact: true }).fill('https://fixture.example/v1');
+ await dialog.getByLabel(copy.settings.models.addKey.field.apiKey, { exact: true }).fill('sk-fixture-only');
+ await dialog.getByRole('button', { name: copy.onboarding.providers.addFooterAddKey, exact: true }).click();
+ await expect(dialog.getByText(copy.onboarding.providers.addErrorPreserved)).toBeVisible();
+ await expect(step).toHaveAttribute('data-setup-screen', 'providers');
+ expect(sources).toEqual(initialSources);
+ await dialog.getByRole('button', { name: copy.common.retry, exact: true }).click();
+ await expect(dialog).toHaveCount(0);
+ await expect(primary).toHaveText(copy.onboarding.providers.actionContinue);
+ await expect(primary).toBeEnabled();
+ expect(creates).toBe(2);
+
+ // The source disappears elsewhere between steps. The assistant screen must
+ // offer recovery even if a direct backend still reports itself entry-eligible.
+ sources = [];
+ await page.route('**/api/backend/*/connection', (route) => route.fulfill({ json: {
+ ok: true, backend: new URL(route.request().url()).pathname.split('/').at(-2),
+ installed: true, enabled: true, auth: 'api_key', application: 'applied',
+ ready: true, entry_eligible: true, supply_mode: 'direct',
+ } }));
+ await primary.click();
+ await expect(step).toHaveAttribute('data-setup-screen', 'assistants');
+ await expect(primary).toBeDisabled();
+ await expect(page.getByText(copy.onboarding.connection.sourceRequired)).toBeVisible();
+ await page.getByRole('button', { name: copy.onboarding.connection.addSource }).click();
+ await expect(step).toHaveAttribute('data-setup-screen', 'providers');
+ await expect(primary).toHaveText(copy.onboarding.providers.actionAdd);
+ await expect(primary).toBeEnabled();
+ expect(denied).toEqual([]);
+ });
+}
diff --git a/ui/e2e/onboarding-fidelity/support.ts b/ui/e2e/onboarding-fidelity/support.ts
index c14dcfc6f..fec47b15c 100644
--- a/ui/e2e/onboarding-fidelity/support.ts
+++ b/ui/e2e/onboarding-fidelity/support.ts
@@ -1,4 +1,4 @@
-import type { Page, Route } from '@playwright/test';
+import { expect, type Page, type Route } from '@playwright/test';
export const ORIGIN = 'http://127.0.0.1:5212';
@@ -85,7 +85,7 @@ export async function serveProduct(page: Page) {
return route.fulfill({ json: { ok: true, agent: { backend, mode: 'direct', sources: { order: [], eligibility: [] }, routes: {}, builtin_models: [], catalog_models: [], named_agents: [], menu: null, model_supply: [], supply_status: 'unavailable' } } });
});
await page.route('**/api/models/runtime/status', (route) => route.fulfill({ json: { ok: true, runtime: { contract_version: 10, enabled: true, host_platform: 'linux', manifest: { name: 'cliproxyapi', resolution: 'resolved', version: 'fixture', source_sha: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', assets: [] }, status: { installed_version: 'fixture', verified: true, health: 'ok' } } } }));
- await page.route('**/status', (route) => route.fulfill({ json: { state: 'running' } }));
+ await page.route(`${ORIGIN}/status`, (route) => route.fulfill({ json: { state: 'running' } }));
await page.route('**/api/backend/*/connection', (route) => route.fulfill({ json: { ok: true, backend: new URL(route.request().url()).pathname.split('/').at(-2), installed: true, enabled: true, auth: 'none', application: 'applied', ready: false, entry_eligible: false } }));
await page.route('**/api/config', (route) => route.fulfill({ json: CONFIG }));
await page.route('**/api/platforms', (route) => route.fulfill({ json: CATALOG }));
@@ -239,15 +239,27 @@ export async function setDocumentHidden(page: Page, hidden: boolean) {
}
export async function openSetup(page: Page, lang: string) {
+ // Assistant captures enter through the same prerequisite as the product. Keep this
+ // source local to this helper so provider-empty cases still begin without one.
+ await page.route('**/api/models/sources', (route) => route.fulfill({ json: { sources: [{
+ id: 'src_setup_fixture', vendor: 'openai', kind: 'api_key', display_name: 'OpenAI',
+ protocol: 'openai_chat', supply_channel: 'hub', billing: 'metered',
+ state: { status: 'active' }, models: [], last_discovered_at: null,
+ }] } }));
await page.getByRole('button', { name: lang === 'zh' ? '立即开始' : 'Get started' }).click();
// The handoff timer uses the same browser clock as the story in deterministic runs.
await page.clock.runFor(950);
- // Providers is the first step now. This fixture answers「no sources」and leaves the
- // Hub unready, so the connection action is disabled and the way on the screen states
- // is the only control that leaves it — which is how a person gets to the assistants
- // here, and so how the capture does. Addressed by the hint's own class rather than
- // its sentence, because these captures run in both languages.
- await page.locator('.onboarding-setup-hint button').click();
+ const onward = lang === 'zh' ? '继续,选择 AI 助手' : 'Continue to assistants';
+ const primary = page.locator('.onboarding-primary-action');
+ await expect(primary).toBeEnabled();
+ // A capture may also detect native keys. Decline that optional migration through
+ // its own review; the existing source above is what permits continuing.
+ if ((await primary.textContent())?.trim() !== onward) {
+ await expect(primary).toContainText(lang === 'zh' ? '迁移' : 'Migrate');
+ await primary.click();
+ await page.getByRole('dialog').getByRole('button', { name: lang === 'zh' ? '暂不迁移' : 'Not now', exact: true }).click();
+ }
+ await page.getByRole('button', { name: onward }).click();
await page.clock.runFor(950);
await page.locator('[data-setup-screen="assistants"]').waitFor();
await page.locator('.onboarding-assistants').waitFor();
diff --git a/ui/src/components/onboarding/AssistantSetup.test.tsx b/ui/src/components/onboarding/AssistantSetup.test.tsx
index 8776c9dea..27df2b283 100644
--- a/ui/src/components/onboarding/AssistantSetup.test.tsx
+++ b/ui/src/components/onboarding/AssistantSetup.test.tsx
@@ -1,5 +1,5 @@
// @vitest-environment jsdom
-import { StrictMode } from 'react';
+import { createRef, StrictMode } from 'react';
import { act, cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react';
import { createInstance } from 'i18next';
import { I18nextProvider } from 'react-i18next';
@@ -9,8 +9,9 @@ import { AgentDetection } from '../steps/AgentDetection';
import { AssistantRow } from './AssistantRow';
import en from '../../i18n/en.json';
import type { BackendConnectionState } from '../../context/ApiContext';
+import type { Source } from '../settings/models/types';
import { RouteSurfaceActiveContext } from '../../lib/routeSurfaceActivity';
-import type { SetupAction } from './setupFlow';
+import type { SetupAction, SetupScreenHandle } from './setupFlow';
import { INITIAL_SETUP_FLOW_STATE } from './setupFlow';
const mock = vi.hoisted(() => ({ api: {
@@ -58,6 +59,11 @@ const hubReads = {
readValue: async () => [{ backend: 'claude' as const, cli_present: true, mode: 'hub' as const, menu_kind: 'fixed' as const, named_agents: [{ name: 'claude', effective_model_id: 'opus-5', supply_status: 'ok' as const }] }],
invalidate: () => undefined,
};
+const setupSource: Source = {
+ id: 'src_a', vendor: 'anthropic', display_name: 'Fixture source', kind: 'api_key',
+ protocol: 'anthropic', supply_channel: 'hub', billing: 'metered',
+ state: { status: 'active' }, models: [], last_discovered_at: null,
+};
beforeEach(() => {
vi.resetAllMocks();
mock.api.getConfig.mockResolvedValue(data());
@@ -652,6 +658,97 @@ describe('assistant installation presentation', () => {
});
describe('Hub route refresh', () => {
+ it.each([false, true])('AUTH-SETUP-126: returns to providers with an empty inventory (direct eligible: %s)', async (directEligible) => {
+ const saved = { ...data(), capabilities: { model_hub: { enabled: true } } };
+ saved.agents.claude.status = 'ok';
+ mock.api.getBackendConnection.mockImplementation(async (backend) => ({
+ ok: true, backend, installed: true, enabled: true, auth: 'none',
+ application: 'applied', ready: directEligible, entry_eligible: directEligible,
+ supply_mode: directEligible ? 'direct' : 'hub',
+ }));
+ const listed = pending<[]>();
+ mock.models.listSources.mockReturnValue(listed.promise);
+ const navigate = vi.fn();
+ const props = { data: saved, onNext: vi.fn(), onNavigate: navigate, agentReads: hubReads };
+ const view = render(wrap(<AgentDetection {...props} />));
+ await waitFor(() => expect(mock.models.listSources).toHaveBeenCalled());
+ expect(screen.queryByRole('button', { name: 'Add model source' })).toBeNull();
+ await waitFor(() => expect(mock.api.getBackendConnection).toHaveBeenCalledTimes(3));
+ const pendingEntry = screen.getByRole<HTMLButtonElement>('button', { name: 'Enter workspace' });
+ expect(pendingEntry.disabled).toBe(true);
+ fireEvent.click(pendingEntry);
+ expect(props.onNext).not.toHaveBeenCalled();
+ await act(async () => listed.resolve([]));
+ const recover = await screen.findByRole<HTMLButtonElement>('button', { name: 'Add model source' });
+ expect(screen.getByText(en.onboarding.connection.sourceRequired)).toBeTruthy();
+ expect(recover.disabled).toBe(false);
+ const enter = screen.getByRole<HTMLButtonElement>('button', { name: 'Enter workspace' });
+ expect(enter.disabled).toBe(true);
+ fireEvent.click(enter);
+ fireEvent.click(recover);
+ expect(navigate).toHaveBeenCalledExactlyOnceWith('providers');
+ expect(props.onNext).not.toHaveBeenCalled();
+ view.rerender(wrap(<AgentDetection {...props} active={false} />));
+ expect(screen.queryByRole('button', { name: 'Add model source' })).toBeNull();
+ });
+
+ it('AUTH-SETUP-126: failed provider evidence blocks entry and retries the inventory read', async () => {
+ const saved = { ...data(), capabilities: { model_hub: { enabled: true } } };
+ saved.agents.claude.status = 'ok';
+ mock.models.listSources.mockRejectedValue(new Error('fixture unavailable'));
+ const onNext = vi.fn();
+ render(wrap(<AgentDetection data={saved} onNext={onNext} onNavigate={vi.fn()} agentReads={hubReads} />));
+ const message = await screen.findByText(en.onboarding.connection.readFailed);
+ const enter = screen.getByRole<HTMLButtonElement>('button', { name: 'Enter workspace' });
+ expect(enter.disabled).toBe(true);
+ expect(screen.queryByRole('button', { name: 'Add model source' })).toBeNull();
+ enter.removeAttribute('disabled');
+ fireEvent.click(enter);
+ expect(onNext).not.toHaveBeenCalled();
+
+ mock.models.listSources.mockResolvedValue([setupSource]);
+ fireEvent.click(within(message.parentElement!).getByRole('button', { name: 'Retry' }));
+ await waitFor(() => expect(enter.disabled).toBe(false));
+ expect(screen.queryByText(en.onboarding.connection.readFailed)).toBeNull();
+ fireEvent.click(enter);
+ await waitFor(() => expect(onNext).toHaveBeenCalledOnce());
+ });
+
+ it.each(['empty', 'native', 'pending', 'failed'] as const)('AUTH-SETUP-126: stale completion retry cannot bypass %s provider evidence', async (inventory) => {
+ const saved = { ...data(), capabilities: { model_hub: { enabled: true } } };
+ saved.agents.claude.status = 'ok';
+ mock.models.listSources.mockResolvedValue([setupSource]);
+ const onNext = vi.fn().mockRejectedValue(new Error('fixture completion failed'));
+ const handle = createRef<SetupScreenHandle>();
+ const props = { ref: handle, data: saved, onNext, onNavigate: vi.fn(), agentReads: hubReads };
+ const view = render(wrap(<AgentDetection {...props} active />));
+ const enter = screen.getByRole<HTMLButtonElement>('button', { name: 'Enter workspace' });
+ await waitFor(() => expect(enter.disabled).toBe(false));
+ fireEvent.click(enter);
+ const alert = await screen.findByRole('alert');
+ expect(alert.textContent).toContain('fixture completion failed');
+ expect(onNext).toHaveBeenCalledOnce();
+
+ view.rerender(wrap(<AgentDetection {...props} active={false} />));
+ const read = pending<Source[]>();
+ mock.models.listSources.mockReturnValue(read.promise);
+ view.rerender(wrap(<AgentDetection {...props} active />));
+ if (inventory === 'failed') await act(async () => read.reject(new Error('fixture unavailable')));
+ else if (inventory !== 'pending') await act(async () => read.resolve(inventory === 'native'
+ ? [{ ...setupSource, kind: 'subscription', supply_channel: 'native_cli' }] : []));
+
+ const retry = within(alert).getByRole<HTMLButtonElement>('button', { name: 'Retry' });
+ expect(enter.disabled).toBe(true);
+ expect(retry.disabled).toBe(true);
+ retry.removeAttribute('disabled');
+ fireEvent.click(retry);
+ await act(async () => handle.current?.activate());
+ expect(onNext).toHaveBeenCalledOnce();
+ if (inventory === 'empty' || inventory === 'native') {
+ expect(screen.getByRole('button', { name: 'Add model source' })).toBeTruthy();
+ }
+ });
+
it.each(['direct', 'hub'] as const)('uses current %s route ownership when the connection read fails', async (mode) => {
const saved = { ...data(), capabilities: { model_hub: { enabled: true } } };
saved.agents.claude.status = 'ok';
@@ -983,7 +1080,7 @@ describe('Hub route refresh', () => {
mock.api.listVibeAgents.mockResolvedValue({ ok: true, agents: [hubAgent()], default_agent_name: 'claude' });
mock.api.getVibeAgent.mockResolvedValue({ ok: true, agent: hubAgent() });
mock.models.getAgentChains.mockResolvedValue([hubChain('shared-id')]);
- mock.models.listSources.mockResolvedValue([{ id: 'src_a', models: [] }]);
+ mock.models.listSources.mockResolvedValue([{ id: 'src_a', state: { status: 'active' }, models: [] }]);
const reads = { ...hubReads, read: async () => ({ kind: 'current' as const, value: [
{ backend: 'claude' as const, cli_present: true, mode: 'hub' as const, menu_kind: 'fixed' as const },
{ backend: 'codex' as const, cli_present: true, mode: 'hub' as const, menu_kind: 'fixed' as const,
@@ -1080,7 +1177,7 @@ describe('Hub route refresh', () => {
application: 'applied', ready: backend !== 'opencode' || opencodeEnabled,
entry_eligible: backend !== 'opencode' || opencodeEnabled, supply_mode: 'hub',
}));
- mock.models.listSources.mockResolvedValue([{ id: 'src_a', models: [{ id: 'gpt-5.6-sol', display_name: 'GPT-5.6-Sol' }] }]);
+ mock.models.listSources.mockResolvedValue([{ id: 'src_a', state: { status: 'active' }, models: [{ id: 'gpt-5.6-sol', display_name: 'GPT-5.6-Sol' }] }]);
mock.models.getAgentChains.mockResolvedValue([{ ...hubChain('gpt-5.6-sol'), backend: 'opencode', model_id: 'gpt-5.6-sol',
chain: [
{ source_id: 'src_a', model_id: 'gpt-5.6-sol', channel: 'hub', health: 'healthy', runnable: true },
diff --git a/ui/src/components/onboarding/WizardCompletion.test.tsx b/ui/src/components/onboarding/WizardCompletion.test.tsx
index 17802db20..3d546202e 100644
--- a/ui/src/components/onboarding/WizardCompletion.test.tsx
+++ b/ui/src/components/onboarding/WizardCompletion.test.tsx
@@ -1,5 +1,5 @@
// @vitest-environment jsdom
-import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';
+import { act, cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react';
import { createInstance } from 'i18next';
import { I18nextProvider } from 'react-i18next';
import { MemoryRouter, Route, Routes, useLocation } from 'react-router-dom';
@@ -17,7 +17,7 @@ const mock = vi.hoisted(() => ({ control: vi.fn(), toast: vi.fn(), permission: v
// the collection authority, the lifecycle helper and the take-over dialog underneath
// them are the real ones, which is what makes the journey below the journey rather
// than a direct mount of the third screen.
- models: { listSources: vi.fn(), listAgents: vi.fn(), refreshAgentPresence: vi.fn(), scanMigration: vi.fn(), getRuntimeStatus: vi.fn(), getAgentChain: vi.fn(), previewAgentChain: vi.fn(), putAgentChain: vi.fn() },
+ models: { listSources: vi.fn(), listAgents: vi.fn(), refreshAgentPresence: vi.fn(), scanMigration: vi.fn(), getRuntimeStatus: vi.fn(), createApiKeySource: vi.fn(), getAgentChain: vi.fn(), previewAgentChain: vi.fn(), putAgentChain: vi.fn() },
}));
vi.mock('../../context/ApiContext', async (importOriginal) => ({ ...await importOriginal<typeof import('../../context/ApiContext')>(), useApi: () => mock.api }));
vi.mock('@/lib/apiFetch', async (importOriginal) => ({ ...await importOriginal<typeof import('@/lib/apiFetch')>(), apiFetch: mock.apiFetch }));
@@ -204,6 +204,7 @@ describe('explicit any-one-ready completion', () => {
expect(screen.getByRole('button', { name: 'Retry' })).toBeTruthy();
mock.control.mockImplementation(async () => { running = true; return { ok: true, action: 'start' }; });
mock.api.mutateConfig.mockImplementation(async (mutations) => { persistConfig(mutations); return {}; });
+ await waitFor(() => expect(enter.hasAttribute('disabled')).toBe(false));
await act(async () => fireEvent.click(screen.getByRole('button', { name: 'Enter workspace' })));
await screen.findByTestId('destination');
});
@@ -480,7 +481,10 @@ describe('the correlated entry gate', () => {
mock.models.listAgents.mockRejectedValue(new Error('engine_down: controller socket absent'));
mock.models.getRuntimeStatus.mockRejectedValue(new Error('engine_down: controller socket absent'));
fireEvent.click(enter);
- expect((await screen.findByRole('alert')).textContent).toContain(en.onboarding.connection.applyPending);
+ // The follow-up inventory read also reports its own route failure on the
+ // cards. The completion refusal remains the separate entry error.
+ await waitFor(() => expect(document.querySelector('.connection-error[role="alert"]')?.textContent)
+ .toContain(en.onboarding.connection.applyPending));
expect(mock.control).not.toHaveBeenCalled();
expect(mock.api.mutateConfig).not.toHaveBeenCalled();
expect(screen.queryByTestId('destination')).toBeNull();
@@ -790,6 +794,108 @@ describe('the registered journey', () => {
const seeds = () => mock.apiFetch.mock.calls.filter(([, init]) => (init as RequestInit | undefined)?.method === 'POST');
const gateway = () => document.querySelector('.setup-gateway')!;
+ it('AUTH-SETUP-126: a completion refusal refreshes sources without leaving assistants', async () => {
+ const enter = await setup();
+ // Another client removes the source after the assistant screen's read. The
+ // fresh completion gate sees that its route cannot run, while this screen
+ // still holds the earlier connected source until it asks again.
+ mock.models.listAgents.mockResolvedValue([]);
+ let confirmSources!: (sources: Source[]) => void;
+ mock.models.listSources.mockReturnValue(new Promise<Source[]>((resolve) => { confirmSources = resolve; }));
+ const priorReads = mock.models.listSources.mock.calls.length;
+ fireEvent.click(enter);
+ const error = await screen.findByRole('alert');
+ expect(error.textContent).toContain(en.onboarding.connection.modelUnavailable);
+ await waitFor(() => expect(mock.models.listSources.mock.calls.length).toBeGreaterThan(priorReads));
+ expect(screenId()).toBe('assistants');
+ expect(primaryAction().hasAttribute('disabled')).toBe(true);
+ expect(within(error).getByRole('button', { name: 'Retry' }).hasAttribute('disabled')).toBe(true);
+ expectNoForwardWrite();
+
+ await act(async () => confirmSources([]));
+ const recover = await screen.findByRole('button', { name: 'Add model source' });
+ expect(primaryAction().hasAttribute('disabled')).toBe(true);
+ expect(within(error).getByRole('button', { name: 'Retry' }).hasAttribute('disabled')).toBe(true);
+ fireEvent.click(recover);
+ await waitFor(() => expect(screenId()).toBe('providers'));
+ await waitFor(() => expect(primaryAction().textContent).toContain(en.onboarding.providers.actionAdd));
+ fireEvent.click(primaryAction());
+ expect(await screen.findByRole('dialog')).toBeTruthy();
+ expectNoForwardWrite();
+ });
+
+ it('AUTH-SETUP-126: source recovery cannot reuse the previous visit while inventory readback is pending', async () => {
+ await arriveAtProviders();
+ mock.models.listSources.mockResolvedValue([]);
+ mock.api.getBackendConnection.mockImplementation(async (backend) => ({
+ ok: true, backend, enabled: true, installed: true, auth: 'api_key',
+ application: 'applied', ready: true, entry_eligible: true, supply_mode: 'direct',
+ }));
+ fireEvent.click(primaryAction());
+ const recover = await screen.findByRole('button', { name: 'Add model source' });
+ expect(primaryAction().hasAttribute('disabled')).toBe(true);
+ fireEvent.click(primaryAction());
+ expect(screenId()).toBe('assistants');
+ expect(mock.api.mutateConfig).not.toHaveBeenCalled();
+
+ let confirmSources!: (sources: Source[]) => void;
+ mock.models.listSources.mockReturnValue(new Promise<Source[]>((resolve) => { confirmSources = resolve; }));
+ const runtimeReads = mock.models.getRuntimeStatus.mock.calls.length;
+ fireEvent.click(recover);
+ await waitFor(() => expect(screenId()).toBe('providers'));
+ await waitFor(() => expect(mock.models.getRuntimeStatus.mock.calls.length).toBeGreaterThan(runtimeReads));
+ expect(primaryAction().hasAttribute('disabled')).toBe(true);
+ fireEvent.click(primaryAction());
+ expect(screenId()).toBe('providers');
+
+ await act(async () => confirmSources([]));
+ await waitFor(() => expect(primaryAction().textContent).toContain(en.onboarding.providers.actionAdd));
+ expect(primaryAction().hasAttribute('disabled')).toBe(false);
+ fireEvent.click(primaryAction());
+ expect(await screen.findByRole('dialog')).toBeTruthy();
+ expect(screenId()).toBe('providers');
+ });
+
+ it('AUTH-SETUP-126: requires source readback before the shell can continue to assistants', async () => {
+ mock.models.listSources.mockResolvedValue([]);
+ mount();
+ fireEvent.click(await screen.findByRole('button', { name: 'Get started' }));
+ await waitFor(() => expect(primaryAction().textContent).toContain(en.onboarding.providers.actionAdd));
+ await waitFor(() => expect(primaryAction().hasAttribute('disabled')).toBe(false));
+ expect(screen.queryByRole('button', { name: 'Continue to assistants' })).toBeNull();
+ fireEvent.click(primaryAction());
+ const dialog = await screen.findByRole('dialog');
+ expect(screenId()).toBe('providers');
+ expect(mock.api.mutateConfig).not.toHaveBeenCalled();
+
+ fireEvent.click(within(dialog).getByRole('button', { name: 'API Key' }));
+ fireEvent.change(within(dialog).getByLabelText('Base URL'), { target: { value: 'https://fixture.example/v1' } });
+ fireEvent.change(within(dialog).getByLabelText('API key'), { target: { value: 'sk-fixture' } });
+ let confirmSources!: (sources: Source[]) => void;
+ const readback = new Promise<Source[]>((resolve) => { confirmSources = resolve; });
+ mock.models.createApiKeySource.mockImplementation(async () => {
+ mock.models.listSources.mockReturnValue(readback);
+ return { source: HUB_SOURCE, added_to: [], adopted_by: [] };
+ });
+ fireEvent.click(within(dialog).getByRole('button', { name: 'Add' }));
+ await waitFor(() => expect(mock.models.createApiKeySource).toHaveBeenCalledOnce());
+ expect(screenId()).toBe('providers');
+ expect(primaryAction().hasAttribute('disabled')).toBe(true);
+ fireEvent.click(primaryAction());
+ expect(screenId()).toBe('providers');
+
+ await act(async () => {
+ mock.models.listSources.mockResolvedValue([HUB_SOURCE]);
+ confirmSources([HUB_SOURCE]);
+ });
+ await waitFor(() => expect(screen.queryByRole('dialog')).toBeNull());
+ await waitFor(() => expect(primaryAction().textContent).toContain(en.onboarding.providers.actionContinue));
+ expect(primaryAction().hasAttribute('disabled')).toBe(false);
+ expect(screenId()).toBe('providers');
+ fireEvent.click(primaryAction());
+ await waitFor(() => expect(screenId()).toBe('assistants'));
+ });
+
it('establishes the controller on arrival at the second screen, never on mount', async () => {
mount();
const start = await screen.findByRole('button', { name: 'Get started' });
@@ -861,6 +967,8 @@ describe('the registered journey', () => {
it('holds the journey on a failed establishment, and its own Retry gives it back', async () => {
mock.models.getRuntimeStatus.mockRejectedValueOnce(new Error('runtime unreadable'));
+ let releaseSources!: (sources: Source[]) => void;
+ mock.models.listSources.mockReturnValue(new Promise<Source[]>((resolve) => { releaseSources = resolve; }));
mount();
fireEvent.click(await screen.findByRole('button', { name: 'Get started' }));
await waitFor(() => expect(gateway().getAttribute('data-state')).toBe('failed'));
@@ -868,7 +976,12 @@ describe('the registered journey', () => {
// step, and the one Retry on screen is the card's rather than the footer's.
expect(gateway().hasAttribute('data-failed-step')).toBe(false);
expect(flowError()).toBeNull();
- expect(primaryAction().textContent).toContain(en.onboarding.providers.actionContinue);
+ // Runtime failure does not settle the independent inventory read. Keep that
+ // boundary controlled so the assertion cannot race its source response in CI.
+ expect(primaryAction().textContent).toContain(en.onboarding.providers.actionChecking);
+ expect(primaryAction().hasAttribute('disabled')).toBe(true);
+ await act(async () => releaseSources([HUB_SOURCE]));
+ await waitFor(() => expect(primaryAction().textContent).toContain(en.onboarding.providers.actionContinue));
expect(primaryAction().hasAttribute('disabled')).toBe(true);
const retry = gateway().querySelector('.setup-gateway-retry') as HTMLButtonElement;
expect(retry.textContent).toContain(en.common.retry);
diff --git a/ui/src/components/onboarding/providers/AddSourceDialog.tsx b/ui/src/components/onboarding/providers/AddSourceDialog.tsx
index 6b31175be..3cb601b28 100644
--- a/ui/src/components/onboarding/providers/AddSourceDialog.tsx
+++ b/ui/src/components/onboarding/providers/AddSourceDialog.tsx
@@ -541,6 +541,7 @@ export const AddSourceDialog: React.FC<{
{phase.kind === 'waitingAuth' && (
<OAuthConnectDialog
open
+ hubOnly
vendor={subscriptionVendor}
sources={sources}
// Cancelled, failed, or abandoned: back to the frame it was launched
diff --git a/ui/src/components/onboarding/providers/ProvidersScreen.test.tsx b/ui/src/components/onboarding/providers/ProvidersScreen.test.tsx
index 27914807d..3e39aa1d0 100644
--- a/ui/src/components/onboarding/providers/ProvidersScreen.test.tsx
+++ b/ui/src/components/onboarding/providers/ProvidersScreen.test.tsx
@@ -335,6 +335,18 @@ afterEach(() => {
});
describe('ProvidersScreen — the stage', () => {
+ it.each(['active', 'standby'] as const)('AUTH-SETUP-126: native %s subscriptions cannot supply the Hub setup step', async (status) => {
+ serve({ sources: [source({ id: 'src_native', vendor: 'anthropic', kind: 'subscription',
+ supply_channel: 'native_cli', state: { status } })] });
+ const { handle } = renderScreen();
+ await settled();
+ expect(lastAction()).toMatchObject({ labelKey: 'onboarding.providers.actionAdd', disabled: false });
+ expect(cardFor('anthropic').dataset.state).toBe('empty');
+ await activate(handle);
+ expect(await screen.findByRole('dialog')).toBeTruthy();
+ expect(navigated).toEqual([]);
+ });
+
it('opens on the shortlist and always offers a third way in', async () => {
serve();
renderScreen();
@@ -788,11 +800,13 @@ describe('ProvidersScreen — the action the shell renders', () => {
icon: 'none',
});
expect(lastAction().labelArgs).toBeUndefined();
+ expect(screen.queryByRole('button', { name: 'Continue to assistants' })).toBeNull();
await activate(handle);
const dialog = await screen.findByRole('dialog');
expect(within(dialog).getByText('Add more model providers')).toBeTruthy();
+ expect(navigated).toEqual([]);
});
it('continues once something is really there to continue with', async () => {
@@ -872,63 +886,40 @@ describe('ProvidersScreen — the action the shell renders', () => {
});
});
-describe('ProvidersScreen — the way on when nothing is connected', () => {
- it('states a way on beside the take-over it found, and only navigates', async () => {
+describe('ProvidersScreen — source required before continuing', () => {
+ it('offers migration without a bypass when a key is detected but not yet imported', async () => {
serve({ scan: [CLAUDE_KEY] });
- renderScreen();
+ const { handle } = renderScreen();
await settled();
-
- // The take-over keeps the footer: whoever came here to connect something is
- // still offered the thing they came for. The way on is beside it, not instead.
await waitFor(() => expect(lastAction().labelKey).toBe('onboarding.providers.actionImport'));
- const onward = screen.getByRole('button', { name: 'Continue to assistants' });
- expect((onward as HTMLButtonElement).disabled).toBe(false);
-
- await userEvent.setup().click(onward);
-
- // Navigating is the whole action. Nothing was added, taken over or installed
- // on the way out, and the review that was on offer is still only on offer.
- expect(navigated).toEqual(['assistants']);
+ expect(screen.queryByRole('button', { name: 'Continue to assistants' })).toBeNull();
+ await activate(handle);
+ expect(await screen.findByRole('dialog')).toBeTruthy();
+ expect(navigated).toEqual([]);
expect(server.sources).toEqual([]);
expect(modelsApi.applyMigration).not.toHaveBeenCalled();
- expect(modelsApi.installRuntime).not.toHaveBeenCalled();
- expect(modelsApi.startRuntime).not.toHaveBeenCalled();
- expect(screen.queryByRole('dialog')).toBeNull();
- });
-
- it('leaves the single action alone once a source is really there', async () => {
- serve({ sources: [source({ id: 'src_zhipu', vendor: 'zhipu' })] });
- renderScreen();
- await settled();
-
- await waitFor(() => expect(lastAction().labelKey).toBe('onboarding.providers.actionContinue'));
- expect(screen.queryByRole('button', { name: 'Continue to assistants' })).toBeNull();
});
- it('takes the way on back when the shell hides the screen, and returns it on re-entry', async () => {
- serve();
- const { show } = renderScreen();
+ it.each(['needs_action', 'error', 'cooldown'] as const)('cannot continue with only a %s source', async (status) => {
+ serve({ sources: [source({ id: 'src_unusable', vendor: 'openai', state: { status } })] });
+ const { handle } = renderScreen();
await settled();
- expect(screen.getByRole('button', { name: 'Continue to assistants' })).toBeTruthy();
-
- // It leaves the screen root to reach the shell's slot, so nothing else would
- // take it out of reach of a reader on the step after this one.
- await show({ active: false });
- expect(screen.queryByRole('button', { name: 'Continue to assistants' })).toBeNull();
-
- await show({ active: true });
- await waitFor(() => expect(screen.getByRole('button', { name: 'Continue to assistants' })).toBeTruthy());
+ await waitFor(() => expect(lastAction().labelKey).toBe('onboarding.providers.actionAdd'));
+ await activate(handle);
+ expect(await screen.findByRole('dialog')).toBeTruthy();
expect(navigated).toEqual([]);
});
- it('says nothing about a way on while the inventory is unread, which is not an empty one', async () => {
+ it('retries an unread inventory without offering or performing navigation', async () => {
serve();
vi.mocked(modelsApi.listSources).mockRejectedValue(new Error('offline'));
- renderScreen();
+ const { handle } = renderScreen();
await settled();
-
await waitFor(() => expect(lastAction().labelKey).toBe('common.retry'));
expect(screen.queryByRole('button', { name: 'Continue to assistants' })).toBeNull();
+ await activate(handle);
+ await waitFor(() => expect(modelsApi.listSources).toHaveBeenCalledTimes(2));
+ expect(navigated).toEqual([]);
});
});
@@ -1046,8 +1037,8 @@ describe('ProvidersScreen — what an import leaves behind', () => {
expect(within(screen.getByRole('dialog')).getByText(CODEX_KEY.masked_detail!)).toBeTruthy();
await user.click(within(screen.getByRole('dialog')).getByRole('button', { name: 'Not now' }));
await waitFor(() => expect(screen.queryByRole('dialog')).toBeNull());
- // Declining the review lets setup continue without changing the native key.
- await waitFor(() => expect(lastAction().labelKey).toBe('onboarding.providers.actionContinue'));
+ // Declining leaves the native key untouched and still requires a Hub source.
+ await waitFor(() => expect(lastAction().labelKey).toBe('onboarding.providers.actionAdd'));
expect(modelsApi.applyMigration).not.toHaveBeenCalled();
});
@@ -1057,11 +1048,11 @@ describe('ProvidersScreen — what an import leaves behind', () => {
await waitFor(() => expect(lastAction().labelKey).toBe('onboarding.providers.actionImport'));
await activate(first.handle);
await userEvent.setup().click(within(await screen.findByRole('dialog')).getByRole('button', { name: 'Not now' }));
- await waitFor(() => expect(lastAction().labelKey).toBe('onboarding.providers.actionContinue'));
+ await waitFor(() => expect(lastAction().labelKey).toBe('onboarding.providers.actionAdd'));
first.unmount();
const again = renderScreen();
- await waitFor(() => expect(lastAction().labelKey).toBe('onboarding.providers.actionContinue'));
+ await waitFor(() => expect(lastAction().labelKey).toBe('onboarding.providers.actionAdd'));
again.unmount();
server.scan = [CODEX_KEY, OPENCODE_KEY];
@@ -1075,7 +1066,7 @@ describe('ProvidersScreen — what an import leaves behind', () => {
await waitFor(() => expect(lastAction().labelKey).toBe('onboarding.providers.actionImport'));
await activate(first.handle);
await userEvent.setup().click(within(await screen.findByRole('dialog')).getByRole('button', { name: 'Not now' }));
- await waitFor(() => expect(lastAction().labelKey).toBe('onboarding.providers.actionContinue'));
+ await waitFor(() => expect(lastAction().labelKey).toBe('onboarding.providers.actionAdd'));
first.unmount();
server.scan = [CODEX_KEY, { ...OPENCODE_KEY, selected: false }];
@@ -1089,7 +1080,7 @@ describe('ProvidersScreen — what an import leaves behind', () => {
server.scan = [CODEX_KEY];
renderScreen();
- await waitFor(() => expect(lastAction().labelKey).toBe('onboarding.providers.actionContinue'));
+ await waitFor(() => expect(lastAction().labelKey).toBe('onboarding.providers.actionAdd'));
});
it('keeps A dismissed when the review unchecks A and migrates only B', async () => {
@@ -1567,6 +1558,39 @@ describe('ProvidersScreen — the engine', () => {
await waitFor(() => expect(create).toHaveBeenCalledTimes(1));
});
+ it('AUTH-SETUP-126: a write settled while hidden cannot answer the next visit', async () => {
+ serve();
+ const created = source({ id: 'src_new', vendor: 'custom' });
+ vi.spyOn(modelsApi, 'createApiKeySource').mockResolvedValue({
+ source: created, added_to: [], adopted_by: [],
+ });
+ const { handle, show } = renderScreen();
+ await settled();
+ const user = userEvent.setup();
+ await activate(handle);
+ const dialog = await screen.findByRole('dialog');
+ await user.click(within(dialog).getByRole('button', { name: 'API Key' }));
+ await user.type(within(dialog).getByLabelText('Base URL'), 'https://api.example/v1');
+ await user.type(within(dialog).getByLabelText('API key'), 'sk-fixture-only');
+
+ const receipt = deferred<Source[]>();
+ vi.mocked(modelsApi.listSources).mockReturnValue(receipt.promise);
+ await user.click(within(dialog).getByRole('button', { name: 'Add' }));
+ await waitFor(() => expect(modelsApi.listSources).toHaveBeenCalledTimes(2));
+ await show({ active: false });
+ await act(async () => receipt.resolve([created]));
+ await waitFor(() => expect(screen.queryByRole('dialog')).toBeNull());
+
+ const current = deferred<Source[]>();
+ vi.mocked(modelsApi.listSources).mockReturnValue(current.promise);
+ await show({ active: true });
+ expect(lastAction()).toMatchObject({ labelKey: 'onboarding.providers.actionChecking', disabled: true });
+ await activate(handle);
+ expect(navigated).toEqual([]);
+ await act(async () => current.resolve([]));
+ await waitFor(() => expect(lastAction()).toMatchObject({ labelKey: 'onboarding.providers.actionAdd', disabled: false }));
+ });
+
it('refuses a write the configuration does not admit, however healthy the engine is', async () => {
serve();
const { handle, show } = renderScreen();
diff --git a/ui/src/components/onboarding/providers/ProvidersScreen.tsx b/ui/src/components/onboarding/providers/ProvidersScreen.tsx
index 4087264f6..e7e2929aa 100644
--- a/ui/src/components/onboarding/providers/ProvidersScreen.tsx
+++ b/ui/src/components/onboarding/providers/ProvidersScreen.tsx
@@ -15,10 +15,8 @@
// composition, and therefore is this file's: the engine has to be up whether or not
// there is an assistant to adopt.
import * as React from 'react';
-import { createPortal } from 'react-dom';
import { useTranslation } from 'react-i18next';
-import { useRouteSurfaceActive } from '@/lib/routeSurfaceActivity';
import { clearMigrationDismissed, isMigrationDismissed, writeMigrationDismissed } from '@/lib/modelHubMigrationDismiss';
import { Button } from '@/components/ui/button';
import {
@@ -223,8 +221,6 @@ export const ProvidersScreen = React.forwardRef<SetupScreenHandle, ProvidersScre
// this screen should ask for, and the action continues instead of opening a review
// of work that is done.
const pending = React.useMemo(() => pendingImportRows(selection), [selection]);
- const importDeclined = selection.selectedBackends.length === 0
- && isMigrationDismissed(offeredImportKeys(selection));
// ── Supply ──────────────────────────────────────────────────────────────
// Whether the server's own row defaults have been honoured yet. A scan is nulled
@@ -252,6 +248,12 @@ export const ProvidersScreen = React.forwardRef<SetupScreenHandle, ProvidersScre
* the refresh is what stops that commit from existing, rather than narrowing it.
*/
const answeredRef = React.useRef<number | null>(null);
+ // Retained screens must re-establish supply on each visit. Reset on both
+ // transitions: a write can finish its readback while this screen is hidden.
+ React.useLayoutEffect(() => {
+ answeredRef.current = null;
+ setSourceRead('reading');
+ }, [active]);
/**
* The runtime observation this screen's supply read is taken against.
*
@@ -575,7 +577,7 @@ export const ProvidersScreen = React.forwardRef<SetupScreenHandle, ProvidersScre
pendingCount: pending.length,
importFailed,
supply: sourceRead === 'read'
- ? { kind: 'read', hasSource: hasSource || importDeclined }
+ ? { kind: 'read', hasSource }
: { kind: sourceRead },
gatewayBusy,
// The same admission the dialogs are opened and submitted against, so the footer
@@ -705,46 +707,8 @@ export const ProvidersScreen = React.forwardRef<SetupScreenHandle, ProvidersScre
),
].join(' · ');
- // ── The way on when nothing is connected ────────────────────────────────
-
- // Connecting a provider is what this screen is for, and it is still the only
- // thing the stage and the footer offer. But an inventory that answered「none」is
- // an answer: whoever meant to connect later — or declined the takeover on offer —
- // has nothing here to press, and a step whose every control stays put is a dead
- // end. So the way on is stated where the shell keeps what is ancillary to the
- // pair, as a sentence rather than a second button competing with the one above.
- //
- // It navigates and does nothing else. Adding a source, taking over a credential
- // and installing the engine each keep the control that already owns them, and
- // none of them happens on the way to the next screen. The engine's admission is
- // not asked about either: it gates writes, and this is not one — gating the way
- // out on it is how the dead end got here.
- //
- // The slot is the shell's, reached the same way the connection step reaches it,
- // and only while this screen is the one being read: a portal leaves the screen
- // root and with it the `inert` the shell puts on the others, so the sentence has
- // to answer to that activity itself.
- const routeSurfaceActive = useRouteSurfaceActive();
- const setupRoot = React.useRef<HTMLDivElement>(null);
- const [actionAside, setActionAside] = React.useState<HTMLElement | null>(null);
- React.useEffect(() => {
- setActionAside(setupRoot.current?.closest('.onboarding-step')
- ?.querySelector<HTMLElement>('[data-setup-action-aside]') ?? null);
- }, [onActionChange]);
- const onwardNode = sourceRead === 'read' && !hasSource && !importDeclined ? (
- <div className="onboarding-setup-hint">
- <p className="text-center text-xs text-muted">
- {t('onboarding.providers.continueHint')}{' '}
- <Button type="button" variant="link" size="xs" className="h-auto p-0 align-baseline text-xs"
- onClick={() => onNavigate('assistants')}>
- {t('onboarding.providers.actionContinue')}
- </Button>
- </p>
- </div>
- ) : null;
-
return (
- <div className="onboarding-setup" ref={setupRoot}>
+ <div className="onboarding-setup">
<header className="onboarding-heading">
{/* `h1` with a programmatic tab stop, like every other screen's heading: the
shell moves focus here on activation, and a heading it cannot find or
@@ -879,10 +843,6 @@ export const ProvidersScreen = React.forwardRef<SetupScreenHandle, ProvidersScre
onDecline={declineImport}
/>
)}
-
- {onwardNode && active && routeSurfaceActive && actionAside
- ? createPortal(onwardNode, actionAside)
- : null}
</div>
);
},
diff --git a/ui/src/components/onboarding/providers/providerStage.ts b/ui/src/components/onboarding/providers/providerStage.ts
index a80f65e91..e301d8879 100644
--- a/ui/src/components/onboarding/providers/providerStage.ts
+++ b/ui/src/components/onboarding/providers/providerStage.ts
@@ -52,7 +52,7 @@ import {
export const PROVIDER_SLOT_COUNT = 2;
/**
- * Whether a source counts as connected.
+ * Whether a source can supply setup's Model Hub route.
*
* `active` and `standby` are the two healthy statuses; the shipped resolver already
* routes through standby, so treating it as anything less would under-report a source
@@ -61,7 +61,8 @@ export const PROVIDER_SLOT_COUNT = 2;
* exists and the person did add it.
*/
export const usableSource = (source: Source): boolean =>
- source.state.status === 'active' || source.state.status === 'standby';
+ source.supply_channel === 'hub'
+ && (source.state.status === 'active' || source.state.status === 'standby');
/**
* How many of the sources added through Add more are still there.
diff --git a/ui/src/components/settings/models/OAuthConnectDialog.test.ts b/ui/src/components/settings/models/OAuthConnectDialog.test.ts
index 40d571b94..0ef114671 100644
--- a/ui/src/components/settings/models/OAuthConnectDialog.test.ts
+++ b/ui/src/components/settings/models/OAuthConnectDialog.test.ts
@@ -69,6 +69,20 @@ const deferred = <T,>() => {
};
describe('add-subscription channel choice', () => {
+ it.each(['anthropic', 'openai'])('AUTH-SETUP-126: setup starts %s only with Hub custody after explicit sign-in', async (vendor) => {
+ const start = vi.spyOn(modelsApi, 'startOAuth').mockImplementation(() => new Promise(() => {}));
+ renderDialog({ vendor, hubOnly: true });
+ const options = screen.getAllByRole('radio');
+ expect(options).toHaveLength(1);
+ expect(options[0].getAttribute('aria-checked')).toBe('true');
+ expect(options[0].textContent).toContain(i18n.t('settings.models.addSub.opt.hub.label'));
+ expect(screen.queryByText(i18n.t('settings.models.addSub.hint.claude'))).toBeNull();
+ expect(start).not.toHaveBeenCalled();
+ await userEvent.click(screen.getByRole('button', { name: i18n.t('settings.models.addSub.signIn') }));
+ await waitFor(() => expect(start).toHaveBeenCalledOnce());
+ expect(start.mock.calls[0].slice(0, 2)).toEqual([vendor, 'hub']);
+ });
+
it('flips the recommendation and visible order by vendor', () => {
expect(recommendedSubscriptionChannel('anthropic')).toBe('native_cli');
expect(subscriptionOptionOrder('anthropic')).toEqual(['native_cli', 'hub']);
diff --git a/ui/src/components/settings/models/OAuthConnectDialog.tsx b/ui/src/components/settings/models/OAuthConnectDialog.tsx
index f4a206af9..dead05275 100644
--- a/ui/src/components/settings/models/OAuthConnectDialog.tsx
+++ b/ui/src/components/settings/models/OAuthConnectDialog.tsx
@@ -89,9 +89,11 @@ export const OAuthConnectDialog: React.FC<{
reauth?: Source | null;
/** Snapshot candidates used to decide whether this backend's native slot is occupied. */
sources?: Source[];
+ /** Setup creates sources for a Hub route. Reauthentication keeps its source's custody. */
+ hubOnly?: boolean;
onClose: () => void;
onConnected: (source?: Source, placement?: Adoption) => void;
-}> = ({ open, vendor, reauth = null, sources = [], onClose, onConnected }) => {
+}> = ({ open, vendor, reauth = null, sources = [], hubOnly = false, onClose, onConnected }) => {
const { t } = useTranslation();
const { showToast } = useToast();
@@ -106,7 +108,7 @@ export const OAuthConnectDialog: React.FC<{
// before the passive open effect runs; deriving this here prevents an occupied
// native row from ever being the initially focused/selected option.
const [channel, setChannel] = React.useState<SupplyChannel>(() =>
- reauth ? (reauth.supply_channel ?? 'native_cli') : initialSubscriptionChannel(vendor, sources),
+ reauth ? (reauth.supply_channel ?? 'native_cli') : hubOnly ? 'hub' : initialSubscriptionChannel(vendor, sources),
);
const [phase, setPhase] = React.useState<ConnectPhase>('choose');
const [nativeSlotTaken, setNativeSlotTaken] = React.useState(() =>
@@ -167,7 +169,7 @@ export const OAuthConnectDialog: React.FC<{
// Take the native-slot reading once per open. A source arriving after this is
// the singleton race the start route owns; it must surface as Already bound,
// not silently rewrite a choice already under the user's pointer.
- const openSubject = open ? `${vendor}:${reauthId ?? 'create'}` : null;
+ const openSubject = open ? `${vendor}:${reauthId ?? 'create'}:${hubOnly}` : null;
React.useEffect(() => {
if (!openSubject) {
initializedOpenSubject.current = null;
@@ -189,12 +191,12 @@ export const OAuthConnectDialog: React.FC<{
}
const occupied = nativeSubscriptionSlotTaken(vendor, sources);
setNativeSlotTaken(occupied);
- setChannel(initialSubscriptionChannel(vendor, sources));
+ setChannel(hubOnly ? 'hub' : initialSubscriptionChannel(vendor, sources));
// A vendor with no chooser copy has no channel choice to put in front of the
// user, so it opens straight into its flow — the same entry the re-auth
// journey takes above.
setPhase(chooser === null ? 'flow' : 'choose');
- }, [chooser, isReauth, openSubject, reauth?.supply_channel, sources, vendor]);
+ }, [chooser, hubOnly, isReauth, openSubject, reauth?.supply_channel, sources, vendor]);
/**
* One owner for 「the server moved the rows the page behind this dialog draws」,
@@ -706,8 +708,8 @@ export const OAuthConnectDialog: React.FC<{
// interpolate i18n keys at the user. Narrowing on `chooser` here rather than on
// a bare phase check is what makes that a type error, not a runtime one.
const choosing = !isReauth && phase === 'choose' && chooser !== null;
- const recommended = recommendedSubscriptionChannel(vendor);
- const optionOrder = subscriptionOptionOrder(vendor);
+ const recommended = hubOnly ? 'hub' : recommendedSubscriptionChannel(vendor);
+ const optionOrder: SupplyChannel[] = hubOnly ? ['hub'] : subscriptionOptionOrder(vendor);
const optionRefs = React.useRef<Partial<Record<SupplyChannel, HTMLButtonElement | null>>>({});
const selectableChannels = optionOrder.filter((candidate) => candidate !== 'native_cli' || !nativeSlotTaken);
@@ -829,7 +831,7 @@ export const OAuthConnectDialog: React.FC<{
);
})}
</div>
- {vendorCopy === 'claude' && (
+ {vendorCopy === 'claude' && !hubOnly && (
<p className="model-hub-add-sub-hint flex items-start gap-2 text-muted">
<Info className="mt-0.5 size-3 shrink-0" />
<span>{t('settings.models.addSub.hint.claude')}</span>
diff --git a/ui/src/components/steps/AgentDetection.tsx b/ui/src/components/steps/AgentDetection.tsx
index 8b8c246b5..e87cf7cde 100644
--- a/ui/src/components/steps/AgentDetection.tsx
+++ b/ui/src/components/steps/AgentDetection.tsx
@@ -40,6 +40,7 @@ import type { AssistantRouteView } from '../onboarding/AssistantRow';
import { isBuiltinAgent } from '../onboarding/setupTargets';
import { readyRegion } from '../settings/models/regionRead';
import { modelsApi } from '../settings/models/modelsApi';
+import { usableSource } from '../onboarding/providers/providerStage';
interface AgentDetectionProps {
active?: boolean;
@@ -154,10 +155,12 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, on
const sharedRouteReady = () => active && activeRef.current && routeRead.done && !routeRead.failed
&& routeRead.confirmed?.epoch === activation.current
&& routeRead.confirmed?.token === routeReadToken.current;
+ const sharedRouteFailed = () => active && activeRef.current && routeRead.failed
+ && routeRead.failure?.epoch === activation.current
+ && routeRead.failure?.token === routeReadToken.current;
const routeTargetReady = (backend: RuntimeBackendId) => sharedRouteReady() && routeRead.backendReads[backend] === 'ready';
const routeFailureCurrent = (backend: RuntimeBackendId) => active && activeRef.current && (
- (routeRead.failed && routeRead.failure?.epoch === activation.current
- && routeRead.failure?.token === routeReadToken.current)
+ sharedRouteFailed()
|| (sharedRouteReady() && routeRead.backendReads[backend] === 'failed'));
const readCardRoutes = useCallback(async (target?: RuntimeBackendId) => {
if (!agentReads) return false;
@@ -594,26 +597,37 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, on
};
const opencodeAgent = agents['opencode'];
+ const requiresSource = canEditSetupRoute && modelHubEnabled;
+ const hasSource = sharedRouteReady() && routeRead.sources.some(usableSource);
+ const needsSource = requiresSource && sharedRouteReady() && !hasSource;
+ const sourceReadFailed = requiresSource && sharedRouteFailed();
+ const sourceReadPending = requiresSource && !sharedRouteReady() && !sourceReadFailed;
const readyBackends = ASSISTANT_ORDER.filter((name) => agents[name].enabled && agents[name].status === 'ok'
&& !installingAgents[name] && !detectingAgents[name] && !connectionPending[name]
&& !pendingWrites[name] && !refreshingAgents[name] && !connectionErrors[name] && connections[name]?.entry_eligible);
- const canContinue = isPage ? Object.values(agents).some((agent) => agent.enabled) : readyBackends.length > 0;
+ const canContinue = isPage ? Object.values(agents).some((agent) => agent.enabled)
+ : (!requiresSource || hasSource) && readyBackends.length > 0;
+ const actionBusy = syncing || entering || isAnyInstalling || Object.values(pendingWrites).some(Boolean) || Object.values(refreshingAgents).some(Boolean);
const primaryPending = useRef(false);
const handlePrimaryAction = async () => {
- if (!active || entering || primaryPending.current) return;
+ if (!active || !canContinue || actionBusy || primaryPending.current) return;
primaryPending.current = true;
if (isPage && onSave) { try { await onSave({ agents }); } finally { primaryPending.current = false; } return; }
setEntering(true); setEntryError('');
try {
await enableQueue.current;
await onNext({ agents, readyBackends });
- } catch (error) { setEntryError(String(error)); }
+ } catch (error) {
+ setEntryError(String(error));
+ // Completion rechecks the server. A refusal can contradict the inventory
+ // this screen still holds, so recover from current evidence before retrying.
+ if (requiresSource) void readCardRoutes();
+ }
finally { primaryPending.current = false; setEntering(false); }
};
- const actionBusy = syncing || entering || isAnyInstalling || Object.values(pendingWrites).some(Boolean) || Object.values(refreshingAgents).some(Boolean);
- useImperativeHandle(ref, () => ({ activate: () => { if (canContinue && !actionBusy) void handlePrimaryAction(); } }));
+ useImperativeHandle(ref, () => ({ activate: () => { void handlePrimaryAction(); } }));
// A layout effect, so the shell's action label lands in the same commit as the state
// it describes: a passive publish would leave one render where the screen already
// shows a settled state while the shared button still carries the previous label.
@@ -655,13 +669,25 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, on
beside it — inside one centred line it pulled the sentence off the
action's axis by half its own width. */
<p className="onboarding-setup-hint-line text-muted">
- <span>{t('onboarding.connection.entryHint')}</span>
- {rescan}
+ <span>{t(sourceReadPending ? 'onboarding.providers.actionChecking'
+ : sourceReadFailed ? 'onboarding.connection.readFailed'
+ : needsSource ? 'onboarding.connection.sourceRequired' : 'onboarding.connection.entryHint')}</span>
+ {needsSource ? (
+ <Button type="button" variant="link" size="xs" className="h-auto p-0"
+ disabled={actionBusy} onClick={() => onNavigate?.('providers')}>
+ {t('onboarding.connection.addSource')}
+ </Button>
+ ) : sourceReadFailed ? (
+ <Button type="button" variant="link" size="xs" className="h-auto p-0"
+ disabled={actionBusy} onClick={() => void readCardRoutes()}>
+ {t('common.retry')}
+ </Button>
+ ) : sourceReadPending ? null : rescan}
</p>
);
const hintInner = (hintSentence || entryError) ? (<>
{hintSentence}
- {entryError && <div role="alert" className="connection-error">{entryError} <Button variant="link" size="sm" disabled={entering} onClick={() => void handlePrimaryAction()}>{t('common.retry')}</Button></div>}
+ {entryError && <div role="alert" className="connection-error">{entryError} <Button variant="link" size="sm" disabled={!canContinue || actionBusy} onClick={() => void handlePrimaryAction()}>{t('common.retry')}</Button></div>}
</>) : null;
// Hosted in one place so the order under the pair is the same every time, and so the
// standalone host keeps the arrangement it already had.
@@ -681,7 +707,7 @@ export const AgentDetection: React.FC<AgentDetectionProps> = ({ data, onNext, on
: (
<div className="onboarding-setup-footer">
<Button type="button" variant="brand" className="group onboarding-action-w onboarding-primary-action" onClick={() => void handlePrimaryAction()}
- disabled={!canContinue || syncing || entering}>
+ disabled={!canContinue || actionBusy}>
{t(entering ? 'onboarding.connection.connecting' : 'onboarding.connection.enter')}
<ArrowRight size={16} className="motion-safe:transition-transform motion-safe:duration-180 motion-safe:group-hover:translate-x-1" />
</Button>
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index cfe709ffc..fa6dd5f3e 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -5295,6 +5295,8 @@
"changeProvider": "Change",
"enter": "Enter workspace",
"entryHint": "Connect any one subscription or API Key to enter the workspace",
+ "sourceRequired": "Add a subscription or API Key before choosing an assistant.",
+ "addSource": "Add model source",
"entryFailed": "A ready assistant could not be confirmed. Refresh and try again.",
"addSubscription": "Add subscription / sign in",
"addKey": "Add API Key",
@@ -5360,7 +5362,6 @@
"actionAdd": "Add subscription or API Key",
"actionConnecting": "Connecting…",
"actionChecking": "Checking connection…",
- "continueHint": "You can connect a provider later",
"addTitle": "Add subscription or API Key",
"addTitleMore": "Add more model providers",
"addDescription": "Add one source to get started. Model Hub handles routing.",
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index a000e2e1c..cc2c64846 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -5295,6 +5295,8 @@
"changeProvider": "更换",
"enter": "进入工作台",
"entryHint": "添加任意一个订阅或 API Key,即可进入工作台",
+ "sourceRequired": "请先添加订阅或 API Key,再选择 AI 助手。",
+ "addSource": "添加模型来源",
"entryFailed": "无法确认可用助手,请刷新后重试",
"addSubscription": "添加订阅 / 登录",
"addKey": "添加 API Key",
@@ -5360,7 +5362,6 @@
"actionAdd": "添加订阅或 API Key",
"actionConnecting": "正在连接…",
"actionChecking": "正在检查连接…",
- "continueHint": "也可以稍后再连接供应商",
"addTitle": "添加订阅或 API Key",
"addTitleMore": "添加更多模型供应商",
"addDescription": "添加一个来源即可开始,由模型网关统一路由",