Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
feat: refresh Codex CLI model catalog
[._.]/ Adam Eivy30e59a1e61de
diff --git a/client/src/components/ProviderModelSelector.test.jsx b/client/src/components/ProviderModelSelector.test.jsxindex f559f58423..9548c6ff70 100644--- a/client/src/components/ProviderModelSelector.test.jsx+++ b/client/src/components/ProviderModelSelector.test.jsx@@ -8,6 +8,7 @@ vi.mock('../services/apiLocalLlm', () => ({ getToolUseModels: (...a) => getToolUimport ProviderModelSelector from './ProviderModelSelector';import { __resetToolUseModelIdsCache } from '../hooks/useToolUseModelIds.js';+import SHIPPED_PROVIDERS from '../../../data.reference/providers.json';const PROVIDERS = [{ id: 'p1', name: 'Provider One' },@@ -35,6 +36,20 @@ describe('ProviderModelSelector', () => {expect(options).toEqual(['Provider One', 'Provider Two', 'm1', 'm2']);});+ it('renders every current Codex fallback choice, including Codex Spark', () => {+ const codexModels = SHIPPED_PROVIDERS.providers.codex.models;+ expect(codexModels).toContain('gpt-5.3-codex-spark');+ renderSelector({+ providers: [{ id: 'codex', name: 'Codex CLI', type: 'cli', models: codexModels }],+ selectedProviderId: 'codex',+ selectedModel: 'gpt-5.3-codex-spark',+ availableModels: codexModels,+ });+ const modelSelect = screen.getAllByRole('combobox')[1];+ expect([...modelSelect.querySelectorAll('option')].map((option) => option.value)).toEqual(codexModels);+ expect(modelSelect.value).toBe('gpt-5.3-codex-spark');+ });+it('prepends empty options with value "" when emptyProviderOption/emptyModelOption are set', () => {renderSelector({ emptyProviderOption: 'Use default', emptyModelOption: 'Default model' });const providerSelect = screen.getAllByRole('combobox')[0];diff --git a/data.reference/providers.json b/data.reference/providers.jsonindex e4664ae4c7..d98f9c91a2 100644--- a/data.reference/providers.json+++ b/data.reference/providers.json@@ -62,7 +62,7 @@"type": "cli","command": "codex","args": [],- "models": ["gpt-5.6-luna", "gpt-5.6-terra", "gpt-5.6-sol"],+ "models": ["gpt-5.6-luna", "gpt-5.6-terra", "gpt-5.6-sol", "gpt-5.3-codex-spark"],"defaultModel": "gpt-5.6-terra","lightModel": "gpt-5.6-luna","mediumModel": "gpt-5.6-terra",@@ -92,7 +92,7 @@"type": "tui","command": "codex","args": ["--dangerously-bypass-approvals-and-sandbox"],- "models": ["gpt-5.6-luna", "gpt-5.6-terra", "gpt-5.6-sol"],+ "models": ["gpt-5.6-luna", "gpt-5.6-terra", "gpt-5.6-sol", "gpt-5.3-codex-spark"],"defaultModel": "gpt-5.6-terra","lightModel": "gpt-5.6-luna","mediumModel": "gpt-5.6-terra",diff --git a/server/lib/aiToolkit/defaults/providers.sample.json b/server/lib/aiToolkit/defaults/providers.sample.jsonindex c28a5dec6d..4c7760c5c4 100644--- a/server/lib/aiToolkit/defaults/providers.sample.json+++ b/server/lib/aiToolkit/defaults/providers.sample.json@@ -414,7 +414,7 @@"type": "cli","command": "codex","args": [],- "models": ["gpt-5.6-luna", "gpt-5.6-terra", "gpt-5.6-sol"],+ "models": ["gpt-5.6-luna", "gpt-5.6-terra", "gpt-5.6-sol", "gpt-5.3-codex-spark"],"defaultModel": "gpt-5.6-terra","lightModel": "gpt-5.6-luna","mediumModel": "gpt-5.6-terra",@@ -431,7 +431,7 @@"type": "tui","command": "codex","args": ["--dangerously-bypass-approvals-and-sandbox"],- "models": ["gpt-5.6-luna", "gpt-5.6-terra", "gpt-5.6-sol"],+ "models": ["gpt-5.6-luna", "gpt-5.6-terra", "gpt-5.6-sol", "gpt-5.3-codex-spark"],"defaultModel": "gpt-5.6-terra","lightModel": "gpt-5.6-luna","mediumModel": "gpt-5.6-terra",diff --git a/server/lib/aiToolkit/defaults/providersSeedParity.test.js b/server/lib/aiToolkit/defaults/providersSeedParity.test.jsindex 09ba94c5c4..4ee6d4cae8 100644--- a/server/lib/aiToolkit/defaults/providersSeedParity.test.js+++ b/server/lib/aiToolkit/defaults/providersSeedParity.test.js@@ -37,8 +37,18 @@ const MODEL_FIELDS = ['models', 'defaultModel', 'lightModel', 'mediumModel', 'he// local model it ships guidance for, while the toolkit sample ships an empty// list because a generic install has no way to know what the user has pulled.const EXEMPT_IDS = new Set(['lmstudio']);+const MODEL_PIN_FIELDS = ['defaultModel', 'lightModel', 'mediumModel', 'heavyModel'];+const STATIC_CLI_PROVIDER_SENTINELS = new Map([+ // Codex's sentinel-only legacy records migrate to real defaults; its fresh+ // seeds intentionally point at selectable models instead.+ ['codex', null],+ ['codex-tui', null],+ ['antigravity-cli', 'antigravity-configured-default'],+ ['antigravity-tui', 'antigravity-configured-default'],+]);const readJson = (path) => JSON.parse(readFileSync(path, 'utf8'));+const modelId = (model) => (typeof model === 'string' ? model : model?.id);describe('provider seed parity — data.reference ↔ aiToolkit sample', () => {const reference = readJson(REFERENCE_PATH);@@ -59,4 +69,30 @@ describe('provider seed parity — data.reference ↔ aiToolkit sample', () => {}});}++ it('ships unique model IDs with valid sentinels and pins', () => {+ for (const [seedName, seed] of [['reference', reference], ['sample', sample]]) {+ for (const [id, provider] of Object.entries(seed.providers)) {+ const modelIds = provider.models.map(modelId);+ expect(modelIds.every(Boolean), `${seedName}.${id}.models contains an invalid entry`).toBe(true);+ expect(new Set(modelIds).size, `${seedName}.${id}.models contains duplicate ids`).toBe(modelIds.length);+ for (const field of MODEL_PIN_FIELDS) {+ if (provider[field] != null) {+ expect(modelIds, `${seedName}.${id}.${field} is not in its catalog`).toContain(provider[field]);+ }+ }+ }+ for (const [id, sentinel] of STATIC_CLI_PROVIDER_SENTINELS) {+ const provider = seed.providers[id];+ expect(provider, `${seedName} is missing ${id}`).toBeDefined();+ expect(Array.isArray(provider.models), `${seedName}.${id}.models must be an array`).toBe(true);+ if (sentinel) {+ expect(provider.models, `${seedName}.${id} lost its configured-default sentinel`).toContain(sentinel);+ }+ if (id === 'codex' || id === 'codex-tui') {+ expect(provider.models, `${seedName}.${id} lost the current Codex Spark fallback`).toContain('gpt-5.3-codex-spark');+ }+ }+ }+ });});diff --git a/server/lib/aiToolkit/providers.js b/server/lib/aiToolkit/providers.jsindex 3ebc753045..dac844695c 100644--- a/server/lib/aiToolkit/providers.js+++ b/server/lib/aiToolkit/providers.js@@ -177,16 +177,29 @@ function ollamaModelSupportsTools(id, capabilities) {const CODEX_CONFIGURED_DEFAULT = 'codex-configured-default';const CODEX_MODEL_KEYS = ['defaultModel', 'lightModel', 'mediumModel', 'heavyModel'];-// Codex 0.144+ exposes three selectable coding-model tiers. Keep the ids in-// provider config (rather than the old "use ~/.codex/config.toml" sentinel) so-// PortOS can pass the user's choice through as `codex --model <id>`.-const CODEX_MODELS = ['gpt-5.6-luna', 'gpt-5.6-terra', 'gpt-5.6-sol'];+// Codex 0.144+ exposes selectable coding-model tiers. Keep the ids in provider+// config (rather than the old "use ~/.codex/config.toml" sentinel) so PortOS+// can pass the user's choice through as `codex --model <id>`.+const CODEX_MODELS = [+ 'gpt-5.6-luna',+ 'gpt-5.6-terra',+ 'gpt-5.6-sol',+ 'gpt-5.3-codex-spark',+];const CODEX_MODEL_DEFAULTS = {defaultModel: 'gpt-5.6-terra',lightModel: 'gpt-5.6-luna',mediumModel: 'gpt-5.6-terra',heavyModel: 'gpt-5.6-sol',};+const PRIOR_CODEX_MODEL_CATALOGS = [+ // Prior 2026-07 catalog before Codex-Spark was added.+ [+ 'gpt-5.6-luna',+ 'gpt-5.6-terra',+ 'gpt-5.6-sol',+ ],+];const ANTIGRAVITY_MODEL_KEYS = ['defaultModel', 'lightModel', 'mediumModel', 'heavyModel'];// agy exposes a per-session `--model` flag and lists its catalog via// `agy models`. This is the shipped fallback list (agy 2026-08) used to seed a@@ -236,6 +249,12 @@ const CODEX_CONTEXT_WINDOW = 1_000_000;const GEMINI_CONTEXT_WINDOW = 1_048_576;const STALE_GENERIC_CONTEXT_WINDOW = 128_000;+function matchesAnyExactCatalog(models, catalogs) {+ return Array.isArray(models) && catalogs.some(+ (catalog) => catalog.length === models.length && catalog.every((model, index) => model === models[index]),+ );+}+function shouldUpgradeContextWindow(value) {return value == null || Number(value) === STALE_GENERIC_CONTEXT_WINDOW;}@@ -249,9 +268,10 @@ function canonicalProviderContextWindow(provider) {return null;}-// Replace only the old sentinel-only Codex setup with the current selectable-// Codex tier catalog. Real model choices are deliberately preserved: PortOS-// must never silently erase a model selected in AI Providers.+// Replace only the old sentinel-only Codex setup or a prior shipped catalog+// with the current selectable Codex catalog. Real model choices are+// deliberately preserved: PortOS must never silently erase a model selected+// in AI Providers.function migrateCodexProvider(data) {if (!data?.providers) return false;let changed = false;@@ -264,10 +284,11 @@ function migrateCodexProvider(data) {&& provider.models.length === 1&& provider.models[0] === CODEX_CONFIGURED_DEFAULT&& CODEX_MODEL_KEYS.every((key) => provider[key] === CODEX_CONFIGURED_DEFAULT);- if (!isSentinelOnly) continue;+ const isPriorSeededList = matchesAnyExactCatalog(provider.models, PRIOR_CODEX_MODEL_CATALOGS);+ if (!isSentinelOnly && !isPriorSeededList) continue;provider.models = [...CODEX_MODELS];- Object.assign(provider, CODEX_MODEL_DEFAULTS);+ if (isSentinelOnly) Object.assign(provider, CODEX_MODEL_DEFAULTS);changed = true;}return changed;@@ -371,10 +392,7 @@ function migrateAntigravityModelCatalog(data) {&& provider.models.length === 1&& provider.models[0] === ANTIGRAVITY_CONFIGURED_DEFAULT;- const isPriorSeededList = Array.isArray(provider.models)- && PRIOR_ANTIGRAVITY_MODEL_CATALOGS.some(- (prior) => prior.length === provider.models.length && prior.every((m, i) => m === provider.models[i]),- );+ const isPriorSeededList = matchesAnyExactCatalog(provider.models, PRIOR_ANTIGRAVITY_MODEL_CATALOGS);if (!isSentinelOnly && !isPriorSeededList) continue;@@ -500,7 +518,7 @@ export function createProviderService(config = {}) {const migratedContextWindows = migrateProviderContextWindows(data);if (migratedCodex || migratedAntigravity || migratedAntigravityModels || migratedContextWindows) {await atomicWrite(PROVIDERS_PATH, data);- if (migratedCodex) console.log('🔧 Migrated Codex providers to the selectable GPT-5.6 model tiers');+ if (migratedCodex) console.log('🔧 Migrated Codex providers to the selectable model catalog');if (migratedAntigravity) console.log('🔧 Migrated Gemini provider config to Antigravity CLI (agy)');if (migratedAntigravityModels) console.log('🔧 Migrated Antigravity providers to the selectable agy model catalog');if (migratedContextWindows) console.log('🔧 Migrated provider context windows to current canonical values');diff --git a/server/lib/aiToolkit/providers.test.js b/server/lib/aiToolkit/providers.test.jsindex 16f632811c..16faa2d639 100644--- a/server/lib/aiToolkit/providers.test.js+++ b/server/lib/aiToolkit/providers.test.js@@ -321,7 +321,12 @@ describe('Provider Service', () => {});const codex = await providerService.getProviderById('codex');- expect(codex.models).toEqual(['gpt-5.6-luna', 'gpt-5.6-terra', 'gpt-5.6-sol']);+ expect(codex.models).toEqual([+ 'gpt-5.6-luna',+ 'gpt-5.6-terra',+ 'gpt-5.6-sol',+ 'gpt-5.3-codex-spark',+ ]);expect(codex.defaultModel).toBe('gpt-5.6-terra');expect(codex.lightModel).toBe('gpt-5.6-luna');expect(codex.mediumModel).toBe('gpt-5.6-terra');@@ -347,13 +352,45 @@ describe('Provider Service', () => {});const codexTui = await providerService.getProviderById('codex-tui');- expect(codexTui.models).toEqual(['gpt-5.6-luna', 'gpt-5.6-terra', 'gpt-5.6-sol']);+ expect(codexTui.models).toEqual([+ 'gpt-5.6-luna',+ 'gpt-5.6-terra',+ 'gpt-5.6-sol',+ 'gpt-5.3-codex-spark',+ ]);expect(codexTui.defaultModel).toBe('gpt-5.6-terra');expect(codexTui.lightModel).toBe('gpt-5.6-luna');expect(codexTui.mediumModel).toBe('gpt-5.6-terra');expect(codexTui.heavyModel).toBe('gpt-5.6-sol');});+ it('widens a prior-seeded Codex catalog without changing selected pins', async () => {+ const priorModels = ['gpt-5.6-luna', 'gpt-5.6-terra', 'gpt-5.6-sol'];+ await writeProvidersFile({+ activeProvider: 'codex',+ providers: {+ codex: {+ id: 'codex',+ name: 'Codex CLI',+ type: 'cli',+ command: 'codex',+ models: [...priorModels],+ defaultModel: 'gpt-5.6-luna',+ lightModel: 'gpt-5.6-sol',+ mediumModel: 'gpt-5.6-luna',+ heavyModel: 'gpt-5.6-terra',+ },+ },+ });++ const codex = await providerService.getProviderById('codex');+ expect(codex.models).toEqual([...priorModels, 'gpt-5.3-codex-spark']);+ expect(codex.defaultModel).toBe('gpt-5.6-luna');+ expect(codex.lightModel).toBe('gpt-5.6-sol');+ expect(codex.mediumModel).toBe('gpt-5.6-luna');+ expect(codex.heavyModel).toBe('gpt-5.6-terra');+ });+it('does not touch non-codex providers', async () => {await writeProvidersFile({activeProvider: 'claude-code',diff --git a/server/lib/providerModels.test.js b/server/lib/providerModels.test.jsindex efa08d611a..1a3d66e74e 100644--- a/server/lib/providerModels.test.js+++ b/server/lib/providerModels.test.js@@ -53,6 +53,8 @@ import { readFileSync } from 'fs';import { resolve, dirname } from 'path';import { fileURLToPath } from 'url';+const SHIPPED_PROVIDERS = JSON.parse(readFileSync(resolve(dirname(fileURLToPath(import.meta.url)), '../../data.reference/providers.json'), 'utf8'));+// The catalog `agy models` prints — the shipped provider list mirrors it.const AGY_CATALOG = ['antigravity-configured-default',@@ -652,6 +654,15 @@ describe('providerModels', () => {it('passes a sentinel-free list through unchanged', () => {expect(filterSelectableModels(['a', 'b'])).toEqual(['a', 'b']);});++ it('leaves every current Codex fallback choice available to server pickers', () => {+ const codexModels = SHIPPED_PROVIDERS.providers.codex.models;+ expect(codexModels).toContain('gpt-5.3-codex-spark');+ expect(filterSelectableModels([+ CODEX_CONFIGURED_DEFAULT,+ ...codexModels,+ ])).toEqual(codexModels);+ });});describe('hasModelFlag', () => {@@ -940,8 +951,7 @@ describe('providerModels', () => {// Anthropic models under its own ids is covered without anyone remembering// to add a case. Only `claude` may rewrite; everything else is verbatim.it('rewrites the model id for no shipped non-claude TUI command', () => {- const __dirname = dirname(fileURLToPath(import.meta.url));- const seed = JSON.parse(readFileSync(resolve(__dirname, '../../data.reference/providers.json'), 'utf8'));+ const seed = SHIPPED_PROVIDERS;const commands = [...new Set(Object.values(seed.providers).filter((p) => p.type === 'tui' && typeof p.command === 'string')