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
let the antigravity reviewer be pinned to a model, not just an effort
[._.]/ Adam Eivyc5d7a2c6b87d
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 8391ad2db2..59fe3c74b6 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -59,6 +59,7 @@## Fixed- **A creative commission pinned to Grok now actually renders on Grok.** Commissions have been able to name their video backend — Grok, or local with a specific local video model — for a while, but the pin only reached renders the Creative Director's *planner* queued. The scene-by-scene render path, which is where a commission's video is actually produced, never read it: every scene went to the local MLX runtime regardless, the pinned local model was ignored in favor of the project's creation-time default, and an install with no local Python configured failed the whole project up front even when Grok was the configured, enabled, pinned backend. Both paths now resolve the backend through one shared ladder — the commission's own pin, then the install-wide Creative Agent render default, then the global video pin — so what the form says is what renders. Grok's 6s/10s-only clip lengths are covered by rounding a scene's duration up rather than letting it silently come back short, and the project's aspect ratio carries through to Grok's base image. A pin naming a backend whose toggle has since been switched off still degrades to local rather than failing a nightly run, and if local is unconfigured too, the scene now says the pinned backend is disabled instead of only asking for a Python path.+- **[issue-3728] The Antigravity code reviewer can finally be pinned to a model, not just an effort.** Every reviewer row offered Antigravity an Effort cell and then told you it "takes no model" — but `agy --model <id>` is real (PortOS already passes it for its own Antigravity runs, and slashdo accepts an `antigravity[<model>]` selector), so the reviewer was silently left on agy's own default, which can be a slow Thinking tier. Antigravity now gets a Model cell everywhere the reviewer picker appears — Code Review Defaults, the task form, the CoS schedule tab, and the slashdo run drawer — populated from agy's installed catalog and free-text so a tier newer than the stored snapshot still works. Because agy lists each reasoning tier as its own model id (`gemini-3.6-flash-high`) while the row already has an Effort control, the picker offers the base ids and PortOS splits a suffixed id you type back into `--model <base> --effort <tier>`, which is the pair agy actually accepts; an effort you picked yourself always wins over the one baked into the id.- **A note that iCloud wrongly reports as "not downloaded" can now be saved anyway.** The write guard screens for an offloaded note by looking for a real byte length with no local blocks — a shape an ordinary sparse or compressed file also has. When that misfired the lockout was permanent: asking iCloud to download an already-local file succeeds instantly and changes nothing, so every save was refused forever while the message told the user to try again shortly. The server now checks whether the download both succeeded and actually moved the file, so it can tell a download still in flight (or one that failed) from a refusal that will never clear — and only the second of those, twice in a row on the same note, offers the Brain Notes and Wiki editors a deliberate "Save anyway" row that writes it regardless. While a download really is in flight you still just wait, and the ordinary Save button, ⌘S, and background mirrors always refuse, so nothing bypasses the guard without an explicit click. The message no longer says to try again shortly when trying again cannot help.- **Quiet Codex reasoning is no longer mistaken for a finished one-shot response.** The TUI runner's eight-second screen-idle fallback could kill an active long-form Luna or Sol stage between status repaints, then hand terminal chrome such as `[Pasted Content …]` to a JSON parser as if it were the model's answer. Codex one-shot calls now wait for their required response file, a natural exit, explicit cancellation, or the configured hard cap; inline idle completion remains available for other TUIs that do not honor file output.- **Quiet Codex reasoning is no longer mistaken for a finished one-shot response.** The TUI runner's eight-second screen-idle fallback could kill an active long-form Luna or Sol stage between status repaints, then hand terminal chrome such as `[Pasted Content …]` to a JSON parser as if it were the model's answer. Codex one-shot calls now wait for their required response file, a natural exit, explicit cancellation, or the configured hard cap; inline idle completion remains available for other TUIs that do not honor file output. The foundation judge also rejects the prompt's echoed `{ score: 6, gap: "string", fix: "string" }` schema example, so terminal chrome cannot masquerade as a real all-six editorial verdict even if a malformed transport reaches the retry gate.diff --git a/client/src/hooks/README.md b/client/src/hooks/README.mdindex de6a0d2a25..80acbcbeb1 100644--- a/client/src/hooks/README.md+++ b/client/src/hooks/README.md@@ -160,7 +160,7 @@ grep -i "what you want to do" client/src/hooks/README.md| `usePostSession` | Post-render callback scheduling. | Generic post-action chaining. || `useRecordMerge` | Duplicate Universe/Series merge flow: open → dry-run preview → resolve field conflicts → execute, with an `onMerged` refresh callback. Drives `<MergeModal>`. | Surfacing the merge-duplicates UI anywhere (Sharing → Duplicates, Universes page). Don't re-implement the preview/execute dance. || `useProviderModels` | AI providers + two-step provider→model selection. | Any UI that picks a provider + model. |-| `useReviewerModelOptions` | Selectable model ids per model-taking reviewer for `ReviewerPicker`'s Model column — local-LLM ids from `/api/local-llm/status`, codex/claude tiers from `/api/providers` (claude's list also spans installed Ollama ids for an Ollama-backed CLI). Returns `{ optionsByReviewer, freeText, unavailable, loaded }`. | Every surface that renders `ReviewerPicker` (Code Review Defaults, TaskAddForm, ScheduleTab, SlashDoRunDrawer) — the picker never fetches; pass this as its `modelOptions`. |+| `useReviewerModelOptions` | Selectable model ids per model-taking reviewer for `ReviewerPicker`'s Model column — local-LLM ids from `/api/local-llm/status`, codex/claude/antigravity tiers from `/api/providers` (claude's list also spans installed Ollama ids for an Ollama-backed CLI; agy's collapses to base ids since the row has its own Effort cell). Returns `{ optionsByReviewer, freeText, unavailable, loaded, reviewers }`. | Every surface that renders `ReviewerPicker` (Code Review Defaults, TaskAddForm, ScheduleTab, SlashDoRunDrawer) — the picker never fetches; pass this as its `modelOptions`. || `useLocalModels` | Live installed Ollama/LM Studio model ids per backend + the server's editorial recommendation. | Model pickers that must show currently-installed local models (not just a provider's stale stored `models`). Fold in via `mergeModelLists` + `localBackendForProvider`. || `useVisionModelIds` | `{ idsByProvider, loaded }` — vision-capable model ids the server reports (Ollama `/api/show` + LM Studio `type:'vlm'`), keyed by the provider id that serves them (`{ ollama: Set, lmstudio: Set }`), `null` until fetched; `loaded` flips once the fetch settles. Drops `backend:'cli'` rows (a blanket per-provider claim, not a per-model fact) and never vouches for a provider the server didn't enumerate. | Any VISION model picker — pass `idsByProvider` to `visionLocalModelFilter` / `assignmentModelOptions` so a new multimodal family (`gemma4`) isn't hidden by the stale client id regex, and so an installed VLM shows even when the provider's stored `models` snapshot is stale; gate any "none installed" messaging on `loaded` and on the provider being a local backend. || `useTheme` | Dark/light theme + paired-theme switching. | Theme picker. |diff --git a/client/src/hooks/useReviewerModelOptions.js b/client/src/hooks/useReviewerModelOptions.jsindex da3797779c..281aaffdba 100644--- a/client/src/hooks/useReviewerModelOptions.js+++ b/client/src/hooks/useReviewerModelOptions.js@@ -1,7 +1,7 @@import { useEffect, useMemo, useState } from 'react';import * as api from '../services/api';-import { filterSelectableModels } from '../utils/providers';-import { MODEL_SELECTABLE_REVIEWERS } from '../components/cos/constants';+import { filterSelectableModels, selectableModelsForProvider, isAntigravityProvider } from '../utils/providers';+import { LOCAL_LLM_REVIEWERS, MODEL_SELECTABLE_REVIEWERS } from '../components/cos/constants';/*** Selectable model ids per model-taking reviewer, for `ReviewerPicker`'s Model@@ -12,8 +12,9 @@ import { MODEL_SELECTABLE_REVIEWERS } from '../components/cos/constants';* Two sources, because the two reviewer kinds are different things:* - `lmstudio` / `ollama` ids come from `/api/local-llm/status`, so they reflect* what's actually installed rather than a provider's stale stored `models`.- * - `codex` / `claude` tiers come from the provider catalog (`/api/providers`) —- * these are CLI reviewers, not local backends, so there's nothing to probe.+ * - `codex` / `claude` / `antigravity` tiers come from the provider catalog+ * (`/api/providers`) — these are CLI reviewers, not local backends, so there's+ * nothing to probe.** The `claude` list spans BOTH usage modes: the `claude-code` provider tiers and* the installed Ollama ids (an Ollama-backed `claude` CLI, where `--model` selects@@ -30,7 +31,7 @@ import { MODEL_SELECTABLE_REVIEWERS } from '../components/cos/constants';* yet" from "genuinely no options" (an empty list is a real answer, not a* pre-fetch placeholder).*- * @returns {{ optionsByReviewer: Record<string, string[]>, freeText: Record<string, boolean>, unavailable: Record<string, boolean>, loaded: boolean }}+ * @returns {{ optionsByReviewer: Record<string, string[]>, freeText: Record<string, boolean>, unavailable: Record<string, boolean>, loaded: boolean, reviewers: string[] }}*/export default function useReviewerModelOptions() {const [localStatus, setLocalStatus] = useState(null);@@ -57,31 +58,45 @@ export default function useReviewerModelOptions() {const localIds = (backend) => (localStatus?.[backend]?.models || []).map((m) => m.id || m.name).filter(Boolean);- const providerTiers = (id) => {- const provider = (providers || []).find((p) => p.id === id);+ // `match` is a predicate rather than an id so a reviewer whose provider can be+ // recognized by more than its shipped id (an `agy` configured by path) uses the+ // same predicate the rest of the app does.+ const providerTiers = (match) => {+ const provider = (providers || []).find(match);if (!provider) return [];// `models` may be empty on a CLI provider configured with only a// defaultModel — `[]` is truthy, so a bare `||` wouldn't fall through.- return filterSelectableModels(provider.models?.length ? provider.models : [provider.defaultModel]);+ const models = provider.models?.length ? provider.models : [provider.defaultModel];+ // `selectableModelsForProvider` owns the per-provider normalization (today:+ // agy's one-id-per-effort-tier catalog collapsed to base ids, so the row's+ // separate Effort cell stays the effort control). Going through it rather+ // than special-casing agy here keeps the rule in one place.+ return filterSelectableModels(selectableModelsForProvider(provider, models));};const ollama = localIds('ollama');const optionsByReviewer = {lmstudio: localIds('lmstudio'),ollama,- codex: providerTiers('codex'),+ codex: providerTiers((p) => p.id === 'codex'),// Claude tiers first (the common case), then installed Ollama ids for an// Ollama-backed `claude`. Deduped, order-preserving.- claude: Array.from(new Set([...providerTiers('claude-code'), ...ollama].filter(Boolean))),+ claude: Array.from(new Set([...providerTiers((p) => p.id === 'claude-code'), ...ollama].filter(Boolean))),+ antigravity: providerTiers(isAntigravityProvider),};return {optionsByReviewer,// A local backend's id list is authoritative (we probed it), so keep those- // pickers a closed `<select>`. The two CLI reviewers are free-text: `claude`- // for the Ollama-backed / Bedrock-form cases above, and `codex` because its- // catalog is a stored snapshot that can lag a newly-released tier.- freeText: { codex: true, claude: true, lmstudio: false, ollama: false },+ // pickers a closed `<select>`. Every CLI reviewer is free-text: `claude` for+ // the Ollama-backed / Bedrock-form cases above, `codex`/`antigravity` because+ // their catalogs are stored snapshots that can lag a newly-released tier (an+ // agy pin may also be typed effort-suffixed — the server splits it). Derived+ // from the rosters so a reviewer added to either one can't silently default to+ // the wrong control.+ freeText: Object.fromEntries(+ MODEL_SELECTABLE_REVIEWERS.map((r) => [r, !LOCAL_LLM_REVIEWERS.includes(r)])+ ),unavailable: {lmstudio: localStatus?.lmstudio?.available === false,ollama: localStatus?.ollama?.available === false,diff --git a/client/src/hooks/useReviewerModelOptions.test.jsx b/client/src/hooks/useReviewerModelOptions.test.jsxnew file mode 100644index 0000000000..6ebe5b0078--- /dev/null+++ b/client/src/hooks/useReviewerModelOptions.test.jsx@@ -0,0 +1,63 @@+import { describe, it, expect, vi, beforeEach } from 'vitest';+import { renderHook, waitFor } from '@testing-library/react';+import useReviewerModelOptions from './useReviewerModelOptions';+import { getLocalLlmStatus, getProviders } from '../services/api';+import { MODEL_SELECTABLE_REVIEWERS } from '../lib/reviewerPins';++vi.mock('../services/api', () => ({+ getLocalLlmStatus: vi.fn(),+ getProviders: vi.fn(),+}));++const providers = [+ { id: 'codex', models: ['gpt-5.6-sol', 'gpt-5.6-luna'] },+ { id: 'claude-code', models: ['claude-opus-5'] },+ // agy enumerates each effort tier as its own id; the reviewer row has a+ // separate Effort cell, so the picker must collapse them to base ids.+ {+ id: 'antigravity-cli',+ defaultModel: 'antigravity-configured-default',+ models: [+ 'antigravity-configured-default',+ 'gemini-3.6-flash-low',+ 'gemini-3.6-flash-high',+ 'gemini-3.1-pro-high',+ ],+ },+];++describe('useReviewerModelOptions', () => {+ beforeEach(() => {+ vi.clearAllMocks();+ getLocalLlmStatus.mockResolvedValue({ ollama: { available: true, models: [{ id: 'qwen2.5:7b' }] } });+ getProviders.mockResolvedValue({ providers });+ });++ it('offers options for every model-selectable reviewer', async () => {+ const { result } = renderHook(() => useReviewerModelOptions());+ await waitFor(() => expect(result.current.loaded).toBe(true));+ for (const reviewer of MODEL_SELECTABLE_REVIEWERS) {+ expect(Array.isArray(result.current.optionsByReviewer[reviewer])).toBe(true);+ }+ });++ // #3728: `agy --model <id>` is real, so the antigravity row gets a Model cell.+ // Its ids arrive effort-suffixed and would otherwise duplicate the Effort cell+ // (and hand agy a `--model X-high --effort high` pair it rejects).+ it('collapses the antigravity catalog to base ids and drops the sentinel', async () => {+ const { result } = renderHook(() => useReviewerModelOptions());+ await waitFor(() => expect(result.current.loaded).toBe(true));+ expect(result.current.optionsByReviewer.antigravity).toEqual(['gemini-3.6-flash', 'gemini-3.1-pro']);+ // Free-text: the stored catalog lags new tiers, and a typed suffixed id is+ // still valid (the server splits it back apart).+ expect(result.current.freeText.antigravity).toBe(true);+ });++ it('degrades to empty option lists when the provider fetch fails', async () => {+ getProviders.mockRejectedValue(new Error('offline'));+ const { result } = renderHook(() => useReviewerModelOptions());+ await waitFor(() => expect(result.current.loaded).toBe(true));+ expect(result.current.optionsByReviewer.antigravity).toEqual([]);+ expect(result.current.optionsByReviewer.codex).toEqual([]);+ });+});diff --git a/client/src/lib/reviewerPins.js b/client/src/lib/reviewerPins.jsindex 363263b3ac..22624833a4 100644--- a/client/src/lib/reviewerPins.js+++ b/client/src/lib/reviewerPins.js@@ -26,8 +26,8 @@ import {*/// CLI reviewers whose binary takes a `--model <id>` tier. Mirror of-// MODEL_CAPABLE_CLI_REVIEWERS.-export const MODEL_CAPABLE_CLI_REVIEWERS = ['codex', 'claude'];+// MODEL_CAPABLE_CLI_REVIEWERS (`antigravity` runs `agy --model <id>`).+export const MODEL_CAPABLE_CLI_REVIEWERS = ['codex', 'claude', 'antigravity'];// The local-LLM backends, which take both a model and an effort.export const LOCAL_LLM_REVIEWERS = ['lmstudio', 'ollama'];diff --git a/server/lib/cosValidation.js b/server/lib/cosValidation.jsindex 8c678cc3ac..d821ffa5ed 100644--- a/server/lib/cosValidation.js+++ b/server/lib/cosValidation.js@@ -11,7 +11,7 @@import { z } from 'zod';import { emptyToUndefined, emptyToNull } from './zodCompat.js';import { isPlainObject } from './objects.js';-import { EFFORT_LEVELS, effortLevelsForProvider, buildEffortArgs } from './providerModels.js';+import { EFFORT_LEVELS, effortLevelsForProvider, buildEffortArgs, splitAntigravityModel } from './providerModels.js';import { ANTIGRAVITY_COMMAND } from './antigravity.js';import { isValidSlashdoCommand } from './slashdoInvocation.js';import { PR_COMPLETION_VALUES } from './prDisposition.js';@@ -36,15 +36,18 @@ export const DEFAULT_REVIEWERS = ['copilot'];export const LOCAL_LLM_REVIEWERS = ['lmstudio', 'ollama'];// CLI reviewers whose binary accepts a `--model <id>` tier the user can pin on// the Code Review Defaults panel (stored as a `<reviewer>Model` settings scalar,-// e.g. `codexModel` / `claudeModel`). The review-loop follow-up threads each as a-// reviewer-keyed model map (`reviewLoopReviewerModels`) so the prompt emits-// `<reviewer> --model <id>` per configured reviewer. `claude` covers both a-// normal Claude tier and an Ollama-backed `claude` (see isOllamaClaudeProvider)-// where `--model` selects the local Ollama model. Copilot/local-LLM reviewers are-// excluded — the former has no CLI, the latter get their model injected-// server-side by `POST /api/code-review/local`. Add a reviewer here (and a-// matching `<reviewer>Model` schema field) when its CLI gains model selection.-export const MODEL_CAPABLE_CLI_REVIEWERS = ['codex', 'claude'];+// e.g. `codexModel` / `claudeModel` / `antigravityModel`). The review-loop+// follow-up threads each as a reviewer-keyed model map+// (`reviewLoopReviewerModels`) so the prompt emits `<reviewer> --model <id>` per+// configured reviewer. `claude` covers both a normal Claude tier and an+// Ollama-backed `claude` (see isOllamaClaudeProvider) where `--model` selects the+// local Ollama model. `antigravity` runs `agy --model <id>`; an effort-suffixed+// agy id is reconciled with the effort pin by `pairReviewerModelsAndEfforts`.+// Copilot/local-LLM reviewers are excluded — the former has no CLI, the latter+// get their model injected server-side by `POST /api/code-review/local`. Add a+// reviewer here when its CLI gains model selection; the `<reviewer>Model`+// settings scalar is generated from this roster (codeReviewSettingsSchema).+export const MODEL_CAPABLE_CLI_REVIEWERS = ['codex', 'claude', 'antigravity'];// Every reviewer whose model the user can PICK in the UI: the model-capable CLIs// above (threaded into the follow-up prompt as `<reviewer> --model <id>`) plus the// local-LLM backends (whose id is injected server-side by@@ -566,11 +569,68 @@ export function resolveReviewerConfig(metadata, codeReviewDefaults, defaultRevieusernames: resolveReviewUsernames(metadata?.usernames, codeReviewDefaults?.usernames),optionalReviewers: resolveOptionalReviewers(metadata?.optionalReviewers, codeReviewDefaults?.optionalReviewers),reviewerMaxRounds: resolveReviewerMaxRounds(metadata?.reviewerMaxRounds, codeReviewDefaults?.reviewerMaxRounds),- reviewerModels: resolveReviewerModels(metadata?.reviewerModels, reviewerModelsFromDefaults(codeReviewDefaults)),- reviewerEfforts: resolveReviewerEfforts(metadata?.reviewerEfforts, reviewerEffortsFromDefaults(codeReviewDefaults))+ ...resolveReviewerPins(metadata, codeReviewDefaults)};}+/**+ * Resolve the model and effort pins TOGETHER — `{ reviewerModels, reviewerEfforts }`+ * with task-over-default precedence, already reconciled into a pair the reviewer's+ * CLI accepts (`pairReviewerModelsAndEfforts`).+ *+ * The two are never legitimately resolved apart: an `antigravity` model id can+ * carry its effort as a suffix, so whoever resolves the models must also be+ * holding the efforts to hand the suffix to. Resolving them separately is the+ * footgun — three prompt-building sites in `cosTaskGenerator.js` had already+ * hand-copied the pair of calls, and each would have emitted an+ * `agy --model <suffixed-id> --effort <tier>` invocation agy rejects. This is the+ * one call every site makes instead.+ *+ * @param {Object} [pins] - task metadata (or explicit options) carrying+ * `reviewerModels` / `reviewerEfforts` maps; an absent map falls back to the+ * Code Review Defaults, an explicitly empty one overrides them.+ * @param {Object} [codeReviewDefaults] - the `<reviewer>Model` / `<reviewer>Effort` scalars+ * @returns {{reviewerModels: Object<string,string>, reviewerEfforts: Object<string,string>}}+ */+export function resolveReviewerPins(pins, codeReviewDefaults) {+ return pairReviewerModelsAndEfforts(+ resolveReviewerModels(pins?.reviewerModels, reviewerModelsFromDefaults(codeReviewDefaults)),+ resolveReviewerEfforts(pins?.reviewerEfforts, reviewerEffortsFromDefaults(codeReviewDefaults))+ );+}++/**+ * Reconcile the resolved model and effort pins into a pair the reviewer's CLI+ * will actually accept, and return them as `{ reviewerModels, reviewerEfforts }`.+ *+ * Only `antigravity` needs reconciling. `agy models` enumerates its reasoning+ * tiers as separate model ids (`gemini-3.6-flash-high`), so a hand-typed pin can+ * carry an effort inside the model — and `agy` validates the PAIR, so+ * `--model gemini-3.6-flash-high --effort high` is not the same thing as the+ * `--model <base> --effort high` it expects. Splitting here mirrors what+ * `resolveAntigravityModelAndEffort` already does for PortOS's own agy spawns:+ * the base id becomes the model, and the baked tier supplies the effort ONLY when+ * the user pinned none (an explicit pick always wins).+ *+ * Applied once inside `resolveReviewerPins` rather than at each emission site, so+ * the slashdo `agy[<model>]` bracket, the effort instruction, and the review-loop+ * prompt's literal command line all describe the same invocation.+ *+ * @param {Object<string,string>} [reviewerModels]+ * @param {Object<string,string>} [reviewerEfforts]+ * @returns {{reviewerModels: Object<string,string>, reviewerEfforts: Object<string,string>}}+ */+export function pairReviewerModelsAndEfforts(reviewerModels, reviewerEfforts) {+ const models = { ...(reviewerModels || {}) };+ const efforts = { ...(reviewerEfforts || {}) };+ const { base, effort } = splitAntigravityModel(models.antigravity);+ if (effort && base) {+ models.antigravity = base;+ if (!normalizeReviewerEffort(efforts.antigravity, 'antigravity')) efforts.antigravity = effort;+ }+ return { reviewerModels: models, reviewerEfforts: efforts };+}+/*** Every token-keyed per-reviewer pin, as `[metadataKey, normalizeMap]`.*@@ -1208,9 +1268,10 @@ export const taskTemplateFromTaskSchema = 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` / `claudeModel` are per-CLI-reviewer model tiers (see-// MODEL_CAPABLE_CLI_REVIEWERS) threaded into the review-loop follow-up prompt as-// `<reviewer> --model <id>` (empty/undefined = let that CLI pick its own default).+// `codexModel` / `claudeModel` / `antigravityModel` are per-CLI-reviewer model+// tiers (see MODEL_CAPABLE_CLI_REVIEWERS) threaded into the review-loop follow-up+// prompt as `<reviewer> --model <id>` (empty/undefined = let that CLI pick its+// own default).// `claudeModel` doubles as the Ollama model id when the user runs an// Ollama-backed `claude` (isOllamaClaudeProvider) as their reviewer.export const codeReviewSettingsSchema = z.object({@@ -1247,21 +1308,23 @@ export const codeReviewSettingsSchema = z.object({// builders would silently drop — the picker would otherwise DISPLAY a pin that// never reaches a reviewer. An unusable value clears the field (undefined)// rather than persisting: same "absent = that reviewer's own default" contract.- lmstudioModel: z.preprocess(v => normalizeReviewerModel(v, 'lmstudio'), z.string().optional()),- ollamaModel: z.preprocess(v => normalizeReviewerModel(v, 'ollama'), z.string().optional()),- codexModel: z.preprocess(v => normalizeReviewerModel(v, 'codex'), z.string().optional()),- claudeModel: z.preprocess(v => normalizeReviewerModel(v, 'claude'), z.string().optional()),+ //+ // GENERATED from the roster, not hand-listed: this object is `.strict()`, so a+ // reviewer that gains model selection (`antigravity`, #3728) would have its+ // PATCH REJECTED until someone remembered to add a line here — while every other+ // site derives its `<reviewer>Model` key from MODEL_SELECTABLE_REVIEWERS and+ // would already be carrying the pin.+ ...Object.fromEntries(MODEL_SELECTABLE_REVIEWERS.map(reviewer => [+ `${reviewer}Model`,+ z.preprocess(v => normalizeReviewerModel(v, reviewer), z.string().optional()),+ ])),// Per-reviewer reasoning-effort defaults, one scalar per effort-capable reviewer// (the model scalars' twin — same rationale for staying scalars: the encoding// crosses installs). Each is checked against that reviewer's OWN ladder, so// `antigravityEffort: 'max'` — a level `agy` rejects — clears rather than// persisting a pin no invocation would carry.//- // GENERATED from the roster rather than hand-listed like the model scalars- // above: this object is `.strict()`, so a reviewer that later gains an effort- // ladder would have its PATCH REJECTED until someone remembered to add a line- // here. Every other site that builds a `<reviewer>Effort` key derives it the- // same way.+ // Generated from the roster for the same reason as the model scalars above....Object.fromEntries(EFFORT_SELECTABLE_REVIEWERS.map(reviewer => [`${reviewer}Effort`,z.preprocess(v => normalizeReviewerEffort(v, reviewer), z.string().optional()),diff --git a/server/lib/cosValidation.test.js b/server/lib/cosValidation.test.jsindex b51384d0a7..187ff78e45 100644--- a/server/lib/cosValidation.test.js+++ b/server/lib/cosValidation.test.js@@ -13,6 +13,9 @@ import {REVIEWER_CLI_BINARIES,REVIEWER_VALUES,EFFORT_SELECTABLE_REVIEWERS,+ MODEL_CAPABLE_CLI_REVIEWERS,+ MODEL_SELECTABLE_REVIEWERS,+ pairReviewerModelsAndEfforts,LOCAL_LLM_EFFORT_LEVELS,reviewerEffortLevels,normalizeReviewerEfforts,@@ -328,4 +331,64 @@ describe('client mirror of the reviewer effort ladders', () => {// Alias parity too — the picker keys rows off stored slugs.expect(client.reviewerEffortLevels('gemini')).toEqual(reviewerEffortLevels('gemini'));});++ // Same failure mode one column over: a reviewer the picker offers a Model cell+ // for but the server drops the pin from (or vice versa — a CLI whose `--model`+ // the UI hides). The two rosters drove `antigravity` out of sync until #3728.+ it('matches the server model-pin rosters', async () => {+ const client = await import('../../client/src/lib/reviewerPins.js');+ expect([...client.MODEL_CAPABLE_CLI_REVIEWERS].sort()).toEqual([...MODEL_CAPABLE_CLI_REVIEWERS].sort());+ expect([...client.MODEL_SELECTABLE_REVIEWERS].sort()).toEqual([...MODEL_SELECTABLE_REVIEWERS].sort());+ });+});++describe('per-reviewer model pins', () => {+ it('keeps an antigravity model pin on the code-review settings slice', () => {+ // `agy --model <id>` is real (unlike the effort-only support PortOS assumed+ // before #3728), so the scalar has to survive the `.strict()` schema.+ expect(codeReviewSettingsSchema.parse({ antigravityModel: 'gemini-3.6-flash' }).antigravityModel)+ .toBe('gemini-3.6-flash');+ // Structural characters would corrupt the emitted `antigravity[<model>]` token.+ expect(codeReviewSettingsSchema.parse({ antigravityModel: 'a,b' }).antigravityModel).toBeUndefined();+ expect(codeReviewSettingsSchema.parse({ antigravityModel: ' ' }).antigravityModel).toBeUndefined();+ });++ it('carries an antigravity model through the task schema and the sanitizer', () => {+ expect(createCosTaskSchema.parse({ description: 'x', reviewerModels: { antigravity: 'gemini-3.6-pro' } }).reviewerModels)+ .toEqual({ antigravity: 'gemini-3.6-pro' });+ expect(sanitizeTaskMetadata({ reviewerModels: { antigravity: 'gemini-3.6-pro', copilot: 'x' } }))+ .toEqual({ reviewerModels: { antigravity: 'gemini-3.6-pro' } });+ });++ it('splits an effort-suffixed antigravity id into a model/effort pair agy accepts', () => {+ expect(pairReviewerModelsAndEfforts({ antigravity: 'gemini-3.6-flash-high' }, {}))+ .toEqual({ reviewerModels: { antigravity: 'gemini-3.6-flash' }, reviewerEfforts: { antigravity: 'high' } });+ // An explicitly pinned effort wins over the one baked into the id.+ expect(pairReviewerModelsAndEfforts({ antigravity: 'gemini-3.6-flash-high' }, { antigravity: 'low' }))+ .toEqual({ reviewerModels: { antigravity: 'gemini-3.6-flash' }, reviewerEfforts: { antigravity: 'low' } });+ // …but an UNUSABLE stored effort doesn't get to suppress the baked one.+ expect(pairReviewerModelsAndEfforts({ antigravity: 'gemini-3.6-flash-low' }, { antigravity: 'max' }))+ .toEqual({ reviewerModels: { antigravity: 'gemini-3.6-flash' }, reviewerEfforts: { antigravity: 'low' } });+ });++ it('leaves unsuffixed ids and every other reviewer untouched', () => {+ expect(pairReviewerModelsAndEfforts({ antigravity: 'gemini-3.6-flash', codex: 'gpt-5.6-sol' }, { codex: 'high' }))+ .toEqual({+ reviewerModels: { antigravity: 'gemini-3.6-flash', codex: 'gpt-5.6-sol' },+ reviewerEfforts: { codex: 'high' }+ });+ // A `-high` suffix on a NON-agy reviewer is part of the id, not an effort.+ expect(pairReviewerModelsAndEfforts({ claude: 'qwen2.5:7b-high' }, {}))+ .toEqual({ reviewerModels: { claude: 'qwen2.5:7b-high' }, reviewerEfforts: {} });+ expect(pairReviewerModelsAndEfforts(undefined, undefined))+ .toEqual({ reviewerModels: {}, reviewerEfforts: {} });+ });++ it('does not mutate the maps it was handed', () => {+ const models = { antigravity: 'gemini-3.6-flash-high' };+ const efforts = {};+ pairReviewerModelsAndEfforts(models, efforts);+ expect(models).toEqual({ antigravity: 'gemini-3.6-flash-high' });+ expect(efforts).toEqual({});+ });});diff --git a/server/services/agentPromptBuilder.js b/server/services/agentPromptBuilder.jsindex cec84b5e9c..a403f25d8b 100644--- a/server/services/agentPromptBuilder.js+++ b/server/services/agentPromptBuilder.js@@ -552,8 +552,9 @@ export function buildReviewLoopFollowUpSection(metadata = {}, { verbose = false,: {};// One entry per CLI reviewer carrying a pinned model and/or effort, rendered as// the literal command line the agent must run. Reviewers are listed rather than- // filtered to MODEL_CAPABLE_CLI_REVIEWERS because `agy` takes an effort but no- // PortOS-pinnable model — it would otherwise have no way to receive one.+ // filtered to MODEL_CAPABLE_CLI_REVIEWERS up front because a CLI reviewer may+ // carry only one of the two pins (and `grok` carries neither). The per-flag+ // gates below decide what each entry renders; an entry with no flags drops out.const reviewerPinEntries = cliReviewers.map((r) => {const flags = [];diff --git a/server/services/cleanupAgentWorktree.test.js b/server/services/cleanupAgentWorktree.test.jsindex 0ebc9d9373..2f87fe78e5 100644--- a/server/services/cleanupAgentWorktree.test.js+++ b/server/services/cleanupAgentWorktree.test.js@@ -832,11 +832,12 @@ describe('cleanupAgentWorktree - openPR path', () => {expect(followUp.metadata.reviewLoopCodexModel).toBeNull();});- // The effort map narrows against EFFORT_SELECTABLE_REVIEWERS, a DIFFERENT roster- // than the model map's — `antigravity` takes an effort but no PortOS-pinnable- // model. Passing the model roster here would silently drop every agy pin at this- // hop with the rest of the suite still green, so pin the distinction explicitly.- it('narrows the effort map against the effort roster, keeping an antigravity pin the model roster excludes', async () => {+ // The two maps narrow against SEPARATE rosters (EFFORT_SELECTABLE_REVIEWERS vs+ // MODEL_SELECTABLE_REVIEWERS). Their memberships coincide today — they last+ // diverged over `antigravity`, which took an effort but no model until #3728 —+ // so this pins that each map is narrowed independently: an effort pin on a+ // reviewer with no model pin (and vice versa) must survive this hop intact.+ it('narrows each pin map on its own roster', async () => {git.push.mockResolvedValue(undefined);git.createPR.mockResolvedValue({ success: true, url: 'https://github.com/test/repo/pull/61' });git.requestCopilotReview.mockResolvedValue({ success: true });diff --git a/server/services/codeReview.js b/server/services/codeReview.jsindex 79d2c897f8..35fd225fef 100644--- a/server/services/codeReview.js+++ b/server/services/codeReview.js@@ -30,12 +30,11 @@ import {resolveOptionalReviewers,normalizeReviewerMaxRounds,resolveReviewerMaxRounds,- resolveReviewerModels,- reviewerModelsFromDefaults,- resolveReviewerEfforts,reviewerEffortsFromDefaults,+ resolveReviewerPins,normalizeReviewerEffort,EFFORT_SELECTABLE_REVIEWERS,+ MODEL_SELECTABLE_REVIEWERS,} from '../lib/validation.js'import { getSettings, settingsEvents } from './settings.js'import { getBaseUrl as getLmStudioBaseUrl } from './lmStudioManager.js'@@ -92,10 +91,16 @@ export function pickCodeReviewDefaults(settings) {// that path can legitimately use. Every consumer that turns a scalar into a// slashdo TOKEN re-validates first (`reviewerModelsFromDefaults`), and the// settings schema rejects an unusable id at write time.- 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,- claudeModel: typeof raw?.claudeModel === 'string' && raw.claudeModel ? raw.claudeModel : null,+ //+ // Generated from the roster, like the effort scalars below: a reviewer that+ // gains model selection (`antigravity`, #3728) must not need a hand-copied+ // line here, or the panel would read back `undefined` for a pin it just saved.+ ...Object.fromEntries(+ MODEL_SELECTABLE_REVIEWERS.map((reviewer) => {+ const stored = raw?.[`${reviewer}Model`]+ return [`${reviewer}Model`, typeof stored === 'string' && stored ? stored : null]+ })+ ),// Per-reviewer reasoning-effort defaults. Unlike the model scalars above these// ARE checked here: a level is a closed per-reviewer enum, not free text, and// `/api/code-review/local` forwards the value straight into the backend request@@ -186,13 +191,14 @@ export async function resolveReviewLoopOptions(metadata, { normalize, isTruthyMe// has never seen the task. The prompt builder routes each kind to its own// mechanism (`--model <id>` for a CLI, the request body's `model` for a local// backend); spawnReviewLoopFollowUp narrows to the reviewers actually in the list.- const reviewerModels = resolveReviewerModels(metadata?.reviewerModels, reviewerModelsFromDefaults(defaults))- // Reviewer-keyed reasoning-effort map, same task-over-default precedence as the- // models above. Routed by the prompt builder the same two ways: an effort flag on- // a CLI reviewer's command line, or `reasoning_effort` in a local reviewer's- // `/api/code-review/local` body.- const reviewerEfforts = resolveReviewerEfforts(metadata?.reviewerEfforts, reviewerEffortsFromDefaults(defaults))- return { reviewers, usernames, optionalReviewers, reviewerMaxRounds, reviewStopMode, reviewerApplies, reviewerModels, reviewerEfforts }+ //+ // Resolved alongside the reviewer-keyed EFFORT map (same precedence, routed the+ // same two ways) because the two have to be reconciled against each other before+ // anything emits them — see `resolveReviewerPins`.+ return {+ reviewers, usernames, optionalReviewers, reviewerMaxRounds, reviewStopMode, reviewerApplies,+ ...resolveReviewerPins(metadata, defaults)+ }}/**diff --git a/server/services/codeReview.test.js b/server/services/codeReview.test.jsindex a6dca65482..352cb1f63b 100644--- a/server/services/codeReview.test.js+++ b/server/services/codeReview.test.js@@ -70,6 +70,15 @@ describe('codeReview helpers', () => {lmstudioEffort: null,ollamaEffort: null,}+ // Same for every model-selectable reviewer — `antigravity` joined the roster+ // when agy's `--model` became pinnable (#3728).+ const NO_MODELS = {+ lmstudioModel: null,+ ollamaModel: null,+ codexModel: null,+ claudeModel: null,+ antigravityModel: null,+ }it('returns the hardcoded fallback when settings has no codeReview slice', () => {expect(pickCodeReviewDefaults(null)).toEqual({reviewers: ['copilot'],@@ -78,10 +87,7 @@ describe('codeReview helpers', () => {reviewerMaxRounds: {},stopMode: 'all',reviewerApplies: false,- lmstudioModel: null,- ollamaModel: null,- codexModel: null,- claudeModel: null,+ ...NO_MODELS,...NO_EFFORTS,})expect(pickCodeReviewDefaults({})).toEqual({@@ -91,10 +97,7 @@ describe('codeReview helpers', () => {reviewerMaxRounds: {},stopMode: 'all',reviewerApplies: false,- lmstudioModel: null,- ollamaModel: null,- codexModel: null,- claudeModel: null,+ ...NO_MODELS,...NO_EFFORTS,})})@@ -145,6 +148,7 @@ describe('codeReview helpers', () => {ollamaModel: 'codellama',codexModel: 'gpt-5.6-sol',claudeModel: 'qwen2.5:7b',+ antigravityModel: 'gemini-3.6-flash',},})expect(out).toEqual({@@ -161,6 +165,7 @@ describe('codeReview helpers', () => {ollamaModel: 'codellama',codexModel: 'gpt-5.6-sol',claudeModel: 'qwen2.5:7b',+ antigravityModel: 'gemini-3.6-flash',...NO_EFFORTS,})})@@ -262,6 +267,19 @@ describe('codeReview helpers', () => {expect(cleared.reviewerModels).toEqual({})})+ it('carries an antigravity model pin and splits a suffixed id into model + effort', async () => {+ mockedSettings.current = { codeReview: { reviewers: ['antigravity'], antigravityModel: 'gemini-3.6-flash' } }+ expect((await resolveReviewLoopOptions({}, testDeps)).reviewerModels)+ .toEqual({ antigravity: 'gemini-3.6-flash' })+ // `agy models` lists each tier as its own id; agy validates the model/effort+ // PAIR, so a typed suffixed pin has to reach the invocation already split.+ mockedSettings.current = { codeReview: { reviewers: ['antigravity'], antigravityModel: 'gemini-3.6-flash-high' } }+ __resetCodeReviewDefaultsCache()+ const split = await resolveReviewLoopOptions({}, testDeps)+ expect(split.reviewerModels).toEqual({ antigravity: 'gemini-3.6-flash' })+ expect(split.reviewerEfforts).toEqual({ antigravity: 'high' })+ })+it('drops a pin on a reviewer that takes no model', async () => {mockedSettings.current = { codeReview: { reviewers: ['copilot'] } }const out = await resolveReviewLoopOptions({ reviewerModels: { copilot: 'nope', '@bot': 'nope' } }, testDeps)diff --git a/server/services/cosTaskGenerator.js b/server/services/cosTaskGenerator.jsindex 64b16016b3..73b8bf96e9 100644--- a/server/services/cosTaskGenerator.js+++ b/server/services/cosTaskGenerator.js@@ -22,7 +22,7 @@import { readFile } from 'fs/promises';import { existsSync } from 'fs';import { join } from 'path';-import { sanitizeTaskMetadata, PIPELINE_BEHAVIOR_FLAGS, MAX_TOTAL_SPAWNS, normalizeReviewers, resolveReviewUsernames, resolveOptionalReviewers, resolveReviewerMaxRounds, resolveReviewerModels, reviewerModelsFromDefaults, resolveReviewerEfforts, reviewerEffortsFromDefaults, buildReviewerEffortNote, buildReviewersCsv, LOCAL_LLM_REVIEWERS, SWARM_COUNT_MIN, ISSUE_AUTHOR_FILTERS } from '../lib/validation.js';+import { sanitizeTaskMetadata, PIPELINE_BEHAVIOR_FLAGS, MAX_TOTAL_SPAWNS, normalizeReviewers, resolveReviewUsernames, resolveOptionalReviewers, resolveReviewerMaxRounds, resolveReviewerPins, buildReviewerEffortNote, buildReviewersCsv, LOCAL_LLM_REVIEWERS, SWARM_COUNT_MIN, ISSUE_AUTHOR_FILTERS } from '../lib/validation.js';import { isPlainObject } from '../lib/objects.js';import { parsePlanItems, extractAllIds, findInProgressIds, pickFirstAvailable, diagnoseUnpickablePlan } from '../lib/planIds.js';import { loadState, saveState, withStateLock, isImprovementEnabled, isDaemonRunning } from './cosState.js';@@ -453,12 +453,15 @@ export async function buildClaimWorkTask(app, { issueAuthorFilter, reviewers, us// Per-reviewer `~max=<n>` round caps ride the same explicit-option → task// metadata → Code Review Defaults precedence.const promptReviewerMaxRounds = resolveReviewerMaxRounds(reviewerMaxRounds ?? metadata.reviewerMaxRounds, codeReviewDefaults?.reviewerMaxRounds);- // Per-reviewer model pins (slashdo's `[<model>]` bracket) ride the same- // explicit-option → task metadata → Code Review Defaults precedence.- const promptReviewerModels = resolveReviewerModels(reviewerModels ?? metadata.reviewerModels, reviewerModelsFromDefaults(codeReviewDefaults));- // Per-reviewer reasoning efforts ride the same precedence. They carry no+ // Per-reviewer model pins (slashdo's `[<model>]` bracket) and reasoning efforts+ // ride the same explicit-option → task metadata → Code Review Defaults+ // precedence, and resolve together so the two describe one invocation (an agy+ // model id can carry its effort as a suffix). The efforts carry no// `--review-with` token, so they land as an appended instruction below.- const promptReviewerEfforts = resolveReviewerEfforts(reviewerEfforts ?? metadata.reviewerEfforts, reviewerEffortsFromDefaults(codeReviewDefaults));+ const { reviewerModels: promptReviewerModels, reviewerEfforts: promptReviewerEfforts } = resolveReviewerPins({+ reviewerModels: reviewerModels ?? metadata.reviewerModels,+ reviewerEfforts: reviewerEfforts ?? metadata.reviewerEfforts,+ }, codeReviewDefaults);const reviewersCsv = buildReviewersCsv(reviewersList, promptUsernames, promptOptionalReviewers, promptReviewerMaxRounds, promptReviewerModels);const issueAuthorFilterBlock = resolveIssueAuthorFilterBlock(promptTaskType, resolvedAuthorFilter);// Swarm mode (`/do:next --swarm`) is prepended (not an in-template@@ -510,9 +513,13 @@ async function resolveClaimReviewerPrompt() {// as `@user` tokens so the play button's claim gates the merge on them too.// Optional-reviewer set rides along so a `~opt` reviewer stays non-blocking,// as do the per-reviewer `~max=<n>` round caps.+ // Model + effort resolve together (an agy model id can carry its effort as a+ // suffix), so the bracket and the appended instruction can't describe different+ // invocations.+ const { reviewerModels, reviewerEfforts } = resolveReviewerPins(null, codeReviewDefaults);return {- csv: buildReviewersCsv(list, codeReviewDefaults?.usernames, codeReviewDefaults?.optionalReviewers, codeReviewDefaults?.reviewerMaxRounds, reviewerModelsFromDefaults(codeReviewDefaults)),- effortBlock: appendReviewerEffortBlock(list, reviewerEffortsFromDefaults(codeReviewDefaults)),+ csv: buildReviewersCsv(list, codeReviewDefaults?.usernames, codeReviewDefaults?.optionalReviewers, codeReviewDefaults?.reviewerMaxRounds, reviewerModels),+ effortBlock: appendReviewerEffortBlock(list, reviewerEfforts),};}@@ -2468,11 +2475,12 @@ async function buildImprovementTaskDescription({ promptTemplate, app, promptTaskconst promptReviewerMaxRounds = resolveReviewerMaxRounds(metadata.reviewerMaxRounds, codeReviewDefaults?.reviewerMaxRounds);// Per-reviewer model pins ride the same precedence, emitted as slashdo's// `[<model>]` bracket. Entries for the local-LLM reviewers filtered out above- // are inert — the emitter only brackets tokens it actually emits.- const promptReviewerModels = resolveReviewerModels(metadata.reviewerModels, reviewerModelsFromDefaults(codeReviewDefaults));- // Per-reviewer reasoning efforts — appended as an instruction after the- // substitutions below, since `--review-with` has no suffix for them.- const promptReviewerEfforts = resolveReviewerEfforts(metadata.reviewerEfforts, reviewerEffortsFromDefaults(codeReviewDefaults));+ // are inert — the emitter only brackets tokens it actually emits. Efforts+ // resolve in the same call (they reconcile against the models) and are appended+ // as an instruction after the substitutions below, since `--review-with` has no+ // suffix for them.+ const { reviewerModels: promptReviewerModels, reviewerEfforts: promptReviewerEfforts } =+ resolveReviewerPins(metadata, codeReviewDefaults);const reviewersCsv = buildReviewersCsv(promptReviewers, promptUsernames, promptOptionalReviewers, promptReviewerMaxRounds, promptReviewerModels);// {issueAuthorFilter} directive — the filter was already merged (global →// per-app override) and value-constrained by sanitizeTaskMetadata, so read itdiff --git a/server/services/cosTaskGenerator.test.js b/server/services/cosTaskGenerator.test.jsindex 66ecf906f6..901ef3ee10 100644--- a/server/services/cosTaskGenerator.test.js+++ b/server/services/cosTaskGenerator.test.js@@ -232,10 +232,20 @@ describe('{reviewers} interpolation honors Code Review Defaults', () => {// claim flows, so a pinned model only reaches slashdo (as its `[<model>]`// bracket) if the CSV carries it. Both paths resolve with task-over-default// precedence off the Code Review Defaults' `<reviewer>Model` scalars.- expect(GEN_SRC).toContain('resolveReviewerModels(metadata.reviewerModels, reviewerModelsFromDefaults(codeReviewDefaults))');- expect(GEN_SRC).toContain('resolveReviewerModels(reviewerModels ?? metadata.reviewerModels, reviewerModelsFromDefaults(codeReviewDefaults))');+ //+ // All three prompt paths go through `resolveReviewerPins`, which resolves the+ // model map TOGETHER with the effort map and reconciles the two (#3728) — an+ // agy model id can carry its effort as a suffix, so a path that resolved the+ // models alone would emit `--model <suffixed> --effort <tier>`, a pair agy+ // rejects, while the other paths emitted the split form.+ expect(GEN_SRC).toContain('resolveReviewerPins(metadata, codeReviewDefaults)');+ expect(GEN_SRC).toContain('reviewerModels: reviewerModels ?? metadata.reviewerModels');+ expect(GEN_SRC).toContain('reviewerEfforts: reviewerEfforts ?? metadata.reviewerEfforts');// The play-button path reads the defaults directly (no task metadata to layer).- expect(GEN_SRC).toContain('codeReviewDefaults?.reviewerMaxRounds, reviewerModelsFromDefaults(codeReviewDefaults)');+ expect(GEN_SRC).toContain('resolveReviewerPins(null, codeReviewDefaults)');+ // No path may resolve one map without the other.+ expect(GEN_SRC).not.toContain('resolveReviewerModels(');+ expect(GEN_SRC).not.toContain('resolveReviewerEfforts(');});});