fix(source-control): default Codex to GPT-5.6 Terra low (#24495)

* fix(source-control): use Codex's configured model by default

Source Control AI pinned Codex to gpt-5.5, which Codex retires on
2026-10-14. Any path that still resolves to that slug would then break
commit-message and PR-field generation.

Follow the Antigravity precedent (#21606): add a "Config default" entry
for Codex, make it the default, and omit --model when it is selected so
`codex exec` uses the model from the user's Codex config or Codex's own
default. Explicit model choices still pass --model.

Older remote servers would still build `--model default`, so advertise
git.codex-configured-model.v1 and have clients refuse the sentinel for
servers without it, the same way Antigravity is gated. The gate now
covers both agents, and the two capabilities live in their own module
because protocol-version.ts is at the max-lines limit.

Written with AI assistance (Claude Code).

Fixes #24481

* fix(source-control): honor -m, repo overrides and low effort for Codex

Review on #24495 found three gaps in the configured-model change.
The remote compatibility gate only recognized --model, so a recipe
passing Codex's -m short flag was rejected on older servers. The gate
also ignored the repository's per-operation model override that the
server applies. And moving Codex to Config default dropped the low
reasoning effort the pinned model used, which would change cost and
latency for users whose Codex config sets a higher effort.

* fix(source-control): match gate repo and model checks to the server

Repo ids can repeat across hosts, so the configured-model gate now reads
the repo row for the worktree's host instead of the first id match, the
same row the server applies. A recipe passing --model default or
-m default no longer counts as an explicit model, since an older server
still forwards that sentinel to the Codex CLI.

* fix(source-control): read only the worktree host's repo row in the gate

A worktree that names its own host must not fall back to the runtime
host's repo row, since the server applies the row for the worktree's
host. Also cover an environment id that needs URL encoding.

* fix(source-control): default Codex to GPT-5.6 Terra low

---------

Co-authored-by: Jinjing <6427696+AmethystLiang@users.noreply.github.com>
This commit is contained in:
Nawapat Buakoet
2026-10-03 10:14:05 -07:00
committed by GitHub
co-authored by Jinjing
parent 786a040b96
commit 1d010ce2f8
4 changed files with 15 additions and 7 deletions
@@ -27,7 +27,7 @@ describe('resolveCommitMessageSettings', () => {
ok: true,
params: {
agentId: 'codex',
model: 'gpt-5.5',
model: 'gpt-5.6-terra',
thinkingLevel: 'low',
customPrompt: 'Use Conventional Commits.',
commandInputTemplate: '{basePrompt}\n\nUse Conventional Commits.'
@@ -69,7 +69,7 @@ describe('resolveCommitMessageSettings', () => {
ok: true,
params: {
agentId: 'codex',
model: 'gpt-5.5',
model: 'gpt-5.6-terra',
thinkingLevel: 'low'
}
})
+5 -3
View File
@@ -45,9 +45,10 @@ describe('COMMIT_MESSAGE_AGENT_SPECS', () => {
])
})
it('uses the strongest available defaults for core agents', () => {
it('uses the expected defaults for core agents', () => {
expect(COMMIT_MESSAGE_AGENT_SPECS.claude?.defaultModelId).toBe('sonnet')
expect(COMMIT_MESSAGE_AGENT_SPECS.codex?.defaultModelId).toBe('gpt-5.5')
expect(COMMIT_MESSAGE_AGENT_SPECS.codex?.defaultModelId).toBe('gpt-5.6-terra')
expect(getCommitMessageModel('codex', 'gpt-5.6-terra')?.defaultThinkingLevel).toBe('low')
expect(COMMIT_MESSAGE_AGENT_SPECS.pi?.defaultModelId).toBe('default')
})
@@ -189,6 +190,7 @@ describe('COMMIT_MESSAGE_AGENT_SPECS', () => {
it('orders Codex models by version descending to match the official picker', () => {
const ids = COMMIT_MESSAGE_AGENT_SPECS.codex?.models.map((m) => m.id)
expect(ids).toEqual([
'gpt-5.6-terra',
'gpt-5.5',
'gpt-5.4',
'gpt-5.4-mini',
@@ -206,7 +208,7 @@ describe('COMMIT_MESSAGE_AGENT_SPECS', () => {
id: 'codex',
label: 'Codex',
modelSource: 'dynamic',
defaultModelId: 'gpt-5.5'
defaultModelId: 'gpt-5.6-terra'
})
expect(codex).not.toHaveProperty('binary')
expect(codex).not.toHaveProperty('buildArgs')
@@ -109,6 +109,12 @@ export function buildPrimaryCommitMessageAgentSpecs({
// Why: ordered to match the official `codex` model picker — descending
// by version so the frontier model lands on top and legacy models trail.
models: [
{
id: 'gpt-5.6-terra',
label: 'GPT-5.6 Terra',
thinkingLevels: OPENAI_THINKING_LEVELS,
defaultThinkingLevel: 'low'
},
{
id: 'gpt-5.5',
label: 'GPT-5.5',
@@ -150,7 +156,7 @@ export function buildPrimaryCommitMessageAgentSpecs({
defaultThinkingLevel: 'low'
}
],
defaultModelId: 'gpt-5.5'
defaultModelId: 'gpt-5.6-terra'
},
opencode: {
id: 'opencode',
@@ -21,7 +21,7 @@ describe('source-control AI policy regressions', () => {
expect(result).toMatchObject({
ok: true,
value: { params: { agentId: 'codex', model: 'gpt-5.5' } }
value: { params: { agentId: 'codex', model: 'gpt-5.6-terra' } }
})
})