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 grok reviewer be pinned to a model, like agy and codex (#3729)
[._.]/ Adam Eivy70d4710f6aef
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 0c24fe8984..7d610bae56 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -67,6 +67,8 @@- **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.- **A commission's video backend now survives the teaser hand-off, and its pinned local model reaches the planner.** Two leaks were left after the render paths were unified. First, when a commission's plan reaches for "produce a teaser from this issue," that tool mints a *separate* Creative Director project — and it was minted unpinned, so the run's actual deliverable rendered on the install default while the commission said Grok. The teaser now inherits the calling project's backend pin and video model; the pin is read from the project record rather than exposed to the planner, so the model writing the plan cannot pick a render backend of its own. Second, a pinned local video model was stored only on the commission's backend pin, leaving the project's own model on the install default — which is the value the Creative Director's planner prompt reports to the model, so the plan was written against a model that was never going to render it. The chosen video model is now the project's model too. A commission that pins nothing still behaves exactly as before.- **[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.++- **[issue-3729] The Grok code reviewer can now be pinned to a model too.** Same gap as [issue-3728] one reviewer over: the Grok row told you it "takes no model" even though `grok --model <id>` is a real flag and slashdo accepts a `grok[<model>]` selector — so every Grok review ran on whatever the CLI picked for itself. Grok 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 — and the pin rides through to the review-loop prompt as `grok --model <id>`. The options come from the Grok Build CLI provider, and the field is free-text like the other CLI reviewers, which matters more here than elsewhere: the shipped Grok provider lists no real model ids at all (only "use the CLI's own default"), so typing an id is usually the only way to pin one. Grok still has no Effort cell — its CLI takes no effort flag — which is now the honest answer rather than a side effect of it carrying no pins at all.- **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/useReviewerModelOptions.js b/client/src/hooks/useReviewerModelOptions.jsindex 281aaffdba..b6e25d5020 100644--- a/client/src/hooks/useReviewerModelOptions.js+++ b/client/src/hooks/useReviewerModelOptions.js@@ -1,6 +1,6 @@import { useEffect, useMemo, useState } from 'react';import * as api from '../services/api';-import { filterSelectableModels, selectableModelsForProvider, isAntigravityProvider } from '../utils/providers';+import { filterSelectableModels, selectableModelsForProvider, isAntigravityProvider, isGrokBuildCli } from '../utils/providers';import { LOCAL_LLM_REVIEWERS, MODEL_SELECTABLE_REVIEWERS } from '../components/cos/constants';/**@@ -12,9 +12,9 @@ import { LOCAL_LLM_REVIEWERS, MODEL_SELECTABLE_REVIEWERS } from '../components/c* 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` / `antigravity` tiers come from the provider catalog- * (`/api/providers`) — these are CLI reviewers, not local backends, so there's- * nothing to probe.+ * - `codex` / `claude` / `antigravity` / `grok` 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@@ -60,9 +60,12 @@ export default function useReviewerModelOptions() {.filter(Boolean);// `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);+ // same predicate the rest of the app does. Several matchers = preference order:+ // `grok` names one binary that ships as BOTH a `cli` and a `tui` provider, and+ // the reviewer is spawned non-interactively, so the CLI's catalog wins — the+ // broad predicate is the fallback for an install that only kept the TUI.+ const providerTiers = (...matchers) => {+ const provider = matchers.reduce((found, match) => found || (providers || []).find(match), null);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.@@ -83,17 +86,23 @@ export default function useReviewerModelOptions() {// Ollama-backed `claude`. Deduped, order-preserving.claude: Array.from(new Set([...providerTiers((p) => p.id === 'claude-code'), ...ollama].filter(Boolean))),antigravity: providerTiers(isAntigravityProvider),+ // The shipped grok provider carries only the configured-default sentinel,+ // which `filterSelectableModels` strips — so this is legitimately `[]` until+ // the user lists real ids on the provider. The Model cell stays useful+ // regardless because grok, like every CLI reviewer, is free-text.+ grok: providerTiers((p) => p.id === 'grok-cli', isGrokBuildCli),};return {optionsByReviewer,// A local backend's id list is authoritative (we probed it), so keep those// 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.+ // the Ollama-backed / Bedrock-form cases above, `codex`/`antigravity`/`grok`+ // because their catalogs are stored snapshots that can lag a newly-released+ // tier — grok's shipped catalog holds no real id at all, so a typed id is the+ // ONLY way to pin one (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)])),diff --git a/client/src/hooks/useReviewerModelOptions.test.jsx b/client/src/hooks/useReviewerModelOptions.test.jsxindex 6ebe5b0078..a3ee2f0ff6 100644--- a/client/src/hooks/useReviewerModelOptions.test.jsx+++ b/client/src/hooks/useReviewerModelOptions.test.jsx@@ -24,6 +24,10 @@ const providers = ['gemini-3.1-pro-high',],},+ // One `grok` binary ships as both a TUI and a CLI provider; the reviewer is+ // spawned non-interactively, so the CLI's catalog is the one it should offer.+ { id: 'grok-tui', type: 'tui', command: 'grok', models: ['stale-tui-id'] },+ { id: 'grok-cli', type: 'cli', command: 'grok', models: ['grok-configured-default', 'grok-code-fast-1'] },];describe('useReviewerModelOptions', () => {@@ -53,6 +57,23 @@ describe('useReviewerModelOptions', () => {expect(result.current.freeText.antigravity).toBe(true);});+ // #3729: `grok --model <id>` is real, so the grok row gets a Model cell too.+ it('sources grok options from the CLI provider, not the TUI, and drops the sentinel', async () => {+ const { result } = renderHook(() => useReviewerModelOptions());+ await waitFor(() => expect(result.current.loaded).toBe(true));+ expect(result.current.optionsByReviewer.grok).toEqual(['grok-code-fast-1']);+ // Free-text: the shipped grok catalog is sentinel-only, so a typed id is+ // often the only way to pin one.+ expect(result.current.freeText.grok).toBe(true);+ });++ it('falls back to a TUI-only grok install for its catalog', async () => {+ getProviders.mockResolvedValue({ providers: [providers.find((p) => p.id === 'grok-tui')] });+ const { result } = renderHook(() => useReviewerModelOptions());+ await waitFor(() => expect(result.current.loaded).toBe(true));+ expect(result.current.optionsByReviewer.grok).toEqual(['stale-tui-id']);+ });+it('degrades to empty option lists when the provider fetch fails', async () => {getProviders.mockRejectedValue(new Error('offline'));const { result } = renderHook(() => useReviewerModelOptions());diff --git a/client/src/lib/reviewerPins.js b/client/src/lib/reviewerPins.jsindex 22624833a4..cd073460f8 100644--- a/client/src/lib/reviewerPins.js+++ b/client/src/lib/reviewerPins.js@@ -26,8 +26,10 @@ import {*/// CLI reviewers whose binary takes a `--model <id>` tier. Mirror of-// MODEL_CAPABLE_CLI_REVIEWERS (`antigravity` runs `agy --model <id>`).-export const MODEL_CAPABLE_CLI_REVIEWERS = ['codex', 'claude', 'antigravity'];+// MODEL_CAPABLE_CLI_REVIEWERS (`antigravity` runs `agy --model <id>`, `grok` runs+// `grok --model <id>` — the latter takes a model but no effort, so this roster is+// deliberately wider than EFFORT_SELECTABLE_REVIEWERS below).+export const MODEL_CAPABLE_CLI_REVIEWERS = ['codex', 'claude', 'antigravity', 'grok'];// 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 d821ffa5ed..279502630b 100644--- a/server/lib/cosValidation.js+++ b/server/lib/cosValidation.js@@ -43,11 +43,14 @@ export const LOCAL_LLM_REVIEWERS = ['lmstudio', 'ollama'];// 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`.+// `grok` runs `grok --model <id>` (slashdo's `grok[<model>]` bracket); it takes a+// model but NO effort, which is why this roster and EFFORT_SELECTABLE_REVIEWERS+// are genuinely different sets rather than two names for one list.// 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'];+export const MODEL_CAPABLE_CLI_REVIEWERS = ['codex', 'claude', 'antigravity', 'grok'];// 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 bydiff --git a/server/lib/cosValidation.test.js b/server/lib/cosValidation.test.jsindex 187ff78e45..ba1704f6c1 100644--- a/server/lib/cosValidation.test.js+++ b/server/lib/cosValidation.test.js@@ -16,6 +16,8 @@ import {MODEL_CAPABLE_CLI_REVIEWERS,MODEL_SELECTABLE_REVIEWERS,pairReviewerModelsAndEfforts,+ reviewerModelsFromDefaults,+ buildReviewWithArgs,LOCAL_LLM_EFFORT_LEVELS,reviewerEffortLevels,normalizeReviewerEfforts,@@ -391,4 +393,33 @@ describe('per-reviewer model pins', () => {expect(models).toEqual({ antigravity: 'gemini-3.6-flash-high' });expect(efforts).toEqual({});});++ // #3729: `grok --model <id>` is real and slashdo accepts a `grok[<model>]`+ // bracket, but `grok` was absent from the roster, so every grok review ran on+ // the CLI's own default and the picker rendered "Grok takes no model".+ it('keeps a grok model pin on the code-review settings slice', () => {+ expect(codeReviewSettingsSchema.parse({ grokModel: 'grok-code-fast-1' }).grokModel)+ .toBe('grok-code-fast-1');+ // Structural characters would corrupt the emitted `grok[<model>]` token.+ expect(codeReviewSettingsSchema.parse({ grokModel: 'a]b' }).grokModel).toBeUndefined();+ expect(codeReviewSettingsSchema.parse({ grokModel: ' ' }).grokModel).toBeUndefined();+ });++ it('carries a grok model through the task schema, sanitizer and defaults adapter', () => {+ expect(createCosTaskSchema.parse({ description: 'x', reviewerModels: { grok: 'grok-code-fast-1' } }).reviewerModels)+ .toEqual({ grok: 'grok-code-fast-1' });+ expect(sanitizeTaskMetadata({ reviewerModels: { grok: 'grok-code-fast-1', copilot: 'x' } }))+ .toEqual({ reviewerModels: { grok: 'grok-code-fast-1' } });+ expect(reviewerModelsFromDefaults({ grokModel: 'grok-code-fast-1' })).toEqual({ grok: 'grok-code-fast-1' });+ });++ it('emits the grok pin as a slashdo bracket, and never splits an effort off it', () => {+ expect(buildReviewWithArgs(['grok'], { reviewerModels: { grok: 'grok-code-fast-1' } }))+ .toBe('--review-with grok[grok-code-fast-1]');+ // Only agy bakes an effort into the model id. A grok id passes through whole,+ // and grok gains no effort pin from having one — its CLI takes no effort flag.+ expect(pairReviewerModelsAndEfforts({ grok: 'grok-code-fast-1' }, {}))+ .toEqual({ reviewerModels: { grok: 'grok-code-fast-1' }, reviewerEfforts: {} });+ expect(reviewerEffortLevels('grok')).toBeNull();+ });});diff --git a/server/services/cleanupAgentWorktree.test.js b/server/services/cleanupAgentWorktree.test.jsindex 2f87fe78e5..65e8ff9c1d 100644--- a/server/services/cleanupAgentWorktree.test.js+++ b/server/services/cleanupAgentWorktree.test.js@@ -833,10 +833,12 @@ describe('cleanupAgentWorktree - openPR path', () => {});// 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.+ // MODEL_SELECTABLE_REVIEWERS), and their memberships genuinely differ: `grok`+ // takes `--model` but has no effort flag (#3729), the mirror of `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, and a pin on the roster the reviewer+ // is absent from is dropped.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' });@@ -844,18 +846,21 @@ describe('cleanupAgentWorktree - openPR path', () => {addTask.mockResolvedValue({ id: 'sys-rl-eff' });await cleanupAgentWorktree('agent-1', true, {- openPR: true, requestCopilotReview: true, reviewers: ['copilot', 'antigravity', 'claude'],- reviewerModels: { claude: 'qwen2.5:7b' },- // `codex` isn't in the reviewer list; `copilot` has no effort control at all.- reviewerEfforts: { antigravity: 'high', claude: 'xhigh', codex: 'low', copilot: 'high' },+ openPR: true, requestCopilotReview: true, reviewers: ['copilot', 'antigravity', 'claude', 'grok'],+ reviewerModels: { claude: 'qwen2.5:7b', grok: 'grok-code-fast-1' },+ // `codex` isn't in the reviewer list; `copilot` has no effort control at all,+ // and neither does `grok` — its CLI takes no effort flag.+ reviewerEfforts: { antigravity: 'high', claude: 'xhigh', codex: 'low', copilot: 'high', grok: 'high' },description: 'Build',originalTask: { id: 'task-orig', priority: 'MEDIUM', metadata: { app: 'sparsetree' }, description: 'Build' }});const [followUp] = addTask.mock.calls[0];+ // `grok` is a listed reviewer but takes no effort, so its effort pin is dropped…expect(followUp.metadata.reviewLoopReviewerEfforts).toEqual({ antigravity: 'high', claude: 'xhigh' });- // The model map narrows on its own roster and is unaffected by the effort pins.- expect(followUp.metadata.reviewLoopReviewerModels).toEqual({ claude: 'qwen2.5:7b' });+ // …while its MODEL pin survives: the model map narrows on its own roster and is+ // unaffected by the effort pins.+ expect(followUp.metadata.reviewLoopReviewerModels).toEqual({ claude: 'qwen2.5:7b', grok: 'grok-code-fast-1' });});it('drops the effort map entirely when no effort-capable reviewer is in the list', async () => {diff --git a/server/services/codeReview.test.js b/server/services/codeReview.test.jsindex 352cb1f63b..3a0da479d4 100644--- a/server/services/codeReview.test.js+++ b/server/services/codeReview.test.js@@ -31,6 +31,7 @@ import {__resetCodeReviewDefaultsCache,__resetReviewerCliInstalledCache,} from './codeReview.js'+import { MODEL_SELECTABLE_REVIEWERS } from '../lib/cosValidation.js'// Minimal stand-ins for the deps resolveReviewLoopOptions is handed by its// callers (agentCliSpawning / agentCompletionCleanup) — kept trivial so the@@ -71,14 +72,11 @@ describe('codeReview helpers', () => {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,- }+ // when agy's `--model` became pinnable (#3728), `grok` when `grok --model`+ // did (#3729). Derived from the roster, because `pickCodeReviewDefaults`+ // derives its keys the same way: a hand-listed copy would have to be edited+ // in lockstep with every future addition and says nothing extra when it is.+ const NO_MODELS = Object.fromEntries(MODEL_SELECTABLE_REVIEWERS.map((r) => [`${r}Model`, null]))it('returns the hardcoded fallback when settings has no codeReview slice', () => {expect(pickCodeReviewDefaults(null)).toEqual({reviewers: ['copilot'],@@ -149,6 +147,7 @@ describe('codeReview helpers', () => {codexModel: 'gpt-5.6-sol',claudeModel: 'qwen2.5:7b',antigravityModel: 'gemini-3.6-flash',+ grokModel: 'grok-code-fast-1',},})expect(out).toEqual({@@ -166,6 +165,7 @@ describe('codeReview helpers', () => {codexModel: 'gpt-5.6-sol',claudeModel: 'qwen2.5:7b',antigravityModel: 'gemini-3.6-flash',+ grokModel: 'grok-code-fast-1',...NO_EFFORTS,})})