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: narrow the reviewer Effort cell by its pinned model so agy can't be handed a pair it rejects (#3733)

[._.]/ Adam Eivydc2e3baa43d7
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index fb670eee4c..cd56118c38 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -243,3 +243,5 @@
- **[issue-3744] A worktree agent is no longer failed for a commit that merged upstream under a rebased sha.** The primary-checkout branch-jack guard cleared benign movement by asking whether the primary carried commits its upstream lacked — but it asked that **by sha**, while the attribution step beside it asked **by patch-id**. PortOS rebase-merges PRs, so a merged commit carries a different sha upstream than the copy a local `git merge --ff-only` puts on the primary; the sha comparison read that copy as unpushed and treated it as stranded, and attribution then matched it against the agent's branch — where it existed only because `/do:pr` had rebased onto that same upstream commit — and called that proof of authorship. The observed run had already opened *and merged* its PR, yet was failed with `primary-checkout-mutated`, escalated to a human, and told to consider `reset --hard` over a commit whose content was fully pushed. The upstream exclusion is now patch-id-precise like the attribution beside it, so a rebase-merged copy clears the checkout exactly as a zero sha count does; a genuinely unpushed commit with no upstream twin is still reported, and the original branch-jack shape is still caught. The failure prose also stopped quoting a commit count derived from a baseline that no longer exists: a mid-run `git pull --rebase` on the primary rewrites the sha stamped at spawn, which made `rev-list ^baseline` span the whole fork point and report "16 new commits" for a run that moved the primary by one and stranded none — that case now says the baseline was rewritten instead of passing the number off as movement.
- **[issue-3726] The character-foundation repair stage no longer builds a prompt too large to answer.** A real autonomous run assembled a 72,404-char prompt for `pipeline-character-foundation` and burned the CLI runner's full 5-minute wall clock without emitting a single byte, failing the whole run. The stage already had a budget — `REPAIR_OUTLINE_MAX_CHARS`, added after a 35KB prompt hung both a primary and a fallback TUI provider — but it bound only one of the prompt's three large sections, and not the largest: 35KB of raw series seed and 15KB of candidate cast rode along unbudgeted, while the outline itself overran its own soft cap by 49% because `renderArc`'s volume spine and character-arc tail were unconditional and could exceed `maxChars` outright. Each section now carries a 12,000-char budget and degrades in priority order rather than being sliced mid-sentence: the series seed sheds its style-guide exemplars (craft material a character repair cannot use) before flattening authored arcs to their want/need spine; the cast payload compacts the full-ensemble roster to a name/role/want/need line and drops members before it touches the batch actually under repair; and `renderArc` drops whole episode lines, then per-volume synopses (keeping `V# title: logline`), and finally clamps — so `maxChars` is a hard bound for any volume/episode/arc shape, pinned by a property test. Every tier names what it left out so the model can tell a short plan from a budgeted one, and the JSON sections stay parseable at every tier. The stage also now requests an explicit 10-minute timeout, matching what TUI providers already default to: the runner's 300s default is what actually killed the run.
+
+- **[issue-3733] The reviewer row's Effort cell now narrows to the tiers its pinned model actually offers.** `agy` validates the model/effort PAIR — `gemini-3.1-pro` has no `medium` tier — and the provider pickers already honored that, but `ReviewerPicker`'s Effort column read a static `low|medium|high` ladder with no knowledge of the model pinned beside it. So a user could pick `gemini-3.1-pro` + `medium` and PortOS would store, display, and emit an invocation agy rejects. `useReviewerModelOptions` (which already fetches `/api/providers` for the Model column) now exposes a `modelEffortLevels(reviewer, model)` accessor built on the same `antigravityModelEffortLevels` helper, and the Effort cell narrows through it — falling back to the full ladder whenever the catalog is empty, the model is unset, or the caller passes no options, so no surface loses its control. A model the catalog lists with no tiers at all drops the cell, unless an effort is already stored: a stale pin stays visible (`medium (unsupported)`) and clearable rather than silently reading as unset.
diff --git a/client/src/components/cos/ReviewerPicker.jsx b/client/src/components/cos/ReviewerPicker.jsx
index a45bc8b0d1..2542994f0e 100644
--- a/client/src/components/cos/ReviewerPicker.jsx
+++ b/client/src/components/cos/ReviewerPicker.jsx
@@ -255,11 +255,23 @@ export default function ReviewerPicker({
// The Effort cell. Only EFFORT_SELECTABLE_REVIEWERS get one, and each offers
// only its own CLI's ladder — copilot has no CLI, grok's takes no effort flag,
// and a `@username` reviewer is a person.
+ //
+ // The ladder is narrowed by the row's PINNED MODEL where the CLI validates the
+ // pair: `agy` rejects `gemini-3.1-pro --effort medium`, so offering `medium`
+ // there would store and emit an invocation it refuses (#3733). The narrowing
+ // needs the provider catalog, which the caller already fetched — falling back to
+ // the static ladder when it didn't, so a caller that passes no `modelOptions`
+ // keeps a working (just unnarrowed) select rather than losing the cell.
const renderEffortCell = (token) => {
- const levels = reviewerEffortLevels(token);
- if (!levels?.length) return renderNoPinCell(`${labelFor(token)} has no reasoning-effort control`);
const subject = labelFor(token);
const stored = efforts.get(token) ?? '';
+ const ladder = reviewerEffortLevels(token);
+ if (!ladder?.length) return renderNoPinCell(`${subject} has no reasoning-effort control`);
+ const levels = modelOptions?.modelEffortLevels?.(token, models.get(token)) ?? ladder;
+ // A pinned model whose catalog lists NO tiers still renders the select when
+ // something is stored, so a pin made before the model changed (or on another
+ // machine) stays visible and clearable rather than vanishing behind the dash.
+ if (!levels.length && !stored) return renderNoPinCell(`${subject}'s pinned model offers no reasoning-effort tiers`);
return renderPinSelect({
selectId: `${id}-effort-${token}`,
value: stored,
diff --git a/client/src/components/cos/ReviewerPicker.test.jsx b/client/src/components/cos/ReviewerPicker.test.jsx
index bef3654610..ac5dfa7744 100644
--- a/client/src/components/cos/ReviewerPicker.test.jsx
+++ b/client/src/components/cos/ReviewerPicker.test.jsx
@@ -477,5 +477,62 @@ describe('ReviewerPicker', () => {
render(<ReviewerPicker reviewers={['codex']} reviewerEfforts={{ Codex: 'high' }} onChange={() => {}} />);
expect(screen.getByLabelText('Reasoning effort for Codex')).toHaveValue('high');
});
+
+ // #3733: agy validates the model/effort PAIR, so the ladder narrows by the
+ // row's pinned model. `modelEffortLevels` is the caller's accessor (see
+ // useReviewerModelOptions) — stubbed here the way the real hook behaves.
+ describe('narrowed by the pinned model', () => {
+ const tiersByModel = {
+ 'gemini-3.1-pro': ['high'],
+ 'gemini-3.6-flash': ['low', 'high'],
+ 'claude-sonnet-4-6': [],
+ };
+ const narrowing = {
+ optionsByReviewer: { antigravity: Object.keys(tiersByModel) },
+ freeText: { antigravity: true },
+ unavailable: {},
+ loaded: true,
+ modelEffortLevels: (reviewer, model) => (reviewer === 'antigravity'
+ ? (tiersByModel[model] ?? ['low', 'medium', 'high'])
+ : ['low', 'medium', 'high'])
+ };
+
+ it('offers only the tiers the pinned model actually has', () => {
+ render(<ReviewerPicker reviewers={['antigravity']} reviewerModels={{ antigravity: 'gemini-3.1-pro' }} modelOptions={narrowing} onChange={() => {}} />);
+ expect(screen.getByRole('option', { name: 'high' })).toBeInTheDocument();
+ // The pair agy rejects — the whole point of the narrowing.
+ expect(screen.queryByRole('option', { name: 'medium' })).not.toBeInTheDocument();
+ });
+
+ it('keeps the full ladder when no model is pinned', () => {
+ render(<ReviewerPicker reviewers={['antigravity']} modelOptions={narrowing} onChange={() => {}} />);
+ expect(screen.getByRole('option', { name: 'medium' })).toBeInTheDocument();
+ });
+
+ it('falls back to the static ladder when the caller passes no modelOptions', () => {
+ render(<ReviewerPicker reviewers={['antigravity']} reviewerModels={{ antigravity: 'gemini-3.1-pro' }} onChange={() => {}} />);
+ expect(screen.getByRole('option', { name: 'medium' })).toBeInTheDocument();
+ });
+
+ it('drops the Effort control for a pinned model with no tiers at all', () => {
+ render(<ReviewerPicker reviewers={['antigravity']} reviewerModels={{ antigravity: 'claude-sonnet-4-6' }} modelOptions={narrowing} onChange={() => {}} />);
+ expect(screen.queryByLabelText('Reasoning effort for Antigravity')).not.toBeInTheDocument();
+ });
+
+ it('still renders a STORED pin under a tier-less model so it stays clearable', () => {
+ const onChange = vi.fn();
+ render(<ReviewerPicker reviewers={['antigravity']} reviewerModels={{ antigravity: 'claude-sonnet-4-6' }} reviewerEfforts={{ antigravity: 'high' }} modelOptions={narrowing} onChange={onChange} />);
+ const select = screen.getByLabelText('Reasoning effort for Antigravity');
+ expect(select).toHaveValue('high');
+ fireEvent.change(select, { target: { value: '' } });
+ expect(onChange).toHaveBeenCalledWith(expect.objectContaining({ reviewerEfforts: {} }));
+ });
+
+ it('keeps a stored tier the pinned model dropped visible as unsupported', () => {
+ render(<ReviewerPicker reviewers={['antigravity']} reviewerModels={{ antigravity: 'gemini-3.1-pro' }} reviewerEfforts={{ antigravity: 'medium' }} modelOptions={narrowing} onChange={() => {}} />);
+ expect(screen.getByLabelText('Reasoning effort for Antigravity')).toHaveValue('medium');
+ expect(screen.getByRole('option', { name: 'medium (unsupported)' })).toBeInTheDocument();
+ });
+ });
});
});
diff --git a/client/src/hooks/useReviewerModelOptions.js b/client/src/hooks/useReviewerModelOptions.js
index b6e25d5020..0bd74c835a 100644
--- a/client/src/hooks/useReviewerModelOptions.js
+++ b/client/src/hooks/useReviewerModelOptions.js
@@ -1,7 +1,8 @@
import { useEffect, useMemo, useState } from 'react';
import * as api from '../services/api';
-import { filterSelectableModels, selectableModelsForProvider, isAntigravityProvider, isGrokBuildCli } from '../utils/providers';
+import { filterSelectableModels, selectableModelsForProvider, isAntigravityProvider, isGrokBuildCli, antigravityModelEffortLevels } from '../utils/providers';
import { LOCAL_LLM_REVIEWERS, MODEL_SELECTABLE_REVIEWERS } from '../components/cos/constants';
+import { reviewerEffortLevels, normalizeReviewerSlug } from '../lib/reviewerPins';
/**
* Selectable model ids per model-taking reviewer, for `ReviewerPicker`'s Model
@@ -31,7 +32,13 @@ import { LOCAL_LLM_REVIEWERS, MODEL_SELECTABLE_REVIEWERS } from '../components/c
* 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, reviewers: string[] }}
+ * `modelEffortLevels(reviewer, model)` narrows a reviewer's effort ladder by its
+ * PINNED MODEL, because `agy` validates the model/effort PAIR (`gemini-3.1-pro`
+ * has no `medium` tier) — see #3733. Only `antigravity` narrows today; every other
+ * reviewer returns its static ladder. Lives here rather than in the picker so the
+ * picker keeps doing no fetching of its own.
+ *
+ * @returns {{ optionsByReviewer: Record<string, string[]>, freeText: Record<string, boolean>, unavailable: Record<string, boolean>, modelEffortLevels: (reviewer: string, model?: string|null) => readonly string[]|null, loaded: boolean, reviewers: string[] }}
*/
export default function useReviewerModelOptions() {
const [localStatus, setLocalStatus] = useState(null);
@@ -93,8 +100,27 @@ export default function useReviewerModelOptions() {
grok: providerTiers((p) => p.id === 'grok-cli', isGrokBuildCli),
};
+ // The agy provider's RAW catalog — one id per effort tier
+ // (`gemini-3.6-flash-low|-medium|-high`), which is exactly what the narrowing
+ // reads. Deliberately NOT `optionsByReviewer.antigravity`: that list has
+ // already had the suffixes collapsed away, so it carries no tier information.
+ const antigravityCatalog = (providers || []).find(isAntigravityProvider)?.models || [];
+ // The effort ladder a reviewer offers ONCE ITS MODEL IS PINNED. `agy` validates
+ // the pair, so a model with no `-medium` sibling must not offer `medium`
+ // (#3733). `antigravityModelEffortLevels` returns null for "can't tell" — empty
+ // catalog, unset model, or the configured-default sentinel — and the full
+ // static ladder stands there, the same null-means-fall-back contract
+ // `effortLevelsForProvider` uses. `[]` is a real answer: that model has no
+ // effort tiers at all.
+ const modelEffortLevels = (reviewer, model = null) => {
+ const ladder = reviewerEffortLevels(reviewer);
+ if (!ladder || normalizeReviewerSlug(reviewer) !== 'antigravity') return ladder;
+ return antigravityModelEffortLevels(model, antigravityCatalog) ?? ladder;
+ };
+
return {
optionsByReviewer,
+ modelEffortLevels,
// 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`/`grok`
diff --git a/client/src/hooks/useReviewerModelOptions.test.jsx b/client/src/hooks/useReviewerModelOptions.test.jsx
index a3ee2f0ff6..65daabe68c 100644
--- a/client/src/hooks/useReviewerModelOptions.test.jsx
+++ b/client/src/hooks/useReviewerModelOptions.test.jsx
@@ -74,6 +74,50 @@ describe('useReviewerModelOptions', () => {
expect(result.current.optionsByReviewer.grok).toEqual(['stale-tui-id']);
});
+ // #3733: `agy` validates the model/effort PAIR, so the Effort cell's ladder has
+ // to come from the pinned model's own tiers, not the static low|medium|high.
+ describe('modelEffortLevels', () => {
+ const levelsFor = async (reviewer, model) => {
+ const { result } = renderHook(() => useReviewerModelOptions());
+ await waitFor(() => expect(result.current.loaded).toBe(true));
+ return result.current.modelEffortLevels(reviewer, model);
+ };
+
+ it('narrows the antigravity ladder to the pinned model\'s catalog tiers', async () => {
+ expect(await levelsFor('antigravity', 'gemini-3.1-pro')).toEqual(['high']);
+ expect(await levelsFor('antigravity', 'gemini-3.6-flash')).toEqual(['low', 'high']);
+ });
+
+ it('narrows through a legacy effort-suffixed pin', async () => {
+ expect(await levelsFor('antigravity', 'gemini-3.1-pro-high')).toEqual(['high']);
+ });
+
+ it('resolves the gemini alias to the antigravity narrowing', async () => {
+ expect(await levelsFor('gemini', 'gemini-3.1-pro')).toEqual(['high']);
+ });
+
+ it('reports no tiers for a model the catalog lists without any', async () => {
+ expect(await levelsFor('antigravity', 'claude-sonnet-4-6')).toEqual([]);
+ });
+
+ it('falls back to the full ladder for an unset model or the configured default', async () => {
+ expect(await levelsFor('antigravity', '')).toEqual(['low', 'medium', 'high']);
+ expect(await levelsFor('antigravity', 'antigravity-configured-default')).toEqual(['low', 'medium', 'high']);
+ });
+
+ it('falls back to the full ladder when the catalog never loaded', async () => {
+ getProviders.mockRejectedValue(new Error('offline'));
+ expect(await levelsFor('antigravity', 'gemini-3.1-pro')).toEqual(['low', 'medium', 'high']);
+ });
+
+ it('leaves every other reviewer on its static ladder', async () => {
+ expect(await levelsFor('codex', 'gpt-5.6-sol')).toContain('ultra');
+ expect(await levelsFor('claude', 'gemini-3.1-pro')).toContain('max');
+ expect(await levelsFor('copilot', null)).toBeNull();
+ expect(await levelsFor('@octocat', null)).toBeNull();
+ });
+ });
+
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/README.md b/client/src/lib/README.md
index 73e35badf2..c8eaebd787 100644
--- a/client/src/lib/README.md
+++ b/client/src/lib/README.md
@@ -44,7 +44,7 @@ grep -i "what you want to do" client/src/lib/README.md
| `grokVideoClip.js` | Mirror of `server/lib/grokVideoClip.js` — `GROK_VIDEO_DURATIONS` (`[6, 10]`) + `GROK_VIDEO_DEFAULT_DURATION`, the clip lengths grok's `image_to_video` actually delivers. |
| `imageCleaners.js` | Mirror of `resolveCleanersFromConfig` from `server/lib/imageClean.js`. Reads `{cleanC2PA, denoise}` off a per-mode settings record. `cleanC2PA` defaults are mode-aware (on for `codex` + `external` — the backends that emit C2PA chunks today — off otherwise, as an allow-list rather than a deny-list); `denoise` defaults off everywhere (lossy, opt-in only). |
| `reviewerModels.js` | `reviewerModelsFromDefaults` / `reviewerModelsToDefaults` / `reviewerEffortsFromDefaults` / `reviewerEffortsToDefaults` — adapt the Code Review Defaults' per-reviewer SCALARS (`codexModel`, `ollamaModel`, `claudeEffort`, …) to and from the token-keyed maps `ReviewerPicker`'s Model and Effort columns take. Mirrors `reviewerModelsFromDefaults` / `reviewerEffortsFromDefaults` in `server/lib/cosValidation.js`. |
-| `reviewerPins.js` | Client mirrors of the per-reviewer pin vocabularies — `MODEL_SELECTABLE_REVIEWERS` / `EFFORT_SELECTABLE_REVIEWERS` / `REVIEWER_EFFORT_LEVELS` / `reviewerEffortLevels` / `sanitizeReviewerModelInput` and their bounds. Dependency-free on purpose: the server suite imports it to pin the mirror against the server's own ladders, so it must not reach for a client-only package. Re-exported by `components/cos/constants.js`. |
+| `reviewerPins.js` | Client mirrors of the per-reviewer pin vocabularies — `MODEL_SELECTABLE_REVIEWERS` / `EFFORT_SELECTABLE_REVIEWERS` / `REVIEWER_EFFORT_LEVELS` / `reviewerEffortLevels` / `normalizeReviewerSlug` / `sanitizeReviewerModelInput` and their bounds. Dependency-free on purpose: the server suite imports it to pin the mirror against the server's own ladders, so it must not reach for a client-only package. Re-exported by `components/cos/constants.js`. |
| `runnerFamilies.js` | Mirror of `server/lib/runners.js`. |
| `slashdoCatalog.js` | Mirror of `server/lib/slashdoCatalog.js` — the launchable slashdo workflows (`SLASHDO_WORKFLOWS`, `slashdoWorkflowsForApp(isSwiftApp)`, `SLASHDO_APP_TYPES`) driving the app-overview Agent Operations buttons. Adds only the per-button Tailwind classes; pinned by `server/lib/slashdoCatalog.test.js`. |
| `issueLength.js` | Mirror of `server/lib/issueLength.js`. |
diff --git a/client/src/lib/reviewerPins.js b/client/src/lib/reviewerPins.js
index cd073460f8..7de0253098 100644
--- a/client/src/lib/reviewerPins.js
+++ b/client/src/lib/reviewerPins.js
@@ -70,14 +70,22 @@ export const EFFORT_SELECTABLE_REVIEWERS = Object.freeze(Object.keys(REVIEWER_EF
// Reviewer slug aliases. `gemini` is the historical name for the Antigravity CLI.
const REVIEWER_ALIASES = { gemini: 'antigravity' };
-// The ladder for one reviewer token, or `null` when it takes no effort. Accepts
-// the `gemini` alias and `@username` tokens (both → null for the latter).
-export const reviewerEffortLevels = (reviewer) => {
- if (typeof reviewer !== 'string') return null;
+// The canonical slug for a reviewer token: lower-cased, trimmed, aliases resolved.
+// `''` for a non-string. `@username` tokens ride through as-is (they're no
+// reviewer slug, so no lookup keyed on this can match one). Exported because any
+// caller that keys behavior on "is this the Antigravity reviewer?" must resolve
+// the `gemini` alias the same way the ladder lookup below does.
+export const normalizeReviewerSlug = (reviewer) => {
+ if (typeof reviewer !== 'string') return '';
const slug = reviewer.trim().toLowerCase();
- return REVIEWER_EFFORT_LEVELS[REVIEWER_ALIASES[slug] || slug] || null;
+ return REVIEWER_ALIASES[slug] || slug;
};
+// The ladder for one reviewer token, or `null` when it takes no effort. Accepts
+// the `gemini` alias and `@username` tokens (both → null for the latter).
+export const reviewerEffortLevels = (reviewer) =>
+ REVIEWER_EFFORT_LEVELS[normalizeReviewerSlug(reviewer)] || null;
+
// Characters that are STRUCTURAL in slashdo's emitted `--review-with` token and
// have no escape inside the `[<model>]` selector, so the server drops an id
// containing one (mirror of REVIEWER_MODEL_FORBIDDEN_RE). Stripped as the user