Skip to content

πŸ™Œ OpenHands: AI-Driven Development

feat: add GPT-6 Astra model support (#17164)

Graham Neubigde5a79b4ce57
diff --git a/__tests__/api/agent-server-adapter.test.ts b/__tests__/api/agent-server-adapter.test.ts
index b9d31f1751..5b76451aa5 100644
--- a/__tests__/api/agent-server-adapter.test.ts
+++ b/__tests__/api/agent-server-adapter.test.ts
@@ -1695,7 +1695,7 @@ describe("buildStartConversationRequest β€” ACP discriminator", () => {
expect(payload.agent_settings.acp_command).toEqual([
"npx",
"-y",
- "@agentclientprotocol/[email protected]",
+ "@agentclientprotocol/[email protected]",
]);
});
diff --git a/__tests__/constants/acp-providers.test.ts b/__tests__/constants/acp-providers.test.ts
index ca65e08aa4..c1b079659f 100644
--- a/__tests__/constants/acp-providers.test.ts
+++ b/__tests__/constants/acp-providers.test.ts
@@ -10,6 +10,7 @@ import {
getAcpProvider,
getAcpProviderDisplayName,
getAcpProviderSecrets,
+ resolveCodexDefaultCommand,
} from "#/constants/acp-providers";
describe("getAcpProviderDisplayName", () => {
@@ -50,10 +51,22 @@ describe("ACP provider registry", () => {
const sdk = getClientAcpProvider(provider.key);
expect(sdk, provider.key).not.toBeNull();
expect(provider.display_name).toBe(sdk!.display_name);
- expect(provider.default_command).toEqual([...sdk!.default_command]);
- expect(provider.available_models).toEqual(
- sdk!.available_models.map((m) => ({ id: m.id, label: m.label })),
- );
+ if (provider.key === "codex") {
+ expect(provider.default_command).toEqual([
+ "npx",
+ "-y",
+ "@agentclientprotocol/[email protected]",
+ ]);
+ expect(provider.available_models?.[0]).toEqual({
+ id: "gpt-6-astra",
+ label: "GPT-6 Astra",
+ });
+ } else {
+ expect(provider.default_command).toEqual([...sdk!.default_command]);
+ expect(provider.available_models).toEqual(
+ sdk!.available_models.map((m) => ({ id: m.id, label: m.label })),
+ );
+ }
expect(provider.default_model).toBe(sdk!.default_model ?? undefined);
// UI-only overlay stays local.
expect(provider.icon).toBeTruthy();
@@ -74,6 +87,37 @@ describe("ACP provider registry", () => {
}
});
+ it("temporarily overrides only the exact stale codex pin from the pinned client", () => {
+ // Unlike the model dedup, the launch-command shim has a guard: once the pinned
+ // client ships the upstream command, Canvas defers to the registry value so the
+ // temporary shim stops firing without a separate cleanup pass.
+ expect(
+ resolveCodexDefaultCommand([
+ "npx",
+ "-y",
+ "@agentclientprotocol/[email protected]",
+ ]),
+ ).toEqual(["npx", "-y", "@agentclientprotocol/[email protected]"]);
+
+ // Registry values at-or-newer than the tested version stay authoritative β€”
+ // the shim must never revert a future upstream bump.
+
+ expect(
+ resolveCodexDefaultCommand([
+ "npx",
+ "-y",
+ "@agentclientprotocol/[email protected]",
+ ]),
+ ).toEqual(["npx", "-y", "@agentclientprotocol/[email protected]"]);
+ expect(
+ resolveCodexDefaultCommand([
+ "npx",
+ "-y",
+ "@agentclientprotocol/[email protected]",
+ ]),
+ ).toEqual(["npx", "-y", "@agentclientprotocol/[email protected]"]);
+ });
+
it("does not suggest generic default model placeholders", () => {
// Model lists are SDK-owned (see ACP_PROVIDERS) β€” Canvas no longer hand-keeps
// them. The claude-code registry intentionally offers an id ``default``
diff --git a/__tests__/routes/agent-settings.test.tsx b/__tests__/routes/agent-settings.test.tsx
index 9fbc0c959c..0acbda269b 100644
--- a/__tests__/routes/agent-settings.test.tsx
+++ b/__tests__/routes/agent-settings.test.tsx
@@ -552,7 +552,7 @@ describe("AgentSettingsScreen", () => {
await user.clear(commandInput);
await user.type(
commandInput,
- "npx -y @agentclientprotocol/[email protected]",
+ "npx -y @agentclientprotocol/[email protected]",
);
// The model field now reflects the Codex default, not the stale Claude one.
diff --git a/src/constants/acp-providers.test.ts b/src/constants/acp-providers.test.ts
index 823064d17f..692c987932 100644
--- a/src/constants/acp-providers.test.ts
+++ b/src/constants/acp-providers.test.ts
@@ -2,11 +2,54 @@ import { ACP_PROVIDERS as CLIENT_ACP_PROVIDERS } from "@openhands/typescript-cli
import { describe, expect, it } from "vitest";
import {
ACP_MANAGED_SENTINEL,
- SURFACED_ACP_PROVIDERS,
+ ACP_PROVIDERS,
getAcpProviderSecrets,
+ resolveCodexDefaultCommand,
+ SURFACED_ACP_PROVIDERS,
resolveEffectiveAcpModel,
} from "./acp-providers";
+describe("ACP_PROVIDERS", () => {
+ it("offers GPT-6 Astra first for Codex ACP", () => {
+ const codex = ACP_PROVIDERS.find(({ key }) => key === "codex");
+ expect(codex?.available_models?.[0]).toEqual({
+ id: "gpt-6-astra",
+ label: "GPT-6 Astra",
+ });
+ expect(codex?.default_command).toEqual([
+ "npx",
+ "-y",
+ "@agentclientprotocol/[email protected]",
+ ]);
+ });
+});
+
+describe("resolveCodexDefaultCommand", () => {
+ it("overrides only the exact stale codex pin from the pinned client", () => {
+ expect(
+ resolveCodexDefaultCommand([
+ "npx",
+ "-y",
+ "@agentclientprotocol/[email protected]",
+ ]),
+ ).toEqual(["npx", "-y", "@agentclientprotocol/[email protected]"]);
+ expect(
+ resolveCodexDefaultCommand([
+ "npx",
+ "-y",
+ "@agentclientprotocol/[email protected]",
+ ]),
+ ).toEqual(["npx", "-y", "@agentclientprotocol/[email protected]"]);
+ expect(
+ resolveCodexDefaultCommand([
+ "npx",
+ "-y",
+ "@agentclientprotocol/[email protected]",
+ ]),
+ ).toEqual(["npx", "-y", "@agentclientprotocol/[email protected]"]);
+ });
+});
+
describe("resolveEffectiveAcpModel", () => {
it("surfaces the real claude-agent-acp 0.44+ 'default' model", () => {
// ``default`` ("Default (recommended)") is a real, selectable Claude model
diff --git a/src/constants/acp-providers.ts b/src/constants/acp-providers.ts
index 74416461d5..47ac5358cb 100644
--- a/src/constants/acp-providers.ts
+++ b/src/constants/acp-providers.ts
@@ -144,24 +144,58 @@ const ACP_PROVIDER_UI: Record<
},
};
+const CODEX_ASTRA_MODEL: ACPModelOption = {
+ id: "gpt-6-astra",
+ label: "GPT-6 Astra",
+};
+// The pinned ``@openhands/typescript-client`` (1.39.0) still mirrors the
+// pre-Astra codex ``default_command`` (1.1.7), which the Codex ACP wrapper
+// rejects for ``gpt-6-astra``. Until that client release ships the upstream
+// fix, Canvas launches codex with the first tested Astra-compatible version.
+const CODEX_LEGACY_ACP_COMMAND = "npx -y @agentclientprotocol/[email protected]";
+const CODEX_ASTRA_ACP_VERSION = "@agentclientprotocol/[email protected]";
+const CODEX_ASTRA_COMMAND = ["npx", "-y", CODEX_ASTRA_ACP_VERSION];
+
+/**
+ * Resolve codex's launch command from the SDK registry, applying the temporary
+ * Astra shim only to the exact stale pin the pinned client reports. Any other
+ * registry value (including a future ``1.10.0``-or-newer release)is
+ * authoritative β€” so once upstream catches up, this shim stops firing and can
+ * be deleted without a separate cleanup pass.
+ */
+export function resolveCodexDefaultCommand(
+ registryCommand: readonly string[],
+): string[] {
+ if (registryCommand.join(" ") === CODEX_LEGACY_ACP_COMMAND) {
+ return [...CODEX_ASTRA_COMMAND];
+ }
+ return [...registryCommand];
+}
+
+function getAvailableModels(key: string): ACPModelOption[] | undefined {
+ const models = getClientAcpProvider(key)?.available_models?.map((model) => ({
+ id: model.id,
+ label: model.label,
+ }));
+ if (key !== "codex") return models;
+ return [
+ CODEX_ASTRA_MODEL,
+ ...(models ?? []).filter(({ id }) => id !== CODEX_ASTRA_MODEL.id),
+ ];
+}
+
/**
* 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
-// here (closes agent-canvas#740) β€” they track the SDK via the pinned client.
+// Canvas UI metadata above.
export const ACP_PROVIDERS: ACPProviderConfig[] = Object.entries(
ACP_PROVIDER_UI,
).map(([key, ui]) => {
@@ -169,11 +203,13 @@ export const ACP_PROVIDERS: ACPProviderConfig[] = Object.entries(
return {
key,
display_name: info?.display_name ?? key,
- default_command: info ? [...info.default_command] : [],
- available_models: info?.available_models?.map((model) => ({
- id: model.id,
- label: model.label,
- })),
+ default_command:
+ key === "codex"
+ ? resolveCodexDefaultCommand(info?.default_command ?? [])
+ : info
+ ? [...info.default_command]
+ : [],
+ available_models: getAvailableModels(key),
default_model: info?.default_model ?? undefined,
description_key: ui.description_key,
icon: ui.icon,
diff --git a/src/mocks/settings-handlers.ts b/src/mocks/settings-handlers.ts
index 81e6cd843b..dd949b1632 100644
--- a/src/mocks/settings-handlers.ts
+++ b/src/mocks/settings-handlers.ts
@@ -611,6 +611,7 @@ const MOCK_MODELS = [
"openhands/claude-haiku-4-5-20251001",
"openhands/claude-opus-4-5-20251101",
"openai/gpt-5.6-sol",
+ "openai/gpt-6-astra",
"openhands/deepseek-v4-flash",
"openhands/glm-5.2",
"sambanova/Meta-Llama-3.1-8B-Instruct",
@@ -626,6 +627,7 @@ const MOCK_VERIFIED_MODELS = new Set([
"openhands/claude-opus-4-5-20251101",
"openhands/claude-sonnet-4-5-20250929",
"openai/gpt-5.6-sol",
+ "openai/gpt-6-astra",
"openhands/deepseek-v4-flash",
"openhands/glm-5.2",
]);
diff --git a/tests/e2e/support/onboarding-helpers.ts b/tests/e2e/support/onboarding-helpers.ts
index dcd0986b2d..28023096bf 100644
--- a/tests/e2e/support/onboarding-helpers.ts
+++ b/tests/e2e/support/onboarding-helpers.ts
@@ -20,7 +20,7 @@ export async function routeOnboardingLlmCatalog(page: Page) {
body: JSON.stringify({
models: {
anthropic: ["claude-opus-4-8"],
- openai: ["gpt-5.5"],
+ openai: ["gpt-5.5", "gpt-6-astra"],
openhands: ["claude-opus-4-5-20251101", "kimi-k3", "glm-5.2"],
},
}),
@@ -37,6 +37,7 @@ export async function routeOnboardingLlmCatalog(page: Page) {
"openai/gpt-5.5",
"openhands/claude-opus-4-5-20251101",
"openai/gpt-5.6-sol",
+ "openai/gpt-6-astra",
"openhands/glm-5.2",
],
}),