diff --git a/apps/code/src/main/services/agent/service.ts b/apps/code/src/main/services/agent/service.ts index 839fa2a75..2d2408fe0 100644 --- a/apps/code/src/main/services/agent/service.ts +++ b/apps/code/src/main/services/agent/service.ts @@ -18,6 +18,7 @@ import { getEffortOptions } from "@posthog/agent/adapters/claude/session/models" import { Agent } from "@posthog/agent/agent"; import { getAvailableModes } from "@posthog/agent/execution-mode"; import { + DEFAULT_CODEX_MODEL, DEFAULT_GATEWAY_MODEL, fetchGatewayModels, formatGatewayModelName, @@ -554,6 +555,7 @@ When creating pull requests, add the following footer at the end of the PR descr adapter, gatewayUrl: proxyUrl, codexBinaryPath: adapter === "codex" ? getCodexBinaryPath() : undefined, + model, processCallbacks: { onProcessSpawned: (info) => { this.processTracking.register( @@ -1622,7 +1624,9 @@ For git operations while detached: const defaultModel = adapter === "codex" - ? (modelOptions[0]?.value ?? "") + ? (modelOptions.find((o) => o.value === DEFAULT_CODEX_MODEL)?.value ?? + modelOptions[0]?.value ?? + "") : DEFAULT_GATEWAY_MODEL; const resolvedModelId = modelOptions.some((o) => o.value === defaultModel) diff --git a/packages/agent/src/agent.ts b/packages/agent/src/agent.ts index 6c0081cca..b2129e630 100644 --- a/packages/agent/src/agent.ts +++ b/packages/agent/src/agent.ts @@ -4,6 +4,7 @@ import { } from "./adapters/acp-connection"; import { BLOCKED_MODELS, + DEFAULT_CODEX_MODEL, DEFAULT_GATEWAY_MODEL, fetchModelsList, } from "./gateway-models"; @@ -104,7 +105,9 @@ export class Agent { } if (!sanitizedModel || !allowedModelIds?.has(sanitizedModel)) { - sanitizedModel = codexModelIds[0]; + sanitizedModel = codexModelIds.includes(DEFAULT_CODEX_MODEL) + ? DEFAULT_CODEX_MODEL + : codexModelIds[0]; } } if (!sanitizedModel && options.adapter !== "codex") { diff --git a/packages/agent/src/gateway-models.ts b/packages/agent/src/gateway-models.ts index 82e6bd956..a15bb7b4d 100644 --- a/packages/agent/src/gateway-models.ts +++ b/packages/agent/src/gateway-models.ts @@ -17,6 +17,8 @@ export interface FetchGatewayModelsOptions { export const DEFAULT_GATEWAY_MODEL = "claude-opus-4-6"; +export const DEFAULT_CODEX_MODEL = "gpt-5.4"; + export const BLOCKED_MODELS = new Set(["gpt-5-mini", "openai/gpt-5-mini"]); type ModelsListResponse =