Skip to content

Commit 354a624

Browse files
authored
feat: codex 5.4 default and pass to model (#1479)
## Problem Codex was not respecting model choice Default changed to 5.4 ## Changes - Added `DEFAULT_CODEX_MODEL` constant set to "gpt-5.4" in gateway-models.ts - Updated model selection logic to prefer the default Codex model when available, falling back to the first model only if the default is not in the available options - Passed the resolved model parameter to the Agent constructor to ensure consistent model usage ## How did you test this? Manual
1 parent c26f424 commit 354a624

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

apps/code/src/main/services/agent/service.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { getEffortOptions } from "@posthog/agent/adapters/claude/session/models"
1818
import { Agent } from "@posthog/agent/agent";
1919
import { getAvailableModes } from "@posthog/agent/execution-mode";
2020
import {
21+
DEFAULT_CODEX_MODEL,
2122
DEFAULT_GATEWAY_MODEL,
2223
fetchGatewayModels,
2324
formatGatewayModelName,
@@ -604,6 +605,7 @@ When creating pull requests, add the following footer at the end of the PR descr
604605
adapter,
605606
gatewayUrl: proxyUrl,
606607
codexBinaryPath: adapter === "codex" ? getCodexBinaryPath() : undefined,
608+
model,
607609
processCallbacks: {
608610
onProcessSpawned: (info) => {
609611
this.processTracking.register(
@@ -1667,7 +1669,9 @@ For git operations while detached:
16671669

16681670
const defaultModel =
16691671
adapter === "codex"
1670-
? (modelOptions[0]?.value ?? "")
1672+
? (modelOptions.find((o) => o.value === DEFAULT_CODEX_MODEL)?.value ??
1673+
modelOptions[0]?.value ??
1674+
"")
16711675
: DEFAULT_GATEWAY_MODEL;
16721676

16731677
const resolvedModelId = modelOptions.some((o) => o.value === defaultModel)

packages/agent/src/agent.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
} from "./adapters/acp-connection";
55
import {
66
BLOCKED_MODELS,
7+
DEFAULT_CODEX_MODEL,
78
DEFAULT_GATEWAY_MODEL,
89
fetchModelsList,
910
} from "./gateway-models";
@@ -104,7 +105,9 @@ export class Agent {
104105
}
105106

106107
if (!sanitizedModel || !allowedModelIds?.has(sanitizedModel)) {
107-
sanitizedModel = codexModelIds[0];
108+
sanitizedModel = codexModelIds.includes(DEFAULT_CODEX_MODEL)
109+
? DEFAULT_CODEX_MODEL
110+
: codexModelIds[0];
108111
}
109112
}
110113
if (!sanitizedModel && options.adapter !== "codex") {

packages/agent/src/gateway-models.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ export interface FetchGatewayModelsOptions {
1717

1818
export const DEFAULT_GATEWAY_MODEL = "claude-opus-4-6";
1919

20+
export const DEFAULT_CODEX_MODEL = "gpt-5.4";
21+
2022
export const BLOCKED_MODELS = new Set(["gpt-5-mini", "openai/gpt-5-mini"]);
2123

2224
type ModelsListResponse =

0 commit comments

Comments
 (0)