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
add selectable Codex model tier to the code-review reviewer
[._.]/ Adam Eivyc0ca58ab014c
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex cdb20a38db..f9b040d303 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -16,6 +16,8 @@- **Grok Build CLI/TUI no longer show a model picker — they use the binary's latest default, like Antigravity.** The CLI and TUI now store a `grok-configured-default` sentinel (same pattern as Codex / Antigravity), so provider/model dropdowns hide model selection and spawn paths omit `--model`, letting the local `grok` binary pick its current default. The xAI Grok **API** provider is unchanged and still lets you choose among chat models.+- **The Codex code reviewer now has a selectable model tier, like the Ollama/LM Studio reviewers.** AI Providers → Code Review Defaults gains a **Codex model** dropdown (shown only when `codex` is in the reviewer chain) populated from the Codex provider's model tiers (e.g. `gpt-5.6-luna` / `gpt-5.6-terra` / `gpt-5.6-sol`). Unlike the local-LLM reviewers — whose model the `/api/code-review/local` endpoint injects server-side — Codex is a CLI the review-loop follow-up agent invokes directly, so the chosen tier is threaded into the follow-up's prompt as `codex --model <id>`. Leave it blank to let the Codex CLI use its own default. The value persists to `settings.codeReview.codexModel` and rides along to the follow-up via `reviewLoopCodexModel`.+## Layered Intelligence- **Layered Intelligence now runs as a visible agent you can watch — and talk to in a TUI — instead of an invisible in-process handler.** It used to be a "handler-backed" task: on each fire it made one inline reasoning call and filed a tracker issue with no agent record, so it never appeared in the CoS queue or the Active Agents page and couldn't be interacted with mid-run. It's now a normal agent-backed scheduled task with two programmatic slots around the agent — a pre-agent step that gathers the app's goals/telemetry/open issues and builds the reasoning prompt, and a post-agent step that validates the agent's structured output and files exactly one deduplicated tracker issue. The reasoning run shows up as an agent like any other automation, and when you select a TUI provider/model you can attach to its terminal and message it while it thinks (`btw`). The "reasoner never writes code" guarantee is preserved by isolation: the agent runs in a throwaway git worktree that is discarded without a commit, push, or merge, so its only durable output is the structured result the filing step consumes. This generalizes into a reusable "programmatic-I/O task" mechanism (pre-agent input hook + post-agent output hook) for future task types that need deterministic data collection or output processing around an agent. Existing installs inherit the throwaway-worktree posture automatically on upgrade (schedule defaults are backfilled) — no migration needed. Per-app enable/interval/provider/model and behavior config (sources, scopes, rules, hand-off) are unchanged, and the Edit App → Intelligence "Last run" status still reflects filed/parked/skipped/no-op outcomes.diff --git a/client/src/components/cos/constants.js b/client/src/components/cos/constants.jsindex 16b95990e4..34f3decb9d 100644--- a/client/src/components/cos/constants.js+++ b/client/src/components/cos/constants.js@@ -91,7 +91,7 @@ export const REVIEWER_OPTIONS = [{ value: 'copilot', label: 'Copilot', description: 'GitHub Copilot (GitHub-only)' },{ value: 'claude', label: 'Claude', description: 'Claude CLI reviews the PR diff' },{ value: 'antigravity', label: 'Antigravity', description: 'Antigravity CLI (agy) reviews the PR diff' },- { value: 'codex', label: 'Codex', description: 'Codex CLI reviews the PR diff' },+ { value: 'codex', label: 'Codex', description: 'Codex CLI reviews the PR diff (optional model tier on AI Providers → Code Review Defaults)' },{ value: 'lmstudio', label: 'LM Studio', description: 'Local LM Studio model reviews the diff (set model on AI Providers)' },{ value: 'ollama', label: 'Ollama', description: 'Local Ollama model reviews the diff (set model on AI Providers)' }];diff --git a/client/src/components/providers/CodeReviewDefaultsPanel.jsx b/client/src/components/providers/CodeReviewDefaultsPanel.jsxindex ec741c3c29..2a50247350 100644--- a/client/src/components/providers/CodeReviewDefaultsPanel.jsx+++ b/client/src/components/providers/CodeReviewDefaultsPanel.jsx@@ -2,6 +2,7 @@ import { useEffect, useId, useMemo, useState } from 'react';import { ShieldCheck } from 'lucide-react';import toast from '../ui/Toast';import * as api from '../../services/api';+import { filterSelectableModels } from '../../utils/providers';import ReviewerPicker from '../cos/ReviewerPicker';import {DEFAULT_REVIEWERS,@@ -12,11 +13,14 @@ import {// task-type config didn't pin its own reviewers. Lives at the top of the AI// Providers page so adding a new provider and pointing reviews at it stay in// the same flow. Per-backend model dropdowns are shown only when the-// corresponding local-LLM reviewer is in the chain; the model list comes from-// `/api/local-llm/status` so it always reflects what's actually installed.+// corresponding reviewer is in the chain: the local-LLM (LM Studio / Ollama)+// lists come from `/api/local-llm/status` so they reflect what's actually+// installed, while the Codex tier list comes from the provider catalog+// (`/api/providers`) since Codex is a CLI reviewer, not a local backend.export default function CodeReviewDefaultsPanel() {const lmStudioSelectId = useId();const ollamaSelectId = useId();+ const codexSelectId = useId();const [loading, setLoading] = useState(true);const [saving, setSaving] = useState(false);const [reviewers, setReviewers] = useState(DEFAULT_REVIEWERS);@@ -24,14 +28,17 @@ export default function CodeReviewDefaultsPanel() {const [reviewerApplies, setReviewerApplies] = useState(false);const [lmstudioModel, setLmstudioModel] = useState('');const [ollamaModel, setOllamaModel] = useState('');+ const [codexModel, setCodexModel] = useState('');const [localLlmStatus, setLocalLlmStatus] = useState(null);+ const [codexProvider, setCodexProvider] = useState(null);useEffect(() => {let cancelled = false;Promise.all([api.getCodeReviewDefaults({ silent: true }).catch(() => null),api.getLocalLlmStatus({ silent: true }).catch(() => null),- ]).then(([defaults, status]) => {+ api.getProviders({ silent: true }).catch(() => null),+ ]).then(([defaults, status, providers]) => {if (cancelled) return;if (defaults) {setReviewers(Array.isArray(defaults.reviewers) && defaults.reviewers.length ? defaults.reviewers : DEFAULT_REVIEWERS);@@ -39,8 +46,12 @@ export default function CodeReviewDefaultsPanel() {setReviewerApplies(defaults.reviewerApplies === true);setLmstudioModel(defaults.lmstudioModel || '');setOllamaModel(defaults.ollamaModel || '');+ setCodexModel(defaults.codexModel || '');}setLocalLlmStatus(status || null);+ // Codex is a CLI reviewer, so its selectable model tiers come from the+ // provider catalog (not the local-LLM status probe the others use).+ setCodexProvider((providers?.providers || []).find((p) => p.id === 'codex') || null);setLoading(false);});return () => { cancelled = true; };@@ -48,6 +59,7 @@ export default function CodeReviewDefaultsPanel() {const needsLmStudio = reviewers.includes('lmstudio');const needsOllama = reviewers.includes('ollama');+ const needsCodex = reviewers.includes('codex');const lmStudioModels = useMemo(() => localLlmStatus?.lmstudio?.models?.map((m) => m.id).filter(Boolean) || [],@@ -57,6 +69,10 @@ export default function CodeReviewDefaultsPanel() {() => localLlmStatus?.ollama?.models?.map((m) => m.id).filter(Boolean) || [],[localLlmStatus]);+ const codexModels = useMemo(+ () => codexProvider ? filterSelectableModels(codexProvider.models || [codexProvider.defaultModel]) : [],+ [codexProvider]+ );const handleSave = async () => {setSaving(true);@@ -69,6 +85,7 @@ export default function CodeReviewDefaultsPanel() {reviewerApplies,lmstudioModel: lmstudioModel || undefined,ollamaModel: ollamaModel || undefined,+ codexModel: codexModel || undefined,};const ok = await api.updateSettings({ codeReview: payload }, { silent: true }).then(() => true)@@ -77,7 +94,9 @@ export default function CodeReviewDefaultsPanel() {if (ok) toast.success('Code Review Defaults saved');};- const renderModelPicker = (label, backend, value, setValue, options, selectId) => {+ // `emptyMessage` overrides the default local-LLM "install a model" hint so the+ // Codex picker (a CLI reviewer, not a local backend) shows relevant guidance.+ const renderModelPicker = (label, backend, value, setValue, options, selectId, emptyMessage = null) => {const status = localLlmStatus?.[backend];const unavailable = status && status.available === false;return (@@ -95,9 +114,9 @@ export default function CodeReviewDefaultsPanel() {</select>) : (<div className="text-xs text-amber-400/80">- {unavailable+ {emptyMessage || (unavailable? `${label} backend isn't reachable — start it from Settings → Local LLMs to load models.`- : `No ${label} models installed yet — add one in Settings → Local LLMs.`}+ : `No ${label} models installed yet — add one in Settings → Local LLMs.`)}</div>)}</div>@@ -111,7 +130,7 @@ export default function CodeReviewDefaultsPanel() {<h2 className="text-base font-semibold text-white">Code Review Defaults</h2></div><p className="text-xs text-gray-500">- Default Review Loop reviewer chain — used by ad-hoc CoS tasks and task-type schedules that haven't pinned their own. Local-LLM reviewers route the diff through PortOS's local code-review endpoint and run the model selected below.+ Default Review Loop reviewer chain — used by ad-hoc CoS tasks and task-type schedules that haven't pinned their own. Local-LLM reviewers route the diff through PortOS's local code-review endpoint; the Codex reviewer invokes the Codex CLI directly. Each runs the model selected below.</p>{loading ? (@@ -132,6 +151,7 @@ export default function CodeReviewDefaultsPanel() {{needsLmStudio && renderModelPicker('LM Studio', 'lmstudio', lmstudioModel, setLmstudioModel, lmStudioModels, lmStudioSelectId)}{needsOllama && renderModelPicker('Ollama', 'ollama', ollamaModel, setOllamaModel, ollamaModels, ollamaSelectId)}+ {needsCodex && renderModelPicker('Codex', 'codex', codexModel, setCodexModel, codexModels, codexSelectId, 'No selectable Codex models — configure the Codex provider on the AI Providers page (or leave blank to use the Codex CLI default).')}<div className="flex justify-end"><buttondiff --git a/server/lib/cosValidation.js b/server/lib/cosValidation.jsindex eb2ca86243..181e34ac97 100644--- a/server/lib/cosValidation.js+++ b/server/lib/cosValidation.js@@ -263,6 +263,9 @@ export const generateWeeklyDigestSchema = z.object({// up spawner reads it as the fallback for `reviewers` when none are passed in.// `lmstudioModel` / `ollamaModel` are the installed model ids the local-LLM// reviewer should run with (empty/undefined = pick the active default model).+// `codexModel` is the Codex CLI model tier (e.g. `gpt-5.6-sol`) threaded into+// the review-loop follow-up prompt as `codex --model <id>` (empty/undefined =+// let the Codex CLI pick its own default).export const codeReviewSettingsSchema = z.object({reviewers: z.preprocess(v => Array.isArray(v) ? v.map(r => (typeof r === 'string' ? (REVIEWER_ALIASES[r] ?? r) : r)) : v,@@ -272,6 +275,7 @@ export const codeReviewSettingsSchema = z.object({reviewerApplies: z.boolean().optional(),lmstudioModel: z.preprocess(emptyToUndefined, z.string().optional()),ollamaModel: z.preprocess(emptyToUndefined, z.string().optional()),+ codexModel: z.preprocess(emptyToUndefined, z.string().optional()),}).strict();// =============================================================================diff --git a/server/lib/validation.test.js b/server/lib/validation.test.jsindex 09f47e9fe7..d266576f66 100644--- a/server/lib/validation.test.js+++ b/server/lib/validation.test.js@@ -103,10 +103,17 @@ describe('validation.js', () => {reviewerApplies: true,lmstudioModel: 'qwen2.5-coder:7b',ollamaModel: 'codellama',+ codexModel: 'gpt-5.6-sol',})expect(r.success).toBe(true)})+ it('coerces an empty codexModel to undefined', () => {+ const r = codeReviewSettingsSchema.safeParse({ reviewers: ['codex'], codexModel: '' })+ expect(r.success).toBe(true)+ expect(r.data.codexModel).toBeUndefined()+ })+it('accepts an empty object (all fields optional)', () => {expect(codeReviewSettingsSchema.safeParse({}).success).toBe(true)})diff --git a/server/services/agentPromptBuilder.js b/server/services/agentPromptBuilder.jsindex d63e9e3b1b..be2f1eca7a 100644--- a/server/services/agentPromptBuilder.js+++ b/server/services/agentPromptBuilder.js@@ -264,6 +264,15 @@ export function buildReviewLoopFollowUpSection(metadata = {}, { verbose = false,const hasCopilot = reviewers.includes(DEFAULT_REVIEWER);const hasLocalLlm = reviewers.some(r => LOCAL_LLM_REVIEWERS.includes(r));const hasCli = reviewers.some(r => r !== DEFAULT_REVIEWER && !LOCAL_LLM_REVIEWERS.includes(r));+ // Optional Codex CLI model tier chosen on the Code Review Defaults panel.+ // Only surfaced when `codex` is actually one of the reviewers; the CLI takes+ // it as `codex --model <id>` (empty = let the Codex CLI use its own default).+ const codexModel = (reviewers.includes('codex') && typeof metadata.reviewLoopCodexModel === 'string' && metadata.reviewLoopCodexModel)+ ? metadata.reviewLoopCodexModel+ : '';+ const codexModelNote = codexModel+ ? ` When invoking the \`codex\` reviewer, pass its model tier: \`codex --model ${codexModel} …\`.`+ : '';const multi = reviewers.length > 1;// The system pre-requests the initial Copilot review only when copilot LEADS the// order; otherwise the agent must request it at copilot's turn (so Copilot reviews@@ -285,10 +294,10 @@ export function buildReviewLoopFollowUpSection(metadata = {}, { verbose = false,hasCopilot ? `**copilot**: ${copilotIsFirst? 'wait for the initial Copilot review the system already pre-requested (Copilot leads the list)': 'request a Copilot review when you reach its turn'} (poll every 5–15s, max 5 min/round), then re-request on later rounds.` : null,- hasCli ? `**codex / antigravity / claude**: invoke that CLI to review this branch's diff against its base (use the CLI's own base-diff mode or \`git diff <base-branch>...HEAD\`; on GitHub \`gh pr diff ${prNumber || ''}\` also works).` : null,+ hasCli ? `**codex / antigravity / claude**: invoke that CLI to review this branch's diff against its base (use the CLI's own base-diff mode or \`git diff <base-branch>...HEAD\`; on GitHub \`gh pr diff ${prNumber || ''}\` also works).${codexModelNote}` : null,hasLocalLlm ? `**lmstudio / ollama**: ${localLlmInvocation}` : null,].filter(Boolean).join(' ');- const singleCliInvocation = `Invoke the ${reviewerLabel} CLI to review this branch's diff against its base (use the CLI's own base-diff mode or \`git diff <base-branch>...HEAD\`; on GitHub \`gh pr diff ${prNumber || ''}\` also works). Capture its findings as concrete issues to address.`;+ const singleCliInvocation = `Invoke the ${reviewerLabel} CLI to review this branch's diff against its base (use the CLI's own base-diff mode or \`git diff <base-branch>...HEAD\`; on GitHub \`gh pr diff ${prNumber || ''}\` also works). Capture its findings as concrete issues to address.${codexModelNote}`;// Resolved sequentially so a future reviewer kind only adds one branch// instead of deepening the nested ternary.let waitOrInvokeStep;diff --git a/server/services/agentPromptBuilder.test.js b/server/services/agentPromptBuilder.test.jsindex eb9652060f..dd28c322c0 100644--- a/server/services/agentPromptBuilder.test.js+++ b/server/services/agentPromptBuilder.test.js@@ -468,6 +468,42 @@ describe('buildLightContextPrompt', () => {expect(prompt).toMatch(/For EACH reviewer in order/);});+ it('threads the configured Codex model tier into the CLI invocation when codex reviews', () => {+ const prompt = buildLightContextPrompt(+ makeTask({ metadata: {+ reviewLoopFollowUp: true,+ reviewLoopPRUrl: 'https://github.com/o/r/pull/9',+ reviewLoopPRBranch: 'b',+ reviewLoopPRNumber: 9,+ reviewLoopReviewers: ['codex'],+ reviewLoopCodexModel: 'gpt-5.6-sol',+ sourceTaskId: 'task-src-cx',+ }}),+ '/r',+ { branchName: 'b', worktreePath: '/tmp/wt' },+ isTruthyMeta);+ expect(prompt).toMatch(/codex --model gpt-5\.6-sol/);+ });++ it('omits the Codex model note when codex is not among the reviewers', () => {+ const prompt = buildLightContextPrompt(+ makeTask({ metadata: {+ reviewLoopFollowUp: true,+ reviewLoopPRUrl: 'https://github.com/o/r/pull/9',+ reviewLoopPRBranch: 'b',+ reviewLoopPRNumber: 9,+ reviewLoopReviewers: ['claude'],+ // Stale model tier from a prior codex config — must not leak into a+ // claude-only review.+ reviewLoopCodexModel: 'gpt-5.6-sol',+ sourceTaskId: 'task-src-noncx',+ }}),+ '/r',+ { branchName: 'b', worktreePath: '/tmp/wt' },+ isTruthyMeta);+ expect(prompt).not.toMatch(/--model gpt-5\.6-sol/);+ });+it('emits the local-LLM POST instruction when a local-LLM reviewer is configured', () => {const prompt = buildLightContextPrompt(makeTask({ metadata: {diff --git a/server/services/agentWorktreeCleanup.js b/server/services/agentWorktreeCleanup.jsindex 3243de1175..7194db2eba 100644--- a/server/services/agentWorktreeCleanup.js+++ b/server/services/agentWorktreeCleanup.js@@ -41,7 +41,7 @@ import { DEFAULT_REVIEWER, DEFAULT_REVIEWERS, DEFAULT_REVIEW_STOP_MODE, normaliz* the worktree branch into the source workspace because `gh pr merge` already handled it.* Otherwise, merges the worktree branch back to the source branch on success.*/-export async function cleanupAgentWorktree(agentId, success, { openPR = false, requestCopilotReview: shouldRequestCopilot = false, reviewers = DEFAULT_REVIEWERS, reviewStopMode = DEFAULT_REVIEW_STOP_MODE, reviewerApplies = false, skipMerge = false, description = null, agentOutput = null, originalTask = null } = {}) {+export async function cleanupAgentWorktree(agentId, success, { openPR = false, requestCopilotReview: shouldRequestCopilot = false, reviewers = DEFAULT_REVIEWERS, reviewStopMode = DEFAULT_REVIEW_STOP_MODE, reviewerApplies = false, codexModel = null, skipMerge = false, description = null, agentOutput = null, originalTask = null } = {}) {const { getAgent: getAgentState } = await import('./cos.js');const agentState = await getAgentState(agentId).catch(() => null);if (!agentState?.metadata?.isWorktree) return [];@@ -178,7 +178,8 @@ export async function cleanupAgentWorktree(agentId, success, { openPR = false, rsourceWorkspace,reviewers: reviewerList,reviewStopMode,- reviewerApplies+ reviewerApplies,+ codexModel}).catch(err => {emitLog('warn', `🤖 Failed to spawn review-loop follow-up for ${prResult.url}: ${err.message}`, { agentId, prUrl: prResult.url });warnings.push(`Review-loop follow-up spawn failed for ${prResult.url}: ${err.message}`);@@ -234,7 +235,7 @@ export async function cleanupAgentWorktree(agentId, success, { openPR = false, r* branch (via createWorktree's `existingBranch` option) so it can fix-and-push* without trampling concurrent agents.*/-export async function spawnReviewLoopFollowUp({ originalAgentId, originalTask, prUrl, prBranch, sourceWorkspace, reviewers = DEFAULT_REVIEWERS, reviewStopMode = DEFAULT_REVIEW_STOP_MODE, reviewerApplies = false }) {+export async function spawnReviewLoopFollowUp({ originalAgentId, originalTask, prUrl, prBranch, sourceWorkspace, reviewers = DEFAULT_REVIEWERS, reviewStopMode = DEFAULT_REVIEW_STOP_MODE, reviewerApplies = false, codexModel = null }) {if (!prUrl || !prBranch) return null;const parsedPr = git.parsePullRequestUrl(prUrl);@@ -280,6 +281,10 @@ export async function spawnReviewLoopFollowUp({ originalAgentId, originalTask, previewLoopReviewers: effectiveReviewers,reviewLoopStopMode: reviewStopMode,reviewLoopReviewerApplies: reviewerApplies,+ // Codex CLI model tier (e.g. `gpt-5.6-sol`) — only meaningful when `codex`+ // is in the reviewer list; the prompt threads it as `codex --model <id>`.+ // `codexModel` is already coerced to string|null upstream (resolveReviewLoopOptions).+ reviewLoopCodexModel: (effectiveReviewers.includes('codex') && codexModel) ? codexModel : null,sourceTaskId: originalTask?.id || null,sourceAgentId: originalAgentId || null,// This follow-up may legitimately exit with zero new commits when everydiff --git a/server/services/cleanupAgentWorktree.test.js b/server/services/cleanupAgentWorktree.test.jsindex 0a1d892334..2b0e6141dc 100644--- a/server/services/cleanupAgentWorktree.test.js+++ b/server/services/cleanupAgentWorktree.test.js@@ -601,7 +601,7 @@ describe('cleanupAgentWorktree - openPR path', () => {await cleanupAgentWorktree('agent-1', true, {openPR: true, requestCopilotReview: true, reviewers: ['copilot', 'codex', 'antigravity'],- reviewStopMode: 'on-findings', reviewerApplies: true, description: 'Build',+ reviewStopMode: 'on-findings', reviewerApplies: true, codexModel: 'gpt-5.6-sol', description: 'Build',originalTask: { id: 'task-orig', priority: 'MEDIUM', metadata: { app: 'sparsetree' }, description: 'Build' }});@@ -611,6 +611,24 @@ describe('cleanupAgentWorktree - openPR path', () => {expect(followUp.metadata.reviewLoopReviewers).toEqual(['copilot', 'codex', 'antigravity']);expect(followUp.metadata.reviewLoopStopMode).toBe('on-findings');expect(followUp.metadata.reviewLoopReviewerApplies).toBe(true);+ // Codex model tier rides along only because `codex` is in the list.+ expect(followUp.metadata.reviewLoopCodexModel).toBe('gpt-5.6-sol');+ });++ it('drops the Codex model tier when codex is not among the reviewers', async () => {+ git.push.mockResolvedValue(undefined);+ git.createPR.mockResolvedValue({ success: true, url: 'https://github.com/test/repo/pull/59' });+ git.requestCopilotReview.mockResolvedValue({ success: true });+ addTask.mockResolvedValue({ id: 'sys-rl-nc' });++ await cleanupAgentWorktree('agent-1', true, {+ openPR: true, requestCopilotReview: true, reviewers: ['copilot', 'claude'],+ codexModel: 'gpt-5.6-sol', description: 'Build',+ originalTask: { id: 'task-orig', priority: 'MEDIUM', metadata: { app: 'sparsetree' }, description: 'Build' }+ });++ const [followUp] = addTask.mock.calls[0];+ expect(followUp.metadata.reviewLoopCodexModel).toBeNull();});it('does NOT pre-request Copilot when it trails a CLI reviewer, but keeps it in the follow-up list', async () => {diff --git a/server/services/codeReview.js b/server/services/codeReview.jsindex b251ad69b0..1c5ba145c5 100644--- a/server/services/codeReview.js+++ b/server/services/codeReview.js@@ -59,6 +59,7 @@ export function pickCodeReviewDefaults(settings) {reviewerApplies: raw?.reviewerApplies === true,lmstudioModel: typeof raw?.lmstudioModel === 'string' && raw.lmstudioModel ? raw.lmstudioModel : null,ollamaModel: typeof raw?.ollamaModel === 'string' && raw.ollamaModel ? raw.ollamaModel : null,+ codexModel: typeof raw?.codexModel === 'string' && raw.codexModel ? raw.codexModel : null,}}@@ -94,6 +95,12 @@ export async function getCodeReviewDefaults() {* module doesn't have to import it directly — keeps validation.js as the* single source of truth for the reviewer enum & fallback rules.*+ * `codexModel` (the Codex CLI model tier for a `codex` reviewer) comes from the+ * Code Review Defaults panel. Unlike the local-LLM models — which the+ * `/api/code-review/local` endpoint injects server-side — the Codex CLI is+ * invoked directly by the follow-up agent, so this value has to ride along into+ * the follow-up's prompt.+ ** Errors in settings I/O fall back to the hardcoded defaults — settings read* failures shouldn't block agent completion.*/@@ -104,7 +111,8 @@ export async function resolveReviewLoopOptions(metadata, { normalize, isTruthyMeconst reviewerApplies = metadata?.reviewerApplies !== undefined? isTruthyMeta(metadata?.reviewerApplies): (defaults?.reviewerApplies === true)- return { reviewers, reviewStopMode, reviewerApplies }+ const codexModel = defaults?.codexModel || null+ return { reviewers, reviewStopMode, reviewerApplies, codexModel }}const CODE_REVIEW_SYSTEM_PROMPT = `You are a careful senior code reviewer. The user will paste a unified PR diff. Review only what the diff changes (not the whole repo). Produce findings as a markdown list grouped by severity:diff --git a/server/services/codeReview.test.js b/server/services/codeReview.test.jsindex 0d4195542b..d560f58ebd 100644--- a/server/services/codeReview.test.js+++ b/server/services/codeReview.test.js@@ -51,6 +51,7 @@ describe('codeReview helpers', () => {reviewerApplies: false,lmstudioModel: null,ollamaModel: null,+ codexModel: null,})expect(pickCodeReviewDefaults({})).toEqual({reviewers: ['copilot'],@@ -58,6 +59,7 @@ describe('codeReview helpers', () => {reviewerApplies: false,lmstudioModel: null,ollamaModel: null,+ codexModel: null,})})@@ -83,12 +85,14 @@ describe('codeReview helpers', () => {reviewerApplies: 'truthy-string',lmstudioModel: '',ollamaModel: 42,+ codexModel: '',},})expect(out.stopMode).toBe('all')expect(out.reviewerApplies).toBe(false)expect(out.lmstudioModel).toBeNull()expect(out.ollamaModel).toBeNull()+ expect(out.codexModel).toBeNull()})it('passes through a valid full payload', () => {@@ -99,6 +103,7 @@ describe('codeReview helpers', () => {reviewerApplies: true,lmstudioModel: 'qwen2.5-coder:7b',ollamaModel: 'codellama',+ codexModel: 'gpt-5.6-sol',},})expect(out).toEqual({@@ -107,6 +112,7 @@ describe('codeReview helpers', () => {reviewerApplies: true,lmstudioModel: 'qwen2.5-coder:7b',ollamaModel: 'codellama',+ codexModel: 'gpt-5.6-sol',})})})