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
address review (codex): respect baked --model pin in OpenCode CoS TUI path
Adam Eivy3672425e2a84
diff --git a/server/services/agentTuiSpawning.js b/server/services/agentTuiSpawning.jsindex a5420c7dd2..bf1ac63b4a 100644--- a/server/services/agentTuiSpawning.js+++ b/server/services/agentTuiSpawning.js@@ -17,7 +17,7 @@ import { analyzeAgentFailure } from './agentErrorAnalysis.js';import { finalizeAgent, releaseAgentLane } from './agentLifecycle.js';import { activeAgents, userTerminatedAgents, pausedAgents } from './agentState.js';import { PATHS } from '../lib/fileUtils.js';-import { resolveCliModel, resolveBedrockCliModel, prefixOpencodeModel } from '../lib/providerModels.js';+import { resolveCliModel, resolveBedrockCliModel, prefixOpencodeModel, hasModelFlag } from '../lib/providerModels.js';import { createStreamingAnsiStripper, stripAnsi } from '../lib/ansiStrip.js';import { createImmediateFallbackSignalDetector } from '../lib/aiToolkit/errorDetection.js';import { isAntigravityCommand } from '../lib/antigravity.js';@@ -183,7 +183,10 @@ function appendModelArgs(args, model, command, provider) {if (!effectiveModel) return args;// OpenCode TUI launches with `opencode --model ollama/<id>` (the top-level// flag preselects the model). Namespace the bare Ollama id; no Bedrock mapping.+ // Respect a user-baked --model/-m pin (mirrors buildTuiInvocation/buildCliArgs)+ // rather than appending a second flag that overrides it.if (command === 'opencode') {+ if (hasModelFlag(args)) return args;return [...args, '--model', prefixOpencodeModel(provider, effectiveModel)];}// Bedrock box: map a bare Claude id to its region-prefixed form just-in-timediff --git a/server/services/agentTuiSpawning.test.js b/server/services/agentTuiSpawning.test.jsindex 8a1ce22544..fdaf7c9d1c 100644--- a/server/services/agentTuiSpawning.test.js+++ b/server/services/agentTuiSpawning.test.js@@ -106,7 +106,9 @@ vi.mock('../lib/providerModels.js', () => ({resolveBedrockCliModel: vi.fn((m) => m),// Mirror the real ollama/ namespacing for opencode providers (fully unit-// tested in providerModels.test.js).- prefixOpencodeModel: vi.fn((p, m) => (p?.command === 'opencode' && p?.ollamaBacked === true && m && !String(m).startsWith('ollama/')) ? `ollama/${m}` : m)+ prefixOpencodeModel: vi.fn((p, m) => (p?.command === 'opencode' && p?.ollamaBacked === true && m && !String(m).startsWith('ollama/')) ? `ollama/${m}` : m),+ // Mirror hasModelFlag (real impl unit-tested in providerModels.test.js).+ hasModelFlag: vi.fn((a) => Array.isArray(a) && a.some((x) => x === '--model' || x === '-m' || (typeof x === 'string' && (x.startsWith('--model=') || x.startsWith('-m=')))))}));// Shrink buffer thresholds so the truncation tests can trip them with tiny@@ -223,6 +225,14 @@ describe('agent TUI spawning', () => {expect(config.args).toEqual(['--model', 'ollama/qwen2.5:7b']);});+ it('respects a user-baked --model pin on an OpenCode TUI and does not duplicate it', () => {+ const config = buildTuiSpawnConfig({+ id: 'opencode-ollama-tui', type: 'tui', command: 'opencode',+ args: ['--model', 'ollama/custom'], ollamaBacked: true,+ }, 'qwen2.5:7b');+ expect(config.args).toEqual(['--model', 'ollama/custom']);+ });+it('falls back to the default command via id heuristic when command is omitted', () => {const codexConfig = buildTuiSpawnConfig({ id: 'my-codex-instance', type: 'tui' }, null);expect(codexConfig.command).toBe('codex');