Skip to content

Commit d1c9e48

Browse files
feat(ui): streamline model provider defaults (#134813)
* fix(ui): polish settings presentation * feat(ui): streamline model provider defaults * fix(ui): preserve full years in timestamps * chore(ui): record model defaults bundle growth * test(ui): cover model defaults autosave * test(ui): align model provider e2e coverage * fix(ui): preserve trailing model fallbacks * docs(models): document autosaving defaults
1 parent 113805d commit d1c9e48

27 files changed

Lines changed: 1298 additions & 694 deletions

‎config/assertion-safety-baseline.txt‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4093,7 +4093,6 @@ ui/src/pages/labs/labs-registry.ts 6
40934093
ui/src/pages/logs/log-lines.ts 1
40944094
ui/src/pages/logs/view.ts 2
40954095
ui/src/pages/memory-import/view.ts 3
4096-
ui/src/pages/model-providers/default-models-view.ts 1
40974096
ui/src/pages/model-providers/view.ts 3
40984097
ui/src/pages/model-setup/provider-picker.ts 3
40994098
ui/src/pages/model-setup/view.ts 2
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"startupJsGzipBytes": 348433,
3-
"reason": "Reconcile merged Control UI changes since the update-lifecycle baseline with CI 33470685955: 348433 B (+641 B, 0.18%); fixed 358400 B cap and existing growth and build-variance allowances retained",
2+
"startupJsGzipBytes": 348668,
3+
"reason": "Model provider defaults consolidation, autosave, and contextual help add 235 B (0.07%) over the reconciled 348433 B main baseline; fixed 358400 B cap and existing allowances retained",
44
"updatedAt": "2026-09-01"
55
}

‎docs/concepts/model-providers.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,13 @@ Reference for **LLM/model providers** (not chat channels like WhatsApp/Telegram)
5757

5858
## Configure providers in the Control UI
5959

60-
Open **Settings → Model Providers** in the Control UI to add, replace, or remove provider API keys stored in `models.providers.<id>.apiKey`. The page identifies whether each API key comes from OpenClaw config or an environment variable without displaying the credential. Environment-provided keys remain managed by the gateway process environment.
60+
Open **Settings → Models** in the Control UI to add, replace, or remove provider API keys stored in `models.providers.<id>.apiKey`. The page identifies whether each API key comes from OpenClaw config or an environment variable without displaying the credential. Environment-provided keys remain managed by the gateway process environment.
6161

6262
Use **Test connection** to run a live provider probe and see latency or a categorized authentication, rate-limit, billing, timeout, or response error. A probe makes a real provider request and may consume a small number of tokens. OAuth and token profiles can also be logged out from the provider card.
6363

64-
The **Default models** card manages the primary model, ordered fallbacks, and utility model from the configured model catalog. Choose the models, then save them together to the existing `agents.defaults.model` and `agents.defaults.utilityModel` settings. For the utility model, **Automatic** leaves the setting unset and **Disabled** stores an empty string to turn utility routing off.
64+
The **Defaults** card manages the primary model, utility model, first fallback, thinking level, and Fast mode from the configured model catalog. Changes save automatically to the existing `agents.defaults` settings. For the utility model, **Auto** leaves the setting unset and **Disabled** stores an empty string to turn utility routing off.
65+
66+
The fallback selector edits the first model in the ordered fallback chain. Replacing it preserves any later fallbacks already configured; selecting **No fallback model** clears the chain. Use `openclaw models fallbacks` to manage the full ordered list.
6567

6668
## Plugin-owned provider behavior
6769

‎scripts/control-ui-mock-dev.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2023,6 +2023,7 @@ async function createChatPickerScenario(
20232023
"chat.abort",
20242024
"chat.history",
20252025
"chat.send",
2026+
"config.patch",
20262027
"config.schema",
20272028
"chat.metadata",
20282029
"chat.startup",

‎ui/src/app-navigation.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ describe("navigationIconForRoute", () => {
126126
about: "fileText",
127127
"ai-agents": "brain",
128128
"model-setup": "spark",
129-
"model-providers": "plug",
129+
"model-providers": "box",
130130
"memory-import": "download",
131131
notifications: "bell",
132132
security: "shieldCheck",

‎ui/src/app-navigation.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ const NAVIGATION_ICONS: NavigationItem = {
299299
about: "fileText",
300300
"ai-agents": "brain",
301301
"model-setup": "spark",
302-
"model-providers": "plug",
302+
"model-providers": "box",
303303
"memory-import": "download",
304304
notifications: "bell",
305305
security: "shieldCheck",

‎ui/src/e2e/config-quick-thinking-persistence.e2e.test.ts‎

Lines changed: 45 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function configResponse(
3636
function requestRaw(request: MockGatewayRequest): Record<string, unknown> {
3737
const params = request.params;
3838
if (!params || typeof params !== "object" || Array.isArray(params)) {
39-
throw new Error("Expected config.set params");
39+
throw new Error("Expected config mutation params");
4040
}
4141
return JSON.parse(String((params as Record<string, unknown>).raw)) as Record<string, unknown>;
4242
}
@@ -63,7 +63,7 @@ suite.define(() => {
6363
);
6464
});
6565

66-
it("reads and writes only agents.defaults.thinkingDefault", async () => {
66+
it("persists agents.defaults.thinkingDefault through autosave", async () => {
6767
await suite.withPage(
6868
{
6969
locale: "en-US",
@@ -75,8 +75,8 @@ suite.define(() => {
7575
const savedConfig = configResponse("high", "hash-2");
7676
const gateway = await installMockGateway(page, {
7777
methodResponses: {
78-
"config.get": initialConfig,
79-
"config.set": savedConfig,
78+
"config.get": { sequence: [initialConfig, savedConfig] },
79+
"config.patch": savedConfig,
8080
},
8181
});
8282

@@ -90,12 +90,19 @@ suite.define(() => {
9090

9191
await modelCard.getByRole("radio", { name: "High", exact: true }).click();
9292

93-
const raw = requestRaw(await gateway.waitForRequest("config.set"));
93+
const raw = requestRaw(await gateway.waitForRequest("config.patch"));
9494
expect(raw).toEqual({
95-
agents: { defaults: { model: "openai/gpt-5.5", thinkingDefault: "high" } },
95+
agents: {
96+
defaults: {
97+
model: "openai/gpt-5.5",
98+
utilityModel: null,
99+
thinkingDefault: "high",
100+
fastModeDefault: null,
101+
},
102+
},
96103
});
97104
expect(JSON.stringify(raw)).not.toContain("thinkingLevel");
98-
expect(JSON.stringify(raw)).not.toContain("fastMode");
105+
expect(raw.agents).not.toHaveProperty("defaults.fastMode");
99106

100107
const freshPage = await context.newPage();
101108
await installMockGateway(freshPage, {
@@ -112,9 +119,9 @@ suite.define(() => {
112119
});
113120

114121
it.each([
115-
{ initial: false, initialLabel: "Standard", next: true, nextLabel: "Fast" },
116-
{ initial: true, initialLabel: "Fast", next: "auto" as const, nextLabel: "Auto" },
117-
{ initial: "auto" as const, initialLabel: "Auto", next: false, nextLabel: "Standard" },
122+
{ initial: false, initialLabel: "Off", next: true, nextLabel: "On" },
123+
{ initial: true, initialLabel: "On", next: "auto" as const, nextLabel: "Auto" },
124+
{ initial: "auto" as const, initialLabel: "Auto", next: false, nextLabel: "Off" },
118125
])(
119126
"persists agents.defaults.fastModeDefault from $initialLabel to $nextLabel",
120127
async ({ initial, initialLabel, next, nextLabel }) => {
@@ -124,37 +131,58 @@ suite.define(() => {
124131
serviceWorkers: "block",
125132
viewport: { height: 900, width: 1280 },
126133
},
127-
async ({ page }) => {
134+
async ({ context, page }) => {
128135
const initialConfig = configResponse("low", "hash-1", initial);
136+
const savedConfig = configResponse("low", "hash-2", next);
129137
const gateway = await installMockGateway(page, {
130-
methodResponses: { "config.get": initialConfig },
138+
methodResponses: {
139+
"config.get": { sequence: [initialConfig, savedConfig] },
140+
"config.patch": savedConfig,
141+
},
131142
});
132143

133144
const response = await page.goto(`${suite.server.baseUrl}settings/model-providers`);
134145
expect(response?.status()).toBe(200);
135146

136147
const modelCard = page.locator("#settings-model-behavior");
137-
const initialButton = modelCard.getByRole("radio", { name: initialLabel, exact: true });
148+
const fastModeGroup = modelCard.locator("wa-radio-group").nth(1);
149+
const initialButton = fastModeGroup.getByRole("radio", {
150+
name: initialLabel,
151+
exact: true,
152+
});
138153
await initialButton.waitFor();
139154
expect(await initialButton.getAttribute("aria-checked")).toBe("true");
140155

141-
await modelCard.getByRole("radio", { name: nextLabel, exact: true }).click();
156+
await fastModeGroup.getByRole("radio", { name: nextLabel, exact: true }).click();
142157

143-
const raw = requestRaw(await gateway.waitForRequest("config.set"));
158+
const raw = requestRaw(await gateway.waitForRequest("config.patch"));
144159
expect(raw).toEqual({
145160
agents: {
146161
defaults: {
147162
model: "openai/gpt-5.5",
163+
utilityModel: null,
148164
thinkingDefault: "low",
149165
fastModeDefault: next,
150166
},
151167
},
152168
});
153169
expect(raw.agents).not.toHaveProperty("defaults.fastMode");
154170

155-
const reloadResponse = await page.reload();
171+
const freshPage = await context.newPage();
172+
await installMockGateway(freshPage, {
173+
methodResponses: { "config.get": savedConfig },
174+
});
175+
const reloadResponse = await freshPage.goto(
176+
`${suite.server.baseUrl}settings/model-providers`,
177+
);
156178
expect(reloadResponse?.status()).toBe(200);
157-
const persistedButton = modelCard.getByRole("radio", { name: nextLabel, exact: true });
179+
const persistedButton = freshPage
180+
.locator("#settings-model-behavior wa-radio-group")
181+
.nth(1)
182+
.getByRole("radio", {
183+
name: nextLabel,
184+
exact: true,
185+
});
158186
await persistedButton.waitFor();
159187
expect(await persistedButton.getAttribute("aria-checked")).toBe("true");
160188
},

‎ui/src/e2e/curated-settings-defaults.e2e.test.ts‎

Lines changed: 78 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ const suite = createControlUiE2eSuite({
1414
});
1515

1616
const captureUiProofEnabled = process.env.OPENCLAW_CAPTURE_UI_PROOF === "1";
17+
const thinkingDefaultExplanation =
18+
"Uses the selected model's thinking policy instead of saving a global thinking override.";
19+
const fastModeDefaultExplanation =
20+
"Uses the selected model's fast-mode policy. Unlike Auto, Default does not enable fast mode by itself.";
1721
let uiProofArtifactDir: string;
1822
beforeEach(() => {
1923
if (captureUiProofEnabled) {
@@ -67,6 +71,21 @@ async function expectInherited(row: Locator, value: string) {
6771
await expect.poll(() => row.textContent()).toContain(`Using default: ${value}`);
6872
}
6973

74+
async function expectDefaultInfo(row: Locator, explanation: string) {
75+
const info = row.locator('wa-radio[value=""] .model-providers__segment-info');
76+
await info.waitFor();
77+
await expect.poll(() => info.getAttribute("aria-label")).toBe(explanation);
78+
await expect.poll(() => info.locator("svg").count()).toBe(1);
79+
}
80+
81+
async function selectDefault(row: Locator) {
82+
await row.locator("wa-radio-group").evaluate((element) => {
83+
const group = element as HTMLElement & { value: string };
84+
group.value = "";
85+
group.dispatchEvent(new Event("change", { bubbles: true, composed: true }));
86+
});
87+
}
88+
7089
suite.define(() => {
7190
it("restores Labs, Security, and Models overrides to inherited defaults across reloads", async () => {
7291
await suite.withPage(
@@ -96,6 +115,17 @@ suite.define(() => {
96115
browser: initialConfig.browser,
97116
tools: { profile: "minimal" },
98117
};
118+
const afterThinkingReset = {
119+
agents: {
120+
defaults: {
121+
fastModeDefault: true,
122+
model: "openai/gpt-5.5",
123+
},
124+
},
125+
};
126+
const afterModelResets = {
127+
agents: { defaults: { model: "openai/gpt-5.5" } },
128+
};
99129
const gateway = await installMockGateway(page, {
100130
methodResponses: {
101131
"config.get": configResponse(initialConfig, "curated-defaults-1"),
@@ -202,8 +232,8 @@ suite.define(() => {
202232
.getByRole("radio", { name: "High", exact: true })
203233
.getAttribute("aria-checked"),
204234
).toBe("true");
205-
await expect.poll(() => thinkingRow.textContent()).toContain("Default: Model policy");
206-
await expect.poll(() => fastModeRow.textContent()).toContain("Default: Model policy");
235+
await expectDefaultInfo(thinkingRow, thinkingDefaultExplanation);
236+
await expectDefaultInfo(fastModeRow, fastModeDefaultExplanation);
207237

208238
if (captureUiProofEnabled) {
209239
await page.locator("#settings-model-behavior").screenshot({
@@ -212,28 +242,50 @@ suite.define(() => {
212242
});
213243
}
214244

215-
const modelSavesBefore = (await gateway.getRequests("config.set")).length;
216-
await thinkingRow.getByRole("radio", { name: "Default", exact: true }).click();
217-
await fastModeRow.getByRole("radio", { name: "Default", exact: true }).click();
218-
await expectInherited(thinkingRow, "Model policy");
219-
await expectInherited(fastModeRow, "Model policy");
245+
await gateway.setMethodResponse(
246+
"config.get",
247+
configResponse(afterThinkingReset, "curated-defaults-model-thinking-reset"),
248+
);
249+
const modelSavesBefore = (await gateway.getRequests("config.patch")).length;
250+
await selectDefault(thinkingRow);
251+
expect(
252+
requestRaw(await gateway.waitForRequest("config.patch", { after: modelSavesBefore })),
253+
).toEqual({
254+
agents: {
255+
defaults: {
256+
model: "openai/gpt-5.5",
257+
utilityModel: null,
258+
thinkingDefault: null,
259+
fastModeDefault: true,
260+
},
261+
},
262+
});
220263
await expect
221-
.poll(async () => {
222-
const requests = await gateway.getRequests("config.set");
223-
const latest = requests.at(-1);
224-
if (requests.length <= modelSavesBefore || !latest) {
225-
return false;
226-
}
227-
const raw = requestRaw(latest);
228-
return (
229-
!hasOwnPath(raw, ["agents", "defaults", "thinkingDefault"]) &&
230-
!hasOwnPath(raw, ["agents", "defaults", "fastModeDefault"])
231-
);
232-
})
233-
.toBe(true);
264+
.poll(() => page.getByRole("status").filter({ hasText: "Defaults saved" }).count())
265+
.toBeGreaterThan(0);
266+
await gateway.setMethodResponse(
267+
"config.get",
268+
configResponse(afterModelResets, "curated-defaults-model-resets"),
269+
);
270+
const fastModeSavesBefore = (await gateway.getRequests("config.patch")).length;
271+
await selectDefault(fastModeRow);
272+
expect(
273+
requestRaw(await gateway.waitForRequest("config.patch", { after: fastModeSavesBefore })),
274+
).toEqual({
275+
agents: {
276+
defaults: {
277+
model: "openai/gpt-5.5",
278+
utilityModel: null,
279+
thinkingDefault: null,
280+
fastModeDefault: null,
281+
},
282+
},
283+
});
284+
await expectDefaultInfo(thinkingRow, thinkingDefaultExplanation);
285+
await expectDefaultInfo(fastModeRow, fastModeDefaultExplanation);
234286
await expect
235-
.poll(() => page.locator("openclaw-settings-save-indicator").textContent())
236-
.toContain("Saved");
287+
.poll(() => page.getByRole("status").filter({ hasText: "Defaults saved" }).count())
288+
.toBeGreaterThan(0);
237289

238290
if (captureUiProofEnabled) {
239291
await page.locator("#settings-model-behavior").screenshot({
@@ -245,16 +297,16 @@ suite.define(() => {
245297
expect((await page.reload())?.status()).toBe(200);
246298
const reloadedThinkingRow = settingsRow(page, "Thinking");
247299
const reloadedFastModeRow = settingsRow(page, "Fast mode");
248-
await expectInherited(reloadedThinkingRow, "Model policy");
249-
await expectInherited(reloadedFastModeRow, "Model policy");
300+
await expectDefaultInfo(reloadedThinkingRow, thinkingDefaultExplanation);
301+
await expectDefaultInfo(reloadedFastModeRow, fastModeDefaultExplanation);
250302
expect(
251303
await reloadedThinkingRow
252-
.getByRole("radio", { name: "Default", exact: true })
304+
.getByRole("radio", { name: /^Default/u })
253305
.getAttribute("aria-checked"),
254306
).toBe("true");
255307
expect(
256308
await reloadedFastModeRow
257-
.getByRole("radio", { name: "Default", exact: true })
309+
.getByRole("radio", { name: /^Default/u })
258310
.getAttribute("aria-checked"),
259311
).toBe("true");
260312

0 commit comments

Comments
 (0)