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

disable codex startup update check so headless agents don't idle out

[._.]/ Adam Eivy1a6c417d10aa
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 608f1feefa..4960cd05cb 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -19,6 +19,7 @@
## Fixed
+- **Codex agents no longer idle out when a new codex release is available.** On every interactive startup codex checks for a newer release and, if one exists, renders a blocking "✨ Update available!" modal whose highlighted default is "1. Update now (runs `brew upgrade --cask codex`)". A headless CoS/TUI agent has no human to steer it: the paste handshake's submit-Enter landed on "Update now", codex shelled out to a ~100 MB brew upgrade, and the session ended at "🎉 Update ran successfully! Please restart Codex." — a dead box that never processed the prompt, so the agent idled out reporting "prompt likely never submitted" (observed repeatedly on gpt-5.6-sol codex-tui runs). PortOS now spawns codex with `-c check_for_update_on_startup=false` across every codex spawn path — interactive TUI, the two `codex exec` CLI builders, and the vision-caption path — via a shared `buildCodexStartupArgs` helper (alongside the existing `buildEffortArgs`), so the input box comes up live and no run wastes startup time on an unattended upgrade it can't complete. The override is skipped when a provider already pins the key.
- **Local image gen: fixed a black band at the bottom of Z-Image-Turbo (and other diffusers-runner) outputs.** The shared runner helper unconditionally enabled VAE *tiling*, whose overlap-blend leaves a seam / dark strip at a content-dependent point near the bottom of the image — most visible at tall aspect ratios like 576×1024 (9:16). Tiling only saves memory on very large decodes and the small-to-mid resolutions PortOS renders never need it (the same reason both runners already disable tiling for image-to-image). VAE tiling is now applied only above a ~6.5 MP area floor that no standard or experimental preset reaches, so ordinary renders decode in one clean pass; pathologically large custom dimensions still get tiling as an out-of-memory safety valve. VAE slicing and attention slicing (which never affect spatial layout) stay on for every render.
- **AI Providers warns before enabling the Grok Build CLI/TUI.** The Grok harness uploads your entire working repo to xAI (GCP) as it works. A callout now appears both on the `grok-cli` / `grok-tui` provider cards and in the create/edit form (when the command is `grok`) — before you enable it — telling you to add `[harness]` / `disable_codebase_upload = true` to `~/.grok/config.toml` to keep your code local. The plain `grok` API provider — which doesn't run the harness — is intentionally excluded.
- **Layered Intelligence no longer wedges on a stale API-only provider.** Any install that ran the Layered Intelligence loop on an api provider (ollama/lmstudio/kimi) before it became agent-backed (#2322) had that provider carried into the per-app override by migration 184 — where it now outranks the global Schedule pin at spawn. The agent-backed loop needs a file-writing CLI/TUI harness, so those runs skipped with "the selected provider is an API-only model with no coding harness," and picking a CLI/TUI provider on the global Schedule page silently missed (it only sets the fallback pin). The loop now self-heals: an api-only per-app provider falls back to a CLI/TUI schedule pin (adopting its matched model), so the Schedule-page selection finally takes effect. It still skips with the actionable message only when no CLI/TUI provider is configured anywhere.
diff --git a/server/lib/README.md b/server/lib/README.md
index 6407b00f99..bb03a6c7bd 100644
--- a/server/lib/README.md
+++ b/server/lib/README.md
@@ -95,7 +95,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub
| `promptTemplate.js` | Mustache-flavored, dot-notation-aware prompt template engine. |
| `promptPartials.js` | Mustache-style partial expansion. |
| `mediaModels.js` | Single source of truth for image/video model metadata. |
-| `providerModels.js` | Provider model resolution sentinels + helpers (`CODEX_CONFIGURED_DEFAULT` / `ANTIGRAVITY_CONFIGURED_DEFAULT` / `GROK_CONFIGURED_DEFAULT`, `resolveCliModel`, `filterSelectableModels`, Bedrock/OpenCode model mappers, model-flag scan helpers, `isCodexProvider`) plus reasoning-effort helpers for the claude/codex CLIs (`CLAUDE_EFFORT_LEVELS` / `CODEX_EFFORT_LEVELS` / `EFFORT_LEVELS`, `effortLevelsForProvider`, `resolveCliEffort`, `hasEffortFlag`, and `buildEffortArgs` — the one emitter of `--effort <level>` / `-c model_reasoning_effort=<level>`). |
+| `providerModels.js` | Provider model resolution sentinels + helpers (`CODEX_CONFIGURED_DEFAULT` / `ANTIGRAVITY_CONFIGURED_DEFAULT` / `GROK_CONFIGURED_DEFAULT`, `resolveCliModel`, `filterSelectableModels`, Bedrock/OpenCode model mappers, model-flag scan helpers, `isCodexProvider`) plus reasoning-effort helpers for the claude/codex CLIs (`CLAUDE_EFFORT_LEVELS` / `CODEX_EFFORT_LEVELS` / `EFFORT_LEVELS`, `effortLevelsForProvider`, `resolveCliEffort`, `hasEffortFlag`, and `buildEffortArgs` — the one emitter of `--effort <level>` / `-c model_reasoning_effort=<level>`) plus codex startup-arg helpers (`CODEX_UPDATE_CHECK_KEY`, `hasCodexUpdateCheckConfig`, `buildCodexStartupArgs` — the one emitter of `-c check_for_update_on_startup=false`, spread by every codex spawn builder to disable the blocking startup update modal). |
| `modelPricing.js` | Per-model API billing rates for the /devtools/usage cost estimates — `resolveModelRates(providerId, model)` (exact → family regex → provider default → blended fallback, with a `matched` tier), `isFreeProvider` (ollama/lmstudio/`ollamaBacked`/localhost = free), `estimateCostUsd`, `PRICING_AS_OF`. Informational only (PortOS runs on subscriptions); excludes cache/batch/tier discounts. |
| `usageRange.js` | `resolveUsageRange({ period, from, to })` — pure period→inclusive-YYYY-MM-DD range resolution for the usage cost report (explicit dates win; `all` unbounded; default 7d). |
| `opencodeConfig.js` | OpenCode config builder — `buildOpencodeEnvVars(provider, model)` builds dynamic `OPENCODE_CONFIG_CONTENT` declaring the models map under `provider.ollama.models` (bare ids) for Ollama-backed OpenCode providers. Fixes --model rejection. |
diff --git a/server/lib/cliProviderArgs.js b/server/lib/cliProviderArgs.js
index dfc00de033..a8ae34affb 100644
--- a/server/lib/cliProviderArgs.js
+++ b/server/lib/cliProviderArgs.js
@@ -17,7 +17,7 @@
* - Claude Code: `-p -` (+ `--model <id>`)
*/
-import { resolveCliModel, hasModelFlag, resolveBedrockCliModel, prefixOpencodeModel, isOpencodeCommand } from './providerModels.js';
+import { resolveCliModel, hasModelFlag, resolveBedrockCliModel, prefixOpencodeModel, isOpencodeCommand, buildCodexStartupArgs } from './providerModels.js';
import { ensureAntigravityPrintArgs, isAntigravityCliProvider } from './antigravity.js';
import { isGrokCommand, ensureGrokHeadlessArgs } from './grok.js';
@@ -50,6 +50,10 @@ export function buildCliArgs(provider) {
if (providerId === 'codex') {
const hasExec = baseArgs.includes('exec');
const args = hasExec ? [...baseArgs] : [...baseArgs, 'exec'];
+ // Disable codex's startup update check (see buildCodexStartupArgs) so a run
+ // never stalls on the update-check network round-trip or an unattended
+ // `brew upgrade` it can't complete headless. No-op when the user pinned it.
+ args.push(...buildCodexStartupArgs(baseArgs));
if (effectiveDefaultModel) {
args.push('--model', effectiveDefaultModel);
}
diff --git a/server/lib/cliProviderArgs.test.js b/server/lib/cliProviderArgs.test.js
index 6d155d6923..053e2e96c3 100644
--- a/server/lib/cliProviderArgs.test.js
+++ b/server/lib/cliProviderArgs.test.js
@@ -62,14 +62,14 @@ describe('cliProviderArgs', () => {
defaultModel: 'gpt-5',
envVars: { CLAUDE_CODE_USE_BEDROCK: '1' },
});
- expect(args).toEqual(['exec', '--model', 'gpt-5', '-']);
+ expect(args).toEqual(['exec', '-c', 'check_for_update_on_startup=false', '--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', '-']);
+ expect(args).toEqual(['exec', '-c', 'check_for_update_on_startup=false', '--model', 'gpt-5.6-sol', '-']);
});
});
diff --git a/server/lib/providerModels.js b/server/lib/providerModels.js
index 29a0cdbd93..e5f3078b43 100644
--- a/server/lib/providerModels.js
+++ b/server/lib/providerModels.js
@@ -155,6 +155,43 @@ export function buildEffortArgs(effort, provider, existingArgs = []) {
: ['--effort', effectiveEffort];
}
+// Codex's config key (set via `-c <key>=<value>`) that gates its startup
+// update check. Kept as a named constant so a codex-side rename is a one-line
+// edit rather than a four-builder grep.
+export const CODEX_UPDATE_CHECK_KEY = 'check_for_update_on_startup';
+
+/**
+ * True when the codex argv already pins the startup-update-check config (a
+ * `-c check_for_update_on_startup=<v>` pair). Mirrors `hasEffortFlag`'s
+ * config-pin scan (null-safe, matches the value element of the pair) so a
+ * caller-supplied value wins over the injected default.
+ * @param {unknown[]} args
+ * @returns {boolean}
+ */
+export function hasCodexUpdateCheckConfig(args) {
+ if (!Array.isArray(args)) return false;
+ return args.some((a) => typeof a === 'string' && a.startsWith(`${CODEX_UPDATE_CHECK_KEY}=`));
+}
+
+/**
+ * The argv fragment that disables codex's interactive startup update check:
+ * `['-c', 'check_for_update_on_startup=false']`, or `[]` when a user-baked pin
+ * already sits in `existingArgs`. Codex checks GitHub for a newer release on
+ * every startup and, if one exists, an interactive run renders a BLOCKING
+ * "Update available! → 1. Update now" modal — a headless agent's submit-Enter
+ * lands on "Update now", triggering a ~100MB `brew upgrade` it can't complete,
+ * and the session dies without processing the prompt. Non-interactive `codex
+ * exec` runs never render the modal but still pay the check's network cost (and
+ * can trip an unattended upgrade), so every codex spawn builder spreads this.
+ * The one home for both the detection and the arg shape, so they can't drift.
+ * @param {unknown[]} [existingArgs]
+ * @returns {string[]}
+ */
+export function buildCodexStartupArgs(existingArgs = []) {
+ if (hasCodexUpdateCheckConfig(existingArgs)) return [];
+ return ['-c', `${CODEX_UPDATE_CHECK_KEY}=false`];
+}
+
/**
* True when a provider command points at the OpenCode binary — matching the bare
* `opencode` on PATH OR an absolute/relative path to it (`/opt/homebrew/bin/opencode`,
diff --git a/server/lib/providerModels.test.js b/server/lib/providerModels.test.js
index 6ffb20f024..28b3a47bbe 100644
--- a/server/lib/providerModels.test.js
+++ b/server/lib/providerModels.test.js
@@ -28,6 +28,9 @@ import {
resolveCliEffort,
hasEffortFlag,
buildEffortArgs,
+ CODEX_UPDATE_CHECK_KEY,
+ hasCodexUpdateCheckConfig,
+ buildCodexStartupArgs,
isCodexProvider
} from './providerModels.js';
@@ -246,6 +249,31 @@ describe('providerModels', () => {
});
});
+ describe('hasCodexUpdateCheckConfig', () => {
+ it('detects a baked check_for_update_on_startup config pair (any value)', () => {
+ expect(hasCodexUpdateCheckConfig(['-c', `${CODEX_UPDATE_CHECK_KEY}=false`])).toBe(true);
+ expect(hasCodexUpdateCheckConfig(['-c', `${CODEX_UPDATE_CHECK_KEY}=true`])).toBe(true);
+ });
+
+ it('is false for unrelated args, non-arrays, and non-string elements', () => {
+ expect(hasCodexUpdateCheckConfig(['-c', 'model_reasoning_effort=high'])).toBe(false);
+ expect(hasCodexUpdateCheckConfig(['exec', '-'])).toBe(false);
+ expect(hasCodexUpdateCheckConfig(null)).toBe(false);
+ expect(hasCodexUpdateCheckConfig([undefined, 42])).toBe(false);
+ });
+ });
+
+ describe('buildCodexStartupArgs', () => {
+ it('emits the update-check disable pair when nothing is pinned', () => {
+ expect(buildCodexStartupArgs()).toEqual(['-c', `${CODEX_UPDATE_CHECK_KEY}=false`]);
+ expect(buildCodexStartupArgs(['exec', '-'])).toEqual(['-c', `${CODEX_UPDATE_CHECK_KEY}=false`]);
+ });
+
+ it('returns [] when the user already pinned the key (their value wins)', () => {
+ expect(buildCodexStartupArgs(['-c', `${CODEX_UPDATE_CHECK_KEY}=true`])).toEqual([]);
+ });
+ });
+
describe('isConfiguredDefaultModel', () => {
it('matches every configured-default sentinel', () => {
expect(isConfiguredDefaultModel(CODEX_CONFIGURED_DEFAULT)).toBe(true);
diff --git a/server/lib/tuiHandshake.js b/server/lib/tuiHandshake.js
index 0b347a79e4..3398e00d6c 100644
--- a/server/lib/tuiHandshake.js
+++ b/server/lib/tuiHandshake.js
@@ -12,7 +12,7 @@
* No cycle risk: this module imports nothing from either consumer.
*/
-import { resolveCliModel, hasModelFlag, resolveBedrockCliModel, prefixOpencodeModel, isOpencodeCommand } from './providerModels.js';
+import { resolveCliModel, hasModelFlag, resolveBedrockCliModel, prefixOpencodeModel, isOpencodeCommand, buildCodexStartupArgs } from './providerModels.js';
import { ensureAntigravityTuiArgs, isAntigravityCommand } from './antigravity.js';
import { ensureGrokTuiArgs, isGrokCommand } from './grok.js';
@@ -795,9 +795,12 @@ export function rendersWorkCounter(commandName) {
// the CLI/exec path uses in `agentCliSpawning.js`. The bypass flag is mutually
// exclusive with `--ask-for-approval` / `--sandbox`, so don't add it when the
// provider config already pins an approval/sandbox/bypass policy of its own.
+// We ALSO disable codex's startup update check (see ensureCodexTuiArgs) —
+// independent of the approval posture, so it's injected even when a provider
+// pins its own policy.
export function applyCommandDefaults(command, args) {
- if (command === 'codex' && !codexHasApprovalPolicy(args)) {
- return ['--dangerously-bypass-approvals-and-sandbox', ...args];
+ if (command === 'codex') {
+ return ensureCodexTuiArgs(args);
}
if (isAntigravityCommand(command)) {
return ensureAntigravityTuiArgs(args);
@@ -808,6 +811,21 @@ export function applyCommandDefaults(command, args) {
return args;
}
+// Disable codex's startup update check (see buildCodexStartupArgs in
+// providerModels.js for the full "Update available!" modal failure mode) and
+// inject the full-yolo bypass. Both are prepended; the update-check disable is
+// independent of the approval posture (the modal is orthogonal to sandboxing),
+// so it rides even when a provider pins its own policy, while the bypass flag is
+// skipped when the argv already declares an approval/sandbox posture.
+function ensureCodexTuiArgs(args) {
+ const prefix = [];
+ if (!codexHasApprovalPolicy(args)) {
+ prefix.push('--dangerously-bypass-approvals-and-sandbox');
+ }
+ prefix.push(...buildCodexStartupArgs(args));
+ return prefix.length ? [...prefix, ...args] : args;
+}
+
// True when the codex argv already declares an approval/sandbox posture, so
// injecting `--dangerously-bypass-approvals-and-sandbox` would collide with it.
function codexHasApprovalPolicy(args) {
diff --git a/server/lib/tuiHandshake.test.js b/server/lib/tuiHandshake.test.js
index dd39937847..a91ad96b15 100644
--- a/server/lib/tuiHandshake.test.js
+++ b/server/lib/tuiHandshake.test.js
@@ -460,24 +460,42 @@ describe('tuiHandshake.inferTuiCommand', () => {
});
describe('tuiHandshake.applyCommandDefaults', () => {
- it('injects `--dangerously-bypass-approvals-and-sandbox` for codex when not already present', () => {
+ it('injects the bypass flag and disables the startup update check for codex when not already present', () => {
expect(applyCommandDefaults('codex', ['exec', '-'])).toEqual([
- '--dangerously-bypass-approvals-and-sandbox', 'exec', '-',
+ '--dangerously-bypass-approvals-and-sandbox', '-c', 'check_for_update_on_startup=false', 'exec', '-',
]);
});
- it('passes codex args through unchanged when --ask-for-approval is already present', () => {
+ it('skips the bypass flag but still disables the update check when --ask-for-approval is already present', () => {
const args = ['--ask-for-approval', 'auto-edit', 'exec', '-'];
- expect(applyCommandDefaults('codex', args)).toBe(args);
+ expect(applyCommandDefaults('codex', args)).toEqual([
+ '-c', 'check_for_update_on_startup=false', '--ask-for-approval', 'auto-edit', 'exec', '-',
+ ]);
});
- it('passes codex args through unchanged when --sandbox is already present', () => {
+ it('skips the bypass flag but still disables the update check when --sandbox is already present', () => {
const args = ['--sandbox', 'workspace-write', 'exec', '-'];
- expect(applyCommandDefaults('codex', args)).toBe(args);
+ expect(applyCommandDefaults('codex', args)).toEqual([
+ '-c', 'check_for_update_on_startup=false', '--sandbox', 'workspace-write', 'exec', '-',
+ ]);
});
it('does not duplicate the bypass flag when codex args already pin it', () => {
const args = ['--dangerously-bypass-approvals-and-sandbox', 'exec', '-'];
+ expect(applyCommandDefaults('codex', args)).toEqual([
+ '-c', 'check_for_update_on_startup=false', '--dangerously-bypass-approvals-and-sandbox', 'exec', '-',
+ ]);
+ });
+
+ it('does not duplicate the update-check config when codex args already pin it', () => {
+ const args = ['-c', 'check_for_update_on_startup=true', 'exec', '-'];
+ expect(applyCommandDefaults('codex', args)).toEqual([
+ '--dangerously-bypass-approvals-and-sandbox', '-c', 'check_for_update_on_startup=true', 'exec', '-',
+ ]);
+ });
+
+ it('returns the same codex arg list untouched when both policy and update-check are already pinned', () => {
+ const args = ['--dangerously-bypass-approvals-and-sandbox', '-c', 'check_for_update_on_startup=false', 'exec', '-'];
expect(applyCommandDefaults('codex', args)).toBe(args);
});
@@ -535,7 +553,7 @@ describe('tuiHandshake.buildTuiInvocation', () => {
const provider = { id: 'codex' };
const out = buildTuiInvocation(provider, null);
expect(out.command).toBe('codex');
- expect(out.args).toEqual(['--dangerously-bypass-approvals-and-sandbox']);
+ expect(out.args).toEqual(['--dangerously-bypass-approvals-and-sandbox', '-c', 'check_for_update_on_startup=false']);
});
it('appends --model when caller passes a model and provider.args has no model flag', () => {
@@ -560,13 +578,13 @@ describe('tuiHandshake.buildTuiInvocation', () => {
// resolveCliModel(CODEX_CONFIGURED_DEFAULT) returns null → no flag.
const provider = { id: 'codex', args: ['exec', '-'] };
const out = buildTuiInvocation(provider, CODEX_CONFIGURED_DEFAULT);
- expect(out.args).toEqual(['--dangerously-bypass-approvals-and-sandbox', 'exec', '-']);
+ expect(out.args).toEqual(['--dangerously-bypass-approvals-and-sandbox', '-c', 'check_for_update_on_startup=false', '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']);
+ expect(out.args).toEqual(['--dangerously-bypass-approvals-and-sandbox', '-c', 'check_for_update_on_startup=false', '--model', 'gpt-5.6-sol']);
});
it('skips --model injection when model is null/undefined/empty', () => {
diff --git a/server/services/agentCliSpawning.js b/server/services/agentCliSpawning.js
index 2dd1bee994..4760fd073b 100644
--- a/server/services/agentCliSpawning.js
+++ b/server/services/agentCliSpawning.js
@@ -27,7 +27,7 @@ import { PROVIDER_TYPES } from '../lib/aiToolkit/constants.js';
import { createImmediateFallbackSignalDetector } from '../lib/aiToolkit/errorDetection.js';
import { ensureAntigravityPrintArgs, isAntigravityCliProvider } from '../lib/antigravity.js';
import { isGrokCommand, ensureGrokHeadlessArgs, prepareGrokPromptFile } from '../lib/grok.js';
-import { resolveCliModel, buildEffortArgs, resolveBedrockCliModel, prefixOpencodeModel, hasModelFlag, isOpencodeCommand, applyLeanClaudeArgs, providerSuppliesGithubToken } from '../lib/providerModels.js';
+import { resolveCliModel, buildEffortArgs, buildCodexStartupArgs, resolveBedrockCliModel, prefixOpencodeModel, hasModelFlag, isOpencodeCommand, applyLeanClaudeArgs, providerSuppliesGithubToken } from '../lib/providerModels.js';
import { agentGuardEnv } from '../lib/agentGuard/index.js';
import { resolveForgeTokenEnv } from './git.js';
import { buildOpencodeEnvVars } from '../lib/opencodeConfig.js';
@@ -263,7 +263,11 @@ export function buildCliSpawnConfig(provider, model, settingsEnv = {}, { systemP
// sandboxed" context this flag documents), matching how we already spawn the
// other CLIs unrestricted.
if (providerId === 'codex') {
- const args = ['exec', '--dangerously-bypass-approvals-and-sandbox'];
+ // buildCodexStartupArgs disables codex's startup update check so a headless
+ // exec run never spends startup time hitting GitHub / kicking off a brew
+ // upgrade it can't complete unattended (the fatal interactive-modal variant
+ // is documented on buildCodexStartupArgs in providerModels.js).
+ const args = ['exec', '--dangerously-bypass-approvals-and-sandbox', ...buildCodexStartupArgs()];
if (effectiveModel) {
args.push('--model', effectiveModel);
}
diff --git a/server/services/agentCliSpawning.test.js b/server/services/agentCliSpawning.test.js
index 82644deb00..7b98cafccb 100644
--- a/server/services/agentCliSpawning.test.js
+++ b/server/services/agentCliSpawning.test.js
@@ -185,13 +185,13 @@ describe('buildCliSpawnConfig', () => {
// The bypass flag is the Codex equivalent of Claude/Antigravity's
// --dangerously-skip-permissions. Without it, codex exec runs sandboxed (no network → `gh`
// can't reach api.github.com) and non-interactive approval prompts get cancelled.
- expect(config.args).toEqual(['exec', '--dangerously-bypass-approvals-and-sandbox']);
+ expect(config.args).toEqual(['exec', '--dangerously-bypass-approvals-and-sandbox', '-c', 'check_for_update_on_startup=false']);
});
it('passes explicit Codex model selections through alongside the sandbox bypass', () => {
const config = buildCliSpawnConfig({ id: 'codex', command: 'codex' }, 'gpt-5.4');
- expect(config.args).toEqual(['exec', '--dangerously-bypass-approvals-and-sandbox', '--model', 'gpt-5.4']);
+ expect(config.args).toEqual(['exec', '--dangerously-bypass-approvals-and-sandbox', '-c', 'check_for_update_on_startup=false', '--model', 'gpt-5.4']);
});
it('uses agy print mode for Antigravity without model flags', () => {
@@ -283,8 +283,7 @@ describe('buildCliSpawnConfig', () => {
describe('reasoning-effort override', () => {
it('adds a -c model_reasoning_effort pair for codex', () => {
const config = buildCliSpawnConfig({ id: 'codex', command: 'codex' }, 'gpt-5.4', {}, { effort: 'xhigh' });
- const idx = config.args.indexOf('-c');
- expect(config.args[idx + 1]).toBe('model_reasoning_effort=xhigh');
+ expect(config.args).toContain('model_reasoning_effort=xhigh');
});
it('adds --effort for claude', () => {
@@ -298,7 +297,9 @@ describe('buildCliSpawnConfig', () => {
});
it('omits the flag entirely when no effort is set or the provider has no effort control', () => {
- expect(buildCliSpawnConfig({ id: 'codex', command: 'codex' }, 'gpt-5.4').args).not.toContain('-c');
+ // Codex always carries `-c check_for_update_on_startup=false`, so assert the
+ // absence of the EFFORT config pair specifically, not any `-c`.
+ expect(buildCliSpawnConfig({ id: 'codex', command: 'codex' }, 'gpt-5.4').args.join(' ')).not.toContain('model_reasoning_effort');
expect(buildCliSpawnConfig({ id: 'claude-code', command: 'claude' }, null).args).not.toContain('--effort');
const grok = buildCliSpawnConfig({ id: 'grok-cli', command: 'grok', args: [] }, null, {}, { effort: 'high' });
expect(grok.args.join(' ')).not.toContain('effort');
diff --git a/server/services/agentTuiSpawning.test.js b/server/services/agentTuiSpawning.test.js
index b22e397984..d66550fa06 100644
--- a/server/services/agentTuiSpawning.test.js
+++ b/server/services/agentTuiSpawning.test.js
@@ -181,8 +181,8 @@ describe('agent TUI spawning', () => {
}, 'codex-configured-default');
expect(config.command).toBe('codex');
- expect(config.args).toEqual(['--dangerously-bypass-approvals-and-sandbox']);
- expect(config.commandLine).toBe('codex --dangerously-bypass-approvals-and-sandbox');
+ expect(config.args).toEqual(['--dangerously-bypass-approvals-and-sandbox', '-c', 'check_for_update_on_startup=false']);
+ expect(config.commandLine).toBe('codex --dangerously-bypass-approvals-and-sandbox -c check_for_update_on_startup=false');
});
it('injects --dangerously-bypass-approvals-and-sandbox for codex TUI when not already set', () => {
@@ -192,17 +192,17 @@ describe('agent TUI spawning', () => {
type: 'tui',
args: ['--cd', '/tmp/work']
}, null);
- expect(config.args).toEqual(['--dangerously-bypass-approvals-and-sandbox', '--cd', '/tmp/work']);
+ expect(config.args).toEqual(['--dangerously-bypass-approvals-and-sandbox', '-c', 'check_for_update_on_startup=false', '--cd', '/tmp/work']);
});
- it('does not inject the bypass flag when the provider config already pins an approval policy', () => {
+ it('skips the bypass flag but still disables the update check when the provider config pins an approval policy', () => {
const config = buildTuiSpawnConfig({
id: 'codex-tui',
command: 'codex',
type: 'tui',
args: ['--ask-for-approval', 'on-failure']
}, null);
- expect(config.args).toEqual(['--ask-for-approval', 'on-failure']);
+ expect(config.args).toEqual(['-c', 'check_for_update_on_startup=false', '--ask-for-approval', 'on-failure']);
});
it('does not inject the bypass flag for non-codex TUI commands', () => {
@@ -270,8 +270,8 @@ describe('agent TUI spawning', () => {
it('omits the --model flag when model is null/empty', () => {
const config = buildTuiSpawnConfig({ id: 'codex-tui', command: 'codex', type: 'tui', args: [] }, null);
- expect(config.args).toEqual(['--dangerously-bypass-approvals-and-sandbox']);
- expect(config.commandLine).toBe('codex --dangerously-bypass-approvals-and-sandbox');
+ expect(config.args).toEqual(['--dangerously-bypass-approvals-and-sandbox', '-c', 'check_for_update_on_startup=false']);
+ expect(config.commandLine).toBe('codex --dangerously-bypass-approvals-and-sandbox -c check_for_update_on_startup=false');
});
it('adds --effort for a claude TUI and a -c model_reasoning_effort pair for a codex TUI', () => {
@@ -287,7 +287,7 @@ describe('agent TUI spawning', () => {
null,
{ effort: 'ultra' },
);
- expect(codex.args[codex.args.indexOf('-c') + 1]).toBe('model_reasoning_effort=ultra');
+ expect(codex.args).toContain('model_reasoning_effort=ultra');
expect(codex.args).not.toContain('--effort');
});
diff --git a/server/services/runner.test.js b/server/services/runner.test.js
index d465e1c0e1..edc1039b3b 100644
--- a/server/services/runner.test.js
+++ b/server/services/runner.test.js
@@ -509,13 +509,13 @@ describe('buildCliArgs — codex (regression coverage for the existing logic)',
it('omits --model when defaultModel is the sentinel', () => {
const provider = { id: 'codex', command: 'codex', args: [], defaultModel: 'codex-configured-default' };
const args = buildCliArgs(provider);
- expect(args).toEqual(['exec', '-']);
+ expect(args).toEqual(['exec', '-c', 'check_for_update_on_startup=false', '-']);
});
it('appends --model when a real model is given', () => {
const provider = { id: 'codex', command: 'codex', args: [], defaultModel: 'o4-mini' };
const args = buildCliArgs(provider);
- expect(args).toEqual(['exec', '--model', 'o4-mini', '-']);
+ expect(args).toEqual(['exec', '-c', 'check_for_update_on_startup=false', '--model', 'o4-mini', '-']);
});
});
@@ -543,7 +543,7 @@ describe('buildCliArgs — strips dangling --model from baseArgs before injectin
it('drops dangling --model on codex too (regression)', () => {
const provider = { id: 'codex', command: 'codex', args: ['--model'], defaultModel: 'o4-mini' };
const args = buildCliArgs(provider);
- expect(args).toEqual(['exec', '--model', 'o4-mini', '-']);
+ expect(args).toEqual(['exec', '-c', 'check_for_update_on_startup=false', '--model', 'o4-mini', '-']);
});
it('preserves a properly-pinned --model and does NOT inject our own', () => {
diff --git a/server/services/visionCli.js b/server/services/visionCli.js
index 7b85c91635..8b6dfcc1ff 100644
--- a/server/services/visionCli.js
+++ b/server/services/visionCli.js
@@ -29,7 +29,7 @@ import { tmpdir } from 'os';
import { join } from 'path';
import { buildCliArgs } from '../lib/cliProviderArgs.js';
import { prepareGrokPromptFile } from '../lib/grok.js';
-import { resolveCliModel, isCodexProvider } from '../lib/providerModels.js';
+import { resolveCliModel, isCodexProvider, buildCodexStartupArgs } from '../lib/providerModels.js';
import { extractCodexAssistant, extractCodexAssistantTail } from '../lib/codexAssistantExtract.js';
import { killProcessTree, resolveWindowsExecutable, prepareWindowsSafeSpawn } from '../lib/bufferedSpawn.js';
@@ -75,6 +75,11 @@ export function buildCliVisionInvocation(provider, model, imageDir, prompt) {
const args = [
...(hasExec ? baseArgs : [...baseArgs, 'exec']),
'--skip-git-repo-check',
+ // Disable codex's startup update check (see buildCodexStartupArgs): this
+ // path runs under a hard vision timeout, so an update-check network stall
+ // or an unattended `brew upgrade` would blow the caption call. No-op when
+ // the user pinned the key in provider.args.
+ ...buildCodexStartupArgs(baseArgs),
'-i', imagePath,
...(codexModel ? ['-m', String(codexModel)] : []),
prompt,
diff --git a/server/services/visionCli.test.js b/server/services/visionCli.test.js
index 6d0c6ff0d4..5f6bfb6565 100644
--- a/server/services/visionCli.test.js
+++ b/server/services/visionCli.test.js
@@ -46,6 +46,9 @@ describe('buildCliVisionInvocation', () => {
expect(inv.args).toContain('-m');
expect(inv.args).toContain('gpt-5');
expect(inv.args[inv.args.length - 1]).toBe('describe'); // prompt is positional
+ // Codex's startup update check is disabled so it can't stall / brew-upgrade
+ // under the vision timeout.
+ expect(inv.args).toEqual(expect.arrayContaining(['-c', 'check_for_update_on_startup=false']));
expect(inv.stdin).toBeNull();
expect(inv.cwd).toBe('/tmp/x');
});