mirror of
https://github.com/block/buzz.git
synced 2026-10-28 13:01:10 +00:00
Preserve model defaults after discovery
Signed-off-by: Salman Mohammed <smohammed@squareup.com>
This commit is contained in:
@@ -425,7 +425,8 @@ export function AgentConfigFields({
|
||||
autoSelectedModelScopeRef.current = null;
|
||||
return;
|
||||
}
|
||||
if ((config.model ?? "").trim().length > 0) return;
|
||||
// Discovery fills an unset model; it must not replace an inherited default.
|
||||
if ((config.model ?? "").trim() || fallbackModel?.trim()) return;
|
||||
if (modelDiscoveryLoading || discoveredModelOptions === null) return;
|
||||
const selectionScope = `${selectedRuntimeId}:${trimmedProvider}`;
|
||||
if (autoSelectedModelScopeRef.current === selectionScope) return;
|
||||
@@ -441,6 +442,7 @@ export function AgentConfigFields({
|
||||
}, [
|
||||
config,
|
||||
discoveredModelOptions,
|
||||
fallbackModel,
|
||||
isCustomProvider,
|
||||
modelDiscoveryLoading,
|
||||
onConfigChange,
|
||||
|
||||
@@ -1234,7 +1234,7 @@ test("baked build config keeps Finish enabled without manual provider setup", as
|
||||
await expect(page.getByTestId("onboarding-finish")).toBeEnabled();
|
||||
});
|
||||
|
||||
test("bundled Goose displays its own provider and model defaults", async ({
|
||||
test("bundled Goose preserves its defaults after model discovery", async ({
|
||||
page,
|
||||
}) => {
|
||||
await installMockBridge(
|
||||
@@ -1263,6 +1263,10 @@ test("bundled Goose displays its own provider and model defaults", async ({
|
||||
bakedBuildEnv: [
|
||||
{ key: "BUZZ_AGENT_PROVIDER", masked: false, value: "anthropic" },
|
||||
],
|
||||
discoverAgentModels: {
|
||||
models: [{ id: "discovered-model", name: "Discovered Model" }],
|
||||
supportsSwitching: true,
|
||||
},
|
||||
globalAgentConfig: {
|
||||
env_vars: {},
|
||||
provider: null,
|
||||
@@ -1279,6 +1283,13 @@ test("bundled Goose displays its own provider and model defaults", async ({
|
||||
await expect(page.getByTestId("global-agent-provider")).toContainText(
|
||||
"Databricks",
|
||||
);
|
||||
// Wait for the competing catalog entry to render so this assertion cannot
|
||||
// pass before the discovery effect has had a chance to replace the default.
|
||||
await page.getByTestId("global-agent-model").click();
|
||||
await expect(
|
||||
page.getByTestId("global-agent-model-option-discovered-model"),
|
||||
).toBeVisible();
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(page.getByTestId("global-agent-model")).toContainText(
|
||||
"bundled-pilot-model",
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user