π OpenHands: AI-Driven Development
fix: force an explicit decision on every ACP harness the registry adds (#17228)
simonrosenbergf920c74f6d1b
diff --git a/src/constants/acp-providers.test.ts b/src/constants/acp-providers.test.tsindex 0994156e6e..823064d17f 100644--- a/src/constants/acp-providers.test.ts+++ b/src/constants/acp-providers.test.ts@@ -1,6 +1,9 @@+import { ACP_PROVIDERS as CLIENT_ACP_PROVIDERS } from "@openhands/typescript-client";import { describe, expect, it } from "vitest";import {ACP_MANAGED_SENTINEL,+ SURFACED_ACP_PROVIDERS,+ getAcpProviderSecrets,resolveEffectiveAcpModel,} from "./acp-providers";@@ -54,3 +57,34 @@ describe("resolveEffectiveAcpModel", () => {).toBe("default");});});++describe("surfaced ACP providers", () => {+ // Everything the pinned client registry publishes that Canvas does not+ // offer. Derived, so a harness added upstream is covered here without an+ // edit β the point of declaring what we surface rather than what we hide.+ const unsurfaced = Object.keys(CLIENT_ACP_PROVIDERS).filter(+ (key) => !SURFACED_ACP_PROVIDERS.includes(key),+ );++ it("surfaces only Claude Code, Codex and Gemini CLI", () => {+ expect([...SURFACED_ACP_PROVIDERS]).toEqual([+ "claude-code",+ "codex",+ "gemini-cli",+ ]);+ });++ it("surfaces nothing the pinned client registry has dropped", () => {+ // A rename or removal upstream must break loudly rather than leave a tile+ // whose command and models resolve to nothing. An addition stays a no-op.+ expect(+ SURFACED_ACP_PROVIDERS.filter((key) => !(key in CLIENT_ACP_PROVIDERS)),+ ).toEqual([]);+ });++ it("offers no credential fields for a harness it does not surface", () => {+ unsurfaced.forEach((key) => {+ expect(getAcpProviderSecrets(key)).toEqual([]);+ });+ });+});diff --git a/src/constants/acp-providers.ts b/src/constants/acp-providers.tsindex 854d82feaa..74416461d5 100644--- a/src/constants/acp-providers.ts+++ b/src/constants/acp-providers.ts@@ -124,8 +124,8 @@ export interface ACPModelOption {// key. Everything else β display name, launch command, model picker list and// default β comes from the typescript-client registry below. Adding a model// or a provider happens upstream in the SDK; Canvas only owns the brand icon-// and the onboarding-tile description here. A provider with no entry here is-// intentionally not surfaced in the UI.+// and the onboarding-tile description here. Its keys are the harnesses Canvas+// offers β see {@link SURFACED_ACP_PROVIDERS}.const ACP_PROVIDER_UI: Record<string,{ icon: ACPProviderIcon; description_key: I18nKey }@@ -144,6 +144,20 @@ const ACP_PROVIDER_UI: Record<},};+/**+ * The ACP harnesses Canvas surfaces β its own declaration of what it offers,+ * independent of what the SDK registry happens to contain. Registering a+ * harness upstream is a no-op here: nothing in Canvas enumerates the registry,+ * so there is no list to keep in step with it.+ *+ * The same constant name carries the same meaning in+ * ``OpenHands/enterprise`` (``openhands/app_server/acp_providers.py``), where+ * it also fails conversation start closed. The two are declared independently+ * and hold the same three keys today.+ */+export const SURFACED_ACP_PROVIDERS: readonly string[] =+ Object.keys(ACP_PROVIDER_UI);+// Built-in ACP providers Canvas surfaces, built by enriching each upstream// registry record (``@openhands/typescript-client`` β Python SDK) with the// Canvas UI metadata above. Model lists + defaults are no longer hand-kept@@ -360,6 +374,10 @@ export function getAcpProviderSecrets(key: string | null | undefined,): ACPProviderSecretField[] {if (!key) return [];+ // Surfaced providers only. The client registry grows with every harness the+ // SDK adds, so reading it directly would offer credential fields for one+ // Canvas never lists.+ if (!getAcpProvider(key)) return [];const info = getClientAcpProvider(key);if (!info) return [];// Subscription / Vertex credentials first β they're the primary auth path for