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

fix(providers): render an option for the configured-default sentinel in the model pickers

[._.]/ Adam Eivy7db40db82632
diff --git a/client/src/pages/AIProviders.jsx b/client/src/pages/AIProviders.jsx
index 580446f83e..7268d03981 100644
--- a/client/src/pages/AIProviders.jsx
+++ b/client/src/pages/AIProviders.jsx
@@ -2,7 +2,7 @@ import { useState, useEffect, useCallback } from 'react';
import toast from '../components/ui/Toast';
import * as api from '../services/api';
import socket from '../services/socket';
-import { filterSelectableModels, filterGenerationModels, isEmbeddingModel, mergeModelLists, localBackendForProvider, modelOptionLabel, providerTypeClass, isTuiProvider, isApiProvider, isProcessProvider, isOllamaBackedProvider, isAntigravityProvider, isGrokBuildCli, isLocalEndpoint, effectiveModelContextWindow } from '../utils/providers';
+import { filterSelectableModels, filterGenerationModels, isEmbeddingModel, mergeModelLists, configuredDefaultIn, localBackendForProvider, modelOptionLabel, providerTypeClass, isTuiProvider, isApiProvider, isProcessProvider, isOllamaBackedProvider, isAntigravityProvider, isGrokBuildCli, isLocalEndpoint, effectiveModelContextWindow } from '../utils/providers';
import useLocalModels from '../hooks/useLocalModels';
import EmptyState from '../components/EmptyState';
import {
@@ -764,7 +764,28 @@ function ProviderForm({ provider, onClose, onSave, allProviders = [] }) {
// Generation pickers (default + light/medium/heavy tiers) — drop embedding-only
// models (and internal sentinels) so an embedding can't be chosen as a model
// that runs prompts, consistent with the fallback picker below.
- const availableModels = filterGenerationModels(mergeModelLists(formData.models, liveModelsFor(formData)));
+ const mergedModels = mergeModelLists(formData.models, liveModelsFor(formData));
+ const availableModels = filterGenerationModels(mergedModels);
+ // A provider can pin its tiers to the "use the CLI's own default" sentinel
+ // while still publishing a real model catalog (Antigravity: `agy models`
+ // lists real ids, but PortOS leaves the tiers on agy's own default). The
+ // sentinel is filtered out of `availableModels`, so without an explicit
+ // option for it the four selects below would hold a value matching no option
+ // and render blank — reading as "no model configured" when one is.
+ const configuredDefault = configuredDefaultIn(mergedModels);
+ // Shared option list for the Default Model + Light/Medium/Heavy tier selects,
+ // so the sentinel option can't be added to some and missed on others.
+ const modelSelectOptions = (
+ <>
+ <option value="">None</option>
+ {configuredDefault && (
+ <option value={configuredDefault}>Use the CLI&apos;s configured default</option>
+ )}
+ {availableModels.map(model => (
+ <option key={model} value={model}>{modelOptionLabel(model, localModels.ctxById)}</option>
+ ))}
+ </>
+ );
// Filter out current provider from fallback options (treat undefined enabled as enabled)
const fallbackOptions = allProviders.filter(p => p.id !== provider?.id && p.enabled !== false);
@@ -1033,10 +1054,7 @@ function ProviderForm({ provider, onClose, onSave, allProviders = [] }) {
onChange={(e) => setFormData(prev => ({ ...prev, defaultModel: e.target.value }))}
className="w-full px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white focus:border-port-accent focus:outline-hidden"
>
- <option value="">None</option>
- {availableModels.map(model => (
- <option key={model} value={model}>{modelOptionLabel(model, localModels.ctxById)}</option>
- ))}
+ {modelSelectOptions}
</select>
) : (
<input
@@ -1068,10 +1086,7 @@ function ProviderForm({ provider, onClose, onSave, allProviders = [] }) {
onChange={(e) => setFormData(prev => ({ ...prev, lightModel: e.target.value }))}
className="w-full px-2 py-1.5 bg-port-bg border border-port-border rounded-lg text-white text-sm focus:border-port-accent focus:outline-hidden"
>
- <option value="">None</option>
- {availableModels.map(model => (
- <option key={model} value={model}>{modelOptionLabel(model, localModels.ctxById)}</option>
- ))}
+ {modelSelectOptions}
</select>
) : (
<input
@@ -1093,10 +1108,7 @@ function ProviderForm({ provider, onClose, onSave, allProviders = [] }) {
onChange={(e) => setFormData(prev => ({ ...prev, mediumModel: e.target.value }))}
className="w-full px-2 py-1.5 bg-port-bg border border-port-border rounded-lg text-white text-sm focus:border-port-accent focus:outline-hidden"
>
- <option value="">None</option>
- {availableModels.map(model => (
- <option key={model} value={model}>{modelOptionLabel(model, localModels.ctxById)}</option>
- ))}
+ {modelSelectOptions}
</select>
) : (
<input
@@ -1118,10 +1130,7 @@ function ProviderForm({ provider, onClose, onSave, allProviders = [] }) {
onChange={(e) => setFormData(prev => ({ ...prev, heavyModel: e.target.value }))}
className="w-full px-2 py-1.5 bg-port-bg border border-port-border rounded-lg text-white text-sm focus:border-port-accent focus:outline-hidden"
>
- <option value="">None</option>
- {availableModels.map(model => (
- <option key={model} value={model}>{modelOptionLabel(model, localModels.ctxById)}</option>
- ))}
+ {modelSelectOptions}
</select>
) : (
<input
diff --git a/client/src/utils/README.md b/client/src/utils/README.md
index fef651c77b..abf17ce249 100644
--- a/client/src/utils/README.md
+++ b/client/src/utils/README.md
@@ -39,7 +39,7 @@ grep -i "what you want to do" client/src/utils/README.md
| `urlNormalize` | `isUrl` detection, `normalizeUrl` (optional git/`requireDot` modes), and `isHttpUrl` (explicit http(s) only — safe-href check). |
| `platform` | `isMac` detection and `modKey` (⌘/Ctrl) for keyboard-shortcut display. |
| `navWorkingSet` | Recent/pinned nav persistence (`recordVisit`, `togglePin`, `isPinned`) plus `resolveRecentNavEntries` for mapping stored deep links back to their longest matching nav-manifest entry. |
-| `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`). |
+| `providers` | AI-provider type predicates and helpers (`isCliProvider`, `isApiProvider`, `isCodexProvider`, `isAntigravityProvider`, `filterSelectableModels`, `configuredDefaultIn` — the sentinel a provider's catalog carries, so a picker can render an option matching a sentinel-valued tier instead of a blank select — `getProviderTimeout`, configured-default sentinels, and the claude/codex/agy 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 / resilience
diff --git a/client/src/utils/providers.js b/client/src/utils/providers.js
index dd65955809..bcf9f306f4 100644
--- a/client/src/utils/providers.js
+++ b/client/src/utils/providers.js
@@ -20,6 +20,23 @@ const CONFIGURED_DEFAULT_SENTINELS = new Set([
/** True for any provider "use CLI's own default" sentinel. Mirror of server `isConfiguredDefaultModel`. */
export const isConfiguredDefaultModel = (model) => CONFIGURED_DEFAULT_SENTINELS.has(model);
+/**
+ * The configured-default sentinel carried in a provider's model list, or null.
+ *
+ * `filterSelectableModels` strips sentinels from every picker, which is right
+ * for a *task's* model choice ("no override" is the empty option there). But a
+ * provider whose `defaultModel`/`lightModel`/… IS the sentinel while its
+ * `models` also holds real ids (Antigravity: `agy` has a real catalog AND its
+ * own configured default) would otherwise drive a `<select>` whose value
+ * matches no `<option>` — the field renders blank and reads as "unset" when the
+ * CLI's own default is in fact what's configured. The provider-edit form uses
+ * this to render an explicit option for it.
+ * @param {string[]|null|undefined} models
+ * @returns {string|null}
+ */
+export const configuredDefaultIn = (models) =>
+ (models || []).find(isConfiguredDefaultModel) || null;
+
export const DEFAULT_LARGE_CONTEXT_WINDOW = 128_000;
export const CODEX_CONTEXT_WINDOW = 1_000_000;
export const GEMINI_CONTEXT_WINDOW = 1_048_576;
diff --git a/client/src/utils/providers.test.js b/client/src/utils/providers.test.js
index 070f78bf3e..73ab7dd4d3 100644
--- a/client/src/utils/providers.test.js
+++ b/client/src/utils/providers.test.js
@@ -40,6 +40,7 @@ import {
CODEX_EFFORT_LEVELS,
ANTIGRAVITY_EFFORT_LEVELS,
isConfiguredDefaultModel,
+ configuredDefaultIn,
isLocalEndpoint,
enabledApiProviderFilter,
providerTypeClass,
@@ -71,6 +72,36 @@ describe('effortLevelsForProvider (server mirror)', () => {
});
});
+// Regression guard for the provider-edit form: an Antigravity provider publishes
+// a real `agy models` catalog while its defaultModel/tiers stay on the sentinel.
+// filterGenerationModels strips the sentinel, so the edit form needs this to
+// render an explicit option for it — otherwise those four selects hold a value
+// matching no option and render blank, reading as "no model configured".
+describe('configuredDefaultIn', () => {
+ it('finds the sentinel in a mixed catalog', () => {
+ expect(configuredDefaultIn([ANTIGRAVITY_CONFIGURED_DEFAULT, 'gemini-3.1-pro-high']))
+ .toBe(ANTIGRAVITY_CONFIGURED_DEFAULT);
+ expect(configuredDefaultIn(['gpt-5.6-terra', CODEX_CONFIGURED_DEFAULT]))
+ .toBe(CODEX_CONFIGURED_DEFAULT);
+ });
+
+ it('returns null when the list carries no sentinel', () => {
+ expect(configuredDefaultIn(['gpt-5.6-terra', 'gpt-5.6-sol'])).toBeNull();
+ expect(configuredDefaultIn([])).toBeNull();
+ expect(configuredDefaultIn(null)).toBeNull();
+ expect(configuredDefaultIn(undefined)).toBeNull();
+ });
+
+ // The sentinel it finds must be exactly what filterGenerationModels removed,
+ // or the option's value still won't match the select's value.
+ it('finds precisely the value the generation filter drops', () => {
+ const models = [ANTIGRAVITY_CONFIGURED_DEFAULT, 'gemini-3.1-pro-high', 'claude-sonnet-4-6'];
+ const sentinel = configuredDefaultIn(models);
+ expect(filterGenerationModels(models)).not.toContain(sentinel);
+ expect([...filterGenerationModels(models), sentinel].sort()).toEqual([...models].sort());
+ });
+});
+
describe('isAntigravityProvider (server mirror)', () => {
it.each([
[{ id: 'antigravity-cli' }, true],
diff --git a/server/lib/README.md b/server/lib/README.md
index ccd60dc781..ddfc7f7fb7 100644
--- a/server/lib/README.md
+++ b/server/lib/README.md
@@ -88,7 +88,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub
|---|---|
| `aiToolkit/` | Vendored toolkit (providers + runner + prompts + status). See `aiToolkit/index.js`. |
| `aiToolkitState.js` | Module-level singleton for the toolkit instance shared by the `providers`/`runner`/`promptService` shims — `setAIToolkitInstance` / `requireToolkit` (throws `AI_TOOLKIT_NOT_INITIALIZED`) / `getAIToolkitInstance` (no-throw for cleanup paths). |
-| `antigravity.js` | Antigravity (`agy`) CLI provider helpers — id/sentinel constants (`ANTIGRAVITY_CLI_ID`, `ANTIGRAVITY_CONFIGURED_DEFAULT`, `LEGACY_GEMINI_*`), `isAntigravityCommand`/`isAntigravityCliProvider` predicates, and `ensureAntigravityPrintArgs`/`ensureAntigravityTuiArgs`/`stripAntigravityUnsupportedArgs` argv normalizers (strip legacy Gemini `--yolo`/`-m`/`--output-format`). |
+| `antigravity.js` | Antigravity (`agy`) CLI provider helpers — id/sentinel constants (`ANTIGRAVITY_CLI_ID`, `ANTIGRAVITY_CONFIGURED_DEFAULT`, `LEGACY_GEMINI_*`), `isAntigravityCommand`/`isAntigravityCliProvider` predicates, and `ensureAntigravityPrintArgs(args, {model, effort})`/`ensureAntigravityTuiArgs(args, {model, effort})`/`stripAntigravityUnsupportedArgs` argv normalizers. The strip drops legacy Gemini `--yolo`/`-m`/`--output-format` but PRESERVES the long `--model` (agy accepts it as a per-session flag, so a user-baked pin is a real selection and suppresses the injected one); the two builders inject `--model`/`--effort` from the per-run overrides, always ahead of the trailing `--print` marker whose value is the prompt. |
| `aiProvider.js` | Shared AI provider utilities for LLM calls. |
| `promptRunner.js` | Shared LLM runner wrapper. |
| `tuiPromptRunner.js` | One-shot TUI prompt runner (PTY-driven). |
@@ -98,7 +98,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` / `KIMI_CONFIGURED_DEFAULT`, `resolveCliModel`, `filterSelectableModels`, Bedrock/OpenCode model mappers, model-flag scan helpers, `isCodexProvider`, `isKimiProvider`) 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). |
+| `providerModels.js` | Provider model resolution sentinels + helpers (`CODEX_CONFIGURED_DEFAULT` / `ANTIGRAVITY_CONFIGURED_DEFAULT` / `GROK_CONFIGURED_DEFAULT` / `KIMI_CONFIGURED_DEFAULT`, `resolveCliModel`, `filterSelectableModels`, Bedrock/OpenCode model mappers, model-flag scan helpers incl. `stripBrokenModelFlags`, `isCodexProvider`, `isKimiProvider`, `isAntigravityProvider`) plus reasoning-effort helpers for the claude/codex/agy CLIs (`CLAUDE_EFFORT_LEVELS` / `CODEX_EFFORT_LEVELS` / `ANTIGRAVITY_EFFORT_LEVELS` / `EFFORT_LEVELS`, `effortLevelsForProvider`, `resolveCliEffort` — clamps an out-of-range effort to the nearest level the target CLI accepts rather than dropping it, so a value saved against a wider ladder survives a provider switch — `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. |