Skip to content

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

add Codex model tiers and paste confirmation

[._.]/ Adam Eivy3183d40c0c2f
diff --git a/data.reference/providers.json b/data.reference/providers.json
index ad77ecd7db..c7d4642ed9 100644
--- a/data.reference/providers.json
+++ b/data.reference/providers.json
@@ -60,11 +60,11 @@
"type": "cli",
"command": "codex",
"args": [],
- "models": ["codex-configured-default"],
- "defaultModel": "codex-configured-default",
- "lightModel": "codex-configured-default",
- "mediumModel": "codex-configured-default",
- "heavyModel": "codex-configured-default",
+ "models": ["gpt-5.6-luna", "gpt-5.6-terra", "gpt-5.6-sol"],
+ "defaultModel": "gpt-5.6-terra",
+ "lightModel": "gpt-5.6-luna",
+ "mediumModel": "gpt-5.6-terra",
+ "heavyModel": "gpt-5.6-sol",
"timeout": 300000,
"enabled": true,
"envVars": {}
@@ -90,11 +90,11 @@
"type": "tui",
"command": "codex",
"args": ["--dangerously-bypass-approvals-and-sandbox"],
- "models": ["codex-configured-default"],
- "defaultModel": "codex-configured-default",
- "lightModel": "codex-configured-default",
- "mediumModel": "codex-configured-default",
- "heavyModel": "codex-configured-default",
+ "models": ["gpt-5.6-luna", "gpt-5.6-terra", "gpt-5.6-sol"],
+ "defaultModel": "gpt-5.6-terra",
+ "lightModel": "gpt-5.6-luna",
+ "mediumModel": "gpt-5.6-terra",
+ "heavyModel": "gpt-5.6-sol",
"timeout": 600000,
"enabled": false,
"envVars": {},
diff --git a/server/lib/aiToolkit/defaults/providers.sample.json b/server/lib/aiToolkit/defaults/providers.sample.json
index a3100879b9..f7f9d03b8d 100644
--- a/server/lib/aiToolkit/defaults/providers.sample.json
+++ b/server/lib/aiToolkit/defaults/providers.sample.json
@@ -118,11 +118,11 @@
"type": "cli",
"command": "codex",
"args": [],
- "models": ["codex-configured-default"],
- "defaultModel": "codex-configured-default",
- "lightModel": "codex-configured-default",
- "mediumModel": "codex-configured-default",
- "heavyModel": "codex-configured-default",
+ "models": ["gpt-5.6-luna", "gpt-5.6-terra", "gpt-5.6-sol"],
+ "defaultModel": "gpt-5.6-terra",
+ "lightModel": "gpt-5.6-luna",
+ "mediumModel": "gpt-5.6-terra",
+ "heavyModel": "gpt-5.6-sol",
"contextWindow": 1000000,
"timeout": 300000,
"enabled": true,
@@ -135,11 +135,11 @@
"type": "tui",
"command": "codex",
"args": ["--dangerously-bypass-approvals-and-sandbox"],
- "models": ["codex-configured-default"],
- "defaultModel": "codex-configured-default",
- "lightModel": "codex-configured-default",
- "mediumModel": "codex-configured-default",
- "heavyModel": "codex-configured-default",
+ "models": ["gpt-5.6-luna", "gpt-5.6-terra", "gpt-5.6-sol"],
+ "defaultModel": "gpt-5.6-terra",
+ "lightModel": "gpt-5.6-luna",
+ "mediumModel": "gpt-5.6-terra",
+ "heavyModel": "gpt-5.6-sol",
"contextWindow": 1000000,
"timeout": 600000,
"enabled": false,
diff --git a/server/lib/aiToolkit/providers.js b/server/lib/aiToolkit/providers.js
index 38abb1cb10..1de55d48f9 100644
--- a/server/lib/aiToolkit/providers.js
+++ b/server/lib/aiToolkit/providers.js
@@ -140,6 +140,16 @@ 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'];
+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 ANTIGRAVITY_MODEL_KEYS = ['defaultModel', 'lightModel', 'mediumModel', 'heavyModel'];
const CODEX_CONTEXT_WINDOW = 1_000_000;
const GEMINI_CONTEXT_WINDOW = 1_048_576;
@@ -158,29 +168,26 @@ function canonicalProviderContextWindow(provider) {
return null;
}
-// Auto-migrate legacy codex provider configs that pin a real model id
-// (e.g. "gpt-5.2") to the sentinel "codex-configured-default" so the Codex
-// CLI uses whatever model is configured in ~/.codex/config.toml. Idempotent.
+// 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.
function migrateCodexProvider(data) {
if (!data?.providers) return false;
let changed = false;
for (const provider of Object.values(data.providers)) {
- if (provider?.id !== 'codex' || provider?.type !== 'cli') continue;
+ const isCodexProcessProvider = (provider?.id === 'codex' || provider?.id === 'codex-tui')
+ && (provider?.type === 'cli' || provider?.type === 'tui');
+ if (!isCodexProcessProvider) continue;
- const modelsAlreadyMigrated = Array.isArray(provider.models)
+ const isSentinelOnly = Array.isArray(provider.models)
&& provider.models.length === 1
- && provider.models[0] === CODEX_CONFIGURED_DEFAULT;
- if (!modelsAlreadyMigrated) {
- provider.models = [CODEX_CONFIGURED_DEFAULT];
- changed = true;
- }
+ && provider.models[0] === CODEX_CONFIGURED_DEFAULT
+ && CODEX_MODEL_KEYS.every((key) => provider[key] === CODEX_CONFIGURED_DEFAULT);
+ if (!isSentinelOnly) continue;
- for (const key of CODEX_MODEL_KEYS) {
- if (provider[key] !== CODEX_CONFIGURED_DEFAULT) {
- provider[key] = CODEX_CONFIGURED_DEFAULT;
- changed = true;
- }
- }
+ provider.models = [...CODEX_MODELS];
+ Object.assign(provider, CODEX_MODEL_DEFAULTS);
+ changed = true;
}
return changed;
}
@@ -343,7 +350,7 @@ export function createProviderService(config = {}) {
const migratedContextWindows = migrateProviderContextWindows(data);
if (migratedCodex || migratedAntigravity || migratedContextWindows) {
await atomicWrite(PROVIDERS_PATH, data);
- if (migratedCodex) console.log('🔧 Migrated codex provider config to codex-configured-default sentinel');
+ if (migratedCodex) console.log('🔧 Migrated Codex providers to the selectable GPT-5.6 model tiers');
if (migratedAntigravity) console.log('🔧 Migrated Gemini provider config to Antigravity CLI (agy)');
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.js
index e2d0ded9c8..2637d06096 100644
--- a/server/lib/aiToolkit/providers.test.js
+++ b/server/lib/aiToolkit/providers.test.js
@@ -260,7 +260,7 @@ describe('Provider Service', () => {
return JSON.parse(raw);
};
- it('rewrites legacy codex models/defaultModel to the sentinel on first read', async () => {
+ it('preserves a real Codex model selection on first read', async () => {
await writeProvidersFile({
activeProvider: 'codex',
providers: {
@@ -280,18 +280,18 @@ describe('Provider Service', () => {
});
const codex = await providerService.getProviderById('codex');
- expect(codex.models).toEqual([CODEX_SENTINEL]);
- expect(codex.defaultModel).toBe(CODEX_SENTINEL);
- expect(codex.lightModel).toBe(CODEX_SENTINEL);
- expect(codex.mediumModel).toBe(CODEX_SENTINEL);
- expect(codex.heavyModel).toBe(CODEX_SENTINEL);
+ expect(codex.models).toEqual(['gpt-5.2', 'gpt-5-codex']);
+ expect(codex.defaultModel).toBe('gpt-5.2');
+ expect(codex.lightModel).toBe('gpt-5');
+ expect(codex.mediumModel).toBe('gpt-5.2');
+ expect(codex.heavyModel).toBe('gpt-5.2');
const onDisk = await readProvidersFile();
- expect(onDisk.providers.codex.defaultModel).toBe(CODEX_SENTINEL);
- expect(onDisk.providers.codex.models).toEqual([CODEX_SENTINEL]);
+ expect(onDisk.providers.codex.defaultModel).toBe('gpt-5.2');
+ expect(onDisk.providers.codex.models).toEqual(['gpt-5.2', 'gpt-5-codex']);
});
- it('is idempotent — already-migrated codex configs are not rewritten', async () => {
+ it('migrates a sentinel-only Codex CLI config to selectable tiers', async () => {
await writeProvidersFile({
activeProvider: 'codex',
providers: {
@@ -311,15 +311,38 @@ describe('Provider Service', () => {
}
});
- const { statSync } = await import('fs');
- const path = join(TEST_DATA_DIR, 'providers.json');
- const mtimeBefore = statSync(path).mtimeMs;
+ const codex = await providerService.getProviderById('codex');
+ expect(codex.models).toEqual(['gpt-5.6-luna', 'gpt-5.6-terra', 'gpt-5.6-sol']);
+ expect(codex.defaultModel).toBe('gpt-5.6-terra');
+ expect(codex.lightModel).toBe('gpt-5.6-luna');
+ expect(codex.mediumModel).toBe('gpt-5.6-terra');
+ expect(codex.heavyModel).toBe('gpt-5.6-sol');
+ });
- await new Promise((resolve) => setTimeout(resolve, 10));
+ it('migrates a sentinel-only Codex TUI config to selectable tiers', async () => {
+ await writeProvidersFile({
+ activeProvider: 'codex-tui',
+ providers: {
+ 'codex-tui': {
+ id: 'codex-tui',
+ name: 'Codex TUI',
+ type: 'tui',
+ command: 'codex',
+ models: [CODEX_SENTINEL],
+ defaultModel: CODEX_SENTINEL,
+ lightModel: CODEX_SENTINEL,
+ mediumModel: CODEX_SENTINEL,
+ heavyModel: CODEX_SENTINEL,
+ },
+ },
+ });
- await providerService.getProviderById('codex');
- const mtimeAfter = statSync(path).mtimeMs;
- expect(mtimeAfter).toBe(mtimeBefore);
+ 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.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('does not touch non-codex providers', async () => {
@@ -402,7 +425,7 @@ describe('Provider Service', () => {
expect(codex.envVars).toEqual({ OPENAI_BASE_URL: 'https://example.com' });
});
- it('handles partial migration (only defaultModel pinned, models[] already sentinel)', async () => {
+ it('preserves a partial legacy config rather than erasing its selected model', async () => {
await writeProvidersFile({
activeProvider: 'codex',
providers: {
@@ -418,7 +441,7 @@ describe('Provider Service', () => {
const codex = await providerService.getProviderById('codex');
expect(codex.models).toEqual([CODEX_SENTINEL]);
- expect(codex.defaultModel).toBe(CODEX_SENTINEL);
+ expect(codex.defaultModel).toBe('gpt-5.2');
});
it('upgrades default Codex and Antigravity context windows on first read', async () => {
diff --git a/server/lib/cliProviderArgs.test.js b/server/lib/cliProviderArgs.test.js
index 52638ab54e..6d155d6923 100644
--- a/server/lib/cliProviderArgs.test.js
+++ b/server/lib/cliProviderArgs.test.js
@@ -64,6 +64,13 @@ describe('cliProviderArgs', () => {
});
expect(args).toEqual(['exec', '--model', 'gpt-5', '-']);
});
+
+ it('passes the selected GPT-5.6 Codex tier to the CLI', () => {
+ const args = buildCliArgs({
+ id: 'codex', command: 'codex', defaultModel: 'gpt-5.6-sol',
+ });
+ expect(args).toEqual(['exec', '--model', 'gpt-5.6-sol', '-']);
+ });
});
describe('buildCliArgs — OpenCode Ollama', () => {
diff --git a/server/lib/tuiHandshake.js b/server/lib/tuiHandshake.js
index d3619f7170..e3673968e0 100644
--- a/server/lib/tuiHandshake.js
+++ b/server/lib/tuiHandshake.js
@@ -31,9 +31,10 @@ export const PASTE_DEADLINE_MS = 10000;
// path; the non-claude providers use PASTE_DEADLINE_MS.
export const TUI_INPUT_READY_DEADLINE_MS = 45000;
-// Claude Code emits `[Pasted text #N +M lines]` after committing a paste.
-// Watch for the marker (or fall back after PASTE_TO_ENTER_FALLBACK_MS)
-// before sending `\r` so Enter doesn't get swallowed mid-paste-commit.
+// Claude Code emits `[Pasted text #N +M lines]`, while Codex emits
+// `[Pasted Content N chars]`, after committing a paste. Watch for either
+// marker (or fall back after PASTE_TO_ENTER_FALLBACK_MS) before sending `\r`
+// so Enter doesn't get swallowed mid-paste-commit.
//
// CRITICAL: the marker must be matched against ANSI-STRIPPED output, never the
// raw PTY stream. Claude Code renders the marker by positioning each token with
@@ -59,7 +60,7 @@ export const PASTE_RETRY_MAX_ATTEMPTS = 3;
export const PASTE_RETRY_BASE_DELAY_MS = 800;
// Minimum prefix length for verification (shorter prompts verify whole-text)
const MIN_VERIFIABLE_PREFIX_LEN = 15;
-export const PASTE_MARKER_PATTERN = /\[Pasted\s*text\s*#\d+/i;
+export const PASTE_MARKER_PATTERN = /\[Pasted\s*(?:text\s*#\d+[^\]]*|content\s*\d+\s*chars)\]/i;
export const PASTE_TO_ENTER_MIN_DELAY_MS = 200;
export const PASTE_TO_ENTER_FALLBACK_MS = 3500;
diff --git a/server/lib/tuiHandshake.test.js b/server/lib/tuiHandshake.test.js
index fd5df5f938..98cdb6e6d7 100644
--- a/server/lib/tuiHandshake.test.js
+++ b/server/lib/tuiHandshake.test.js
@@ -79,6 +79,11 @@ describe('tuiHandshake — paste timing constants', () => {
expect(PASTE_MARKER_PATTERN.test('banner stuff [Pasted text #7 +1 lines] trailer')).toBe(true);
});
+ it('PASTE_MARKER_PATTERN matches Codex paste-commit chips', () => {
+ expect(PASTE_MARKER_PATTERN.test('[Pasted Content 2431 chars]')).toBe(true);
+ expect(PASTE_MARKER_PATTERN.test('[PastedContent2431chars]')).toBe(true);
+ });
+
it('PASTE_MARKER_PATTERN matches the SPACE-COLLAPSED form left after ANSI strip', () => {
// The raw PTY stream renders the marker with absolute-column cursor moves
// between tokens (`[Pasted\x1b[11Gtext\x1b[16G#1…`), so once ANSI is stripped
@@ -501,6 +506,12 @@ describe('tuiHandshake.buildTuiInvocation', () => {
expect(out.args).toEqual(['--dangerously-bypass-approvals-and-sandbox', 'exec', '-']);
});
+ it('passes a selected Codex model tier to the interactive CLI', () => {
+ const provider = { id: 'codex-tui', command: 'codex', args: [] };
+ const out = buildTuiInvocation(provider, 'gpt-5.6-sol');
+ expect(out.args).toEqual(['--dangerously-bypass-approvals-and-sandbox', '--model', 'gpt-5.6-sol']);
+ });
+
it('skips --model injection when model is null/undefined/empty', () => {
const provider = { id: 'claude', args: ['-p', '-'] };
expect(buildTuiInvocation(provider, null).args).toEqual(['-p', '-']);