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.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Harness Team account: Codex opens on a model its owner is offered
bitcoinbuilder2ca092f3afd9
diff --git a/cli/src/team/relay.spec.ts b/cli/src/team/relay.spec.tsindex 8ea4e3e57..de0abc8cc 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, dropUnofferedModel, offeredCodexModels, codexModelNotOffered,+ CODEX_CLIENT_VERSION_FALLBACK, settleCodexModel, offeredCodexModels, codexModelNotOffered,type TeamRelayLaunchDeps, type TeamRelayPublisherDeps, type TeamRelayReadDeps, type WindowsRelayFs,} from './relay.js'@@ -347,28 +347,45 @@ describe('Codex\'s home for the relay', () => {// 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 () => {+ it('sets the owner\'s first listed model where a saved one 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.+ expect(readFileSync(config, 'utf8')).toBe('model = "gpt-6.1-sol"\nmodel_reasoning_effort = "high"\n\n[tui]\nmodel = "kept"\n')+ // An offered one stays; nothing is touched without a list, or in a table.writeFileSync(config, "model = 'gpt-6-astra' # chosen\n")- expect(dropUnofferedModel(config, new Set(['gpt-6-astra']))).toBe(false)+ expect(settleCodexModel(config, new Set(['gpt-6-astra']), 'gpt-6.1-sol')).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(settleCodexModel(config, new Set(), 'gpt-6.1-sol')).toBe(false)+ // No listed model to fall back on: the unoffered one is taken out, as before.+ expect(settleCodexModel(config, new Set(['gpt-reserve']), null)).toBe(true)+ expect(readFileSync(config, 'utf8')).toBe('')expect(statSync(config).mode & 0o777).toBe(0o600)})+ // 2026-10-29: with no model saved, Codex opened on its own default, gpt-6.1-sol, which Mac Auto's owner is not offered, and+ // the agent's first message was refused before the start's model was switched in.+ it('pins a model the owner is offered where none is saved, and writes the file when there is none', async () => {+ const dir = join(home(), '.codex')+ mkdirSync(dir)+ const config = join(dir, 'config.toml')+ await prepareCodexHome(dir, grant, { fetch: answer(200, { models: [{ slug: 'gpt-reserve', visibility: 'hide' }, { slug: 'gpt-6-luna', visibility: 'list' }] }) as never,+ version: () => null, now: () => 0 })+ expect(readFileSync(config, 'utf8')).toBe('model = "gpt-6-luna"\n')+ writeFileSync(config, '[tui]\nscreen_reader_detection_done = true\n[profiles.x]\nmodel = "gpt-5.5"\n')+ expect(settleCodexModel(config, new Set(['gpt-6-luna']), 'gpt-6-luna')).toBe(true)+ expect(readFileSync(config, 'utf8')).toBe('model = "gpt-6-luna"\n[tui]\nscreen_reader_detection_done = true\n[profiles.x]\nmodel = "gpt-5.5"\n')+ // A model name that could break the file is never written: the unoffered line is only taken out.+ expect(settleCodexModel(join(dir, 'config.toml'), new Set(['x']), 'bad"name')).toBe(true)+ expect(readFileSync(config, 'utf8')).not.toContain('bad')+ // Nothing is written into a folder that is not there.+ expect(settleCodexModel(join(dir, 'no', 'config.toml'), new Set(['x']), 'gpt-6-luna')).toBe(false)+ })+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.tsindex c1fe65467..befa3b3c2 100644--- a/cli/src/team/relay.ts+++ b/cli/src/team/relay.ts@@ -392,7 +392,8 @@ 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] : [])))+ const rows = models.flatMap(m => m && typeof m === 'object' && typeof (m as { slug?: unknown }).slug === 'string' ? [m as { slug: string; visibility?: unknown }] : [])+ settleCodexModel(join(dir, 'config.toml'), new Set(rows.map(m => m.slug)), rows.find(m => m.visibility === 'list')?.slug ?? null)return models} catch { /* The relay or ChatGPT did not answer: Codex keeps the list it had. */ }return null@@ -434,28 +435,36 @@ export const codexModelNotOffered = (model: string, offered: OfferedCodexModels)+ (offered.listed.length ? `it offers ${offered.listed.join(', ')}.` : 'it lists no model to choose.')/**- * 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.+ * The team account's Codex is set to open on a model its owner is offered. Codex saves the model a /model switch picks in+ * its config, 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 opened on a "Meet GPT-6 Sol" choice nobody answers, and every start on Mac Auto's waited+ * 3 minutes and failed. With no model saved, Codex opened on its own default, gpt-6.1-sol, which Mac Auto's owner is not+ * offered either, so the agent's first message was refused before the start's model was switched in (2026-10-29). A+ * saved model the owner is offered stays; otherwise the top-level `model` becomes [fallback], the first model the owner's+ * list offers to choose, or is taken out when there is none. Only that line is written, and only against a list that was+ * read. Returns whether the file changed.*/-export function dropUnofferedModel(config: string, offered: ReadonlySet<string>): boolean {+export function settleCodexModel(config: string, offered: ReadonlySet<string>, fallback: string | null): boolean {if (!offered.size) return false- let text: string- try { text = readFileSync(config, 'utf8') } catch { return false }- const lines = text.split('\n')+ let text = ''+ try { text = readFileSync(config, 'utf8') } catch (error) {+ if ((error as NodeJS.ErrnoException).code !== 'ENOENT') return false+ }+ const lines = text ? text.split('\n') : []const firstTable = lines.findIndex(line => /^\s*\[/.test(line))const top = firstTable < 0 ? lines.length : firstTableconst 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]!)+ const saved = index < 0 ? null : /^\s*model\s*=\s*(?:"([^"]*)"|'([^']*)')\s*(?:#.*)?$/.exec(lines[index]!)if (saved && offered.has(saved[1] ?? saved[2] ?? '')) return false- lines.splice(index, 1)+ const line = fallback && /^[A-Za-z0-9][A-Za-z0-9._:-]{0,99}$/.test(fallback) ? `model = "${fallback}"` : null+ if (index >= 0) { if (line) lines[index] = line; else lines.splice(index, 1) }+ else if (line) lines.unshift(line)+ else return falseconst next = `${config}.harness-${process.pid}`- writeFileSync(next, lines.join('\n'), { mode: 0o600 })- renameSync(next, config)+ try {+ writeFileSync(next, lines.join('\n') + (text ? '' : '\n'), { mode: 0o600 })+ renameSync(next, config)+ } catch { return false }return true}