From 8e93424e92bfaec4a9e66f7f7b96df2507a46076 Mon Sep 17 00:00:00 2001 From: Nam Rodriguez Date: Mon, 26 Oct 2026 14:40:42 -0400 Subject: [PATCH] Settings, System, Models: switch how a self-hosted install calls Claude, and show when an update needs model access - Models section: Claude on Amazon Bedrock (prefix, exact ids under Advanced) or Anthropic API keys; every model answers a test call before a switch is saved, and a refusal shows the model, the fix and the console link. - Update to vX needs your action: the next release's model check on System and Setup, with Check again; no override for a model the release calls. - Install guide Models step: You can change this later in Settings, System. --- dashboard/e2e/models-switch.spec.ts | 231 +++++++++++++++ dashboard/src/app/settings/setup/page.tsx | 25 +- dashboard/src/app/settings/system/page.tsx | 34 ++- dashboard/src/components/models-section.tsx | 302 ++++++++++++++++++++ dashboard/src/lib/api.ts | 82 +++++- docs/components/install/wizard.tsx | 1 + 6 files changed, 669 insertions(+), 6 deletions(-) create mode 100644 dashboard/e2e/models-switch.spec.ts create mode 100644 dashboard/src/components/models-section.tsx diff --git a/dashboard/e2e/models-switch.spec.ts b/dashboard/e2e/models-switch.spec.ts new file mode 100644 index 00000000..b31c2c8a --- /dev/null +++ b/dashboard/e2e/models-switch.spec.ts @@ -0,0 +1,231 @@ +import { expect, test, type Page, type Route } from "@playwright/test"; +import fs from "node:fs"; +import path from "node:path"; + +// Settings, System, Models on a self-hosted install: switching between +// Claude on Amazon Bedrock and Anthropic API keys (every model answers a +// test call first), a switch refused with its fix, and the update held by a +// refused model ("Update to vX needs your action") on System and Setup. +// Every call is answered here; nothing reaches AWS or a model. + +const SHOTS_DIR = process.env.E2E_SHOTS_DIR || path.join("test-results", "shots"); +const SELF = { apiUrl: "", streamUrl: "", selfHosted: true, version: "v1.2.0" }; +const ME = { user_id: "u_1", team_id: "t_1", github_login: null, email: "owner@example.org", avatar_url: "", role: "owner", auth_provider: "email", mfa_enabled: false, platform_admin: true }; +const MODELS = ["claude-opus-5-5", "claude-sonnet-5-5"]; +const MODEL_ACCESS = "https://console.aws.amazon.com/bedrock/home?region=us-east-1#/modelaccess"; + +function models(provider: "anthropic" | "bedrock", prefix = "us.", by: string | null = null) { + return { + provider, + inference_prefix: prefix, + model_ids: {}, + source: by ? "settings" : "deploy", + updated_at: by ? "2026-10-26T09:00:00Z" : null, + updated_by: by, + deploy_default: { provider: "anthropic", inference_prefix: "us." }, + region: "us-east-1", + models: MODELS, + bedrock_ids: Object.fromEntries(MODELS.map((m) => [m, `${prefix}anthropic.${m}`])), + prefixes: ["us.", "eu.", "apac.", "global.", ""], + }; +} + +const pass = (m: string, id = `us.anthropic.${m}`) => ({ model: m, id, status: "pass", code: "ok", detail: `${id} answered through Amazon Bedrock.` }); +const useCase = (m: string) => ({ + model: m, id: `us.anthropic.${m}`, status: "fail", code: "use_case_required", required: true, + detail: `Bedrock refused us.anthropic.${m}: Anthropic's use case details haven't been submitted for this AWS account.`, + fix: "Submit the use case details on the Bedrock console's Model access page (a person fills in the form once per account), then check again.", + url: MODEL_ACCESS, +}); +const terms = (m: string) => ({ + model: m, id: `us.anthropic.${m}`, status: "fail", code: "marketplace_failed", required: true, + detail: `Bedrock refused us.anthropic.${m}: Anthropic's terms for this model haven't been accepted in AWS Marketplace.`, + fix: `Have someone allowed to subscribe in AWS Marketplace accept the terms for ${m} on the Bedrock console's Model access page, then check again.`, + url: MODEL_ACCESS, +}); + +interface Opts { + /** The switch to Bedrock is refused (use case form missing). */ + refuse?: boolean; + /** The next release calls a model whose terms aren't accepted. */ + blocked?: boolean; + /** The release's signature is still being checked. */ + pending?: boolean; +} + +async function setup(page: Page, opts: Opts = {}) { + const state = { models: models("anthropic"), refuse: !!opts.refuse, blocked: !!opts.blocked, pending: !!opts.pending }; + const calls: { method: string; path: string; body: Record }[] = []; + const json = (route: Route, body: unknown, status = 200) => route.fulfill({ status, contentType: "application/json", body: JSON.stringify(body) }); + const modelCheck = () => ({ + version: "v1.3.0", checked_at: "2026-10-26T08:00:00Z", ok: !state.blocked && !state.pending, pending: state.pending, provider: "bedrock", region: "us-east-1", + results: state.blocked ? [pass("claude-opus-5-5"), terms("claude-sonnet-5-5")] : MODELS.map((m) => pass(m)), + }); + await page.route((url) => url.pathname === "/runtime-config.js", (route) => + route.fulfill({ contentType: "text/javascript", body: `window.__CODERHELM_CONFIG__ = ${JSON.stringify(SELF)};` })); + await page.route((url) => !["localhost", "127.0.0.1"].includes(url.hostname), (route) => route.abort()); + await page.route((url) => ["localhost", "127.0.0.1"].includes(url.hostname) && /^\/(api|auth)\//.test(url.pathname), async (route) => { + const req = route.request(); + const p = new URL(req.url()).pathname; + const body = JSON.parse(req.postData() || "{}"); + if (req.method() !== "GET") calls.push({ method: req.method(), path: p, body }); + if (p === "/api/me") return json(route, ME); + if (p === "/api/banners") return json(route, { banners: [] }); + if (p === "/api/teams") return json(route, { teams: [{ team_id: "t_1", org: "your-team", status: "active", current: true }] }); + if (p === "/api/usage") return json(route, { month: "2026-10", total_tokens: 0, tokens_in: 0, tokens_out: 0, total_runs: 0, max_tokens: 0 }); + if (p === "/api/system/version") { + return json(route, { + self_hosted: true, + current: { version: "v1.2.0", commit: "abc1234def", released_at: "2026-10-01T00:00:00Z", config_fingerprint: "0123456789ab" }, + latest: { version: "v1.3.0", notes: "## Changes\n\n- Faster reviews.", url: "https://example.org/r", breaking: false }, + update_available: true, running: false, + settings: { auto: true, channel: "stable", day: "sun", hour: 3, timezone: "UTC", majors: "ask" }, + history: [], + model_check: modelCheck(), + }); + } + if (p === "/api/system/preflight") { + const mc = modelCheck(); + return json(route, { + checked_at: "2026-10-26T08:00:00Z", ready: mc.ok, current: "v1.2.0", latest: "v1.3.0", + blockers: mc.results.filter((r) => r.status === "fail").map((r) => ({ + key: `model:${r.model}`, severity: "block", detail: `Update to v1.3.0 needs your action: ${r.detail}`, fix: { text: (r as unknown as { fix: string }).fix, url: MODEL_ACCESS }, + })), + checks: [], + }); + } + if (p === "/api/system/update-check") return json(route, { model_check: modelCheck() }); + if (p === "/api/system/update") { + const mc = modelCheck(); + if (!mc.ok) return json(route, { error: `Update to v1.3.0 needs your action: ${terms("claude-sonnet-5-5").detail}`, model_check: mc }, 400); + return json(route, { version: "v1.3.0", actor: "owner@example.org", status: "running" }); + } + if (p === "/api/system/checks") { + const mc = modelCheck(); + const c = mc.ok + ? [{ key: "update_models", group: "Claude", label: "The next release's models answer", status: "pass", detail: "Every model v1.3.0 calls answered a test call." }] + : [{ key: "update_models", group: "Claude", label: "The next release's models answer", status: "fail", detail: `Update to v1.3.0 needs your action: ${terms("claude-sonnet-5-5").detail}`, why: "v1.3.0 calls claude-sonnet-5-5; it won't be applied until it answers. The check runs again daily.", fix: { text: terms("claude-sonnet-5-5").fix, url: MODEL_ACCESS } }]; + return json(route, { checked_at: "2026-10-26T08:00:00Z", summary: { pass: mc.ok ? 1 : 0, warn: 0, fail: mc.ok ? 0 : 1, skip: 0, ready: mc.ok }, checks: c }); + } + if (p === "/api/system/models" && req.method() === "GET") return json(route, state.models); + if (p === "/api/system/models/check" || (p === "/api/system/models" && req.method() === "PUT")) { + const prefix = String(body.inference_prefix ?? "us."); + const results = body.provider === "bedrock" + ? state.refuse + ? [pass("claude-opus-5-5", `${prefix}anthropic.claude-opus-5-5`), useCase("claude-sonnet-5-5")] + : MODELS.map((m) => pass(m, `${prefix}anthropic.${m}`)) + : MODELS.map((m) => ({ model: m, id: m, status: "pass", code: "ok", detail: `${m} answered through the Anthropic API.` })); + const ok = results.every((r) => r.status !== "fail"); + if (p.endsWith("/check")) return json(route, { ok, results }); + if (!ok) return json(route, { error: "Not switched: claude-sonnet-5-5 didn't answer. Fix it and check again.", results }, 409); + state.models = models(body.provider as "bedrock" | "anthropic", prefix, "owner@example.org"); + return json(route, { ...state.models, results }); + } + return json(route, {}); + }); + return { state, calls }; +} + +async function shot(page: Page, name: string, width: number) { + fs.mkdirSync(SHOTS_DIR, { recursive: true }); + await page.screenshot({ path: path.join(SHOTS_DIR, `${name}-${width}.png`), fullPage: true }); +} + +async function noSidewaysScroll(page: Page, width: number) { + const w = await page.evaluate(() => document.documentElement.scrollWidth); + expect(w).toBeLessThanOrEqual(width); +} + +for (const width of [1440, 390]) { + test.describe(`at ${width}px`, () => { + test.use({ viewport: { width, height: width > 600 ? 900 : 844 } }); + + test("switch to Bedrock: every model answers, then it is saved", async ({ page }) => { + const { calls, state } = await setup(page); + await page.goto("/settings/system/#models"); + const section = page.getByTestId("models-section"); + await expect(section.getByTestId("models-current")).toContainText("Anthropic API keys"); + await expect(section.getByTestId("models-current")).toContainText("From the install config"); + await section.getByRole("radio", { name: /Claude on Amazon Bedrock/ }).check(); + await section.getByRole("combobox", { name: "Inference profile prefix" }).selectOption("eu."); + await section.getByText("Advanced: exact Bedrock ids").click(); + await expect(section.getByRole("textbox", { name: /Bedrock id for claude-opus-5-5/ })).toHaveAttribute("placeholder", "eu.anthropic.claude-opus-5-5"); + await section.getByRole("button", { name: "Check and switch to Claude on Amazon Bedrock" }).click(); + await expect(section.getByTestId("models-results")).toContainText("Every model answered"); + await expect(section.getByTestId("model-result-claude-sonnet-5-5")).toHaveAttribute("data-status", "pass"); + await expect(section.getByTestId("models-current")).toContainText("Claude on Amazon Bedrock"); + await expect(section.getByTestId("models-current")).toContainText("Changed here by owner@example.org"); + const put = calls.find((c) => c.method === "PUT" && c.path === "/api/system/models"); + expect(put?.body).toEqual({ provider: "bedrock", inference_prefix: "eu.", model_ids: {} }); + expect(state.models.provider).toBe("bedrock"); + await noSidewaysScroll(page, width); + await section.scrollIntoViewIfNeeded(); + await shot(page, "models-switch-success", width); + }); + + test("switch refused: the model, the fix and the console link; nothing changes", async ({ page }) => { + const { state } = await setup(page, { refuse: true }); + await page.goto("/settings/system/#models"); + const section = page.getByTestId("models-section"); + await section.getByRole("radio", { name: /Claude on Amazon Bedrock/ }).check(); + await section.getByRole("button", { name: /Check and switch/ }).click(); + const results = section.getByTestId("models-results"); + await expect(results).toContainText("Not switched: claude-sonnet-5-5 didn't answer"); + const bad = section.getByTestId("model-result-claude-sonnet-5-5"); + await expect(bad).toHaveAttribute("data-status", "fail"); + await expect(bad).toContainText("use case details haven't been submitted"); + await expect(bad).toContainText("Submit the use case details"); + await expect(bad.getByRole("link", { name: "Open the AWS console" })).toHaveAttribute("href", MODEL_ACCESS); + await expect(section.getByTestId("model-result-claude-opus-5-5")).toHaveAttribute("data-status", "pass"); + await expect(section.getByTestId("models-current")).toContainText("Anthropic API keys"); + expect(state.models.provider).toBe("anthropic"); + // Fixed in the console: Check again passes. + state.refuse = false; + await section.getByRole("button", { name: "Check again" }).click(); + await expect(results).toContainText("Every model answered"); + state.refuse = true; + await section.getByRole("button", { name: "Check access" }).click(); + await expect(results).toContainText("a model was refused"); + await noSidewaysScroll(page, width); + await shot(page, "models-switch-refused", width); + }); + + test("update blocked: Update to v1.3.0 needs your action, on System and Setup", async ({ page }) => { + const { state, calls } = await setup(page, { blocked: true }); + await page.goto("/settings/system/"); + const banner = page.getByTestId("update-needs-action"); + await expect(banner).toContainText("Update to v1.3.0 needs your action"); + await expect(banner.getByTestId("model-result-claude-sonnet-5-5")).toContainText("terms for this model haven't been accepted"); + await expect(banner.getByRole("link", { name: "Open the AWS console" })).toHaveAttribute("href", MODEL_ACCESS); + await expect(banner).toContainText("Coderhelm only checks"); + // No override for a model the release calls. + await expect(banner.getByRole("button", { name: "Skip this check" })).toHaveCount(0); + await expect(page.getByRole("button", { name: "Update now to v1.3.0" })).toBeDisabled(); + await expect(page.getByTestId("update-readiness")).toContainText("Update to v1.3.0 needs your action"); + await noSidewaysScroll(page, width); + await shot(page, "update-blocked-system", width); + + await page.goto("/settings/setup/"); + const onSetup = page.getByTestId("update-needs-action"); + await expect(onSetup).toContainText("Update to v1.3.0 needs your action"); + await noSidewaysScroll(page, width); + await shot(page, "update-blocked-setup", width); + + // Accepted in the console: Check again clears it. + state.blocked = false; + await onSetup.getByRole("button", { name: "Check again" }).click(); + await expect(page.getByTestId("update-needs-action")).toHaveCount(0); + expect(calls.some((c) => c.path === "/api/system/update-check")).toBe(true); + }); + }); +} + +test("while the release's signature is checked, the update waits and says so", async ({ page }) => { + const { state } = await setup(page, { pending: true }); + await page.goto("/settings/system/"); + await expect(page.getByTestId("update-checking")).toContainText("Checking v1.3.0 before it can be applied"); + await expect(page.getByTestId("update-needs-action")).toHaveCount(0); + state.pending = false; + await page.getByTestId("update-checking").getByRole("button", { name: "Check again" }).click(); + await expect(page.getByTestId("update-checking")).toHaveCount(0); +}); diff --git a/dashboard/src/app/settings/setup/page.tsx b/dashboard/src/app/settings/setup/page.tsx index 7a2c1341..d5a1b2aa 100644 --- a/dashboard/src/app/settings/setup/page.tsx +++ b/dashboard/src/app/settings/setup/page.tsx @@ -2,7 +2,8 @@ import { useCallback, useEffect, useState } from "react"; import Link from "next/link"; -import { api, type SystemChecks } from "@/lib/api"; +import { api, type ModelCheck, type SystemChecks } from "@/lib/api"; +import { UpdateNeedsAction } from "@/components/models-section"; import { EMAIL_OK_KEY, loadSetupChecks, setupProgress, useInstallAdmin, type SetupCheck } from "@/lib/install"; import { Page, PageHeader } from "@/components/page"; import { Callout } from "@/components/callout"; @@ -42,6 +43,14 @@ function Setup() { const [checks, setChecks] = useState(null); const [server, setServer] = useState(null); const [serverState, setServerState] = useState<"loading" | "ready" | "failed">("loading"); + // The next release's model check (the updater's), for its banner. + const [modelCheck, setModelCheck] = useState(null); + useEffect(() => { + api + .getSystemVersion() + .then((v) => setModelCheck(v.latest && v.model_check?.version === v.latest.version ? v.model_check : null)) + .catch(() => setModelCheck(null)); + }, []); const runChecks = useCallback(() => { setServerState("loading"); @@ -93,6 +102,20 @@ function Setup() { lead={progress ? `${progress.done} of ${progress.total} required steps done. The install checks itself each time this page opens, and anything that needs a fix says how.` : "What is left to set up on this install. It checks itself each time this page opens, and anything that needs a fix says how."} /> + {modelCheck && !modelCheck.ok && ( +
+ { + setModelCheck(c); + runChecks(); + }} + /> +

+ Open Settings, System +

+
+ )}

Getting started

diff --git a/dashboard/src/app/settings/system/page.tsx b/dashboard/src/app/settings/system/page.tsx index a0e9e793..b5c4f0f8 100644 --- a/dashboard/src/app/settings/system/page.tsx +++ b/dashboard/src/app/settings/system/page.tsx @@ -6,6 +6,7 @@ import { api, type AutoUpdateSettings, type SystemPreflight, type SystemVersion, import { FixBlock } from "@/components/install-checks"; import { DomainSection } from "@/components/domain-section"; import { HybridSection } from "@/components/hybrid-section"; +import { ModelsSection, UpdateNeedsAction } from "@/components/models-section"; import { CodeBlock } from "@/components/code-block"; /** The same checks from the operator's machine. */ @@ -158,11 +159,23 @@ function System() { } }; - const start = async (kind: "update" | "rollback") => { + const start = async (kind: "update" | "rollback", skipCheck = false) => { setBusy(kind); try { - const e = kind === "update" ? await api.updateNow(latest?.version) : await api.rollbackInstall(); - toast(kind === "update" ? `Updating to ${e.version}. This takes 10 to 20 minutes.` : `Rolling back to ${e.version}.`); + if (kind === "update") { + const r = await api.updateNow(latest?.version, skipCheck); + if (!r.ok) { + // A model the release calls was refused: show which, with its fix. + if (r.model_check) setData({ ...data, model_check: r.model_check }); + toast(r.error, "error"); + loadPreflight(); + return; + } + toast(`Updating to ${r.version}. This takes 10 to 20 minutes.`); + } else { + const e = await api.rollbackInstall(); + toast(`Rolling back to ${e.version}.`); + } await load(); } catch (e) { toast(e instanceof Error ? e.message : "Could not start", "error"); @@ -175,6 +188,16 @@ function System() { {header}
+ {latest && data.model_check?.version === latest.version && ( + { + setData({ ...data, model_check: c }); + loadPreflight(); + }} + onSkip={() => start("update", true)} + /> + )} + + + + @@ -321,6 +348,7 @@ function System() {

{(h.status === "failed" || h.status === "rolled_back") && (

diff --git a/dashboard/src/components/models-section.tsx b/dashboard/src/components/models-section.tsx new file mode 100644 index 00000000..d969e39d --- /dev/null +++ b/dashboard/src/components/models-section.tsx @@ -0,0 +1,302 @@ +"use client"; + +import { useCallback, useEffect, useState } from "react"; +import Link from "next/link"; +import { api, type ModelAccess, type ModelCheck, type ModelProviderId, type ModelsChoice, type SystemModels } from "@/lib/api"; +import { FixBlock } from "@/components/install-checks"; +import { Callout } from "@/components/callout"; +import { Skeleton } from "@/components/skeleton"; +import { Chip, Time } from "@/components/list"; +import { Select } from "@/components/select"; +import { useToast } from "@/components/toast"; +import { Code, Field, SettingsDisclosure } from "@/components/settings"; +import { focusRing, linkButton, primaryButton, secondaryButton } from "@/components/ui"; + +const PROVIDERS: { id: ModelProviderId; title: string; help: string }[] = [ + { id: "bedrock", title: "Claude on Amazon Bedrock", help: "Runs in this AWS account with its own role. No API key; usage is on the AWS bill." }, + { id: "anthropic", title: "Anthropic API keys", help: "Each team uses its own key from Settings, AI models; usage is on each team's Anthropic bill." }, +]; + +const PREFIX_LABEL: Record = { + "us.": "us. (United States)", + "eu.": "eu. (Europe)", + "apac.": "apac. (Asia Pacific)", + "global.": "global. (any region)", + "": "None (in-region model ids)", +}; + +function providerName(p: ModelProviderId | string | null | undefined): string { + return p === "bedrock" ? "Claude on Amazon Bedrock" : "Anthropic API keys"; +} + +/** The Bedrock id a model is called by, before any override. */ +function defaultId(prefix: string, model: string, current: SystemModels): string { + const shown = current.bedrock_ids[model]; + // The server's id carries the saved prefix; swap in the one picked here. + if (shown && shown.startsWith(current.inference_prefix) && !current.model_ids[model]) { + return `${prefix}${shown.slice(current.inference_prefix.length)}`; + } + return `${prefix}anthropic.${model}`; +} + +/** One model's test call: passed, or what is wrong and how to fix it. */ +export function ModelResult({ r }: { r: ModelAccess }) { + return ( +

  • +

    + {r.model} + {r.status === "pass" ? Answers : r.status === "skip" ? Not checked : Refused} +

    +

    {r.detail}

    + {r.status !== "pass" && (r.fix || r.url || r.href) && } +
  • + ); +} + +/** + * Settings, System, Models: switch between Claude on Amazon Bedrock and + * Anthropic API keys at any time. Every model the release calls gets a + * test call first; a refused one stops the switch with its fix. + */ +export function ModelsSection() { + const { toast } = useToast(); + const [current, setCurrent] = useState(null); + const [failed, setFailed] = useState(false); + const [provider, setProvider] = useState("anthropic"); + const [prefix, setPrefix] = useState("us."); + const [overrides, setOverrides] = useState>({}); + const [busy, setBusy] = useState<"" | "check" | "save">(""); + const [results, setResults] = useState<{ ok: boolean; items: ModelAccess[]; error?: string } | null>(null); + + const reset = (m: SystemModels) => { + setCurrent(m); + setProvider(m.provider); + setPrefix(m.inference_prefix); + setOverrides(m.model_ids ?? {}); + }; + const load = useCallback(() => { + api + .getSystemModels() + .then((m) => { + if (!m?.provider || !Array.isArray(m.models) || !Array.isArray(m.prefixes)) throw new Error("not a models answer"); + reset(m); + setFailed(false); + }) + .catch(() => setFailed(true)); + }, []); + useEffect(() => { + load(); + }, [load]); + + if (failed) { + return ( +
    + + + +
    + ); + } + if (!current) return
    ; + + const cleanOverrides = Object.fromEntries(Object.entries(overrides).filter(([, v]) => v.trim())); + const choice: ModelsChoice = provider === "bedrock" ? { provider, inference_prefix: prefix, model_ids: cleanOverrides } : { provider }; + const dirty = + provider !== current.provider || + (provider === "bedrock" && (prefix !== current.inference_prefix || JSON.stringify(cleanOverrides) !== JSON.stringify(current.model_ids ?? {}))); + + const check = async () => { + setBusy("check"); + try { + const r = await api.checkSystemModels(choice); + setResults({ ok: r.ok, items: r.results }); + } catch (e) { + setResults({ ok: false, items: [], error: e instanceof Error ? e.message : "The check couldn't run" }); + } finally { + setBusy(""); + } + }; + const save = async () => { + setBusy("save"); + try { + const r = await api.setSystemModels(choice); + if (r.ok) { + reset(r); + setResults({ ok: true, items: r.results ?? [] }); + toast(`Now calling Claude through ${providerName(r.provider)}. Runs under way finish where they started.`); + } else { + setResults({ ok: false, items: r.results ?? [], error: r.error }); + } + } finally { + setBusy(""); + } + }; + + return ( +
    +

    + Now: {providerName(current.provider)} + {current.provider === "bedrock" && <> with {current.inference_prefix || "in-region"} ids}.{" "} + + {current.source === "settings" && current.updated_at ? ( + <>Changed here{current.updated_by ? ` by ${current.updated_by}` : ""} +

    + +
    + How this install calls Claude +
    + {PROVIDERS.map((p) => ( + + ))} +
    +
    + + {provider === "bedrock" ? ( +
    + + {(ids) => ( + + )} + + 0}> +

    Leave empty to use the id shown. Set one to call an application inference profile ARN or another id.

    + {current.models.map((m) => ( + Bedrock id for {m}} + placeholder={defaultId(prefix, m, current)} + value={overrides[m] ?? ""} + onChange={(e) => { setOverrides({ ...overrides, [m]: e.target.value }); setResults(null); }} + autoComplete="off" + spellCheck={false} + /> + ))} +
    +

    + Someone in your company turns on model access, submits the use case form and accepts Anthropic's terms in the AWS console. Coderhelm never does that for you; it checks the result.{" "} + Open Model access +

    +
    + ) : ( +

    + Each team keeps its own key in Settings, AI models. The switch is checked with your team's key, so add yours first. +

    + )} + +

    + Before anything changes, each model this release calls ({current.models.map((m, i) => {i > 0 && ", "}{m})}) answers one test call. Runs under way finish where they started; new model calls use the new choice within 30 seconds. +

    + + {results && ( +
    + {results.ok ? ( + + ) : ( + +

    Fix it in the console, then check again. Nothing has changed.

    +
    + )} + {results.items.length > 0 && ( +
      + {results.items.map((r) => )} +
    + )} +
    + )} + +
    + + +
    +
    + ); +} + +/** + * "Update to vX needs your action": a model the next release calls was + * refused. Shown on Settings, System and Setup with each model's fix. + */ +export function UpdateNeedsAction({ check, onChecked, onSkip }: { check: ModelCheck | null | undefined; onChecked?: (c: ModelCheck | null) => void; onSkip?: () => void }) { + const [busy, setBusy] = useState(false); + const [mc, setMc] = useState(check ?? null); + useEffect(() => setMc(check ?? null), [check]); + if (!mc || mc.ok) return null; + if (mc.pending) { + return ( + api.checkUpdateModels().then((r) => { setMc(r.model_check); onChecked?.(r.model_check); }).catch(() => {})}>Check again} + > +

    Coderhelm checks the release's signature, then tries each model it calls. This takes a few minutes.

    +
    + ); + } + const failing = mc.results.filter((r) => r.status === "fail"); + const again = async () => { + setBusy(true); + try { + const r = await api.checkUpdateModels(); + setMc(r.model_check); + onChecked?.(r.model_check); + } catch { + // Keep what was shown; the next daily check runs anyway. + } finally { + setBusy(false); + } + }; + return ( + + + {mc.skippable && onSkip && } + + } + > +

    + {mc.version} calls {failing.length === 1 ? "a model" : "models"} this install can't call yet{mc.provider ? ` through ${providerName(mc.provider)}` : ""}, so it won't be applied until {failing.length === 1 ? "it answers" : "they answer"}. The check runs again daily; with automatic updates on, the update applies by itself once it passes. +

    +
      + {failing.map((r) => )} +
    +

    Accepting model terms and the Bedrock use case form are done by a person in the AWS console; Coderhelm only checks.

    +

    Checked

    +
    + ); +} diff --git a/dashboard/src/lib/api.ts b/dashboard/src/lib/api.ts index 6ab3ac64..19cd3cbe 100644 --- a/dashboard/src/lib/api.ts +++ b/dashboard/src/lib/api.ts @@ -1113,8 +1113,26 @@ export const api = { getSystemVersion: () => request("/api/system/version"), setAutoUpdate: (settings: Partial) => request<{ settings: AutoUpdateSettings }>("/api/system/auto-update", { method: "PUT", body: JSON.stringify(settings) }), - updateNow: (version?: string) => - request("/api/system/update", { method: "POST", body: JSON.stringify(version ? { version } : {}) }), + /** + * Update to `version` (default: the latest). Refused with the model check + * when a model the release calls was refused; `skipCheck` passes only a + * failure on a model the release doesn't call. + */ + updateNow: (version?: string, skipCheck = false) => + requestWithBody("/api/system/update", { + method: "POST", + body: JSON.stringify({ ...(version ? { version } : {}), ...(skipCheck ? { skip_check: true } : {}) }), + }), + /** The next release's model check, run again now. */ + checkUpdateModels: () => request<{ model_check: ModelCheck | null }>("/api/system/update-check", { method: "POST", body: "{}" }), + /** How the install calls Claude (install admins, self-hosted). */ + getSystemModels: () => request("/api/system/models"), + /** The test calls a switch would make, nothing saved. */ + checkSystemModels: (to: ModelsChoice) => + request<{ ok: boolean; results: ModelAccess[] }>("/api/system/models/check", { method: "POST", body: JSON.stringify(to) }), + /** Switch, once every model answers; refused with the results otherwise. */ + setSystemModels: (to: ModelsChoice) => + requestWithBody("/api/system/models", { method: "PUT", body: JSON.stringify(to) }), rollbackInstall: () => request("/api/system/rollback", { method: "POST", body: "{}" }), // Setup checks and update readiness (install admins), each with its fix. getSystemChecks: () => request("/api/system/checks"), @@ -3573,6 +3591,8 @@ export interface UpdateEntry { mode?: "update" | "rollback"; status: "running" | "succeeded" | "failed" | "rolled_back"; reason?: string; + /** "model check skipped for …" when an admin skipped a model the release doesn't call. */ + note?: string; started_at?: string; finished_at?: string; } @@ -3652,6 +3672,62 @@ export interface SystemPreflight { checks: InstallCheck[]; } +/** One model's test call, explained (common::model_access on the platform). */ +export interface ModelAccess { + model: string; + /** What was called: the Bedrock id, or the model's name on the Anthropic API. */ + id: string; + status: "pass" | "fail" | "skip"; + code: string; + detail: string; + fix?: string; + url?: string; + href?: string; + /** Update check: the release calls this model (no skipping it). */ + required?: boolean; +} + +/** The updater's check of the next release's models. */ +export interface ModelCheck { + version: string; + checked_at: string; + ok: boolean; + provider?: string | null; + region?: string | null; + results: ModelAccess[]; + /** Only a model the release doesn't call failed: Update now may skip it. */ + skippable?: boolean; + /** The release's signature is being checked before its model list is read. */ + pending?: boolean; + note?: string; +} + +export type ModelProviderId = "bedrock" | "anthropic"; + +export interface ModelsChoice { + provider: ModelProviderId; + inference_prefix?: string; + model_ids?: Record; +} + +export interface SystemModels { + provider: ModelProviderId; + inference_prefix: string; + model_ids: Record; + /** `deploy`: the install config's first-boot choice; `settings`: changed here. */ + source: "deploy" | "settings"; + updated_at: string | null; + updated_by: string | null; + deploy_default: { provider: ModelProviderId; inference_prefix: string }; + region: string; + /** The models this release calls. */ + models: string[]; + /** The Bedrock id each model is called by under these settings. */ + bedrock_ids: Record; + prefixes: string[]; + results?: ModelAccess[]; +} + export interface SystemVersion { self_hosted: boolean; current: { version: string | null; commit: string | null; released_at: string | null; config_fingerprint: string | null }; @@ -3660,6 +3736,8 @@ export interface SystemVersion { settings?: AutoUpdateSettings; running?: boolean; history?: UpdateEntry[]; + /** The latest release's model check, once it has run. */ + model_check?: ModelCheck | null; } // ── Deliveries ────────────────────────────────────────────────────────── diff --git a/docs/components/install/wizard.tsx b/docs/components/install/wizard.tsx index 6f37f2cc..2c470520 100644 --- a/docs/components/install/wizard.tsx +++ b/docs/components/install/wizard.tsx @@ -1006,6 +1006,7 @@ export function InstallWizard() { ))} +

    You can change this later in Settings, System.

    ) : null}