Python
Show settings connection errors
YASHAS148b741d94ab
diff --git a/surfaces/gui/e2e/settings.spec.ts b/surfaces/gui/e2e/settings.spec.tsindex bc5c1045..7451fcb4 100644--- a/surfaces/gui/e2e/settings.spec.ts+++ b/surfaces/gui/e2e/settings.spec.ts@@ -26,6 +26,19 @@ test("Settings opens as a full page and navigates sections", async ({ page }) =>await expect(page.getByTestId("set-provider-openai")).toBeVisible();});+test("Models explains when the agent server cannot be reached", async ({ page }) => {+ await page.goto("/");+ await page.getByTestId("account-row").click();+ await page.getByRole("button", { name: "Settings", exact: true }).click();++ await page.route("**/v1/settings", (route) => route.abort("failed"));+ await page.getByRole("button", { name: "Models & Keys", exact: true }).click();++ await expect(page.getByText("Couldn't reach the agent server")).toBeVisible();+ await expect(page.getByText("Make sure OpenWorker is running, then try again.")).toBeVisible();+ await expect(page.getByTestId("settings-retry")).toBeVisible();+});+// The flag's "0" escape hatch hides the tab again (the default is on — UX-029).test("Settings: Coworkers tab opens by default; flag \"0\" hides it", async ({ page }) => {await page.goto("/");diff --git a/surfaces/gui/src/components/ManageTabs.tsx b/surfaces/gui/src/components/ManageTabs.tsxindex 9e45fe1e..ab309fb4 100644--- a/surfaces/gui/src/components/ManageTabs.tsx+++ b/surfaces/gui/src/components/ManageTabs.tsx@@ -96,7 +96,16 @@ export function ModelsTab() {const [settings, setSettings] = useState<ModelSettings | null>(null);// The Pick a model dialog (UX-055): "" closed, "+" picking, else the model to configure.const [dialog, setDialog] = useState<string>("");- const refreshSettings = () => getSettings().then(setSettings).catch(() => setSettings(null));+ const [settingsError, setSettingsError] = useState(false);+ const refreshSettings = () => {+ setSettingsError(false);+ getSettings()+ .then(setSettings)+ .catch(() => {+ setSettings(null);+ setSettingsError(true);+ });+ };const ps = useProviderSetup({ onSaved: refreshSettings });useEffect(() => {refreshSettings();@@ -109,6 +118,20 @@ export function ModelsTab() {} catch { /* private window */ }}, []);+ if (settingsError) {+ return (+ <div className="text-ui text-muted space-y-3">+ <div>+ <p className="text-ink font-medium">Couldn't reach the agent server</p>+ <p className="mt-1">Make sure OpenWorker is running, then try again.</p>+ </div>+ <button className={BTN_BORDERED} onClick={refreshSettings} data-testid="settings-retry">+ Retry+ </button>+ </div>+ );+ }+if (!settings) return <div className="text-ui text-muted">{t("manage.loading")}</div>;const info = ps.info;