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
simplify pass on the effort override: one codex predicate, clearable update pin, resolved-command keying
[._.]/ Adam Eivy96ffe64b62a5
diff --git a/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx b/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsxindex e69db4b4be..348f46ff6c 100644--- a/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx+++ b/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx@@ -106,25 +106,19 @@ export default function GlobalConfigControls({ taskType, config, onUpdate, onTrisetUpdating(false);};- const handleModelChange = async (newModel) => {+ // Optimistic single-field update: set locally, PUT ('' → null clears the+ // pin), roll back to the persisted value on failure. Shared by the model and+ // effort selects (provider has its own handler — it also resets these two).+ const makeScalarFieldHandler = (field, setter) => async (newValue) => {setUpdating(true);- setSelectedModel(newModel);- const model = newModel === '' ? null : newModel;- await onUpdate(taskType, { model }).catch(() => {- setSelectedModel(config.model || '');- });- setUpdating(false);- };-- const handleEffortChange = async (newEffort) => {- setUpdating(true);- setSelectedEffort(newEffort);- const effort = newEffort === '' ? null : newEffort;- await onUpdate(taskType, { effort }).catch(() => {- setSelectedEffort(config.effort || '');+ setter(newValue);+ await onUpdate(taskType, { [field]: newValue === '' ? null : newValue }).catch(() => {+ setter(config[field] || '');});setUpdating(false);};+ const handleModelChange = makeScalarFieldHandler('model', setSelectedModel);+ const handleEffortChange = makeScalarFieldHandler('effort', setSelectedEffort);const handlePrAuthorFilterChange = async (value) => {setUpdating(true);diff --git a/client/src/utils/README.md b/client/src/utils/README.mdindex 574958b691..95be1edfac 100644--- a/client/src/utils/README.md+++ b/client/src/utils/README.md@@ -36,7 +36,7 @@ grep -i "what you want to do" client/src/utils/README.md| `urlNormalize` | `isUrl` detection and `normalizeUrl` (optional git/`requireDot` modes). || `platform` | `isMac` detection and `modKey` (⌘/Ctrl) for keyboard-shortcut display. || `navWorkingSet` | Recent/pinned nav persistence in localStorage (`recordVisit`, `togglePin`, `isPinned`). |-| `providers` | AI-provider type predicates and helpers (`isCliProvider`, `isApiProvider`, `filterSelectableModels`, `getProviderTimeout`, configured-default sentinels). |+| `providers` | AI-provider type predicates and helpers (`isCliProvider`, `isApiProvider`, `isCodexProvider`, `filterSelectableModels`, `getProviderTimeout`, configured-default sentinels, and the claude/codex thinking-effort levels — `effortLevelsForProvider`, mirror of server `providerModels.js`). || `layeredIntelligenceReasons` | Canonical gloss for the Layered Intelligence loop's run-outcome reason tokens, shared by the on-demand toast and the durable "Last run" line (`formatLiReason`, `liReasonTone`, `LI_NEUTRAL_REASONS`). |## Module loading / resiliencediff --git a/server/lib/README.md b/server/lib/README.mdindex bb69ceeab3..6407b00f99 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). |+| `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>`). || `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/cosValidation.js b/server/lib/cosValidation.jsindex 709cb129cb..45f8ab348d 100644--- a/server/lib/cosValidation.js+++ b/server/lib/cosValidation.js@@ -284,9 +284,14 @@ const cosTaskDiagnosticsSchema = z.object({failureReason: z.string().optional(),}).passthrough();-// Reasoning-effort override for effort-capable CLIs (claude/codex). '' from a-// form's "Default" option → undefined (no override persisted).+// Reasoning-effort override for effort-capable CLIs (claude/codex). On create,+// '' from a form's "Default" option → undefined (no override persisted). On+// update, ''/null must survive as null so the store's legacy-field normalizer+// deletes the pin (absent-vs-cleared, CLAUDE.md) — emptyToUndefined would drop+// the clear signal at the route's `!== undefined` gate and make a set effort+// permanent through the API.const effortInputSchema = z.preprocess(emptyToUndefined, z.enum(EFFORT_LEVELS).optional());+const effortUpdateSchema = z.preprocess(emptyToNull, z.enum(EFFORT_LEVELS).nullable().optional());export const createCosTaskSchema = z.object({description: z.string().min(1),@@ -361,7 +366,7 @@ export const updateCosTaskSchema = z.object({context: z.string().optional(),model: z.string().optional(),provider: z.string().optional(),- effort: effortInputSchema,+ effort: effortUpdateSchema,app: z.string().optional(),blockedReason: z.string().optional(),type: z.string().optional().default('user'),diff --git a/server/lib/cosValidation.test.js b/server/lib/cosValidation.test.jsnew file mode 100644index 0000000000..7d0431b0ca--- /dev/null+++ b/server/lib/cosValidation.test.js@@ -0,0 +1,28 @@+import { describe, it, expect } from 'vitest';+import { createCosTaskSchema, updateCosTaskSchema } from './cosValidation.js';+import { EFFORT_LEVELS } from './providerModels.js';++describe('cosValidation effort field', () => {+ it('accepts every EFFORT_LEVELS value on create and rejects unknown values', () => {+ for (const effort of EFFORT_LEVELS) {+ expect(createCosTaskSchema.safeParse({ description: 'x', effort }).success).toBe(true);+ }+ expect(createCosTaskSchema.safeParse({ description: 'x', effort: 'bogus' }).success).toBe(false);+ });++ it("create: '' (the form's Default option) parses to absent, not a stored empty pin", () => {+ const parsed = createCosTaskSchema.parse({ description: 'x', effort: '' });+ expect('effort' in parsed && parsed.effort !== undefined).toBe(false);+ });++ it("update: ''/null survive as null so the API can CLEAR a set effort pin", () => {+ // absent-vs-cleared (CLAUDE.md): the route gates on `!== undefined`, and the+ // store's legacy-field normalizer deletes a null pin — so the clear signal+ // must reach the route as null, not be preprocessed away to undefined.+ expect(updateCosTaskSchema.parse({ effort: '' }).effort).toBeNull();+ expect(updateCosTaskSchema.parse({ effort: null }).effort).toBeNull();+ expect(updateCosTaskSchema.parse({ effort: 'high' }).effort).toBe('high');+ expect(updateCosTaskSchema.parse({}).effort).toBeUndefined();+ expect(updateCosTaskSchema.safeParse({ effort: 'bogus' }).success).toBe(false);+ });+});diff --git a/server/lib/stageRunner.js b/server/lib/stageRunner.jsindex 06e1b5f192..e527a2c7f0 100644--- a/server/lib/stageRunner.js+++ b/server/lib/stageRunner.js@@ -20,7 +20,7 @@ import { resolveEffectiveModel, runPromptThroughProvider, DEFAULT_TIMEOUT_MS, isimport { stripCodeFences } from './aiProvider.js';import { extractCodexAssistant } from './codexAssistantExtract.js';import { getActiveProvider, getProviderById } from '../services/providers.js';-import { commandBasename } from './providerModels.js';+import { commandBasename, isCodexProvider } from './providerModels.js';import { buildPrompt, getStage } from '../services/promptService.js';import { createRun, patchRunMetadata } from '../services/runner.js';import { MIN_TIMEOUT as STAGE_TIMEOUT_MIN_MS, MAX_TIMEOUT as STAGE_TIMEOUT_MAX_MS } from './aiToolkit/constants.js';@@ -150,7 +150,7 @@ export function knownProviderContextWindow(provider) {// resolves the same vendor window as a bare `grok` on PATH — matching how the// arg-builder predicates (isOpencodeCommand/isGrokCommand) key on commandBasename.const command = commandBasename(provider?.command);- if (id === 'codex' || id === 'codex-tui' || command === 'codex') return CODEX_CONTEXT_WINDOW;+ if (isCodexProvider(provider)) return CODEX_CONTEXT_WINDOW;if (id === 'antigravity-cli' || id === 'antigravity-tui' || command === 'agy') return GEMINI_CONTEXT_WINDOW;if (id === 'grok-cli' || id === 'grok-tui' || command === 'grok') return GROK_CONTEXT_WINDOW;return null;diff --git a/server/services/agentCliSpawning.js b/server/services/agentCliSpawning.jsindex 24ce57d6ea..2dd1bee994 100644--- a/server/services/agentCliSpawning.js+++ b/server/services/agentCliSpawning.js@@ -350,11 +350,14 @@ export function buildCliSpawnConfig(provider, model, settingsEnv = {}, { systemPargs.push('--model', injectedModel);}// Per-task reasoning-effort override; a user-baked --effort in provider args- // wins (buildEffortArgs mirrors the hasModelFlag rule).- args.push(...buildEffortArgs(effort, provider, args));+ // wins (buildEffortArgs mirrors the hasModelFlag rule). Keyed on the RESOLVED+ // launch command — not the raw provider — so a blank-command claude provider+ // still qualifies, matching the TUI builder's re-keying.+ const command = provider?.command || process.env.CLAUDE_PATH || 'claude';+ args.push(...buildEffortArgs(effort, { id: providerId, command }, args));return {- command: provider?.command || process.env.CLAUDE_PATH || 'claude',+ command,args,stdinMode: 'prompt',streamFormat: 'stream-json'diff --git a/server/services/agentCliSpawning.test.js b/server/services/agentCliSpawning.test.jsindex b868b6daf2..82644deb00 100644--- a/server/services/agentCliSpawning.test.js+++ b/server/services/agentCliSpawning.test.js@@ -304,6 +304,14 @@ describe('buildCliSpawnConfig', () => {expect(grok.args.join(' ')).not.toContain('effort');});+ it('keys effort on the RESOLVED command, so a blank-command claude provider still qualifies', () => {+ // id gives no claude-code* hint and command is blank; the builder resolves+ // the launch command to `claude`, so the effort pin must apply — matching+ // the TUI builder's re-keying (same pin, same behavior per execution mode).+ const config = buildCliSpawnConfig({ id: 'whatever' }, null, {}, { effort: 'high' });+ expect(config.args[config.args.indexOf('--effort') + 1]).toBe('high');+ });+it('never emits the claude-shaped --effort for a renamed codex provider (detection and emission agree)', () => {// id !== 'codex' routes this into the default (claude-style) branch, but// the effort arg shape must still follow the binary, not the branch.diff --git a/server/services/visionCli.js b/server/services/visionCli.jsindex e75923abf3..7b85c91635 100644--- a/server/services/visionCli.js+++ b/server/services/visionCli.js@@ -29,16 +29,16 @@ import { tmpdir } from 'os';import { join } from 'path';import { buildCliArgs } from '../lib/cliProviderArgs.js';import { prepareGrokPromptFile } from '../lib/grok.js';-import { resolveCliModel } from '../lib/providerModels.js';+import { resolveCliModel, isCodexProvider } from '../lib/providerModels.js';import { extractCodexAssistant, extractCodexAssistantTail } from '../lib/codexAssistantExtract.js';import { killProcessTree, resolveWindowsExecutable, prepareWindowsSafeSpawn } from '../lib/bufferedSpawn.js';const CLI_VISION_TIMEOUT_MS = 120000;const IMAGE_BASENAME = 'vision-input.png';-// Codex matches on id OR command so a renamed/duplicated codex provider still-// takes the `-i` path. Everything else uses the cwd-local-file convention.-const isCodexProvider = (provider) => provider?.id === 'codex' || provider?.command === 'codex';+// Codex matches on id OR command basename (via the shared isCodexProvider) so a+// renamed/duplicated/path-configured codex provider still takes the `-i` path.+// Everything else uses the cwd-local-file convention./*** Decode a `data:image/...;base64,...` URL to raw bytes. Throws on a malformed