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
fix: clear an effort whose control the newly-picked model hides (review round 1)
[._.]/ Adam Eivyeb8424dd6f61
diff --git a/client/src/components/ProviderModelSelector.jsx b/client/src/components/ProviderModelSelector.jsxindex f43f034862..be5a769b95 100644--- a/client/src/components/ProviderModelSelector.jsx+++ b/client/src/components/ProviderModelSelector.jsx@@ -50,7 +50,7 @@* providers, whose ids don't encode their family.*/import { useId } from 'react';-import { effectiveModelFor, effortLevelsForProvider, localToolUseHint, withToolUseOptionLabel } from '../utils/providers.js';+import { effectiveModelFor, effortLevelsForProvider, effortSurvivingModel, localToolUseHint, withToolUseOptionLabel } from '../utils/providers.js';import EffortSelect from './cos/EffortSelect.jsx';const SELECT_CLASS =@@ -116,7 +116,20 @@ export default function ProviderModelSelector({// renders null for a provider with no effort control, so gate the label+wrapper// on the same predicate or a non-effort provider gets an orphaned label.const showEffort = !!onEffortChange && !!effortLevelsForProvider(selectedProvider, effectiveModel);- const wrapperClass = layout === 'stacked' ? 'flex flex-col gap-1' : 'flex items-center gap-2';+ // Picking a model with NO effort tiers (Antigravity's ladder is per-model) makes+ // the select above disappear — so clear the effort with it, or the value stays in+ // state with no UI left to change it and every submit still sends it. Owned here+ // rather than by each caller so the rule can't be forgotten by the next picker.+ const handleModelChange = (value) => {+ onModelChange(value);+ if (!onEffortChange || !effort) return;+ const surviving = effortSurvivingModel(selectedProvider, value, effort);+ if (surviving !== effort) onEffortChange(surviving);+ };+ // `row` was sized for two selects; the effort control makes it three, which is+ // unreadable at phone width — stack until `sm` when it's showing.+ const rowClass = showEffort ? 'flex flex-col sm:flex-row sm:items-center gap-2' : 'flex items-center gap-2';+ const wrapperClass = layout === 'stacked' ? 'flex flex-col gap-1' : rowClass;return (<div className={wrapperClass}><div className="flex-1 min-w-0">@@ -142,7 +155,7 @@ export default function ProviderModelSelector({<selectid={modelSelectId}value={selectedModel}- onChange={(e) => onModelChange(e.target.value)}+ onChange={(e) => handleModelChange(e.target.value)}disabled={disabled || modelDisabled}title={compact ? 'Model' : undefined}aria-label={compact ? 'Model' : undefined}diff --git a/client/src/components/cos/TaskAddForm.jsx b/client/src/components/cos/TaskAddForm.jsxindex 88a9a0396a..97b986fb38 100644--- a/client/src/components/cos/TaskAddForm.jsx+++ b/client/src/components/cos/TaskAddForm.jsx@@ -7,7 +7,7 @@ import { processScreenshotUploads, processAttachmentUploads } from '../../servicimport { ATTACHMENT_ACCEPT } from '../../utils/fileUpload';import FilePickerButton from '../ui/FilePickerButton';import { formatBytes } from '../../utils/formatters';-import { effectiveModelFor, effortAwareModelOptions, isTuiProvider, isCliProvider, isProcessProvider, isCodexProvider, seedModelEffort } from '../../utils/providers';+import { effectiveModelFor, effortAwareModelOptions, effortSurvivingModel, isTuiProvider, isCliProvider, isProcessProvider, isCodexProvider, seedModelEffort } from '../../utils/providers';import { DEFAULT_PR_COMPLETION, DEFAULT_REVIEWERS, DEFAULT_REVIEW_STOP_MODE, PR_COMPLETION_OPTIONS, prCompletionOption } from './constants';import { clickableProps } from '../../lib/a11yKeyboard';import { slashdoLabel } from '../../lib/slashdoCatalog';@@ -639,7 +639,13 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = fa<selectid="task-model"value={newTask.model}- onChange={e => setNewTask(t => ({ ...t, model: e.target.value }))}+ onChange={e => setNewTask(t => ({+ ...t,+ model: e.target.value,+ // A model with no effort tiers hides the select below — clear the+ // value with it rather than submitting a level the UI stopped showing.+ effort: effortSurvivingModel(selectedProvider, e.target.value, t.effort),+ }))}className="w-full px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white text-sm min-h-[44px]"><option value="">Select model...</option>diff --git a/client/src/components/cos/tabs/ResumeAgentModal.jsx b/client/src/components/cos/tabs/ResumeAgentModal.jsxindex 939219dbe5..8eaf89aa0e 100644--- a/client/src/components/cos/tabs/ResumeAgentModal.jsx+++ b/client/src/components/cos/tabs/ResumeAgentModal.jsx@@ -6,7 +6,7 @@ import Modal from '../../ui/Modal';import FilePickerButton from '../../ui/FilePickerButton';import { FormField } from '../../ui/FormField';import EffortSelect from '../EffortSelect';-import { effectiveModelFor, effortAwareModelOptions, seedModelEffort } from '../../../utils/providers';+import { effectiveModelFor, effortAwareModelOptions, effortSurvivingModel, seedModelEffort } from '../../../utils/providers';export default function ResumeAgentModal({ agent, taskType = 'user', providers, apps, onSubmit, onClose }) {const taskDescription = agent.metadata?.taskDescription || agent.taskId || 'Resume previous task';@@ -231,7 +231,13 @@ export default function ResumeAgentModal({ agent, taskType = 'user', providers,<FormField label="Model" className="flex-1"><selectvalue={formData.model}- onChange={e => setFormData({ ...formData, model: e.target.value })}+ onChange={e => setFormData(d => ({+ ...d,+ model: e.target.value,+ // A model with no effort tiers hides the select beside it — clear+ // the value with it instead of resuming on a level the UI dropped.+ effort: effortSurvivingModel(selectedProvider, e.target.value, d.effort),+ }))}className="w-full px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white text-sm focus:border-port-accent focus:outline-hidden"disabled={!formData.provider}>diff --git a/client/src/components/cos/tabs/schedule/PipelineStageConfig.jsx b/client/src/components/cos/tabs/schedule/PipelineStageConfig.jsxindex d707b1a2d3..4b9fe34bdc 100644--- a/client/src/components/cos/tabs/schedule/PipelineStageConfig.jsx+++ b/client/src/components/cos/tabs/schedule/PipelineStageConfig.jsx@@ -1,4 +1,4 @@-import { effectiveModelFor, effortAwareModelOptions } from '../../../../utils/providers';+import { effectiveModelFor, effortAwareModelOptions, effortSurvivingModel } from '../../../../utils/providers';import { FormField } from '../../../ui/FormField';import EffortSelect from '../../EffortSelect';import { pipelineStages } from './scheduleConstants';@@ -23,6 +23,12 @@ export default function PipelineStageConfig({ taskType, config, providers, onUpddelete updated.model;delete updated.effort;}+ // A model with NO effort tiers (Antigravity's ladder is per-model) hides the+ // stage's effort select, so the stored value has to go with it — otherwise the+ // stage keeps a level the run can never use and no UI is left to clear it.+ if (field === 'model' && !effortSurvivingModel(providers?.find(p => p.id === stage.providerId), value, updated.effort)) {+ delete updated.effort;+ }return updated;});const updatedMeta = {diff --git a/client/src/hooks/useTaskModelPins.js b/client/src/hooks/useTaskModelPins.jsindex 1ecceeb0c8..3efca9883a 100644--- a/client/src/hooks/useTaskModelPins.js+++ b/client/src/hooks/useTaskModelPins.js@@ -1,5 +1,5 @@import { useState, useEffect, useCallback, useMemo } from 'react';-import { effortAwareModelOptions, mergeModelLists, resolveEffectiveProvider } from '../utils/providers';+import { effortAwareModelOptions, effortSurvivingModel, mergeModelLists, resolveEffectiveProvider } from '../utils/providers';/*** Provider / model / effort pins for one CoS scheduled task, shared by the@@ -9,7 +9,8 @@ import { effortAwareModelOptions, mergeModelLists, resolveEffectiveProvider } fr* Each change is written immediately (`'' → null` clears the pin) and rolled* back to the persisted value when the write fails. Picking a provider also* clears model + effort in the same PUT — a model from the previous provider- * would not resolve.+ * would not resolve. Picking a model clears the effort in the same PUT only when+ * that model has no effort tiers at all (see `changeModel`).** `saving` is the in-flight flag callers must use to gate any action that reads* these pins server-side (the "Run Now" button), per the repo's@@ -58,17 +59,25 @@ export function useTaskModelPins({ taskType, config, providers, activeProviderIdonBusyChange?.(false);}, [onUpdate, taskType, persisted, onBusyChange]);- // Provider is the only one that clears its siblings: a model (and the effort- // ladder behind it) belongs to the provider it came from.- const changeProvider = useCallback((next) => change({ providerId: next, model: '', effort: '' }), [change]);- const changeModel = useCallback((next) => change({ model: next }), [change]);- const changeEffort = useCallback((next) => change({ effort: next }), [change]);-const { provider, usingActive } = useMemo(() => resolveEffectiveProvider(providers, pins.providerId, activeProviderId),[providers, pins.providerId, activeProviderId]);+ // Provider is the only one that clears its siblings outright: a model (and the+ // effort ladder behind it) belongs to the provider it came from.+ const changeProvider = useCallback((next) => change({ providerId: next, model: '', effort: '' }), [change]);+ // Model clears the effort CONDITIONALLY, in the same write: picking a model with+ // no effort tiers (Antigravity's ladder is per-model) hides the effort select,+ // and a stored level with no UI left to change it would keep being sent on every+ // run — an invocation agy rejects. A merely narrowed ladder is left alone, since+ // EffortSelect still renders the clamp as a visible option.+ const changeModel = useCallback((next) => {+ const surviving = effortSurvivingModel(provider, next, pins.effort);+ return change(surviving === pins.effort ? { model: next } : { model: next, effort: surviving });+ }, [change, provider, pins.effort]);+ const changeEffort = useCallback((next) => change({ effort: next }), [change]);+// Both surfaces that use these pins persist a separate effort, so Antigravity// lists BASE models (`gemini-3.6-flash`) with the tier picked beside them —// `effortAwareModelOptions` also keeps a legacy suffixed pin selectable, sincediff --git a/client/src/utils/providers.js b/client/src/utils/providers.jsindex f11ceaa336..c30b9123c0 100644--- a/client/src/utils/providers.js+++ b/client/src/utils/providers.js@@ -343,6 +343,31 @@ export const effortLevelsForProvider = (provider, model = null) => {return null;};+/**+ * The effort a picker should keep after its MODEL changed under a fixed provider:+ * the current one, or `''` when the new model has no effort control at all.+ *+ * Antigravity's tiers are per-model, and a model with NO tiers hides the select+ * entirely (`effortLevelsForProvider` → null — `claude-sonnet-4-6` in the shipped+ * agy catalog has no `-low|-medium|-high` siblings). Without this the previous+ * effort stays in state with no UI left to clear it, and every submit path still+ * sends it: an invocation agy rejects (`--model claude-sonnet-4-6 --effort high`)+ * and, on the records that persist it, a stored level the run never used.+ *+ * A merely NARROWED ladder is deliberately left alone — `EffortSelect` renders an+ * explicit `medium (runs as low)` option there, so the clamp stays visible rather+ * than silently discarding the user's choice.+ *+ * CLIENT-ONLY (no server mirror) — the server clamps what it is sent; this keeps+ * the UI from sending something it stopped showing.+ * @param {{id?:string, command?:string, models?:unknown[], defaultModel?:string}|null|undefined} provider+ * @param {string|null|undefined} model - the NEWLY selected model+ * @param {string|null|undefined} effort - the currently selected effort+ * @returns {string}+ */+export const effortSurvivingModel = (provider, model, effort) =>+ (effortLevelsForProvider(provider, effectiveModelFor(provider, model)) ? (effort || '') : '');+// Every effort value any CLI accepts, weakest→strongest. MIRROR of EFFORT_RANK// in server/lib/providerModels.js — keep in lockstep.const EFFORT_RANK = Object.freeze(['minimal', 'low', 'medium', 'high', 'xhigh', 'max', 'ultra']);diff --git a/client/src/utils/providers.test.js b/client/src/utils/providers.test.jsindex 85fea499f8..4bec496387 100644--- a/client/src/utils/providers.test.js+++ b/client/src/utils/providers.test.js@@ -53,6 +53,7 @@ import {withStaleAntigravityPin,effortAwareModelOptions,effectiveModelFor,+ effortSurvivingModel,seedModelEffort,} from './providers.js';import { PROVIDER_TYPES as SERVER_PROVIDER_TYPES } from '../../../server/lib/aiToolkit/constants.js';@@ -263,6 +264,44 @@ describe('Antigravity base-model split (server mirror)', () => {expect(seedModelEffort(agy, null, null)).toEqual({ model: '', effort: '' });});});++ // A model with no tiers HIDES the effort select. Without this the previous+ // effort sat in state with no UI left to clear it, and every submit still sent+ // it — an invocation agy rejects, plus a persisted level the run never used.+ describe('effortSurvivingModel', () => {+ const agy = { id: 'antigravity-cli', command: 'agy', models: CATALOG, defaultModel: ANTIGRAVITY_CONFIGURED_DEFAULT };++ it('drops the effort when the newly-picked model has no tiers at all', () => {+ // `claude-sonnet-4-6` ships in the agy catalog with no -low/-medium/-high+ // siblings, so effortLevelsForProvider returns null and the select vanishes.+ expect(effortSurvivingModel(agy, 'claude-sonnet-4-6', 'high')).toBe('');+ });++ it('keeps an effort the new model still offers', () => {+ expect(effortSurvivingModel(agy, 'gemini-3.6-flash', 'high')).toBe('high');+ });++ it('keeps an out-of-ladder effort when the ladder merely NARROWS', () => {+ // gemini-3.1-pro has no `medium`, but EffortSelect renders an explicit+ // "medium (runs as low)" option — the clamp stays visible, so don't+ // silently discard what the user picked.+ expect(effortSurvivingModel(agy, 'gemini-3.1-pro', 'medium')).toBe('medium');+ });++ it('falls back to the provider default when the model is cleared', () => {+ // Blank model = "use the provider default", which for agy is the sentinel —+ // an UNKNOWN model, so the full ladder applies and the effort survives.+ expect(effortSurvivingModel(agy, '', 'high')).toBe('high');+ });++ it('drops the effort for a provider with no effort control at all', () => {+ expect(effortSurvivingModel({ id: 'grok-cli', command: 'grok' }, 'grok-4', 'high')).toBe('');+ });++ it('normalizes a nullish effort to the empty sentinel', () => {+ expect(effortSurvivingModel(agy, 'gemini-3.6-flash', null)).toBe('');+ });+ });});// Regression guard for the provider-edit form: an Antigravity provider publishesdiff --git a/server/services/games/feedback.js b/server/services/games/feedback.jsindex 7f4812ccf5..12c98d296b 100644--- a/server/services/games/feedback.js+++ b/server/services/games/feedback.js@@ -4,7 +4,6 @@import { randomUUID } from 'crypto';import { ServerError } from '../../lib/errorHandler.js';-import { buildEffortArgs } from '../../lib/providerModels.js';import {resolveEffectiveModel,runPromptThroughProvider,@@ -72,10 +71,16 @@ export async function requestGameFeedback(id, { providerId, model, effort, prompthrow new ServerError('Choose an enabled AI provider', { status: 400, code: 'PROVIDER_UNAVAILABLE' });}const selectedModel = resolveEffectiveModel(provider, model);- const effortArgs = buildEffortArgs(effort, provider, provider.args || []);+ // Effort rides the runner's own first-class argument rather than being baked+ // into `provider.args` here: the runner clamps it against the provider AND the+ // selected model, which Antigravity requires — agy validates the PAIR and+ // rejects `--model gemini-3.1-pro --effort medium`. Hand-baking it (as this+ // predated #3480 doing) resolved against the provider-wide ladder only, so a+ // tier the chosen model doesn't offer produced an invocation agy refuses.const run = await runPromptThroughProvider({- provider: effortArgs.length ? { ...provider, args: [...(provider.args || []), ...effortArgs] } : provider,+ provider,model: selectedModel ?? undefined,+ effort: effort || undefined,prompt: await buildGameFeedbackPrompt(game, prompt),source: 'game-asset-feedback',});diff --git a/server/services/games/feedback.test.js b/server/services/games/feedback.test.jsindex d9d6266079..491e61120b 100644--- a/server/services/games/feedback.test.js+++ b/server/services/games/feedback.test.js@@ -72,12 +72,16 @@ describe('requestGameFeedback', () => {prompt: 'Review the bundle.',});expect(getProviderById).toHaveBeenCalledWith('codex');+ // The effort rides the runner's own `effort` argument rather than being baked+ // into `provider.args` here. That is what makes it MODEL-clamped: Antigravity+ // validates the model/effort PAIR (`gemini-3.1-pro` has no `medium`), and a+ // hand-baked flag resolves against the provider-wide ladder only. So assert the+ // provider is forwarded UNMODIFIED — a regression that re-bakes the flag would+ // both fail the `args: []` match and re-introduce the unclamped invocation.expect(runPromptThroughProvider).toHaveBeenCalledWith(expect.objectContaining({- provider: expect.objectContaining({- id: 'codex',- args: ['-c', 'model_reasoning_effort=high'],- }),+ provider: expect.objectContaining({ id: 'codex', args: [] }),model: 'gpt-5.6-terra',+ effort: 'high',source: 'game-asset-feedback',}));expect(result.feedback).toEqual(expect.objectContaining({