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
feat: pin a reasoning-effort tier per code reviewer
[._.]/ Adam Eivy69fdf51a6c29
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 83a2ab0481..fca52a7241 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -1,6 +1,7 @@# Unreleased## Code Review Defaults+- **Each code reviewer can now be pinned to a reasoning-effort tier.** The reviewer table already let you pick which model a reviewer runs; how *hard* that model thinks was stuck at whatever its CLI defaults to, so the only way to buy a more careful review (or a cheaper, faster one) was to change the model. Every reviewer row now has an Effort column alongside Model, on the AI Providers → Code Review Defaults panel, the task form, the CoS schedule config, and the `/do:next` run drawer. Each row offers only the tiers that reviewer actually accepts — Codex's `minimal`…`ultra`, Claude's `low`…`max`, Antigravity's `low`/`medium`/`high`, and `low`/`medium`/`high` for the local LM Studio / Ollama reviewers — so the picker can't offer a level the CLI rejects, and Copilot, Grok, and `@username` reviewers show no control at all because they have no such knob. Because slashdo's `--review-with` grammar has no effort suffix, the pinned tier travels on the invocation instead: as `codex -c model_reasoning_effort=high` / `claude --effort high` / `agy --effort low` when an agent drives the reviewer CLI, and as an `effort` field on the local review request when PortOS runs it. Leaving a row unset keeps that reviewer's own default, exactly as before.- **[issue-3606] A Review Loop reviewer whose CLI isn't installed is now flagged up front.** Previously the only way to find out a configured reviewer (Claude, Antigravity, Codex, or Grok) couldn't actually run was to wait for the review loop itself to discover its command was missing — after PortOS had already opened the PR and spent an agent run. The Code Review Defaults panel, task form, schedule config, and `/do:next` run drawer now show a "not installed" badge next to any reviewer whose CLI binary isn't found on this machine. It's informational only — the reviewer stays selectable, since a federated peer machine (or a later install) may still be able to run it.## Addeddiff --git a/client/src/components/apps/SlashDoRunDrawer.jsx b/client/src/components/apps/SlashDoRunDrawer.jsxindex 58cfd90565..ccbab708d2 100644--- a/client/src/components/apps/SlashDoRunDrawer.jsx+++ b/client/src/components/apps/SlashDoRunDrawer.jsx@@ -5,7 +5,7 @@ import ProviderModelSelector from '../ProviderModelSelector';import ReviewerPicker from '../cos/ReviewerPicker';import useProviderModels from '../../hooks/useProviderModels';import useReviewerModelOptions from '../../hooks/useReviewerModelOptions';-import { reviewerModelsFromDefaults } from '../../lib/reviewerModels';+import { reviewerModelsFromDefaults, reviewerEffortsFromDefaults } from '../../lib/reviewerModels';import { CodeReviewDefaultsProvider, useCodeReviewDefaults } from '../../hooks/useCodeReviewDefaults';import { isProcessProvider } from '../../utils/providers';import WorkItemPicker from './WorkItemPicker';@@ -45,10 +45,15 @@ function SlashDoRunDrawerBody({ open, command, label, appId, appName, onClose, o// Seeded from the install's Code Review Defaults for display. `reviewDirty`// gates whether they're SENT — see the component doc.const [review, setReview] = useState(null);- // The defaults carry per-reviewer models as `<reviewer>Model` scalars; the picker- // takes the token-keyed map, so fold them in for the seeded (untouched) display.+ // The defaults carry per-reviewer models and efforts as `<reviewer>Model` /+ // `<reviewer>Effort` scalars; the picker takes the token-keyed maps, so fold them+ // in for the seeded (untouched) display.const seededReview = useMemo(- () => ({ ...codeReviewDefaults, reviewerModels: reviewerModelsFromDefaults(codeReviewDefaults) }),+ () => ({+ ...codeReviewDefaults,+ reviewerModels: reviewerModelsFromDefaults(codeReviewDefaults),+ reviewerEfforts: reviewerEffortsFromDefaults(codeReviewDefaults),+ }),[codeReviewDefaults]);const reviewValue = review ?? seededReview;@@ -85,7 +90,8 @@ function SlashDoRunDrawerBody({ open, command, label, appId, appName, onClose, ousernames: review.usernames,optionalReviewers: review.optionalReviewers,reviewerMaxRounds: review.reviewerMaxRounds,- reviewerModels: review.reviewerModels+ reviewerModels: review.reviewerModels,+ reviewerEfforts: review.reviewerEfforts} : {})}, { silent: true }).catch((err) => {setSubmitError(err.message || 'Failed to queue the task');@@ -152,13 +158,14 @@ function SlashDoRunDrawerBody({ open, command, label, appId, appName, onClose, ooptionalReviewers={reviewValue.optionalReviewers}reviewerMaxRounds={reviewValue.reviewerMaxRounds}reviewerModels={reviewValue.reviewerModels}+ reviewerEfforts={reviewValue.reviewerEfforts}modelOptions={reviewerModelOptions}installed={codeReviewDefaults.installed}// The claim flows substitute a reviewer CSV into their prompt and have// no slashdo flag string, so stop-mode / reviewer-applies can't be honored.showRunFlags={false}- onChange={({ reviewers, usernames, optionalReviewers, reviewerMaxRounds, reviewerModels }) =>- setReview({ reviewers, usernames, optionalReviewers, reviewerMaxRounds, reviewerModels })}+ onChange={({ reviewers, usernames, optionalReviewers, reviewerMaxRounds, reviewerModels, reviewerEfforts }) =>+ setReview({ reviewers, usernames, optionalReviewers, reviewerMaxRounds, reviewerModels, reviewerEfforts })}/><p className="text-xs text-gray-500">The claim flow opens and merges its own PR, so these reviewers gate that merge (slashdo <code>--review-with</code>).diff --git a/client/src/components/cos/ReviewerPicker.jsx b/client/src/components/cos/ReviewerPicker.jsxindex 1975857504..9319b1c646 100644--- a/client/src/components/cos/ReviewerPicker.jsx+++ b/client/src/components/cos/ReviewerPicker.jsx@@ -11,6 +11,7 @@ import {MODEL_SELECTABLE_REVIEWERS,cleanReviewUsername,normalizeReviewUsernames,+ reviewerEffortLevels,sanitizeReviewerModelInput} from './constants';@@ -18,8 +19,8 @@ const labelFor = (value) => REVIEWER_OPTIONS.find(o => o.value === value)?.labelconst normalizeReviewerValue = (value) => value === 'gemini' ? 'antigravity' : value;/**- * Ordered multi-reviewer picker, rendered as one row per reviewer with the four- * per-reviewer controls as columns: **Provider | Model | Optional | Max+ * Ordered multi-reviewer picker, rendered as one row per reviewer with the five+ * per-reviewer controls as columns: **Provider | Model | Effort | Optional | Max* Iterations** (#3133). Click a reviewer in the Add row to append it (run order =* click order), reorder with the arrows, remove with ✕. Maps to slashdo's* `--review-with a,b,c` plus the stop-mode / `--reviewer-applies` flags.@@ -35,14 +36,21 @@ const normalizeReviewerValue = (value) => value === 'gemini' ? 'antigravity' : v* agent invokes directly, `<reviewer> --model <id>`). Only rendered for* MODEL_SELECTABLE_REVIEWERS. The option lists are OWNED BY THE CALLER (see* `modelOptions`) so this component does no fetching.+ * - **Effort** → the reviewer's reasoning-effort tier. Unlike the others this+ * maps to NO slashdo token (its entry grammar has no effort suffix) — it rides+ * the invocation instead: `claude --effort high` / `codex -c+ * model_reasoning_effort=high` for a CLI reviewer, `"effort"` in the+ * `/api/code-review/local` body for a local one. Only rendered for+ * EFFORT_SELECTABLE_REVIEWERS, and each row offers only the levels its own CLI+ * accepts (`agy` rejects `--effort max`).* - **Optional** → the `~opt` non-blocking marker.* - **Max Iterations** → the numeric `~max=<n>` round cap (blank = slashdo's* built-in default, `0` = loop until clean).** Controlled: emits the full next shape via onChange so the parent can store* `reviewers` / `usernames` / `optionalReviewers` / `reviewerModels` /- * `reviewerMaxRounds` / `reviewStopMode` / `reviewerApplies` however it persists- * them.+ * `reviewerEfforts` / `reviewerMaxRounds` / `reviewStopMode` / `reviewerApplies`+ * however it persists them.** `modelOptions` is the resolved model-picker data, shaped like* `useReviewerModelOptions()`'s return: `{ optionsByReviewer, freeText,@@ -72,6 +80,7 @@ export default function ReviewerPicker({optionalReviewers = [],reviewerMaxRounds = {},reviewerModels = {},+ reviewerEfforts = {},modelOptions = null,installed = null,stopMode = DEFAULT_REVIEW_STOP_MODE,@@ -101,10 +110,10 @@ export default function ReviewerPicker({const optionalSet = new Set(optionalTokens.map(t => t.toLowerCase()));const isOptional = (token) => optionalSet.has(token.toLowerCase());const withoutToken = (token) => optionalTokens.filter(t => t.toLowerCase() !== token.toLowerCase());- // Shared shape for the two token-keyed maps below (`~max=<n>` caps and model- // pins). Both key on the same emitted `--review-with` token and both need the- // same case-insensitive read / key-preserving delete, so the lookup helpers are- // generated once rather than written twice.+ // Shared shape for the three token-keyed maps below (`~max=<n>` caps, model+ // pins, effort pins). All key on the same emitted `--review-with` token and all+ // need the same case-insensitive read / key-preserving delete, so the lookup+ // helpers are generated once rather than written three times.const asMap = (value) => (value && typeof value === 'object' && !Array.isArray(value)) ? value : {};const keyedLookup = (map) => ({get: (token) => {@@ -127,6 +136,11 @@ export default function ReviewerPicker({// DELETES the key rather than persisting `''` (a `--model ` with no id).const modelsMap = asMap(reviewerModels);const models = keyedLookup(modelsMap);+ // Per-reviewer reasoning-effort pins, same token keying and same absent-vs-empty+ // contract as the model pins: no key = "let that reviewer think however it+ // normally does", so clearing the select DELETES the key rather than writing `''`.+ const effortsMap = asMap(reviewerEfforts);+ const efforts = keyedLookup(effortsMap);// Only an explicit `false` counts — `undefined` covers both "not a CLI// reviewer" (copilot/lmstudio/ollama/@username) and "caller didn't fetch// `installed`", neither of which should render a warning badge.@@ -148,6 +162,7 @@ export default function ReviewerPicker({optionalReviewers: optionalTokens,reviewerMaxRounds: maxRoundsMap,reviewerModels: modelsMap,+ reviewerEfforts: effortsMap,stopMode,reviewerApplies,...next@@ -194,6 +209,51 @@ export default function ReviewerPicker({emit({ reviewerModels: { ...models.without(token), [token]: model } });};+ // Blank clears the pin so the reviewer reasons at its own default — the DELETE,+ // not an empty-string write, same absent-vs-empty contract as setModel.+ //+ // No sanitizing pass (unlike setModel, whose input is free text): the value can+ // only be one of the exact levels renderEffortCell rendered, and the one+ // out-of-ladder option it renders is already the selected value, so picking it+ // fires no change.+ const setEffort = (token, level) => emit({+ reviewerEfforts: level ? { ...efforts.without(token), [token]: level } : efforts.without(token)+ });++ // 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.+ const renderEffortCell = (token) => {+ const levels = reviewerEffortLevels(token);+ if (!levels?.length) {+ return <span className="text-[11px] text-gray-700" title={`${labelFor(token)} has no reasoning-effort control`}>—</span>;+ }+ const subject = labelFor(token);+ // A pin whose level left this reviewer's ladder (set on another machine, or+ // before a CLI dropped a tier) still needs an <option>, or the select renders+ // blank and reads as "unset" while the value is in fact stored.+ const stored = efforts.get(token) ?? '';+ return (+ <select+ id={`${id}-effort-${token}`}+ value={stored}+ disabled={disabled}+ onChange={(e) => setEffort(token, e.target.value)}+ aria-label={`Reasoning effort for ${subject}`}+ title={stored+ ? `${subject} reviews at ${stored} reasoning effort. Choose "default" to let it decide.`+ : `${subject} reasons at its own default. Pick a tier to make it think harder (slower, pricier) or lighter.`}+ className={`w-full min-w-0 max-w-[8rem] px-1.5 py-0.5 text-[11px] font-mono rounded border bg-port-bg min-h-[28px] disabled:opacity-40 focus:outline-none focus:border-port-accent ${stored+ ? 'text-port-accent-2 border-port-accent-2/50'+ : 'text-gray-500 border-port-border/60'}`}+ >+ <option value="">— default —</option>+ {stored && !levels.includes(stored) && <option value={stored}>{stored} (unsupported)</option>}+ {levels.map((level) => <option key={level} value={level}>{level}</option>)}+ </select>+ );+ };+// The `~opt` non-blocking toggle rendered on every reviewer/username row.// `subject` is the human name used in the aria-label; `title` is the (row-// kind-specific) hover copy the caller resolves.@@ -353,7 +413,8 @@ export default function ReviewerPicker({reviewerMaxRounds: maxRounds.without(`@${value}`),// A username row has no Model cell, but prune anyway: a hand-edited settings// file (or a future reviewer that gains one) must not leave an orphan pin.- reviewerModels: models.without(`@${value}`)+ reviewerModels: models.without(`@${value}`),+ reviewerEfforts: efforts.without(`@${value}`)});const add = (value) => emit({ reviewers: [...selected, value] });@@ -361,7 +422,8 @@ export default function ReviewerPicker({reviewers: selected.filter(r => r !== value),optionalReviewers: withoutToken(value),reviewerMaxRounds: maxRounds.without(value),- reviewerModels: models.without(value)+ reviewerModels: models.without(value),+ reviewerEfforts: efforts.without(value)});const move = (index, delta) => {const target = index + delta;@@ -376,9 +438,9 @@ export default function ReviewerPicker({// label/value block so a narrow screen never needs horizontal scrolling. The// header row is desktop-only — on mobile each cell carries its own inline// label, since a header far above a stacked row doesn't associate.- const ROW_CLASS = 'grid grid-cols-[auto_1fr] sm:grid-cols-[2.5rem_minmax(5rem,1fr)_minmax(0,2fr)_auto_3.25rem_auto] items-center gap-x-2 gap-y-1 px-1.5 py-1.5 rounded border border-port-border bg-port-bg sm:border-transparent sm:bg-transparent sm:py-0.5 sm:rounded-none';+ const ROW_CLASS = 'grid grid-cols-[auto_1fr] sm:grid-cols-[2.5rem_minmax(5rem,1fr)_minmax(0,2fr)_minmax(0,7rem)_auto_3.25rem_auto] items-center gap-x-2 gap-y-1 px-1.5 py-1.5 rounded border border-port-border bg-port-bg sm:border-transparent sm:bg-transparent sm:py-0.5 sm:rounded-none';const CELL_LABEL_CLASS = 'sm:hidden text-[10px] uppercase tracking-wide text-gray-600';- const HEADER_CLASS = 'hidden sm:grid sm:grid-cols-[2.5rem_minmax(5rem,1fr)_minmax(0,2fr)_auto_3.25rem_auto] items-center gap-x-2 px-1.5 text-[10px] uppercase tracking-wide text-gray-600';+ const HEADER_CLASS = 'hidden sm:grid sm:grid-cols-[2.5rem_minmax(5rem,1fr)_minmax(0,2fr)_minmax(0,7rem)_auto_3.25rem_auto] items-center gap-x-2 px-1.5 text-[10px] uppercase tracking-wide text-gray-600';return (<div className="flex flex-col gap-2 w-full">@@ -390,6 +452,7 @@ export default function ReviewerPicker({<span>#</span><span>Provider</span><span>Model</span>+ <span>Effort</span><span>Optional</span><span className="text-center">Max</span><span className="sr-only">Remove</span>@@ -428,6 +491,8 @@ export default function ReviewerPicker({</span><span className={CELL_LABEL_CLASS}>Model</span><div className="min-w-0">{renderModelCell(value)}</div>+ <span className={CELL_LABEL_CLASS}>Effort</span>+ <div className="min-w-0">{renderEffortCell(value)}</div><span className={CELL_LABEL_CLASS}>Optional</span><div>{renderOptToggle(value, labelFor(value), isOptional(value)@@ -459,7 +524,7 @@ export default function ReviewerPicker({{(selected.length > 0 || selectedUsernames.length > 0) && (<span className="text-[11px] text-gray-600">- Tip: <span className="font-mono text-port-accent">Model</span> pins the model that reviewer runs (blank = its own default). The <span className="font-mono text-port-warning">~opt</span> badge marks a reviewer <em>non-blocking</em> — it still runs and its findings are still fixed, but an inconclusive verdict (timeout / no result) won't block the merge. A hard failure still does. <span className="font-mono text-port-accent-2">Max</span> caps that reviewer's review → fix → re-review rounds (blank = its built-in cap, <span className="font-mono">0</span> = loop until clean) — a small cap keeps a slow local model affordable.+ Tip: <span className="font-mono text-port-accent">Model</span> pins the model that reviewer runs (blank = its own default), and <span className="font-mono text-port-accent-2">Effort</span> pins how hard it reasons — higher is slower and pricier, and each reviewer only offers the tiers its own CLI accepts. The <span className="font-mono text-port-warning">~opt</span> badge marks a reviewer <em>non-blocking</em> — it still runs and its findings are still fixed, but an inconclusive verdict (timeout / no result) won't block the merge. A hard failure still does. <span className="font-mono text-port-accent-2">Max</span> caps that reviewer's review → fix → re-review rounds (blank = its built-in cap, <span className="font-mono">0</span> = loop until clean) — a small cap keeps a slow local model affordable.</span>)}@@ -501,6 +566,8 @@ export default function ReviewerPicker({<span className="text-xs text-gray-300 col-span-2 sm:col-span-1 truncate">{value}</span><span className={CELL_LABEL_CLASS}>Model</span><div className="min-w-0">{renderModelCell(`@${value}`)}</div>+ <span className={CELL_LABEL_CLASS}>Effort</span>+ <div className="min-w-0">{renderEffortCell(`@${value}`)}</div><span className={CELL_LABEL_CLASS}>Optional</span><div>{renderOptToggle(`@${value}`, `@${value}`, isOptional(`@${value}`)diff --git a/client/src/components/cos/ReviewerPicker.test.jsx b/client/src/components/cos/ReviewerPicker.test.jsxindex bb2daa0f42..bef3654610 100644--- a/client/src/components/cos/ReviewerPicker.test.jsx+++ b/client/src/components/cos/ReviewerPicker.test.jsx@@ -421,4 +421,61 @@ describe('ReviewerPicker', () => {expect(onChange).toHaveBeenCalledWith(expect.objectContaining({ reviewerModels: { claude: 'Some Model (High)' } }));});});+ describe('Effort column', () => {+ it('offers each reviewer only the tiers its own CLI accepts', () => {+ render(<ReviewerPicker reviewers={['antigravity']} onChange={() => {}} />);+ const select = screen.getByLabelText('Reasoning effort for Antigravity');+ expect(select.tagName).toBe('SELECT');+ expect(screen.getByRole('option', { name: 'high' })).toBeInTheDocument();+ // agy rejects `--effort max`, so the picker must not offer it.+ expect(screen.queryByRole('option', { name: 'max' })).not.toBeInTheDocument();+ });++ it('offers the wider claude ladder on a claude row', () => {+ render(<ReviewerPicker reviewers={['claude']} onChange={() => {}} />);+ expect(screen.getByRole('option', { name: 'xhigh' })).toBeInTheDocument();+ });++ it('renders no Effort control for a reviewer with no effort knob', () => {+ render(<ReviewerPicker reviewers={['copilot', 'grok']} usernames={['flaky-bot']} onChange={() => {}} />);+ expect(screen.queryByLabelText('Reasoning effort for Copilot')).not.toBeInTheDocument();+ expect(screen.queryByLabelText('Reasoning effort for Grok')).not.toBeInTheDocument();+ expect(screen.queryByLabelText('Reasoning effort for @flaky-bot')).not.toBeInTheDocument();+ });++ it('shows an existing pin and emits a picked tier', () => {+ const onChange = vi.fn();+ render(<ReviewerPicker reviewers={['codex']} reviewerEfforts={{ codex: 'low' }} onChange={onChange} />);+ const select = screen.getByLabelText('Reasoning effort for Codex');+ expect(select).toHaveValue('low');+ fireEvent.change(select, { target: { value: 'high' } });+ expect(onChange).toHaveBeenCalledWith(expect.objectContaining({ reviewerEfforts: { codex: 'high' } }));+ });++ it('clearing DELETES the key rather than writing an empty string', () => {+ const onChange = vi.fn();+ render(<ReviewerPicker reviewers={['codex']} reviewerEfforts={{ codex: 'high' }} onChange={onChange} />);+ fireEvent.change(screen.getByLabelText('Reasoning effort for Codex'), { target: { value: '' } });+ expect(onChange).toHaveBeenCalledWith(expect.objectContaining({ reviewerEfforts: {} }));+ });++ it('keeps a stored tier the ladder no longer lists visible instead of reading as unset', () => {+ render(<ReviewerPicker reviewers={['antigravity']} reviewerEfforts={{ antigravity: 'max' }} onChange={() => {}} />);+ const select = screen.getByLabelText('Reasoning effort for Antigravity');+ expect(select).toHaveValue('max');+ expect(screen.getByRole('option', { name: 'max (unsupported)' })).toBeInTheDocument();+ });++ it('prunes the effort pin when its reviewer is removed', () => {+ const onChange = vi.fn();+ render(<ReviewerPicker reviewers={['codex', 'ollama']} reviewerEfforts={{ ollama: 'high' }} onChange={onChange} />);+ fireEvent.click(screen.getByLabelText('Remove Ollama'));+ expect(onChange).toHaveBeenCalledWith(expect.objectContaining({ reviewers: ['codex'], reviewerEfforts: {} }));+ });++ it('reads a pin case-insensitively, like the sibling maps', () => {+ render(<ReviewerPicker reviewers={['codex']} reviewerEfforts={{ Codex: 'high' }} onChange={() => {}} />);+ expect(screen.getByLabelText('Reasoning effort for Codex')).toHaveValue('high');+ });+ });});diff --git a/client/src/components/cos/TaskAddForm.jsx b/client/src/components/cos/TaskAddForm.jsxindex 0737045ca6..86e64d70ac 100644--- a/client/src/components/cos/TaskAddForm.jsx+++ b/client/src/components/cos/TaskAddForm.jsx@@ -14,7 +14,7 @@ import { slashdoLabel } from '../../lib/slashdoCatalog';import ReviewerPicker from './ReviewerPicker';import EffortSelect from './EffortSelect';import useReviewerModelOptions from '../../hooks/useReviewerModelOptions';-import { reviewerModelsFromDefaults } from '../../lib/reviewerModels';+import { reviewerModelsFromDefaults, reviewerEffortsFromDefaults } from '../../lib/reviewerModels';export default function TaskAddForm({ providers, apps, onTaskAdded, compact = false, defaultExpanded = false, defaultApp = '' }) {const [newTask, setNewTask] = useState({ description: '', model: '', provider: '', effort: '', app: defaultApp });@@ -30,6 +30,7 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = faconst [optionalReviewers, setOptionalReviewers] = useState([]);const [reviewerMaxRounds, setReviewerMaxRounds] = useState({});const [reviewerModels, setReviewerModels] = useState({});+ const [reviewerEfforts, setReviewerEfforts] = useState({});const [reviewStopMode, setReviewStopMode] = useState(DEFAULT_REVIEW_STOP_MODE);const [reviewerApplies, setReviewerApplies] = useState(false);const [reviewerCliInstalled, setReviewerCliInstalled] = useState({});@@ -81,6 +82,7 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = fa// The defaults persist per-reviewer models as scalars; the picker takes the// token-keyed map (see client/src/lib/reviewerModels.js).setReviewerModels(reviewerModelsFromDefaults(d));+ setReviewerEfforts(reviewerEffortsFromDefaults(d));if (d.stopMode) setReviewStopMode(d.stopMode);if (d.reviewerApplies === true) setReviewerApplies(true);if (d.installed && typeof d.installed === 'object' && !Array.isArray(d.installed)) setReviewerCliInstalled(d.installed);@@ -329,13 +331,18 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = faopenPR: useWorktree && openPR,simplify,prCompletion: useWorktree && openPR ? prCompletion : undefined,- reviewers: openPR && prCompletion === 'review-then-merge' ? reviewers : undefined,- usernames: openPR && prCompletion === 'review-then-merge' ? reviewUsernames : undefined,- optionalReviewers: openPR && prCompletion === 'review-then-merge' ? optionalReviewers : undefined,- reviewerMaxRounds: openPR && prCompletion === 'review-then-merge' ? reviewerMaxRounds : undefined,- reviewerModels: openPR && prCompletion === 'review-then-merge' ? reviewerModels : undefined,- reviewStopMode: openPR && prCompletion === 'review-then-merge' ? reviewStopMode : undefined,- reviewerApplies: openPR && prCompletion === 'review-then-merge' ? reviewerApplies : undefined,+ // One gate for every per-reviewer field: they only apply when this task+ // opens a PR that PortOS reviews before merging.+ ...(openPR && prCompletion === 'review-then-merge' ? {+ reviewers,+ usernames: reviewUsernames,+ optionalReviewers,+ reviewerMaxRounds,+ reviewerModels,+ reviewerEfforts,+ reviewStopMode,+ reviewerApplies,+ } : {}),screenshots: screenshots.length > 0 ? screenshots.map(s => s.path) : undefined,attachments: attachments.length > 0 ? attachments.map(a => ({filename: a.filename,@@ -590,16 +597,18 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = faoptionalReviewers={optionalReviewers}reviewerMaxRounds={reviewerMaxRounds}reviewerModels={reviewerModels}+ reviewerEfforts={reviewerEfforts}modelOptions={reviewerModelOptions}installed={reviewerCliInstalled}stopMode={reviewStopMode}reviewerApplies={reviewerApplies}- onChange={({ reviewers: r, usernames: u, optionalReviewers: o, reviewerMaxRounds: m, reviewerModels: rm, stopMode, reviewerApplies: ra }) => {+ onChange={({ reviewers: r, usernames: u, optionalReviewers: o, reviewerMaxRounds: m, reviewerModels: rm, reviewerEfforts: re, stopMode, reviewerApplies: ra }) => {setReviewers(r);setReviewUsernames(u);setOptionalReviewers(o);setReviewerMaxRounds(m);setReviewerModels(rm);+ setReviewerEfforts(re);setReviewStopMode(stopMode);setReviewerApplies(ra);}}diff --git a/client/src/components/cos/constants.js b/client/src/components/cos/constants.jsindex f915b63111..32bfe41f4f 100644--- a/client/src/components/cos/constants.js+++ b/client/src/components/cos/constants.js@@ -13,6 +13,11 @@ import {Newspaper,ChartGantt} from 'lucide-react';+import {+ CLAUDE_EFFORT_LEVELS,+ CODEX_EFFORT_LEVELS,+ ANTIGRAVITY_EFFORT_LEVELS+} from '../../utils/providers';export const TABS = [{ id: 'briefing', label: 'Briefing', icon: Newspaper },@@ -226,6 +231,39 @@ export const MODEL_SELECTABLE_REVIEWERS = [...MODEL_CAPABLE_CLI_REVIEWERS, ...LO// dropped server-side, so the input must not accept one.export const MAX_REVIEWER_MODEL_LENGTH = 200;+// Reasoning-effort ladder for the local-LLM reviewers — the OpenAI-compatible+// `reasoning_effort` tier names both LM Studio and Ollama accept. Client mirror+// of LOCAL_LLM_EFFORT_LEVELS in server/lib/cosValidation.js.+export const LOCAL_LLM_EFFORT_LEVELS = Object.freeze(['low', 'medium', 'high']);++// The effort ladder each reviewer offers, or absent when it has no effort control+// (`copilot` is a GitHub review, `grok`'s CLI takes no effort flag, and an+// `@username` reviewer is a person). Client mirror of `reviewerEffortLevels` in+// server/lib/cosValidation.js — the CLI ladders come from the same+// providers.js constants the server derives its own from, so the picker can only+// offer a level the reviewer's binary actually accepts (`agy` really does reject+// `--effort max`). Keep in sync; a level offered here but rejected there would+// show the user a pin that never persists.+export const REVIEWER_EFFORT_LEVELS = Object.freeze({+ claude: CLAUDE_EFFORT_LEVELS,+ codex: CODEX_EFFORT_LEVELS,+ antigravity: ANTIGRAVITY_EFFORT_LEVELS,+ lmstudio: LOCAL_LLM_EFFORT_LEVELS,+ ollama: LOCAL_LLM_EFFORT_LEVELS,+});++// Every reviewer whose effort the user can pick per row in ReviewerPicker.+// Client mirror of EFFORT_SELECTABLE_REVIEWERS in server/lib/cosValidation.js.+export const EFFORT_SELECTABLE_REVIEWERS = Object.freeze(Object.keys(REVIEWER_EFFORT_LEVELS));++// 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;+ const slug = reviewer.trim().toLowerCase();+ return REVIEWER_EFFORT_LEVELS[REVIEWER_ALIASES[slug] || slug] || 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 indiff --git a/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx b/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsxindex b03c2a455a..67af38c626 100644--- a/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx+++ b/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx@@ -1,4 +1,4 @@-import { useState, useEffect } from 'react';+import { useState, useEffect, useMemo } from 'react';import { RotateCcw, AlertCircle } from 'lucide-react';import CronInput from '../../../CronInput';import { AGENT_OPTIONS, DEFAULT_REVIEW_STOP_MODE, IMPLICIT_PR_COMPLETION, PR_AUTHOR_FILTER_OPTIONS, PR_COMPLETION_OPTIONS, pinnedPrCompletion, prCompletionOption, ISSUE_AUTHOR_FILTER_OPTIONS, ISSUE_AUTHOR_FILTER_TASK_TYPES, SWARM_COUNT_OPTIONS, SWARM_TASK_TYPES } from '../../constants';@@ -9,7 +9,7 @@ import { FormField } from '../../../ui/FormField';import { formatDateTime } from '../../../../utils/formatters';import { useCodeReviewDefaults } from '../../../../hooks/useCodeReviewDefaults';import useReviewerModelOptions from '../../../../hooks/useReviewerModelOptions';-import { reviewerModelsFromDefaults } from '../../../../lib/reviewerModels';+import { reviewerModelsFromDefaults, reviewerEffortsFromDefaults } from '../../../../lib/reviewerModels';import ToggleSwitch from '../../../ToggleSwitch';import useTaskModelPins from '../../../../hooks/useTaskModelPins';import { effectiveModelFor } from '../../../../utils/providers';@@ -28,6 +28,14 @@ export default function GlobalConfigControls({ taskType, config, onUpdate, onTri// Resolved model lists for the reviewer table's Model column (the picker itself// never fetches — see its `modelOptions` prop).const reviewerModelOptions = useReviewerModelOptions();+ // The install defaults persist per-reviewer models and efforts as `<reviewer>Model`+ // / `<reviewer>Effort` scalars; the picker takes token-keyed maps. Memoized so a+ // re-render (every `updating` flip) doesn't re-walk the roster and hand the picker+ // fresh object identities. Mirrors SlashDoRunDrawer's `seededReview`.+ const seededPins = useMemo(() => ({+ models: reviewerModelsFromDefaults(reviewDefaults),+ efforts: reviewerEffortsFromDefaults(reviewDefaults),+ }), [reviewDefaults]);const [selectedType, setSelectedType] = useState(config.type);const [editingPrompt, setEditingPrompt] = useState(false);const [promptValue, setPromptValue] = useState(config.prompt || '');@@ -469,7 +477,8 @@ export default function GlobalConfigControls({ taskType, config, onUpdate, onTrireviewerMaxRounds={config.taskMetadata?.reviewerMaxRounds ?? reviewDefaults.reviewerMaxRounds}// The task type's own pins when it has them, else the install's Code// Review Defaults (persisted as `<reviewer>Model` scalars).- reviewerModels={config.taskMetadata?.reviewerModels ?? reviewerModelsFromDefaults(reviewDefaults)}+ reviewerModels={config.taskMetadata?.reviewerModels ?? seededPins.models}+ reviewerEfforts={config.taskMetadata?.reviewerEfforts ?? seededPins.efforts}modelOptions={reviewerModelOptions}installed={reviewDefaults.installed}stopMode={config.taskMetadata?.reviewStopMode || reviewDefaults.stopMode || DEFAULT_REVIEW_STOP_MODE}@@ -477,11 +486,11 @@ export default function GlobalConfigControls({ taskType, config, onUpdate, onTri? (config.taskMetadata?.reviewerApplies === true || config.taskMetadata?.reviewerApplies === 'true'): reviewDefaults.reviewerApplies}disabled={updating}- onChange={({ reviewers, usernames, optionalReviewers, reviewerMaxRounds, reviewerModels, stopMode, reviewerApplies }) => {+ onChange={({ reviewers, usernames, optionalReviewers, reviewerMaxRounds, reviewerModels, reviewerEfforts, stopMode, reviewerApplies }) => {// Drop the legacy single `reviewer` key so storage converges on `reviewers`.const { reviewer: _reviewer, ...rest } = config.taskMetadata || {};onUpdate(taskType, {- taskMetadata: { ...rest, reviewers, usernames, optionalReviewers, reviewerMaxRounds, reviewerModels, reviewStopMode: stopMode, reviewerApplies }+ taskMetadata: { ...rest, reviewers, usernames, optionalReviewers, reviewerMaxRounds, reviewerModels, reviewerEfforts, reviewStopMode: stopMode, reviewerApplies }});}}/>diff --git a/client/src/components/providers/CodeReviewDefaultsPanel.jsx b/client/src/components/providers/CodeReviewDefaultsPanel.jsxindex d8805eb3a2..fd10140246 100644--- a/client/src/components/providers/CodeReviewDefaultsPanel.jsx+++ b/client/src/components/providers/CodeReviewDefaultsPanel.jsx@@ -4,7 +4,7 @@ import toast from '../ui/Toast';import * as api from '../../services/api';import ReviewerPicker from '../cos/ReviewerPicker';import useReviewerModelOptions from '../../hooks/useReviewerModelOptions';-import { reviewerModelsFromDefaults, reviewerModelsToDefaults } from '../../lib/reviewerModels';+import { reviewerModelsFromDefaults, reviewerModelsToDefaults, reviewerEffortsFromDefaults, reviewerEffortsToDefaults } from '../../lib/reviewerModels';import {DEFAULT_REVIEWERS,DEFAULT_REVIEW_STOP_MODE,@@ -24,6 +24,7 @@ export default function CodeReviewDefaultsPanel() {const [optionalReviewers, setOptionalReviewers] = useState([]);const [reviewerMaxRounds, setReviewerMaxRounds] = useState({});const [reviewerModels, setReviewerModels] = useState({});+ const [reviewerEfforts, setReviewerEfforts] = useState({});const [stopMode, setStopMode] = useState(DEFAULT_REVIEW_STOP_MODE);const [reviewerApplies, setReviewerApplies] = useState(false);const [installed, setInstalled] = useState({});@@ -43,6 +44,7 @@ export default function CodeReviewDefaultsPanel() {? defaults.reviewerMaxRounds: {});setReviewerModels(reviewerModelsFromDefaults(defaults));+ setReviewerEfforts(reviewerEffortsFromDefaults(defaults));setStopMode(defaults.stopMode || DEFAULT_REVIEW_STOP_MODE);setReviewerApplies(defaults.reviewerApplies === true);setInstalled(defaults.installed && typeof defaults.installed === 'object' && !Array.isArray(defaults.installed) ? defaults.installed : {});@@ -62,6 +64,7 @@ export default function CodeReviewDefaultsPanel() {stopMode,reviewerApplies,...reviewerModelsToDefaults(reviewerModels),+ ...reviewerEffortsToDefaults(reviewerEfforts),};const ok = await api.updateSettings({ codeReview: payload }, { silent: true }).then(() => true)@@ -90,17 +93,19 @@ export default function CodeReviewDefaultsPanel() {optionalReviewers={optionalReviewers}reviewerMaxRounds={reviewerMaxRounds}reviewerModels={reviewerModels}+ reviewerEfforts={reviewerEfforts}modelOptions={modelOptions}installed={installed}stopMode={stopMode}reviewerApplies={reviewerApplies}disabled={saving}- onChange={({ reviewers: r, usernames: u, optionalReviewers: o, reviewerMaxRounds: m, reviewerModels: dm, stopMode: s, reviewerApplies: a }) => {+ onChange={({ reviewers: r, usernames: u, optionalReviewers: o, reviewerMaxRounds: m, reviewerModels: dm, reviewerEfforts: de, stopMode: s, reviewerApplies: a }) => {setReviewers(r);setUsernames(u);setOptionalReviewers(o);setReviewerMaxRounds(m);setReviewerModels(dm);+ setReviewerEfforts(de);setStopMode(s);setReviewerApplies(a);}}diff --git a/client/src/hooks/useCodeReviewDefaults.jsx b/client/src/hooks/useCodeReviewDefaults.jsxindex 7b90b6035c..8cfefe0bfd 100644--- a/client/src/hooks/useCodeReviewDefaults.jsx+++ b/client/src/hooks/useCodeReviewDefaults.jsx@@ -1,16 +1,26 @@import { createContext, useContext, useEffect, useState } from 'react';import * as api from '../services/api';-import { DEFAULT_REVIEWERS, DEFAULT_REVIEW_STOP_MODE } from '../components/cos/constants';+import { DEFAULT_REVIEWERS, DEFAULT_REVIEW_STOP_MODE, EFFORT_SELECTABLE_REVIEWERS, MODEL_SELECTABLE_REVIEWERS } from '../components/cos/constants';++// The per-reviewer scalars, generated from the same rosters the picker renders+// Model and Effort cells for. Generated rather than hand-listed because a+// reviewer missing from this context silently blanks its configured pin on every+// consumer — with nothing failing to say so.+const pinScalars = (source) => Object.fromEntries([+ ...MODEL_SELECTABLE_REVIEWERS.map((reviewer) => [`${reviewer}Model`, source?.[`${reviewer}Model`] || null]),+ ...EFFORT_SELECTABLE_REVIEWERS.map((reviewer) => [`${reviewer}Effort`, source?.[`${reviewer}Effort`] || null]),+]);// Resolved "Code Review Defaults" (AI Providers panel) — used by TaskAddForm// and ScheduleTab's per-task-type config to seed the picker's fallback state// instead of the hardcoded `['copilot']`. Returned shape mirrors the server's// `getCodeReviewDefaults()` so a consumer can rely on the same field names// regardless of whether it reads context or calls the API directly.-// Mirrors the server's `pickCodeReviewDefaults` shape, including all four-// `<reviewer>Model` scalars — the reviewer table's Model column reads them via-// `reviewerModelsFromDefaults`, so omitting the two CLI scalars here would silently-// blank a configured codex/claude pin on every consumer of this context.+// Mirrors the server's `pickCodeReviewDefaults` shape, including every+// `<reviewer>Model` / `<reviewer>Effort` scalar — the reviewer table's Model and+// Effort columns read them via `reviewerModelsFromDefaults` /+// `reviewerEffortsFromDefaults`, so omitting one here would silently blank a+// configured pin on every consumer of this context.const FALLBACK = Object.freeze({reviewers: DEFAULT_REVIEWERS,usernames: [],@@ -18,10 +28,7 @@ const FALLBACK = Object.freeze({reviewerMaxRounds: {},stopMode: DEFAULT_REVIEW_STOP_MODE,reviewerApplies: false,- lmstudioModel: null,- ollamaModel: null,- codexModel: null,- claudeModel: null,+ ...pinScalars(null),// Per-CLI-reviewer install probe (#3606) — absent/empty means "not fetched// yet", not "nothing installed"; ReviewerPicker only warns on an explicit// `false`.@@ -51,10 +58,7 @@ export function CodeReviewDefaultsProvider({ children }) {: {},stopMode: d.stopMode || DEFAULT_REVIEW_STOP_MODE,reviewerApplies: d.reviewerApplies === true,- lmstudioModel: d.lmstudioModel || null,- ollamaModel: d.ollamaModel || null,- codexModel: d.codexModel || null,- claudeModel: d.claudeModel || null,+ ...pinScalars(d),installed: d.installed && typeof d.installed === 'object' && !Array.isArray(d.installed) ? d.installed : {},});})diff --git a/client/src/lib/README.md b/client/src/lib/README.mdindex fb66a183f1..4a9b9c4ce9 100644--- a/client/src/lib/README.md+++ b/client/src/lib/README.md@@ -43,7 +43,7 @@ grep -i "what you want to do" client/src/lib/README.md| `editorialRoadmap.js` | `projectAnalyzedPoints` (aggregate roadmap → analyzed chart points with arc-position `frac`) + `dominant` (most-frequent string). Shared by EditorialRoadmapPanel and the Reader Map page. || `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` — adapt the Code Review Defaults' per-reviewer model SCALARS (`codexModel`, `ollamaModel`, …) to and from the token-keyed map `ReviewerPicker`'s Model column takes. Mirrors `reviewerModelsFromDefaults` in `server/lib/cosValidation.js`. |+| `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`. || `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/reviewerModels.js b/client/src/lib/reviewerModels.jsindex 0586145037..53b5871955 100644--- a/client/src/lib/reviewerModels.js+++ b/client/src/lib/reviewerModels.js@@ -1,17 +1,25 @@-import { MODEL_SELECTABLE_REVIEWERS, MAX_REVIEWER_MODEL_LENGTH, sanitizeReviewerModelInput } from '../components/cos/constants';+import {+ MODEL_SELECTABLE_REVIEWERS,+ MAX_REVIEWER_MODEL_LENGTH,+ EFFORT_SELECTABLE_REVIEWERS,+ reviewerEffortLevels,+ sanitizeReviewerModelInput+} from '../components/cos/constants';/**- * Adapters between the two shapes a per-reviewer model pin takes.+ * Adapters between the two shapes a per-reviewer pin takes — model ids and+ * reasoning-effort tiers alike.** The Code Review Defaults settings slice persists ONE SCALAR PER REVIEWER- * (`codexModel`, `claudeModel`, `lmstudioModel`, `ollamaModel`) and stays that way- * — the encoding crosses installs, so changing it would need a migration for zero- * gain. Everything else (the ReviewerPicker table, per-task metadata, the slashdo- * token builders) speaks the token-keyed MAP shape the `~opt` / `~max` controls- * already use, so the two need one documented conversion point rather than a- * hand-rolled loop in each consumer.+ * (`codexModel`, `claudeModel`, `lmstudioModel`, `ollamaModel`, and the matching+ * `<reviewer>Effort` scalars) and stays that way — the encoding crosses installs,+ * so changing it would need a migration for zero gain. Everything else (the+ * ReviewerPicker table, per-task metadata, the slashdo token builders) speaks the+ * token-keyed MAP shape the `~opt` / `~max` controls already use, so the two need+ * one documented conversion point rather than a hand-rolled loop in each consumer.*- * Server mirror: `reviewerModelsFromDefaults` in `server/lib/cosValidation.js`.+ * Server mirror: `reviewerModelsFromDefaults` / `reviewerEffortsFromDefaults` in+ * `server/lib/cosValidation.js`.*//**@@ -43,3 +51,33 @@ export function reviewerModelsToDefaults(models) {MODEL_SELECTABLE_REVIEWERS.map((reviewer) => [`${reviewer}Model`, models?.[reviewer] || undefined]));}++/**+ * Effort twin of `reviewerModelsFromDefaults`: scalars → `{ codex: 'high' }`.+ * Each value is re-checked against that reviewer's OWN ladder, so a level stored+ * before the reviewer's CLI dropped it (or hand-edited into settings.json) doesn't+ * surface as a pin the server's normalizer would then drop — the picker would+ * otherwise DISPLAY an effort no reviewer ever receives.+ */+export function reviewerEffortsFromDefaults(defaults) {+ const out = {};+ for (const reviewer of EFFORT_SELECTABLE_REVIEWERS) {+ const raw = defaults?.[`${reviewer}Effort`];+ if (typeof raw !== 'string') continue;+ const effort = raw.trim().toLowerCase();+ if (reviewerEffortLevels(reviewer)?.includes(effort)) out[reviewer] = effort;+ }+ return out;+}++/**+ * Map → scalars, for a settings PATCH. Same every-key contract as+ * `reviewerModelsToDefaults`: an unpinned reviewer sends `undefined` so the+ * schema's `emptyToUndefined` preprocess CLEARS the stored scalar instead of+ * leaving a stale effort behind.+ */+export function reviewerEffortsToDefaults(efforts) {+ return Object.fromEntries(+ EFFORT_SELECTABLE_REVIEWERS.map((reviewer) => [`${reviewer}Effort`, efforts?.[reviewer] || undefined])+ );+}diff --git a/server/lib/cosValidation.js b/server/lib/cosValidation.jsindex 68c23bc8f0..04934df6a1 100644--- a/server/lib/cosValidation.js+++ b/server/lib/cosValidation.js@@ -10,7 +10,8 @@*/import { z } from 'zod';import { emptyToUndefined, emptyToNull } from './zodCompat.js';-import { EFFORT_LEVELS } from './providerModels.js';+import { isPlainObject } from './objects.js';+import { EFFORT_LEVELS, effortLevelsForProvider, buildEffortArgs } from './providerModels.js';import { ANTIGRAVITY_COMMAND } from './antigravity.js';import { isValidSlashdoCommand } from './slashdoInvocation.js';import { PR_COMPLETION_VALUES } from './prDisposition.js';@@ -241,6 +242,58 @@ export function resolveOptionalReviewers(metadataOptional, defaultOptional) {: (normalizeOptionalReviewers(defaultOptional) || []);}+/**+ * Factory for the token-keyed per-reviewer PIN normalizers (`~max=<n>` caps,+ * model ids, reasoning efforts). All three share one contract and only differ in+ * how they validate a single value, so the contract lives here once:+ *+ * - Non-object input → `undefined`, so an omitted field isn't persisted as an+ * empty override (an explicitly empty `{}` IS kept — it's a real "clear the+ * defaults for this task" choice).+ * - Keys are normalized to the exact token `--review-with` emits+ * (`normalizeReviewerToken`), so the maps can't disagree about what a reviewer+ * is called; unknown tokens are dropped.+ * - First spelling wins for two names of one reviewer (`gemini`/`antigravity`,+ * `@Bot`/`@bot`) — mirrors `normalizeOptionalReviewers`' dedupe.+ * - A value `normalizeOne` rejects is DROPPED, never coerced — for every pin+ * kind, "absent" and "a falsy value" mean different things downstream.+ *+ * `Object.create(null)` while building so a reviewer token can't collide with+ * `Object.prototype` keys; spread on return so callers get a plain object.+ *+ * @param {(value: unknown, token: string) => unknown} normalizeOne - returns the+ * validated value, or a falsy value to drop the entry.+ */+function keyedReviewerPinNormalizer(normalizeOne) {+ return (map) => {+ if (!isPlainObject(map)) return undefined;+ const out = Object.create(null);+ for (const [rawKey, rawValue] of Object.entries(map)) {+ const token = normalizeReviewerToken(rawKey);+ if (!token) continue;+ const value = normalizeOne(rawValue, token);+ if (!value && value !== 0) continue;+ if (Object.prototype.hasOwnProperty.call(out, token)) continue;+ out[token] = value;+ }+ return { ...out };+ };+}++/**+ * Factory for the matching task-over-default resolvers: a task-level map — even+ * an explicitly empty one — overrides the Code Review Defaults; only an+ * absent/malformed one falls back. Mirrors `resolveOptionalReviewers`.+ *+ * @param {(map: unknown) => Object|undefined} normalizeMap - the normalizer this+ * pin kind was built with.+ */+function keyedReviewerPinResolver(normalizeMap) {+ return (metadataMap, defaultMap) => (isPlainObject(metadataMap)+ ? (normalizeMap(metadataMap) || {})+ : (normalizeMap(defaultMap) || {}));+}+// Ceiling on a per-reviewer `~max=<n>` cap. slashdo's inner loops carry their own// 10-iteration safety guardrail, so a budget above it can never be spent —// accepting one would just be a lie in the flag string.@@ -264,24 +317,18 @@ export const MAX_REVIEWER_MAX_ROUNDS = 10;* MAX_REVIEWER_MAX_ROUNDS so a hand-edited settings.json can't smuggle in an* unbounded budget. Non-object input → undefined (an omitted field isn't* persisted as an empty override).+ *+ * `0` is the one pin value that is falsy AND meaningful, which is why the shared+ * factory keeps it explicitly.*/-export function normalizeReviewerMaxRounds(map) {- if (!map || typeof map !== 'object' || Array.isArray(map)) return undefined;- const out = Object.create(null);- for (const [rawKey, rawValue] of Object.entries(map)) {- const token = normalizeReviewerToken(rawKey);- if (!token) continue;- // Only a genuine non-negative integer is a cap. A string "2", null, NaN, or- // 1.5 is not — and must NOT fall through to 0, which slashdo reads as- // "unlimited".- if (!Number.isInteger(rawValue) || rawValue < 0 || rawValue > MAX_REVIEWER_MAX_ROUNDS) continue;- // First occurrence wins for two spellings of the same reviewer (`gemini` /- // `antigravity`, `@Bot` / `@bot`) — mirrors normalizeOptionalReviewers' dedupe.- if (Object.prototype.hasOwnProperty.call(out, token)) continue;- out[token] = rawValue;- }- return { ...out };-}+export const normalizeReviewerMaxRounds = keyedReviewerPinNormalizer((rawValue) => (+ // Only a genuine non-negative integer is a cap. A string "2", null, NaN, or+ // 1.5 is not — and must NOT fall through to 0, which slashdo reads as+ // "unlimited".+ (Number.isInteger(rawValue) && rawValue >= 0 && rawValue <= MAX_REVIEWER_MAX_ROUNDS)+ ? rawValue+ : undefined+));/*** Resolve per-reviewer iteration caps with task-over-default precedence: a@@ -289,12 +336,7 @@ export function normalizeReviewerMaxRounds(map) {* only fall back to the defaults when the task didn't pin its own. Mirrors* `resolveOptionalReviewers`.*/-export function resolveReviewerMaxRounds(metadataMap, defaultMap) {- const isMap = (v) => !!v && typeof v === 'object' && !Array.isArray(v);- return isMap(metadataMap)- ? (normalizeReviewerMaxRounds(metadataMap) || {})- : (normalizeReviewerMaxRounds(defaultMap) || {});-}+export const resolveReviewerMaxRounds = keyedReviewerPinResolver(normalizeReviewerMaxRounds);// Upper bound on a pinned reviewer model id. Generous (Bedrock/Ollama ids get// long) but present so a hand-edited settings.json can't smuggle in a blob that@@ -367,21 +409,7 @@ export const BRACKET_MODEL_REVIEWERS = MODEL_SELECTABLE_REVIEWERS.filter(r => r* Dropping is the safe failure — the reviewer falls back to its own default model* instead of running against a corrupt reviewer list.*/-export function normalizeReviewerModels(map) {- if (!map || typeof map !== 'object' || Array.isArray(map)) return undefined;- const out = Object.create(null);- for (const [rawKey, rawValue] of Object.entries(map)) {- const token = normalizeReviewerToken(rawKey);- if (!token) continue;- const model = normalizeReviewerModel(rawValue, token);- if (!model) continue;- // First occurrence wins for two spellings of one reviewer — mirrors the- // sibling normalizers' dedupe.- if (Object.prototype.hasOwnProperty.call(out, token)) continue;- out[token] = model;- }- return { ...out };-}+export const normalizeReviewerModels = keyedReviewerPinNormalizer(normalizeReviewerModel);/*** Resolve per-reviewer model pins with task-over-default precedence: a@@ -389,12 +417,7 @@ export function normalizeReviewerModels(map) {* only fall back to the defaults when the task didn't pin its own. Mirrors* `resolveReviewerMaxRounds`.*/-export function resolveReviewerModels(metadataMap, defaultMap) {- const isMap = (v) => !!v && typeof v === 'object' && !Array.isArray(v);- return isMap(metadataMap)- ? (normalizeReviewerModels(metadataMap) || {})- : (normalizeReviewerModels(defaultMap) || {});-}+export const resolveReviewerModels = keyedReviewerPinResolver(normalizeReviewerModels);/*** Fold the Code Review Defaults' per-reviewer model SCALARS@@ -418,6 +441,175 @@ export function reviewerModelsFromDefaults(defaults) {return out;}+// Reasoning-effort ladder for the local-LLM reviewers. Their review request goes+// out as an OpenAI-compatible `/v1/chat/completions` call, whose `reasoning_effort`+// field both LM Studio and Ollama accept for thinking models — but only over the+// low/medium/high tier names. The wider CLI ladder (`minimal`/`xhigh`/`max`/+// `ultra`) is vendor-CLI vocabulary that an OpenAI-shaped backend can reject, so+// the local reviewers get their own, narrower set.+export const LOCAL_LLM_EFFORT_LEVELS = Object.freeze(['low', 'medium', 'high']);++/**+ * Reviewer slug → the reasoning-effort ladder that reviewer accepts. Only+ * reviewers WITH an effort control appear: `copilot` is a GitHub review, `grok`'s+ * CLI takes no effort flag, and an `@username` reviewer is a person.+ *+ * Built once at module load and DERIVED from `effortLevelsForProvider` rather+ * than restated, so a reviewer's ladder here is exactly the one+ * `reviewerEffortArgs` (and the agent-spawn argv builder) will accept — a CLI+ * that gains or loses a tier moves both at once. The lookup goes through+ * `reviewerCliBinary` because that's what identifies the CLI: the `antigravity`+ * slug names no executable, `agy` does.+ *+ * Mirrored in `client/src/components/cos/constants.js` (pinned by a parity test)+ * so the picker only offers a level the server would keep.+ */+export const REVIEWER_EFFORT_LEVELS = Object.freeze(Object.fromEntries(+ REVIEWER_VALUES+ .map((slug) => {+ if (LOCAL_LLM_REVIEWERS.includes(slug)) return [slug, LOCAL_LLM_EFFORT_LEVELS];+ const binary = reviewerCliBinary(slug);+ return [slug, binary ? effortLevelsForProvider({ id: slug, command: binary }) : null];+ })+ .filter(([, levels]) => levels?.length)+));++/**+ * Every reviewer the user can pick an effort for — the effort-capable CLIs+ * (`claude`, `codex`, `antigravity`) plus the local-LLM backends.+ */+export const EFFORT_SELECTABLE_REVIEWERS = Object.freeze(Object.keys(REVIEWER_EFFORT_LEVELS));++/**+ * The ladder for ONE reviewer token, or `null` when it takes no effort. Accepts+ * the `gemini` alias; an `@username` token resolves to null like any non-reviewer.+ *+ * @param {string} reviewer - reviewer slug+ * @returns {readonly string[]|null}+ */+export function reviewerEffortLevels(reviewer) {+ if (typeof reviewer !== 'string') return null;+ const slug = reviewer.trim().toLowerCase();+ return REVIEWER_EFFORT_LEVELS[REVIEWER_ALIASES[slug] ?? slug] || null;+}++/**+ * Validate ONE reviewer effort — the single definition shared by the token-keyed+ * map normalizer and the `<reviewer>Effort` settings scalars, so a level can't be+ * accepted by one path and dropped by another.+ *+ * `reviewer` is REQUIRED — this is the tight branch by design. Defaulting it to+ * "any known effort" would validate against the union of every ladder, so a+ * caller that forgot the argument would quietly accept `ollama: 'ultra'` and+ * `antigravity: 'max'`, the exact values the drop-don't-clamp contract exists to+ * reject.+ *+ * Returns the level, or `undefined` when it isn't usable: a non-string, a level+ * outside that reviewer's own ladder (`agy` really does reject `--effort max`),+ * or a reviewer with no effort control at all. Deliberately NOT clamped the way+ * `resolveCliEffort` clamps a provider pin: this value is user-chosen from a+ * per-reviewer list, so an out-of-ladder entry means the stored config is stale+ * or hand-edited, and silently reviewing at a *different* effort than the one+ * displayed is worse than falling back to the reviewer's own default.+ */+export function normalizeReviewerEffort(raw, reviewer) {+ if (typeof raw !== 'string') return undefined;+ const effort = raw.trim().toLowerCase();+ if (!effort) return undefined;+ return reviewerEffortLevels(reviewer)?.includes(effort) ? effort : undefined;+}++/**+ * Per-reviewer reasoning-effort pins — how hard ONE reviewer thinks, keyed by the+ * same emitted `--review-with` token as `normalizeReviewerModels` (e.g.+ * `{ codex: 'high', ollama: 'low' }`).+ *+ * Unlike the model pin, this never becomes part of a slashdo token: slashdo's+ * entry grammar has no effort suffix. It reaches a reviewer through the two+ * places PortOS actually controls the invocation — the review-loop follow-up+ * prompt's CLI command line (`codex -c model_reasoning_effort=high`, `claude+ * --effort high`) and the `reasoning_effort` field of the local reviewer's+ * `/api/code-review/local` request body.+ *+ * An absent key means "let that reviewer use its own default effort", which is+ * NOT the same as a blank string, so an unusable value is DROPPED rather than+ * persisted. Non-object input → undefined, so an omitted field isn't persisted as+ * an empty override.+ */+export const normalizeReviewerEfforts = keyedReviewerPinNormalizer(normalizeReviewerEffort);++/**+ * Resolve per-reviewer effort pins with task-over-default precedence: a+ * task-level map (even explicitly empty) overrides the Code Review Defaults;+ * only fall back to the defaults when the task didn't pin its own. Mirrors+ * `resolveReviewerModels`.+ */+export const resolveReviewerEfforts = keyedReviewerPinResolver(normalizeReviewerEfforts);++/**+ * Fold the Code Review Defaults' per-reviewer effort SCALARS (`codexEffort` /+ * `claudeEffort` / `antigravityEffort` / `lmstudioEffort` / `ollamaEffort`) into+ * the token-keyed map shape the resolvers and the picker UI both speak — the+ * effort twin of `reviewerModelsFromDefaults`, and the one adapter between the+ * two shapes.+ */+export function reviewerEffortsFromDefaults(defaults) {+ const out = {};+ for (const r of EFFORT_SELECTABLE_REVIEWERS) {+ // Re-checked, not trusted: settings.json is hand-editable, and a stale level+ // must not surface as a pin the invocation builders would then drop.+ const effort = normalizeReviewerEffort(defaults?.[`${r}Effort`], r);+ if (effort) out[r] = effort;+ }+ return out;+}++/**+ * The argv fragment a CLI reviewer takes for a reasoning-effort override —+ * `['--effort', 'high']` for claude/agy, `['-c', 'model_reasoning_effort=high']`+ * for codex, `[]` for everything else. Delegates to `buildEffortArgs` so the flag+ * shape has exactly one home (the spawn builders use the same one).+ *+ * @param {string} reviewer - reviewer slug+ * @param {string|null|undefined} effort+ * @returns {string[]}+ */+export function reviewerEffortArgs(reviewer, effort) {+ const binary = reviewerCliBinary(reviewer);+ if (!binary || !effort) return [];+ return buildEffortArgs(effort, { id: reviewer, command: binary });+}++/**+ * Prose instruction carrying the per-reviewer effort pins into a **slashdo**+ * invocation — `/do:pr --review-with …`, where the model pin rides the token's+ * `[<model>]` bracket but the effort has nowhere to go: slashdo's entry grammar+ * (`<agent>[<model>](~opt|~max=<n>)*`) has no effort suffix, and inventing one+ * would just be a token its parser drops.+ *+ * So the effort is delivered the only way that actually reaches the nested CLI:+ * as an instruction to append the flag when the loop invokes it. Scoped to CLI+ * reviewers on purpose — slashdo's local-model loop calls the backend itself+ * rather than through PortOS's endpoint, so there is no flag to name for+ * `ollama`/`lmstudio` there (their effort still applies on the PortOS-driven+ * review-loop follow-up, which posts to `/api/code-review/local`).+ *+ * @param {string[]} reviewers - the reviewer slugs the invocation emits+ * @param {Object<string, string>} [reviewerEfforts] - token-keyed effort pins+ * @returns {string} a single sentence, or '' when no reviewer carries an effort+ */+export function buildReviewerEffortNote(reviewers, reviewerEfforts = {}) {+ const efforts = normalizeReviewerEfforts(reviewerEfforts) || {};+ const entries = (Array.isArray(reviewers) ? reviewers : [])+ .map((r) => {+ const args = reviewerEffortArgs(r, efforts[r]);+ return args.length ? `\`${reviewerCliBinary(r)} ${args.join(' ')}\`` : null;+ })+ .filter(Boolean);+ if (!entries.length) return '';+ return `When the review loop invokes a reviewer CLI, add its pinned reasoning effort: ${entries.join(', ')}. \`--review-with\` has no effort suffix, so this is the only way it reaches the reviewer.`;+}+/*** Build the set of lowercased optional-reviewer tokens for a fast membership* test in the builders. Tolerates the raw (unnormalized) list.@@ -726,6 +918,15 @@ export const createCosTaskSchema = z.object({v => normalizeReviewerModels(v),z.record(z.string().min(1).max(MAX_REVIEWER_MODEL_LENGTH)).optional()),+ // Per-reviewer reasoning-effort pins, keyed by the emitted `--review-with`+ // token — how hard ONE reviewer thinks (`codex -c model_reasoning_effort=high`,+ // `claude --effort high`, or a local reviewer's `reasoning_effort` body field).+ // Normalized so a hand-crafted request can't pin an effort on a reviewer that+ // takes none, or a level that reviewer's CLI rejects. Absent → undefined (not `{}`).+ reviewerEfforts: z.preprocess(+ v => normalizeReviewerEfforts(v),+ z.record(z.enum(EFFORT_LEVELS)).optional()+ ),// Bundled slashdo workflow this task runs (#3089) — the BARE command name,// never a rendered `/do:x` string (see slashdoInvocation.js).slashdoCommand: z.preprocess(emptyToUndefined, slashdoCommandSchema.optional()),@@ -975,6 +1176,21 @@ export const codeReviewSettingsSchema = z.object({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()),+ // 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.+ ...Object.fromEntries(EFFORT_SELECTABLE_REVIEWERS.map(reviewer => [+ `${reviewer}Effort`,+ z.preprocess(v => normalizeReviewerEffort(v, reviewer), z.string().optional()),+ ])),}).strict();// =============================================================================@@ -1053,7 +1269,7 @@ export const slashdoTaskSchema = createCosTaskSchema.pick({model: true, provider: true, effort: true, simplify: true,reviewers: true, usernames: true, optionalReviewers: true, reviewerMaxRounds: true,- reviewerModels: true+ reviewerModels: true, reviewerEfforts: true}).extend({command: z.string().min(1),@@ -1135,6 +1351,16 @@ export function sanitizeTaskMetadata(raw) {clean.reviewerModels = normalizeReviewerModels(raw.reviewerModels) || {};hasKeys = true;}+ // `reviewerEfforts` pins how hard each reviewer thinks (the follow-up prompt's+ // `--effort <level>` / `-c model_reasoning_effort=<level>`, or a local reviewer's+ // `reasoning_effort` body field). Like `reviewerModels`, an explicitly empty MAP+ // is KEPT so a task/type can override the Code Review Defaults' efforts back to+ // "each reviewer's own default"; an entry naming a reviewer with no effort+ // control, or a level that reviewer's CLI rejects, is dropped by the normalizer.+ if (raw.reviewerEfforts && typeof raw.reviewerEfforts === 'object' && !Array.isArray(raw.reviewerEfforts)) {+ clean.reviewerEfforts = normalizeReviewerEfforts(raw.reviewerEfforts) || {};+ hasKeys = true;+ }if (Object.prototype.hasOwnProperty.call(raw, 'reviewStopMode') && REVIEW_STOP_MODES.includes(raw.reviewStopMode)) {clean.reviewStopMode = raw.reviewStopMode;hasKeys = true;diff --git a/server/lib/cosValidation.test.js b/server/lib/cosValidation.test.jsindex 3b0adc2bc3..a6f3a95872 100644--- a/server/lib/cosValidation.test.js+++ b/server/lib/cosValidation.test.js@@ -12,9 +12,19 @@ import {REVIEWER_ALIASES,REVIEWER_CLI_BINARIES,REVIEWER_VALUES,+ EFFORT_SELECTABLE_REVIEWERS,+ LOCAL_LLM_EFFORT_LEVELS,+ reviewerEffortLevels,+ normalizeReviewerEfforts,+ resolveReviewerEfforts,+ reviewerEffortsFromDefaults,+ reviewerEffortArgs,+ buildReviewerEffortNote,+ sanitizeTaskMetadata,+ codeReviewSettingsSchema,} from './cosValidation.js';import { LOCAL_AGENT_REVIEWERS } from './slashdoInvocation.js';-import { EFFORT_LEVELS } from './providerModels.js';+import { EFFORT_LEVELS, CLAUDE_EFFORT_LEVELS, CODEX_EFFORT_LEVELS, ANTIGRAVITY_EFFORT_LEVELS } from './providerModels.js';describe('cosValidation effort field', () => {it('accepts every EFFORT_LEVELS value on create and rejects unknown values', () => {@@ -142,3 +152,139 @@ describe('cosValidation reviewer CLI binaries', () => {expect([...LOCAL_AGENT_REVIEWERS].sort()).toEqual(Object.keys(REVIEWER_CLI_BINARIES).sort());});});++describe('per-reviewer reasoning effort (reviewerEfforts)', () => {+ it('offers each reviewer only the ladder its own CLI accepts', () => {+ expect(reviewerEffortLevels('claude')).toEqual(CLAUDE_EFFORT_LEVELS);+ expect(reviewerEffortLevels('codex')).toEqual(CODEX_EFFORT_LEVELS);+ expect(reviewerEffortLevels('antigravity')).toEqual(ANTIGRAVITY_EFFORT_LEVELS);+ // The `gemini` alias resolves to the same ladder as `antigravity`.+ expect(reviewerEffortLevels('gemini')).toEqual(ANTIGRAVITY_EFFORT_LEVELS);+ expect(reviewerEffortLevels('ollama')).toEqual(LOCAL_LLM_EFFORT_LEVELS);+ expect(reviewerEffortLevels('lmstudio')).toEqual(LOCAL_LLM_EFFORT_LEVELS);+ // No effort control: copilot is a GitHub review, grok's CLI takes no flag,+ // and a `@username` reviewer is a person.+ expect(reviewerEffortLevels('copilot')).toBeNull();+ expect(reviewerEffortLevels('grok')).toBeNull();+ expect(reviewerEffortLevels('@somebody')).toBeNull();+ });++ it('EFFORT_SELECTABLE_REVIEWERS is exactly the reviewers with a non-empty ladder', () => {+ expect([...EFFORT_SELECTABLE_REVIEWERS].sort())+ .toEqual(['antigravity', 'claude', 'codex', 'lmstudio', 'ollama']);+ for (const reviewer of REVIEWER_VALUES) {+ expect(EFFORT_SELECTABLE_REVIEWERS.includes(reviewer))+ .toBe((reviewerEffortLevels(reviewer) || []).length > 0);+ }+ });++ it('normalizes a token-keyed map: aliases, case, and out-of-ladder levels', () => {+ expect(normalizeReviewerEfforts({+ gemini: 'HIGH', // alias + case-folded+ codex: 'ultra', // in codex's ladder only+ claude: 'medium',+ ollama: ' low ', // trimmed+ })).toEqual({ antigravity: 'high', codex: 'ultra', claude: 'medium', ollama: 'low' });+ });++ it('DROPS rather than clamps a level the reviewer rejects — a displayed effort must be the one it runs', () => {+ // `agy` really does reject `--effort max`; clamping it to `high` would review+ // at a different effort than the picker shows.+ expect(normalizeReviewerEfforts({ antigravity: 'max' })).toEqual({});+ // Reviewers with no effort control at all.+ expect(normalizeReviewerEfforts({ copilot: 'high', grok: 'high', '@bot': 'high' })).toEqual({});+ // Non-strings and blanks are absent, never an empty pin.+ expect(normalizeReviewerEfforts({ codex: '', claude: null, ollama: 3 })).toEqual({});+ // Non-object input is undefined so an omitted field isn't persisted as `{}`.+ expect(normalizeReviewerEfforts(undefined)).toBeUndefined();+ expect(normalizeReviewerEfforts(['codex'])).toBeUndefined();+ });++ it('resolves task-over-default, with an explicitly empty task map overriding', () => {+ expect(resolveReviewerEfforts({ codex: 'high' }, { codex: 'low' })).toEqual({ codex: 'high' });+ expect(resolveReviewerEfforts({}, { codex: 'low' })).toEqual({});+ expect(resolveReviewerEfforts(undefined, { codex: 'low' })).toEqual({ codex: 'low' });+ });++ it('folds the settings scalars into the map, re-checking each against its ladder', () => {+ expect(reviewerEffortsFromDefaults({+ codexEffort: 'high',+ claudeEffort: 'xhigh',+ antigravityEffort: 'max', // not in agy's ladder — dropped, not clamped+ ollamaEffort: 'medium',+ lmstudioEffort: 'ultra', // OpenAI-shaped backends don't take this tier+ grokEffort: 'high', // grok has no effort control at all+ })).toEqual({ codex: 'high', claude: 'xhigh', ollama: 'medium' });+ expect(reviewerEffortsFromDefaults(null)).toEqual({});+ });++ it('renders the argv fragment each CLI actually takes', () => {+ expect(reviewerEffortArgs('claude', 'high')).toEqual(['--effort', 'high']);+ expect(reviewerEffortArgs('codex', 'high')).toEqual(['-c', 'model_reasoning_effort=high']);+ // The `antigravity` slug names no executable — `agy` does, and it takes --effort.+ expect(reviewerEffortArgs('antigravity', 'low')).toEqual(['--effort', 'low']);+ expect(reviewerEffortArgs('grok', 'high')).toEqual([]);+ expect(reviewerEffortArgs('copilot', 'high')).toEqual([]);+ expect(reviewerEffortArgs('claude', null)).toEqual([]);+ });++ it('builds the slashdo-invocation note only for CLI reviewers carrying an effort', () => {+ const note = buildReviewerEffortNote(['codex', 'claude', 'copilot'], { codex: 'high', claude: 'low', copilot: 'high' });+ expect(note).toContain('`codex -c model_reasoning_effort=high`');+ expect(note).toContain('`claude --effort low`');+ expect(note).not.toContain('copilot');+ // A reviewer not in the list contributes nothing, and no pins at all = no note.+ expect(buildReviewerEffortNote(['copilot'], { codex: 'high' })).toBe('');+ expect(buildReviewerEffortNote(['codex'], {})).toBe('');+ expect(buildReviewerEffortNote(undefined, { codex: 'high' })).toBe('');+ // slashdo's local-model loop calls the backend itself, so there's no flag to+ // name for lmstudio/ollama in this path.+ expect(buildReviewerEffortNote(['ollama'], { ollama: 'high' })).toBe('');+ });++ it('carries reviewerEfforts through the task schema and the metadata sanitizer', () => {+ const parsed = createCosTaskSchema.parse({+ description: 'x',+ reviewerEfforts: { codex: 'high', antigravity: 'max', copilot: 'low' },+ });+ expect(parsed.reviewerEfforts).toEqual({ codex: 'high' });+ expect(createCosTaskSchema.parse({ description: 'x' }).reviewerEfforts).toBeUndefined();+ // An explicitly empty MAP is KEPT: it's a real "use each reviewer's own+ // default for this task" choice that must override the Code Review Defaults.+ expect(sanitizeTaskMetadata({ reviewerEfforts: {} })).toEqual({ reviewerEfforts: {} });+ expect(sanitizeTaskMetadata({ reviewerEfforts: { claude: 'high', grok: 'high' } }))+ .toEqual({ reviewerEfforts: { claude: 'high' } });+ });++ it('accepts each per-reviewer effort scalar on the code-review settings slice', () => {+ const parsed = codeReviewSettingsSchema.parse({+ claudeEffort: 'max', codexEffort: 'minimal', antigravityEffort: 'high',+ ollamaEffort: 'low', lmstudioEffort: 'high',+ });+ expect(parsed).toEqual({+ claudeEffort: 'max', codexEffort: 'minimal', antigravityEffort: 'high',+ ollamaEffort: 'low', lmstudioEffort: 'high',+ });+ // An unusable stored value clears the field rather than persisting a pin no+ // invocation would carry.+ expect(codeReviewSettingsSchema.parse({ antigravityEffort: 'max' }).antigravityEffort).toBeUndefined();+ expect(codeReviewSettingsSchema.parse({ codexEffort: 'bogus' }).codexEffort).toBeUndefined();+ });+});++// The picker's Effort cell is driven by a CLIENT mirror of these ladders. A level+// offered there but rejected here would show the user a pin that silently never+// persists (and the reverse would hide a tier their CLI accepts), so the mirror is+// pinned rather than trusted to a "keep in sync" comment.+describe('client mirror of the reviewer effort ladders', () => {+ it('matches server reviewerEffortLevels for every reviewer', async () => {+ const client = await import('../../client/src/components/cos/constants.js');+ expect([...client.EFFORT_SELECTABLE_REVIEWERS].sort()).toEqual([...EFFORT_SELECTABLE_REVIEWERS].sort());+ expect(client.LOCAL_LLM_EFFORT_LEVELS).toEqual(LOCAL_LLM_EFFORT_LEVELS);+ for (const reviewer of REVIEWER_VALUES) {+ expect(client.reviewerEffortLevels(reviewer) ?? null).toEqual(reviewerEffortLevels(reviewer) ?? null);+ }+ // Alias parity too — the picker keys rows off stored slugs.+ expect(client.reviewerEffortLevels('gemini')).toEqual(reviewerEffortLevels('gemini'));+ });+});diff --git a/server/lib/slashdoInvocation.js b/server/lib/slashdoInvocation.jsindex b80a3d9a72..b51107a639 100644--- a/server/lib/slashdoInvocation.js+++ b/server/lib/slashdoInvocation.js@@ -334,9 +334,14 @@ export function resolveSlashdoInvocation({* `body`. Pass only when the host has file tools.* @param {string} [opts.reviewWith=''] - reviewer CSV to pin (`codex,copilot`).* Required when `body` had reviewer variants pruned out of it.+ * @param {string} [opts.reviewerEffortNote=''] - the per-reviewer reasoning-effort+ * instruction (`buildReviewerEffortNote`). Emitted independently of `reviewWith`:+ * this workflow runs its OWN review loop, so an effort pinned on the task has no+ * other way to reach the reviewer CLI the workflow spawns — and unlike the CSV it+ * applies whether or not the body was pruned.* @returns {string} markdown section, or '' when `resolved` is null*/-export function buildSlashdoSection(resolved, body = null, { bodyPath = null, reviewWith = '' } = {}) {+export function buildSlashdoSection(resolved, body = null, { bodyPath = null, reviewWith = '', reviewerEffortNote = '' } = {}) {if (!resolved) return '';// Without explicit args the workflow operates on the task described above —@@ -364,6 +369,9 @@ export function buildSlashdoSection(resolved, body = null, { bodyPath = null, re`Run this workflow with \`--review-with ${reviewWith}\` — the procedure you were given carries ONLY those reviewers' loops (the others were omitted as unreachable). Do not substitute a different reviewer from a saved slashdo default.`);}+ if (reviewerEffortNote) {+ lines.push('', reviewerEffortNote);+ }if (body && bodyPath && body.length > SLASHDO_INLINE_BUDGET_CHARS) {lines.push('',diff --git a/server/routes/codeReview.js b/server/routes/codeReview.jsindex dffa242da3..d2146e319d 100644--- a/server/routes/codeReview.js+++ b/server/routes/codeReview.js@@ -1,19 +1,20 @@import { Router } from 'express'import { z } from 'zod'import { asyncHandler, ServerError } from '../lib/errorHandler.js'-import { validateRequest, LOCAL_LLM_REVIEWERS } from '../lib/validation.js'+import { validateRequest, LOCAL_LLM_REVIEWERS, LOCAL_LLM_EFFORT_LEVELS, reviewerEffortsFromDefaults } from '../lib/validation.js'import { getSettings } from '../services/settings.js'import { runLocalCodeReview, getCodeReviewDefaults, getReviewerCliInstalled } from '../services/codeReview.js'const router = Router()-// Body shape for POST /api/code-review/local. `model` is optional — when-// omitted (or empty) we fall back to the model configured on the Code Review-// Defaults panel. The diff is sent as-is; agents can pipe `gh pr diff <N>`-// straight into it without preprocessing.+// Body shape for POST /api/code-review/local. `model` and `effort` are optional —+// when omitted (or empty) we fall back to the model / reasoning effort configured+// on the Code Review Defaults panel. The diff is sent as-is; agents can pipe+// `gh pr diff <N>` straight into it without preprocessing.const localReviewRequestSchema = z.object({backend: z.enum(LOCAL_LLM_REVIEWERS),model: z.string().optional(),+ effort: z.enum(LOCAL_LLM_EFFORT_LEVELS).optional(),diff: z.string().min(1, 'diff must be non-empty'),timeoutMs: z.number().int().positive().max(600000).optional(),}).strict()@@ -40,9 +41,16 @@ router.post('/local', asyncHandler(async (req, res) => {? settings.codeReview?.lmstudioModel: settings.codeReview?.ollamaModelconst model = body.model || configured+ // Per-request effort wins over the panel default; absent in both = omit the+ // field entirely so the model reasons however it normally would. The stored+ // default is read through the validated accessor rather than off the raw slice,+ // so this route and `pickCodeReviewDefaults` agree on a hand-edited value+ // (an open-coded read misses the normalizer's case-folding).+ const effort = body.effort || reviewerEffortsFromDefaults(settings.codeReview)[body.backend] || nullconst result = await runLocalCodeReview({backend: body.backend,model,+ effort,diff: body.diff,timeoutMs: body.timeoutMs,})diff --git a/server/routes/cosTaskRoutes.js b/server/routes/cosTaskRoutes.jsindex 6deb751c76..e5d3b4be4f 100644--- a/server/routes/cosTaskRoutes.js+++ b/server/routes/cosTaskRoutes.js@@ -122,7 +122,7 @@ router.post('/tasks/enhance', asyncHandler(async (req, res) => {router.post('/tasks/slashdo', asyncHandler(async (req, res) => {const {command, app, provider, model, effort, simplify,- target, issueAuthorFilter, reviewers, usernames, optionalReviewers, reviewerMaxRounds, reviewerModels+ target, issueAuthorFilter, reviewers, usernames, optionalReviewers, reviewerMaxRounds, reviewerModels, reviewerEfforts} = validateRequest(slashdoTaskSchema, req.body);const workflow = getSlashdoWorkflow(command);@@ -172,7 +172,7 @@ router.post('/tasks/slashdo', asyncHandler(async (req, res) => {const { useWorktree, openPR } = workflow.settings;let shape;if (command === 'next') {- const claim = await buildClaimWorkTask(appObj, { target, issueAuthorFilter, reviewers, usernames, optionalReviewers, reviewerMaxRounds, reviewerModels });+ const claim = await buildClaimWorkTask(appObj, { target, issueAuthorFilter, reviewers, usernames, optionalReviewers, reviewerMaxRounds, reviewerModels, reviewerEfforts });const scope = claim.target? `claim ${workTrackerLabel(claim.tracker)} item ${claim.target}`: `claim next ${workTrackerLabel(claim.tracker)} item`;diff --git a/server/services/agentPromptBuilder.js b/server/services/agentPromptBuilder.jsindex 9248acf41a..b6e65d3bc6 100644--- a/server/services/agentPromptBuilder.js+++ b/server/services/agentPromptBuilder.js@@ -17,7 +17,7 @@ import { getActiveProvider } from './providers.js';import { runPromptThroughProvider } from '../lib/promptRunner.js';import { readJSONFile, PATHS, tryReadFile, expandHome } from '../lib/fileUtils.js';import { loadSlashdoFile, loadSlashdoLib, writeResolvedSlashdoBody } from '../lib/slashdoLoader.js';-import { DEFAULT_REVIEWER, DEFAULT_REVIEWERS, DEFAULT_REVIEW_STOP_MODE, LOCAL_LLM_REVIEWERS, MODEL_CAPABLE_CLI_REVIEWERS, describeReviewerCli, isCliReviewer, reviewerCliBinary, normalizeReviewers, normalizeReviewUsernames, normalizeOptionalReviewers, normalizeReviewerMaxRounds, resolveReviewUsernames, resolveOptionalReviewers, resolveReviewerMaxRounds, resolveReviewerModels, reviewerModelsFromDefaults, resolveKeyedReviewers, buildReviewWithArgs, buildReviewersCsv } from '../lib/validation.js';+import { DEFAULT_REVIEWER, DEFAULT_REVIEWERS, DEFAULT_REVIEW_STOP_MODE, LOCAL_LLM_REVIEWERS, MODEL_CAPABLE_CLI_REVIEWERS, describeReviewerCli, isCliReviewer, reviewerCliBinary, normalizeReviewers, normalizeReviewUsernames, normalizeOptionalReviewers, normalizeReviewerMaxRounds, resolveReviewUsernames, resolveOptionalReviewers, resolveReviewerMaxRounds, resolveReviewerModels, reviewerModelsFromDefaults, resolveReviewerEfforts, reviewerEffortsFromDefaults, reviewerEffortArgs, buildReviewerEffortNote, resolveKeyedReviewers, buildReviewWithArgs, buildReviewersCsv } from '../lib/validation.js';import { PROVIDER_TYPES } from '../lib/aiToolkit/constants.js';import { canTypeSlashCommands, resolveSlashdoInvocation, buildSlashdoSection, unreachableReviewerIncludes, SLASHDO_INLINE_BUDGET_CHARS } from '../lib/slashdoInvocation.js';import { shellQuote } from '../lib/shellQuote.js';@@ -391,6 +391,7 @@ async function applySlashdoInvocation(task, {const resolvedOptional = resolveOptionalReviewers(task.metadata?.optionalReviewers, codeReviewDefaults?.optionalReviewers);const resolvedMaxRounds = resolveReviewerMaxRounds(task.metadata?.reviewerMaxRounds, codeReviewDefaults?.reviewerMaxRounds);const resolvedModels = resolveReviewerModels(task.metadata?.reviewerModels, reviewerModelsFromDefaults(codeReviewDefaults));+ const resolvedEfforts = resolveReviewerEfforts(task.metadata?.reviewerEfforts, reviewerEffortsFromDefaults(codeReviewDefaults));// A resolved lone `copilot` with no usernames is ambiguous: it's what an// unconfigured install produces (`pickCodeReviewDefaults` and@@ -438,7 +439,12 @@ async function applySlashdoInvocation(task, {const reviewWith = skipIncludes.length? buildReviewersCsv(resolvedReviewers, resolvedUsernames, resolvedOptional, resolvedMaxRounds, resolvedModels): '';- const section = buildSlashdoSection(resolved, body, { bodyPath, reviewWith });+ // Unlike `reviewWith` this is NOT gated on pruning: the workflow drives its own+ // review loop, so a pinned effort has no other route to the reviewer CLI it+ // spawns — the `/do:pr` completion step further down the prompt is a different+ // invocation entirely, and for a slashdo-backed task usually isn't reached.+ const reviewerEffortNote = buildReviewerEffortNote(resolvedReviewers, resolvedEfforts);+ const section = buildSlashdoSection(resolved, body, { bodyPath, reviewWith, reviewerEffortNote });return { ...task, description: `${task.description}\n\n${section}` };}@@ -532,23 +538,43 @@ export function buildReviewLoopFollowUpSection(metadata = {}, { verbose = false,: (typeof metadata.reviewLoopCodexModel === 'string' && metadata.reviewLoopCodexModel? { codex: metadata.reviewLoopCodexModel }: {});- const reviewerModelEntries = MODEL_CAPABLE_CLI_REVIEWERS- .filter(r => reviewers.includes(r) && typeof reviewerModelMap[r] === 'string' && reviewerModelMap[r])- // Thread each configured model id VERBATIM. We deliberately don't env-map it- // here (e.g. bare Claude tier → Bedrock form): this is a text-template layer- // with only a providerId, not the merged spawn env (process.env + settings.json- // + provider.envVars) the CLI argv builder normalizes against — and the nested- // reviewer CLI is spawned by the agent, not PortOS, so the argv chokepoint never- // runs. The Code Review Defaults model field is free-text for exactly this- // reason: the user configures the id their environment needs (a Bedrock-form id- // on a Bedrock box, an installed Ollama model for an Ollama-backed `claude`).- // Binary, not slug: this renders a literal command line. Safe today only- // because MODEL_CAPABLE_CLI_REVIEWERS happens to hold two same-named CLIs —- // `agy` also takes `--model`, so the moment antigravity is added there the- // slug would be emitted as a command again.- .map(r => `\`${reviewerCliBinary(r) || r} --model ${reviewerModelMap[r]} …\``);+ // Optional per-reviewer reasoning-effort pins, same two sources as the models.+ // A CLI reviewer's effort becomes a flag on the command line the agent runs+ // (`--effort high` for claude/agy, `-c model_reasoning_effort=high` for codex —+ // `reviewerEffortArgs` owns that shape); a local-LLM reviewer's becomes the+ // `reasoning_effort` field of its `/api/code-review/local` body (below). There is+ // no slashdo `--review-with` suffix for effort, which is why it rides the+ // invocation rather than `equivArgs`.+ const reviewerEffortMap = (metadata.reviewLoopReviewerEfforts && typeof metadata.reviewLoopReviewerEfforts === 'object')+ ? metadata.reviewLoopReviewerEfforts+ : {};+ // 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.+ const reviewerModelEntries = cliReviewers+ .map((r) => {+ const flags = [];+ // Thread each configured model id VERBATIM. We deliberately don't env-map it+ // here (e.g. bare Claude tier → Bedrock form): this is a text-template layer+ // with only a providerId, not the merged spawn env (process.env + settings.json+ // + provider.envVars) the CLI argv builder normalizes against — and the nested+ // reviewer CLI is spawned by the agent, not PortOS, so the argv chokepoint never+ // runs. The Code Review Defaults model field is free-text for exactly this+ // reason: the user configures the id their environment needs (a Bedrock-form id+ // on a Bedrock box, an installed Ollama model for an Ollama-backed `claude`).+ if (MODEL_CAPABLE_CLI_REVIEWERS.includes(r) && typeof reviewerModelMap[r] === 'string' && reviewerModelMap[r]) {+ flags.push(`--model ${reviewerModelMap[r]}`);+ }+ const effortArgs = reviewerEffortArgs(r, reviewerEffortMap[r]);+ if (effortArgs.length) flags.push(effortArgs.join(' '));+ // Binary, not slug: this renders a literal command line, and the+ // `antigravity` slug names no executable.+ return flags.length ? `\`${reviewerCliBinary(r) || r} ${flags.join(' ')} …\`` : null;+ })+ .filter(Boolean);const reviewerModelNote = reviewerModelEntries.length- ? ` When invoking a reviewer with a pinned model, pass it: ${reviewerModelEntries.join(', ')}.`+ ? ` When invoking a reviewer with a pinned model or reasoning effort, pass it: ${reviewerModelEntries.join(', ')}.`: '';// When the slashdo local-agent review loop is inlined below (a spawnable CLI// reviewer is in the list), point the invocation step at it so the agent runs@@ -612,9 +638,18 @@ export function buildReviewLoopFollowUpSection(metadata = {}, { verbose = false,// in the POST body overrides the configured default (see routes/codeReview.js).// Absent pin ⇒ omit the key entirely rather than sending `""`, which would be a// model id the backend can't resolve.- const localLlmModelNote = LOCAL_LLM_REVIEWERS- .filter(r => reviewers.includes(r) && typeof reviewerModelMap[r] === 'string' && reviewerModelMap[r])- .map(r => `\`${r}\` → \`"model": "${reviewerModelMap[r]}"\``);+ // The pinned reasoning effort rides the same body as `effort` — the endpoint+ // forwards it as the backend's OpenAI-compatible `reasoning_effort`. Same+ // absent-vs-empty contract as the model: no pin ⇒ the key is omitted, not blank.+ const localLlmPinNote = LOCAL_LLM_REVIEWERS+ .filter(r => reviewers.includes(r))+ .map((r) => {+ const keys = [];+ if (typeof reviewerModelMap[r] === 'string' && reviewerModelMap[r]) keys.push(`"model": "${reviewerModelMap[r]}"`);+ if (typeof reviewerEffortMap[r] === 'string' && reviewerEffortMap[r]) keys.push(`"effort": "${reviewerEffortMap[r]}"`);+ return keys.length ? `\`${r}\` → \`${keys.join(', ')}\`` : null;+ })+ .filter(Boolean);const localLlmInvocation = `POST the diff to PortOS's local reviewer endpoint and extract its review text before evaluating it. Substitute the active reviewer name for \`<lmstudio|ollama>\`:\`\`\`bashREVIEW_RESPONSE=$(mktemp)@@ -627,8 +662,8 @@ elsecat "\${REVIEW_RESPONSE}.findings"fi\`\`\`-Only a successfully extracted \`.findings\` value is the review text; treat it like any other reviewer's findings.${localLlmModelNote.length- ? ` This run pins a model for ${localLlmModelNote.join(', ')} — add that key to the JSON body (\`jq -Rs '{ backend: "…", model: "…", diff: . }'\`) so the review runs on the pinned model instead of the install default.`+Only a successfully extracted \`.findings\` value is the review text; treat it like any other reviewer's findings.${localLlmPinNote.length+ ? ` This run pins settings for ${localLlmPinNote.join(', ')} — add those keys to the JSON body (\`jq -Rs '{ backend: "…", model: "…", effort: "…", diff: . }'\`) so the review runs with them instead of the install defaults.`: ''}`;// Instruct the agent to request each username reviewer as a PR reviewer and// gate the merge on their approval. `gh pr edit --add-reviewer` takes the bare@@ -1333,6 +1368,7 @@ After completing your work and before committing, ${simplifyInstruction}. Fix anconst taskOptionalReviewers = resolveOptionalReviewers(task.metadata?.optionalReviewers, codeReviewDefaults?.optionalReviewers);const taskReviewerMaxRounds = resolveReviewerMaxRounds(task.metadata?.reviewerMaxRounds, codeReviewDefaults?.reviewerMaxRounds);const taskReviewerModels = resolveReviewerModels(task.metadata?.reviewerModels, reviewerModelsFromDefaults(codeReviewDefaults));+ const taskReviewerEfforts = resolveReviewerEfforts(task.metadata?.reviewerEfforts, reviewerEffortsFromDefaults(codeReviewDefaults));const taskReviewStopMode = task.metadata?.reviewStopMode || codeReviewDefaults?.stopMode || DEFAULT_REVIEW_STOP_MODE;const taskReviewerApplies = task.metadata?.reviewerApplies !== undefined? isTruthyMetaFn(task.metadata?.reviewerApplies)@@ -1379,6 +1415,7 @@ After completing your work and before committing, ${simplifyInstruction}. Fix anoptionalReviewers: taskOptionalReviewers,reviewerMaxRounds: taskReviewerMaxRounds,reviewerModels: taskReviewerModels,+ reviewerEfforts: taskReviewerEfforts,reviewStopMode: taskReviewStopMode,reviewerApplies: taskReviewerApplies})@@ -1659,6 +1696,7 @@ function buildLightContextSections(task, workspaceDir, worktreeInfo, isTruthyMetconst lightOptionalReviewers = resolveOptionalReviewers(task.metadata?.optionalReviewers, codeReviewDefaults?.optionalReviewers);const lightReviewerMaxRounds = resolveReviewerMaxRounds(task.metadata?.reviewerMaxRounds, codeReviewDefaults?.reviewerMaxRounds);const lightReviewerModels = resolveReviewerModels(task.metadata?.reviewerModels, reviewerModelsFromDefaults(codeReviewDefaults));+ const lightReviewerEfforts = resolveReviewerEfforts(task.metadata?.reviewerEfforts, reviewerEffortsFromDefaults(codeReviewDefaults));const lightReviewStopMode = task.metadata?.reviewStopMode || codeReviewDefaults?.stopMode || DEFAULT_REVIEW_STOP_MODE;const lightReviewerApplies = task.metadata?.reviewerApplies !== undefined? isTruthyMetaFn(task.metadata?.reviewerApplies)@@ -1794,10 +1832,10 @@ function buildLightContextSections(task, workspaceDir, worktreeInfo, isTruthyMetbranchName: worktreeInfo?.branchName || null,baseBranch: worktreeInfo?.baseBranch || null,leavePrOpen: leavesPrForHuman(task),- reviewers: lightReviewers, usernames: lightReviewerUsernames, optionalReviewers: lightOptionalReviewers, reviewerMaxRounds: lightReviewerMaxRounds, reviewerModels: lightReviewerModels, reviewStopMode: lightReviewStopMode, reviewerApplies: lightReviewerApplies+ reviewers: lightReviewers, usernames: lightReviewerUsernames, optionalReviewers: lightOptionalReviewers, reviewerMaxRounds: lightReviewerMaxRounds, reviewerModels: lightReviewerModels, reviewerEfforts: lightReviewerEfforts, reviewStopMode: lightReviewStopMode, reviewerApplies: lightReviewerApplies}));} else {- sections.push(buildCliCompletionSection({ worktreeInfo, willOpenPR, prCompletion, hasSlashdo, simplifyEnabled, leavePrOpen: leavesPrForHuman(task), reviewers: lightReviewers, usernames: lightReviewerUsernames, optionalReviewers: lightOptionalReviewers, reviewerMaxRounds: lightReviewerMaxRounds, reviewerModels: lightReviewerModels, reviewStopMode: lightReviewStopMode, reviewerApplies: lightReviewerApplies }));+ sections.push(buildCliCompletionSection({ worktreeInfo, willOpenPR, prCompletion, hasSlashdo, simplifyEnabled, leavePrOpen: leavesPrForHuman(task), reviewers: lightReviewers, usernames: lightReviewerUsernames, optionalReviewers: lightOptionalReviewers, reviewerMaxRounds: lightReviewerMaxRounds, reviewerModels: lightReviewerModels, reviewerEfforts: lightReviewerEfforts, reviewStopMode: lightReviewStopMode, reviewerApplies: lightReviewerApplies }));}return { taskSections, contractSections };@@ -1891,7 +1929,7 @@ function buildPostPRMergeSteps(startStep, { prCompletion = PR_COMPLETIONS.REVIEW* return this IS a Claude session, so `/simplify` and `/do:pr` are both safe to* emit without a second provider check.*/-function buildTuiCompletionSection({ willOpenPR, prCompletion = PR_COMPLETIONS.MERGE_ON_GREEN, simplifyEnabled, sentinelPath, slashdoFree = false, branchName = null, baseBranch = null, leavePrOpen = false, reviewers = DEFAULT_REVIEWERS, usernames = [], optionalReviewers = [], reviewerMaxRounds = {}, reviewerModels = {}, reviewStopMode = DEFAULT_REVIEW_STOP_MODE, reviewerApplies = false }) {+function buildTuiCompletionSection({ willOpenPR, prCompletion = PR_COMPLETIONS.MERGE_ON_GREEN, simplifyEnabled, sentinelPath, slashdoFree = false, branchName = null, baseBranch = null, leavePrOpen = false, reviewers = DEFAULT_REVIEWERS, usernames = [], optionalReviewers = [], reviewerMaxRounds = {}, reviewerModels = {}, reviewerEfforts = {}, reviewStopMode = DEFAULT_REVIEW_STOP_MODE, reviewerApplies = false }) {const policyLeavesOpen = prCompletion === PR_COMPLETIONS.LEAVE_OPEN;const runsReviewLoop = prCompletion === PR_COMPLETIONS.REVIEW_THEN_MERGE;if (slashdoFree) {@@ -1920,6 +1958,9 @@ function buildTuiCompletionSection({ willOpenPR, prCompletion = PR_COMPLETIONS.M? ' — `/do:pr` runs the Copilot review loop after the PR opens.': ` — \`/do:pr\` runs the review loop for ${reviewerListLabel} in order after the PR opens.`): (willOpenPR ? ' — external review is disabled for this task.' : '');+ // Effort pins can't ride `--review-with` (no suffix for them in slashdo's+ // grammar), so they're stated as an instruction on the invocation instead.+ const effortNote = willOpenPR && runsReviewLoop ? buildReviewerEffortNote(reviewers, reviewerEfforts) : '';// Reached only for a Claude TUI (a non-Claude one took the slashdoFree branch// above), so `/simplify` — a Claude Code built-in — is invokable here.const simplifyStep = simplifyEnabled ? '1. `/simplify`' : '1. (simplify disabled — skip)';@@ -1938,6 +1979,7 @@ function buildTuiCompletionSection({ willOpenPR, prCompletion = PR_COMPLETIONS.M'',simplifyStep,`2. \`${cmd}${reviewerArg}\`${reviewSuffix}`,+ ...(effortNote ? [` ${effortNote}`] : []),...merge.lines,`${sentinelStep}. Write a short markdown summary (~5–15 lines) to the completion sentinel, then stop — this sentinel is the done signal. PortOS polls it every 2s, finalizes the run, and closes the session for you. Do NOT run \`/quit\` (it's a UI command, not something you can invoke) and do NOT wait for anything after writing the sentinel.`,'',@@ -2030,7 +2072,7 @@ function buildManualTuiCompletionSection({ willOpenPR, prCompletion = PR_COMPLET* CLI providers fall through to the legacy commit-only block where PortOS* handles push+PR on exit.*/-function buildCliCompletionSection({ worktreeInfo, willOpenPR, prCompletion = PR_COMPLETIONS.MERGE_ON_GREEN, hasSlashdo = false, simplifyEnabled = false, leavePrOpen = false, reviewers = DEFAULT_REVIEWERS, usernames = [], optionalReviewers = [], reviewerMaxRounds = {}, reviewerModels = {}, reviewStopMode = DEFAULT_REVIEW_STOP_MODE, reviewerApplies = false }) {+function buildCliCompletionSection({ worktreeInfo, willOpenPR, prCompletion = PR_COMPLETIONS.MERGE_ON_GREEN, hasSlashdo = false, simplifyEnabled = false, leavePrOpen = false, reviewers = DEFAULT_REVIEWERS, usernames = [], optionalReviewers = [], reviewerMaxRounds = {}, reviewerModels = {}, reviewerEfforts = {}, reviewStopMode = DEFAULT_REVIEW_STOP_MODE, reviewerApplies = false }) {const policyLeavesOpen = prCompletion === PR_COMPLETIONS.LEAVE_OPEN;const runsReviewLoop = prCompletion === PR_COMPLETIONS.REVIEW_THEN_MERGE;const reviewUsernames = normalizeReviewUsernames(usernames);@@ -2052,6 +2094,10 @@ function buildCliCompletionSection({ worktreeInfo, willOpenPR, prCompletion = PR: `and drives the review loop for ${[...reviewers, ...reviewUsernames.map(u => `@${u}`)].join(', ')} in order until clean.`): 'with external review disabled.';lines.push(`${step++}. \`/do:pr${reviewerArg}\` — commits your changes, pushes the branch, and opens a pull request against the default branch ${completionNote}`);+ // Effort pins have no `--review-with` suffix to ride, so they're stated as an+ // instruction on the invocation instead (see buildReviewerEffortNote).+ const effortNote = runsReviewLoop ? buildReviewerEffortNote(reviewers, reviewerEfforts) : '';+ if (effortNote) lines.push(` ${effortNote}`);// Merge steps follow — review-gated with a loop, CI-gated without one — unless// this PR is a human's to land (JIRA-tracked; see lib/prDisposition.js).if (leavePrOpen || policyLeavesOpen) {diff --git a/server/services/agentPromptBuilder.test.js b/server/services/agentPromptBuilder.test.jsindex 37f250b12e..7d202c5c69 100644--- a/server/services/agentPromptBuilder.test.js+++ b/server/services/agentPromptBuilder.test.js@@ -1036,6 +1036,49 @@ describe('buildLightContextPrompt', () => {expect(prompt).toMatch(/claude --model qwen2\.5:7b/);});+ it('threads a reviewer-keyed effort map onto each CLI invocation, in that CLI-specific flag form', () => {+ const prompt = buildLightContextPrompt(+ makeTask({ metadata: {+ reviewLoopFollowUp: true,+ reviewLoopPRUrl: 'https://github.com/o/r/pull/9',+ reviewLoopPRBranch: 'b',+ reviewLoopPRNumber: 9,+ reviewLoopReviewers: ['codex', 'claude', 'antigravity'],+ reviewLoopReviewerModels: { codex: 'gpt-5.6-sol' },+ reviewLoopReviewerEfforts: { codex: 'high', claude: 'xhigh', antigravity: 'low' },+ sourceTaskId: 'task-src-effort',+ }}),+ '/r',+ { branchName: 'b', worktreePath: '/tmp/wt' },+ isTruthyMeta);+ // codex takes a config pair; claude and agy take --effort. The model pin+ // and the effort ride the SAME command line when both are set.+ expect(prompt).toMatch(/codex --model gpt-5\.6-sol -c model_reasoning_effort=high/);+ expect(prompt).toMatch(/claude --effort xhigh/);+ // `antigravity` names no executable — the invocation must say `agy`.+ expect(prompt).toMatch(/agy --effort low/);+ expect(prompt).not.toMatch(/antigravity --effort/);+ });++ it('names a pinned local-LLM effort as an /api/code-review/local body key', () => {+ const prompt = buildLightContextPrompt(+ makeTask({ metadata: {+ reviewLoopFollowUp: true,+ reviewLoopPRUrl: 'https://github.com/o/r/pull/9',+ reviewLoopPRBranch: 'b',+ reviewLoopPRNumber: 9,+ reviewLoopReviewers: ['ollama'],+ reviewLoopReviewerEfforts: { ollama: 'high' },+ sourceTaskId: 'task-src-local-effort',+ }}),+ '/r',+ { branchName: 'b', worktreePath: '/tmp/wt' },+ isTruthyMeta);+ expect(prompt).toContain('"effort": "high"');+ // The effort has no slashdo suffix, so it must NOT leak into the flag string.+ expect(prompt).not.toMatch(/--review-with[^\n]*effort/);+ });+it('spells out per-reviewer ~max round caps in the follow-up loop instructions', () => {const prompt = buildLightContextPrompt(makeTask({ metadata: {@@ -2128,6 +2171,35 @@ describe('buildAgentPrompt — slashdo prompt-size controls', () => {warn.mockRestore();});+ // The workflow drives its OWN review loop, so an effort pinned on the task has+ // no other route to the reviewer CLI it spawns — `--review-with` carries a+ // `[<model>]` bracket but has no effort suffix.+ it('states a pinned reviewer effort in the slashdo section', async () => {+ const prompt = await buildAgentPrompt(+ slashdoTask({ reviewers: ['codex'], reviewerEfforts: { codex: 'high' } }),+ {}, '/r', null, isTruthyMeta,+ { providerType: 'cli', providerId: 'codex' });+ expect(prompt).toContain('`codex -c model_reasoning_effort=high`');+ });++ it('names only the reviewers this run actually resolved', async () => {+ // A stale pin for a reviewer that isn't in the list (set on another task, or+ // left behind by the Code Review Defaults) must not tell the agent to pass a+ // flag to a CLI it never invokes.+ const prompt = await buildAgentPrompt(+ slashdoTask({ reviewers: ['codex'], reviewerEfforts: { codex: 'high', claude: 'xhigh' } }),+ {}, '/r', null, isTruthyMeta,+ { providerType: 'cli', providerId: 'codex' });+ expect(prompt).toContain('`codex -c model_reasoning_effort=high`');+ expect(prompt).not.toContain('--effort xhigh');+ });++ it('adds no effort sentence when no reviewer pins one', async () => {+ const prompt = await buildAgentPrompt(+ slashdoTask({ reviewers: ['codex'] }), {}, '/r', null, isTruthyMeta,+ { providerType: 'cli', providerId: 'codex' });+ expect(prompt).not.toContain('pinned reasoning effort');+ });describe('reviewer-variant pruning', () => {const skipArg = () => vi.mocked(loadSlashdoFile).mock.calls.at(-1)[1].skipIncludes;diff --git a/server/services/agentWorktreeCleanup.js b/server/services/agentWorktreeCleanup.jsindex f72045f739..0e915937b4 100644--- a/server/services/agentWorktreeCleanup.js+++ b/server/services/agentWorktreeCleanup.js@@ -26,7 +26,7 @@ import { isRetryHoldOwner, clearedRetryHoldMetadata } from '../lib/taskRetryHoldimport { RECOVERY_TASK_PREFIX } from './recoveryTasks.js';import { detectForgeCli } from '../lib/gitForge.js';import { PR_COMPLETIONS, PR_COMPLETION_VALUES, leavesPrForHuman } from '../lib/prDisposition.js';-import { DEFAULT_REVIEWER, DEFAULT_REVIEWERS, DEFAULT_REVIEW_STOP_MODE, MODEL_SELECTABLE_REVIEWERS, normalizeReviewers, normalizeReviewUsernames, normalizeOptionalReviewers, normalizeReviewerMaxRounds } from '../lib/validation.js';+import { DEFAULT_REVIEWER, DEFAULT_REVIEWERS, DEFAULT_REVIEW_STOP_MODE, MODEL_SELECTABLE_REVIEWERS, EFFORT_SELECTABLE_REVIEWERS, normalizeReviewers, normalizeReviewUsernames, normalizeOptionalReviewers, normalizeReviewerMaxRounds } from '../lib/validation.js';// In-flight cleanup per agentId, so two completion paths racing to clean the// SAME agent coalesce onto one run instead of tripping over each other.@@ -79,7 +79,7 @@ export async function cleanupAgentWorktree(agentId, success, options = {}) {return run;}-async function runCleanupAgentWorktree(agentId, success, { openPR = false, prCompletion = null, requestCopilotReview: legacyRequestCopilotReview = false, reviewers = DEFAULT_REVIEWERS, usernames = [], optionalReviewers = [], reviewerMaxRounds = {}, reviewStopMode = DEFAULT_REVIEW_STOP_MODE, reviewerApplies = false, reviewerModels = null, skipMerge = false, description = null, agentOutput = null, originalTask = null } = {}) {+async function runCleanupAgentWorktree(agentId, success, { openPR = false, prCompletion = null, requestCopilotReview: legacyRequestCopilotReview = false, reviewers = DEFAULT_REVIEWERS, usernames = [], optionalReviewers = [], reviewerMaxRounds = {}, reviewStopMode = DEFAULT_REVIEW_STOP_MODE, reviewerApplies = false, reviewerModels = null, reviewerEfforts = null, skipMerge = false, description = null, agentOutput = null, originalTask = null } = {}) {const { getAgent: getAgentState } = await import('./cos.js');const agentState = await getAgentState(agentId).catch(() => null);if (!agentState?.metadata?.isWorktree) return [];@@ -274,6 +274,7 @@ async function runCleanupAgentWorktree(agentId, success, { openPR = false, prComreviewStopMode,reviewerApplies,reviewerModels,+ reviewerEfforts,leaveOpen}).catch(err => {emitLog('warn', `🤖 Failed to spawn PR follow-up for ${prResult.url}: ${err.message}`, { agentId, prUrl: prResult.url });@@ -648,7 +649,7 @@ export async function releaseRetryHold({ agentId, task, success, agentMetadata }* branch (via createWorktree's `existingBranch` option) so it can fix-and-push* without trampling concurrent agents.*/-export async function spawnReviewLoopFollowUp({ originalAgentId, originalTask, prUrl, prBranch, sourceWorkspace, prCompletion = PR_COMPLETIONS.REVIEW_THEN_MERGE, reviewers = DEFAULT_REVIEWERS, usernames = [], optionalReviewers = [], reviewerMaxRounds = {}, reviewStopMode = DEFAULT_REVIEW_STOP_MODE, reviewerApplies = false, reviewerModels = null, leaveOpen = false }) {+export async function spawnReviewLoopFollowUp({ originalAgentId, originalTask, prUrl, prBranch, sourceWorkspace, prCompletion = PR_COMPLETIONS.REVIEW_THEN_MERGE, reviewers = DEFAULT_REVIEWERS, usernames = [], optionalReviewers = [], reviewerMaxRounds = {}, reviewStopMode = DEFAULT_REVIEW_STOP_MODE, reviewerApplies = false, reviewerModels = null, reviewerEfforts = null, leaveOpen = false }) {if (!prUrl || !prBranch) return null;if (prCompletion === PR_COMPLETIONS.LEAVE_OPEN) return null;@@ -693,10 +694,19 @@ export async function spawnReviewLoopFollowUp({ originalAgentId, originalTask, p// local-LLM reviewer's as the `model` field of its `/api/code-review/local` body.// `reviewerModels` is already coerced to string values upstream// (resolveReviewLoopOptions).- const narrowedReviewerModels = {};- for (const r of effectiveReviewers) {- if (MODEL_SELECTABLE_REVIEWERS.includes(r) && reviewerModels?.[r]) narrowedReviewerModels[r] = reviewerModels[r];- }+ // Empty → null so the prompt builder's "nothing configured" path is unambiguous.+ const narrowPins = (pins, roster) => {+ const out = Object.fromEntries(effectiveReviewers+ .filter(r => roster.includes(r) && pins?.[r])+ .map(r => [r, pins[r]]));+ return Object.keys(out).length ? out : null;+ };+ const narrowedReviewerModels = narrowPins(reviewerModels, MODEL_SELECTABLE_REVIEWERS);+ // Reviewer-keyed reasoning-effort map, narrowed the same way. The prompt turns a+ // CLI reviewer's effort into a flag on its command line (`--effort high` /+ // `-c model_reasoning_effort=high`) and a local-LLM reviewer's into the+ // `reasoning_effort` field of its `/api/code-review/local` body.+ const narrowedReviewerEfforts = narrowPins(reviewerEfforts, EFFORT_SELECTABLE_REVIEWERS);// One place that names the mode, so the title, the log line, and the warning// can't drift apart as the two follow-up kinds evolve.@@ -771,13 +781,13 @@ export async function spawnReviewLoopFollowUp({ originalAgentId, originalTask, previewLoopReviewerMaxRounds: effectiveReviewerMaxRounds,reviewLoopStopMode: reviewStopMode,reviewLoopReviewerApplies: reviewerApplies,- // Empty → null so the prompt builder's "no models configured" path is unambiguous.- reviewLoopReviewerModels: Object.keys(narrowedReviewerModels).length ? narrowedReviewerModels : null,+ reviewLoopReviewerModels: narrowedReviewerModels,+ reviewLoopReviewerEfforts: narrowedReviewerEfforts,// Back-compat: older installs' prompt builder reads only the codex-scalar key.// Mirror the (already-narrowed) codex entry so a follow-up task persisted by this// version still threads a codex model after a downgrade. Remove once no supported// peer reads it.- reviewLoopCodexModel: narrowedReviewerModels.codex || null,+ reviewLoopCodexModel: narrowedReviewerModels?.codex || null,sourceTaskId: originalTask?.id || null,sourceAgentId: originalAgentId || null,// This follow-up may legitimately exit with zero new commits when everydiff --git a/server/services/codeReview.js b/server/services/codeReview.jsindex a0203bfd53..79d2c897f8 100644--- a/server/services/codeReview.js+++ b/server/services/codeReview.js@@ -32,6 +32,10 @@ import {resolveReviewerMaxRounds,resolveReviewerModels,reviewerModelsFromDefaults,+ resolveReviewerEfforts,+ reviewerEffortsFromDefaults,+ normalizeReviewerEffort,+ EFFORT_SELECTABLE_REVIEWERS,} from '../lib/validation.js'import { getSettings, settingsEvents } from './settings.js'import { getBaseUrl as getLmStudioBaseUrl } from './lmStudioManager.js'@@ -60,6 +64,7 @@ export function isLocalLlmReviewer(backend) {*/export function pickCodeReviewDefaults(settings) {const raw = settings && typeof settings === 'object' ? settings.codeReview : null+ const effortDefaults = reviewerEffortsFromDefaults(raw)const reviewersIn = Array.isArray(raw?.reviewers) ? raw.reviewers : nullconst reviewers = reviewersIn? Array.from(new Set(reviewersIn.map((r) => REVIEWER_ALIASES[r] || r).filter((r) => REVIEWER_VALUES.includes(r))))@@ -91,6 +96,19 @@ export function pickCodeReviewDefaults(settings) {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,+ // 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+ // — passing through a stale `antigravityEffort: 'ultra'` would just produce a+ // rejected call rather than something a downstream consumer could use.+ //+ // Checked through `reviewerEffortsFromDefaults`, not an inline comparison, so+ // this path and `resolveReviewLoopOptions` can't disagree about a stored value+ // (an open-coded check missed the normalizer's case-folding, so a settings.json+ // holding `"High"` resolved one way here and another there).+ ...Object.fromEntries(+ EFFORT_SELECTABLE_REVIEWERS.map((reviewer) => [`${reviewer}Effort`, effortDefaults[reviewer] ?? null])+ ),}}@@ -169,7 +187,12 @@ export async function resolveReviewLoopOptions(metadata, { normalize, isTruthyMe// 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))- return { reviewers, usernames, optionalReviewers, reviewerMaxRounds, reviewStopMode, reviewerApplies, reviewerModels }+ // 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 }}/**@@ -232,10 +255,15 @@ For each finding, name the file:line (when known) and explain the issue + sugges* @param {'lmstudio'|'ollama'} opts.backend* @param {string} opts.model - Installed model id (e.g. `qwen2.5-coder:7b`).* @param {string} opts.diff - Unified diff text to review.+ * @param {string} [opts.effort] - Reasoning effort (`low`/`medium`/`high`), sent+ * as the OpenAI-compatible `reasoning_effort` field. Omitted from the body+ * entirely when unset or not a level this backend accepts — a non-reasoning+ * model would otherwise get a field it has no answer for, and `absent` is the+ * only spelling of "use the model's own default".* @param {number} [opts.timeoutMs=120000] - 2 min default — LM Studio cold-* load of a large coder model regularly exceeds 30s but rarely 2 min.*/-export async function runLocalCodeReview({ backend, model, diff, timeoutMs = 120000 } = {}) {+export async function runLocalCodeReview({ backend, model, diff, effort = null, timeoutMs = 120000 } = {}) {if (!isLocalLlmReviewer(backend)) {return { ok: false, error: `Unsupported reviewer backend: ${backend}` }}@@ -256,6 +284,10 @@ export async function runLocalCodeReview({ backend, model, diff, timeoutMs = 120// can't be closed by the diff's own content (the same technique GitHub uses// to nest a fenced block inside a fenced block).const fence = '`'.repeat(Math.max(3, ...(trimmedDiff.match(/`+/g) || ['']).map((run) => run.length + 1)))+ // Re-checked here rather than trusted from the caller: this is the last layer+ // before the request goes out, and both backends 400 on a `reasoning_effort`+ // outside the OpenAI tier names.+ const resolvedEffort = normalizeReviewerEffort(effort, backend) || nullconst body = {model,messages: [@@ -264,6 +296,7 @@ export async function runLocalCodeReview({ backend, model, diff, timeoutMs = 120],temperature: 0.2,stream: false,+ ...(resolvedEffort ? { reasoning_effort: resolvedEffort } : {}),}const response = await fetchWithTimeout(`${baseUrl}/v1/chat/completions`, {@@ -290,5 +323,5 @@ export async function runLocalCodeReview({ backend, model, diff, timeoutMs = 120if (!findings || typeof findings !== 'string') {return { ok: false, backend, model, error: `${backend} returned no content.` }}- return { ok: true, backend, model, findings: findings.trim() }+ return { ok: true, backend, model, effort: resolvedEffort, findings: findings.trim() }}diff --git a/server/services/codeReview.test.js b/server/services/codeReview.test.jsindex 11d50ef6f1..c9388bfa43 100644--- a/server/services/codeReview.test.js+++ b/server/services/codeReview.test.js@@ -61,6 +61,15 @@ describe('codeReview helpers', () => {})describe('pickCodeReviewDefaults', () => {+ // Every effort-capable reviewer reports `null` when nothing is configured;+ // spread rather than pasted so the roster only has to change in one place.+ const NO_EFFORTS = {+ claudeEffort: null,+ codexEffort: null,+ antigravityEffort: null,+ lmstudioEffort: null,+ ollamaEffort: null,+ }it('returns the hardcoded fallback when settings has no codeReview slice', () => {expect(pickCodeReviewDefaults(null)).toEqual({reviewers: ['copilot'],@@ -73,6 +82,7 @@ describe('codeReview helpers', () => {ollamaModel: null,codexModel: null,claudeModel: null,+ ...NO_EFFORTS,})expect(pickCodeReviewDefaults({})).toEqual({reviewers: ['copilot'],@@ -85,6 +95,7 @@ describe('codeReview helpers', () => {ollamaModel: null,codexModel: null,claudeModel: null,+ ...NO_EFFORTS,})})@@ -150,6 +161,7 @@ describe('codeReview helpers', () => {ollamaModel: 'codellama',codexModel: 'gpt-5.6-sol',claudeModel: 'qwen2.5:7b',+ ...NO_EFFORTS,})})@@ -297,9 +309,28 @@ describe('codeReview helpers', () => {expect(r.error).toMatch(/Empty diff/)})+ it('omits reasoning_effort entirely when no effort is pinned — absent is the only spelling of the model default', async () => {+ await runLocalCodeReview({ backend: 'ollama', model: 'codellama', diff: 'd' })+ const body = JSON.parse(global.fetch.mock.calls[0][1].body)+ expect('reasoning_effort' in body).toBe(false)+ })++ it('sends a pinned effort as the OpenAI-compatible reasoning_effort field', async () => {+ const r = await runLocalCodeReview({ backend: 'lmstudio', model: 'm', diff: 'd', effort: 'high' })+ expect(JSON.parse(global.fetch.mock.calls[0][1].body).reasoning_effort).toBe('high')+ expect(r.effort).toBe('high')+ })++ it('drops an effort outside the local ladder rather than letting the backend 400 on it', async () => {+ // `xhigh`/`ultra` are vendor-CLI tiers; an OpenAI-shaped backend rejects them.+ const r = await runLocalCodeReview({ backend: 'ollama', model: 'm', diff: 'd', effort: 'ultra' })+ const body = JSON.parse(global.fetch.mock.calls[0][1].body)+ expect('reasoning_effort' in body).toBe(false)+ expect(r.effort).toBeNull()+ })it('posts to the backend chat-completions endpoint and returns the response content', async () => {const r = await runLocalCodeReview({ backend: 'ollama', model: 'codellama', diff: 'diff --git a b' })- expect(r).toEqual({ ok: true, backend: 'ollama', model: 'codellama', findings: 'No findings.' })+ expect(r).toEqual({ ok: true, backend: 'ollama', model: 'codellama', effort: null, findings: 'No findings.' })expect(global.fetch).toHaveBeenCalledTimes(1)const [url, init] = global.fetch.mock.calls[0]expect(url).toMatch(/\/v1\/chat\/completions$/)diff --git a/server/services/cosTaskGenerator.js b/server/services/cosTaskGenerator.jsindex d3ee6cb49f..e9ca1e5293 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, 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, resolveReviewerModels, reviewerModelsFromDefaults, resolveReviewerEfforts, reviewerEffortsFromDefaults, 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';@@ -412,7 +412,7 @@ export function resolveClaimAuthorFilter(explicit, metadata) {** @returns {Promise<{ tracker, source, promptTaskType, prompt, taskMetadata, target }>}*/-export async function buildClaimWorkTask(app, { issueAuthorFilter, reviewers, usernames, optionalReviewers, reviewerMaxRounds, reviewerModels, target } = {}) {+export async function buildClaimWorkTask(app, { issueAuthorFilter, reviewers, usernames, optionalReviewers, reviewerMaxRounds, reviewerModels, reviewerEfforts, target } = {}) {const { resolveAppWorkTracker, trackerToClaimTaskType } = await import('../lib/workTracker.js');const { getTaskPrompt } = await import('./taskPromptService.js');const taskSchedule = await import('./taskSchedule.js');@@ -456,6 +456,9 @@ export async function buildClaimWorkTask(app, { issueAuthorFilter, reviewers, us// 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+ // `--review-with` token, so they land as an appended instruction below.+ const promptReviewerEfforts = resolveReviewerEfforts(reviewerEfforts ?? metadata.reviewerEfforts, reviewerEffortsFromDefaults(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@@ -475,7 +478,8 @@ export async function buildClaimWorkTask(app, { issueAuthorFilter, reviewers, us// interpreted as a backreference (see the scheduler's same-pattern note)..replace(/\{reviewers\}/g, () => reviewersCsv).replace(/\{issueAuthorFilter\}/g, () => issueAuthorFilterBlock)- + appendTargetWorkItemBlock(promptTaskType, targetRef);+ + appendTargetWorkItemBlock(promptTaskType, targetRef)+ + appendReviewerEffortBlock(reviewersList, promptReviewerEfforts);// Mirror the scheduler: inherit the delegated flow's isolation posture so the// JIRA route runs in a CoS-managed worktree rather than the live checkout.@@ -488,12 +492,17 @@ export async function buildClaimWorkTask(app, { issueAuthorFilter, reviewers, us}/**- * Resolve the reviewers CSV for the claim flow exactly as buildClaimWorkTask- * does (Code Review Defaults, minus local-LLM reviewers the claim prompt can't- * drive, falling back to the hardcoded default). Mirrors the scheduled- * claim-work resolution so the JIRA play button honors the user's reviewer choice.+ * Resolve the reviewer prompt pieces for the claim flow exactly as+ * buildClaimWorkTask does (Code Review Defaults, minus local-LLM reviewers the+ * claim prompt can't drive, falling back to the hardcoded default). Mirrors the+ * scheduled claim-work resolution so the JIRA play button honors the user's+ * reviewer choice.+ *+ * Returns BOTH pieces because the two travel differently: `csv` fills the+ * template's `{reviewers}` placeholder, while `effortBlock` is appended prose —+ * `--review-with` has no effort suffix to carry it.*/-async function resolveClaimReviewersCsv() {+async function resolveClaimReviewerPrompt() {const codeReviewDefaults = await getCodeReviewDefaults().catch(() => null);const list = normalizeReviewers({}, codeReviewDefaults?.reviewers).filter((r) => !LOCAL_LLM_REVIEWERS.includes(r));@@ -501,7 +510,10 @@ async function resolveClaimReviewersCsv() {// 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.- return buildReviewersCsv(list, codeReviewDefaults?.usernames, codeReviewDefaults?.optionalReviewers, codeReviewDefaults?.reviewerMaxRounds, reviewerModelsFromDefaults(codeReviewDefaults));+ return {+ csv: buildReviewersCsv(list, codeReviewDefaults?.usernames, codeReviewDefaults?.optionalReviewers, codeReviewDefaults?.reviewerMaxRounds, reviewerModelsFromDefaults(codeReviewDefaults)),+ effortBlock: appendReviewerEffortBlock(list, reviewerEffortsFromDefaults(codeReviewDefaults)),+ };}/**@@ -565,6 +577,19 @@ const appendTargetWorkItemBlock = (promptTaskType, ref) => {return block ? `\n\n${block}` : '';};+/**+ * The per-reviewer reasoning-effort instruction, appended to a claim prompt with+ * the same blank-line separator. APPENDED rather than substituted into a+ * `{...}` placeholder because a new placeholder would be silently dropped by+ * every install whose customized claim template predates it (the same reason+ * `swarmBlock` is prepended) — and because there is no `--review-with` suffix to+ * carry it, so it has to be prose. Empty when no reviewer in the list pins one.+ */+const appendReviewerEffortBlock = (reviewers, reviewerEfforts) => {+ const note = buildReviewerEffortNote(reviewers, reviewerEfforts);+ return note ? `\n\n${note}` : '';+};+/*** Build a one-off "implement THIS JIRA ticket" task for `app` — the per-card* "play" button on the app overview's sprint board (the JIRA analogue of the@@ -588,9 +613,9 @@ export async function buildJiraTicketTask(app, ticketKey) {const key = normalizeWorkItemRef(ticketKey);// Independent reads (prompt body + Code Review Defaults) — fetch concurrently.- const [template, reviewersCsv] = await Promise.all([+ const [template, { csv: reviewersCsv, effortBlock }] = await Promise.all([getTaskPrompt('claim-issue-jira'),- resolveClaimReviewersCsv(),+ resolveClaimReviewerPrompt(),]);const prompt = template.replace(/\{appName\}/g, app.name)@@ -599,7 +624,8 @@ export async function buildJiraTicketTask(app, ticketKey) {// Function-form replacer so a literal `$` in the reviewers CSV isn't read as// a backreference..replace(/\{reviewers\}/g, () => reviewersCsv)- + appendTargetWorkItemBlock('claim-issue-jira', key);+ + appendTargetWorkItemBlock('claim-issue-jira', key)+ + effortBlock;return { ticketKey: key, prompt, taskMetadata: { useWorktree: false, openPR: false } };}@@ -2464,6 +2490,9 @@ async function buildImprovementTaskDescription({ promptTemplate, app, promptTask// `[<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));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 it@@ -2501,7 +2530,16 @@ async function buildImprovementTaskDescription({ promptTemplate, app, promptTask.replace(/\{zombieIssues\}/g, () => blocks.zombieIssues).replace(/\{repoFullName\}/g, () => blocks.repoFullName).replace(/\{defaultBranch\}/g, () => blocks.defaultBranch)- .replace(/\{planConstraint\}/g, () => blocks.planConstraint);+ .replace(/\{planConstraint\}/g, () => blocks.planConstraint)+ // The effort note accompanies the reviewer CSV, so it's only appended when this+ // template actually carries one. A task type whose prompt does NOT drive its own+ // reviewers gets its PR reviewed by the completion workflow instead, and+ // `buildCliCompletionSection` already states the effort next to that `/do:pr`+ // step — appending here too would print the same sentence twice and give one+ // instruction two owners to drift apart.+ + (/\{reviewers\}/.test(promptTemplate)+ ? appendReviewerEffortBlock(promptReviewers, promptReviewerEfforts)+ : '');}/**diff --git a/server/services/cosTaskStore.js b/server/services/cosTaskStore.jsindex 1db33c9666..0142376774 100644--- a/server/services/cosTaskStore.js+++ b/server/services/cosTaskStore.js@@ -16,7 +16,7 @@ import { readFile, writeFile, stat } from 'fs/promises';import { existsSync } from 'fs';import { join } from 'path';import { parseTasksMarkdown, groupTasksByStatus, getAutoApprovedTasks, getAwaitingApprovalTasks, generateTasksMarkdown, hasKnownPrefix } from '../lib/taskParser.js';-import { REVIEW_STOP_MODES, normalizeReviewers, normalizeReviewUsernames, normalizeOptionalReviewers, normalizeReviewerMaxRounds, normalizeReviewerModels } from '../lib/validation.js';+import { REVIEW_STOP_MODES, normalizeReviewers, normalizeReviewUsernames, normalizeOptionalReviewers, normalizeReviewerMaxRounds, normalizeReviewerModels, normalizeReviewerEfforts } from '../lib/validation.js';import { PR_COMPLETIONS, PR_COMPLETION_VALUES } from '../lib/prDisposition.js';import { RETRY_HOLD_KEY, RETRY_HOLD_SINCE_KEY } from '../lib/taskRetryHold.js';import { REQUEUED_AT_KEY } from '../lib/taskRequeue.js';@@ -397,6 +397,12 @@ export async function addTask(taskData, taskType = 'user', { raw = false, ignoreif (taskData.reviewerModels && typeof taskData.reviewerModels === 'object' && !Array.isArray(taskData.reviewerModels)) {metadata.reviewerModels = normalizeReviewerModels(taskData.reviewerModels) || {};}+ // Per-reviewer reasoning-effort pins, same token keying and same explicit-empty+ // semantics. An entry naming a reviewer with no effort control, or a level that+ // reviewer's CLI rejects, is dropped by the normalizer.+ if (taskData.reviewerEfforts && typeof taskData.reviewerEfforts === 'object' && !Array.isArray(taskData.reviewerEfforts)) {+ metadata.reviewerEfforts = normalizeReviewerEfforts(taskData.reviewerEfforts) || {};+ }if (REVIEW_STOP_MODES.includes(taskData.reviewStopMode)) metadata.reviewStopMode = taskData.reviewStopMode;if (taskData.reviewerApplies === true) metadata.reviewerApplies = true;else if (taskData.reviewerApplies === false) metadata.reviewerApplies = false;