Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Harness Team account: a saved Codex model the owner is not offered is taken out before launch

bitcoinbuilder462d44ae5cdf
diff --git a/cli/src/team/relay.spec.ts b/cli/src/team/relay.spec.ts
index 9ab774266..1194302ee 100644
--- a/cli/src/team/relay.spec.ts
+++ b/cli/src/team/relay.spec.ts
@@ -8,7 +8,7 @@ import type { TeamConfig } from './config.js'
import {
publishTeamRelay, publishWindowsTeamRelay, readTeamRelay, readWindowsTeamRelay, setfaclGrant, TEAM_RELAY_GUEST, teamRelayDir, teamRelayFile,
teamRelayLaunch, teamRelayPublished, NO_PM_RELAY, type OwnerRelayLaunch, TeamRelayPublisher, prepareCodexHome, installedCodexVersion,
- CODEX_CLIENT_VERSION_FALLBACK,
+ CODEX_CLIENT_VERSION_FALLBACK, dropUnofferedModel,
type TeamRelayLaunchDeps, type TeamRelayPublisherDeps, type TeamRelayReadDeps, type WindowsRelayFs,
} from './relay.js'
@@ -345,6 +345,30 @@ describe('Codex\'s home for the relay', () => {
expect(String((fetch.mock.calls[0] as unknown[])[0])).toContain(`client_version=${CODEX_CLIENT_VERSION_FALLBACK}`)
})
+ // 2026-10-29: a /model switch saved gpt-5.5 in Mac Auto's Team account, and Codex 0.164 then opened on "Meet GPT-6 Sol"
+ // before its session started, so every Codex start there failed at 3 minutes.
+ it('takes out a saved default model the owner is not offered, once the owner\'s list is read', async () => {
+ const dir = join(home(), '.codex')
+ mkdirSync(dir)
+ const config = join(dir, 'config.toml')
+ writeFileSync(config, 'model = "gpt-5.5"\nmodel_reasoning_effort = "high"\n\n[tui]\nmodel = "kept"\n')
+ await prepareCodexHome(dir, grant, { fetch: answer() as never, version: () => null, now: () => 0 })
+ expect(readFileSync(config, 'utf8')).toBe('model_reasoning_effort = "high"\n\n[tui]\nmodel = "kept"\n')
+ // An offered one stays; nothing is taken out without a list, or from a table.
+ writeFileSync(config, "model = 'gpt-6-astra' # chosen\n")
+ expect(dropUnofferedModel(config, new Set(['gpt-6-astra']))).toBe(false)
+ writeFileSync(config, 'model = "gpt-5.5"\n')
+ await prepareCodexHome(dir, grant, { fetch: answer(503) as never, version: () => null, now: () => 0 })
+ expect(readFileSync(config, 'utf8')).toBe('model = "gpt-5.5"\n')
+ expect(dropUnofferedModel(config, new Set())).toBe(false)
+ writeFileSync(config, '[profiles.x]\nmodel = "gpt-5.5"\n')
+ expect(dropUnofferedModel(config, new Set(['gpt-6.1-sol']))).toBe(false)
+ expect(dropUnofferedModel(join(dir, 'missing.toml'), new Set(['gpt-6.1-sol']))).toBe(false)
+ writeFileSync(config, 'model = "gpt-5.5"\n')
+ expect(dropUnofferedModel(config, new Set(['gpt-6.1-sol']))).toBe(true)
+ expect(statSync(config).mode & 0o777).toBe(0o600)
+ })
+
it('reads the relay\'s left-over sign-in as Codex not signed in', async () => {
const root = home()
mkdirSync(join(root, '.codex'))
diff --git a/cli/src/team/relay.ts b/cli/src/team/relay.ts
index a55cfc96c..c7b71b008 100644
--- a/cli/src/team/relay.ts
+++ b/cli/src/team/relay.ts
@@ -390,9 +390,36 @@ export async function prepareCodexHome(dir: string, grant: TeamRelayGrant, deps:
const file = join(dir, 'models_cache.json'), next = `${file}.harness-${process.pid}`
writeFileSync(next, JSON.stringify({ fetched_at: new Date(deps.now()).toISOString(), client_version: version, models }), { mode: 0o600 })
renameSync(next, file)
+ dropUnofferedModel(join(dir, 'config.toml'), new Set(models.flatMap(m => typeof (m as { slug?: unknown })?.slug === 'string' ? [(m as { slug: string }).slug] : [])))
} catch { /* The relay or ChatGPT did not answer: Codex keeps the list it had. */ }
}
+/**
+ * A default model saved in the team account's Codex config that the owner's account does not offer is taken out, so Codex
+ * starts on the owner's default. Codex saves the model a /model switch picks there, and a switch made while the account
+ * knew only Codex's built-in models saved gpt-5.5, which ChatGPT refuses for the owner. Codex 0.164 then opens on a
+ * "Meet GPT-6 Sol" choice before its session starts, which nobody in a team account answers: every Codex start on Mac
+ * Auto's waited 3 minutes and failed (2026-10-29). Only a top-level `model` line is touched, and only against a list that
+ * was read; a model the owner is offered stays.
+ */
+export function dropUnofferedModel(config: string, offered: ReadonlySet<string>): boolean {
+ if (!offered.size) return false
+ let text: string
+ try { text = readFileSync(config, 'utf8') } catch { return false }
+ const lines = text.split('\n')
+ const firstTable = lines.findIndex(line => /^\s*\[/.test(line))
+ const top = firstTable < 0 ? lines.length : firstTable
+ const index = lines.slice(0, top).findIndex(line => /^\s*model\s*=/.test(line))
+ if (index < 0) return false
+ const saved = /^\s*model\s*=\s*(?:"([^"]*)"|'([^']*)')\s*(?:#.*)?$/.exec(lines[index]!)
+ if (saved && offered.has(saved[1] ?? saved[2] ?? '')) return false
+ lines.splice(index, 1)
+ const next = `${config}.harness-${process.pid}`
+ writeFileSync(next, lines.join('\n'), { mode: 0o600 })
+ renameSync(next, config)
+ return true
+}
+
/** The version of the Codex the team account installed for itself (team/script.ts TEAM_ENGINES_INSTALL, in ~/.local). */
export function installedCodexVersion(home: string): string | null {
try {