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: cap review rounds per reviewer via slashdo's ~max=<n> suffix (#3123)
[._.]/ Adam Eivyda20212cfba7
diff --git a/client/src/components/apps/SlashDoRunDrawer.jsx b/client/src/components/apps/SlashDoRunDrawer.jsxindex 721c095241..c716eaf9a0 100644--- a/client/src/components/apps/SlashDoRunDrawer.jsx+++ b/client/src/components/apps/SlashDoRunDrawer.jsx@@ -70,7 +70,8 @@ function SlashDoRunDrawerBody({ open, command, label, appId, appName, onClose, o...(review ? {reviewers: review.reviewers,usernames: review.usernames,- optionalReviewers: review.optionalReviewers+ optionalReviewers: review.optionalReviewers,+ reviewerMaxRounds: review.reviewerMaxRounds} : {})}, { silent: true }).catch((err) => {setSubmitError(err.message || 'Failed to queue the task');@@ -133,11 +134,12 @@ function SlashDoRunDrawerBody({ open, command, label, appId, appName, onClose, oreviewers={reviewValue.reviewers}usernames={reviewValue.usernames}optionalReviewers={reviewValue.optionalReviewers}+ reviewerMaxRounds={reviewValue.reviewerMaxRounds}// 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 }) =>- setReview({ reviewers, usernames, optionalReviewers })}+ onChange={({ reviewers, usernames, optionalReviewers, reviewerMaxRounds }) =>+ setReview({ reviewers, usernames, optionalReviewers, reviewerMaxRounds })}/><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 92a51a896b..d587d2f9ba 100644--- a/client/src/components/cos/ReviewerPicker.jsx+++ b/client/src/components/cos/ReviewerPicker.jsx@@ -5,6 +5,7 @@ import {REVIEW_STOP_MODES,DEFAULT_REVIEW_STOP_MODE,MAX_REVIEW_USERNAMES,+ MAX_REVIEWER_MAX_ROUNDS,cleanReviewUsername,normalizeReviewUsernames} from './constants';@@ -21,9 +22,13 @@ const normalizeReviewerValue = (value) => value === 'gemini' ? 'antigravity' : v* `@CodeReviewbot`) requested as PR reviewers to gate the merge — appended to* `--review-with` as `@user` tokens after the keyed reviewers.*+ * Each chip carries two per-entry slashdo suffix controls: the `~opt`+ * non-blocking badge and a 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` / `reviewStopMode` / `reviewerApplies` however it- * persists them.+ * `reviewers` / `usernames` / `reviewerMaxRounds` / `reviewStopMode` /+ * `reviewerApplies` however it persists them.** `showRunFlags={false}` hides the stop-mode select and the "reviewer applies* fixes" checkbox for surfaces that can't honor them — the `/do:next` claim@@ -35,6 +40,7 @@ export default function ReviewerPicker({reviewers = [],usernames = [],optionalReviewers = [],+ reviewerMaxRounds = {},stopMode = DEFAULT_REVIEW_STOP_MODE,reviewerApplies = false,onChange,@@ -62,11 +68,27 @@ 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());+ // Per-reviewer `~max=<n>` round caps, keyed by the same emitted token. Absent+ // key = no cap requested (slashdo's built-in default stands); `0` = loop until+ // clean. The two must never collapse, so the input renders '' for absent and+ // clearing it DELETES the key rather than writing 0 (server+ // `normalizeReviewerMaxRounds` owns the authoritative shape).+ const maxRoundsMap = (reviewerMaxRounds && typeof reviewerMaxRounds === 'object' && !Array.isArray(reviewerMaxRounds))+ ? reviewerMaxRounds+ : {};+ const maxRoundsFor = (token) => {+ const key = Object.keys(maxRoundsMap).find(k => k.toLowerCase() === token.toLowerCase());+ return key === undefined ? undefined : maxRoundsMap[key];+ };+ const maxRoundsWithout = (token) => Object.fromEntries(+ Object.entries(maxRoundsMap).filter(([k]) => k.toLowerCase() !== token.toLowerCase())+ );const emit = (next) => onChange?.({reviewers: selected,usernames: selectedUsernames,optionalReviewers: optionalTokens,+ reviewerMaxRounds: maxRoundsMap,stopMode,reviewerApplies,...next@@ -76,6 +98,20 @@ export default function ReviewerPicker({optionalReviewers: isOptional(token) ? withoutToken(token) : [...optionalTokens, token]});+ // Blank clears the cap entirely (back to slashdo's built-in default); any other+ // value is clamped to 0..MAX_REVIEWER_MAX_ROUNDS so the input can't offer a+ // budget the server would drop.+ const setMaxRounds = (token, raw) => {+ if (raw === '') {+ emit({ reviewerMaxRounds: maxRoundsWithout(token) });+ return;+ }+ const parsed = Number.parseInt(raw, 10);+ if (!Number.isInteger(parsed)) return;+ const clamped = Math.min(Math.max(parsed, 0), MAX_REVIEWER_MAX_ROUNDS);+ emit({ reviewerMaxRounds: { ...maxRoundsWithout(token), [token]: clamped } });+ };+// The `~opt` non-blocking toggle rendered on every reviewer/username chip.// `subject` is the human name used in the aria-label; `title` is the (chip-// kind-specific) hover copy the caller resolves.@@ -95,6 +131,40 @@ export default function ReviewerPicker({</button>);+ // The `~max=<n>` round-cap input rendered on every reviewer/username chip.+ // Blank means "no cap" — the number input's empty string is the sentinel for an+ // absent key, distinct from a typed `0` (loop until clean).+ const renderMaxRounds = (token, subject) => {+ const value = maxRoundsFor(token);+ const inputId = `${id}-max-${token}`;+ return (+ <span className="inline-flex items-center gap-0.5">+ <label htmlFor={inputId} className="text-[10px] font-mono leading-none text-gray-600">~max</label>+ <input+ id={inputId}+ type="number"+ inputMode="numeric"+ min={0}+ max={MAX_REVIEWER_MAX_ROUNDS}+ step={1}+ disabled={disabled}+ value={value === undefined ? '' : value}+ placeholder="–"+ onChange={(e) => setMaxRounds(token, e.target.value)}+ aria-label={`Max review rounds for ${subject}`}+ title={value === undefined+ ? `${subject} uses slashdo's built-in round cap. Enter a number to cap its review → fix → re-review cycles (0 = loop until clean).`+ : value === 0+ ? `${subject} loops until clean (~max=0), bounded by slashdo's safety guardrail. Clear to restore the built-in cap.`+ : `${subject} runs at most ${value} review round${value === 1 ? '' : 's'} (~max=${value}). Clear to restore the built-in cap.`}+ className={`w-8 px-0.5 py-0.5 text-[10px] font-mono leading-none text-center rounded border bg-port-bg disabled:opacity-40 focus:outline-none focus:border-port-accent ${value === undefined+ ? 'text-gray-500 border-transparent hover:border-port-border'+ : 'text-port-accent-2 border-port-accent-2/50'}`}+ />+ </span>+ );+ };+const addUsername = () => {const clean = cleanReviewUsername(usernameInput);if (!clean) {@@ -116,13 +186,15 @@ export default function ReviewerPicker({};const removeUsername = (value) => emit({usernames: selectedUsernames.filter(u => u !== value),- optionalReviewers: withoutToken(`@${value}`)+ optionalReviewers: withoutToken(`@${value}`),+ reviewerMaxRounds: maxRoundsWithout(`@${value}`)});const add = (value) => emit({ reviewers: [...selected, value] });const remove = (value) => emit({reviewers: selected.filter(r => r !== value),- optionalReviewers: withoutToken(value)+ optionalReviewers: withoutToken(value),+ reviewerMaxRounds: maxRoundsWithout(value)});const move = (index, delta) => {const target = index + delta;@@ -165,6 +237,7 @@ export default function ReviewerPicker({{renderOptToggle(value, labelFor(value), isOptional(value)? `${labelFor(value)} is non-blocking (~opt): an inconclusive verdict from it won't block the merge. Click to make it blocking.`: `${labelFor(value)} gates the merge. Click to make it non-blocking (~opt) — its inconclusive verdicts won't block the merge (a hard failure still does).`)}+ {renderMaxRounds(value, labelFor(value))}<buttontype="button"disabled={disabled}@@ -183,7 +256,7 @@ export default function ReviewerPicker({{(selected.length > 0 || selectedUsernames.length > 0) && (<span className="text-[11px] text-gray-600 -mt-1">- Tip: 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.+ Tip: 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>)}@@ -222,6 +295,7 @@ export default function ReviewerPicker({{renderOptToggle(`@${value}`, `@${value}`, isOptional(`@${value}`)? `@${value} is non-blocking (~opt): if it never submits a review, the merge isn't blocked. Click to make it blocking.`: `@${value} gates the merge. Click to make it non-blocking (~opt) — a missing/timed-out review from it won't block the merge.`)}+ {renderMaxRounds(`@${value}`, `@${value}`)}<buttontype="button"disabled={disabled}diff --git a/client/src/components/cos/ReviewerPicker.test.jsx b/client/src/components/cos/ReviewerPicker.test.jsxindex e0519cb09a..379ebe5cca 100644--- a/client/src/components/cos/ReviewerPicker.test.jsx+++ b/client/src/components/cos/ReviewerPicker.test.jsx@@ -1,5 +1,5 @@import { describe, it, expect, vi } from 'vitest';-import { render, screen } from '@testing-library/react';+import { render, screen, fireEvent } from '@testing-library/react';import userEvent from '@testing-library/user-event';import ReviewerPicker from './ReviewerPicker';@@ -143,4 +143,87 @@ describe('ReviewerPicker', () => {await user.click(screen.getByLabelText('Remove Ollama'));expect(onChange).toHaveBeenCalledWith(expect.objectContaining({ reviewers: ['codex'], optionalReviewers: [] }));});++ describe('~max round caps', () => {+ it('renders a blank cap input per reviewer/username chip when no cap is set', () => {+ render(<ReviewerPicker reviewers={['codex', 'ollama']} usernames={['flaky-bot']} onChange={() => {}} />);+ expect(screen.getByLabelText('Max review rounds for Codex')).toHaveValue(null);+ expect(screen.getByLabelText('Max review rounds for Ollama')).toHaveValue(null);+ expect(screen.getByLabelText('Max review rounds for @flaky-bot')).toHaveValue(null);+ });++ it('shows an existing cap, including an explicit 0', () => {+ render(<ReviewerPicker reviewers={['codex', 'ollama']} reviewerMaxRounds={{ ollama: 0, codex: 2 }} onChange={() => {}} />);+ // 0 is a real value (loop until clean) and must render as 0, not blank.+ expect(screen.getByLabelText('Max review rounds for Ollama')).toHaveValue(0);+ expect(screen.getByLabelText('Max review rounds for Codex')).toHaveValue(2);+ });++ it('sets a cap for a keyed reviewer', async () => {+ const onChange = vi.fn();+ const user = userEvent.setup();+ render(<ReviewerPicker reviewers={['codex', 'ollama']} onChange={onChange} />);+ await user.type(screen.getByLabelText('Max review rounds for Ollama'), '1');+ expect(onChange).toHaveBeenCalledWith(expect.objectContaining({ reviewerMaxRounds: { ollama: 1 } }));+ });++ it('sets a cap for a @username reviewer keyed by its @-form token', async () => {+ const onChange = vi.fn();+ const user = userEvent.setup();+ render(<ReviewerPicker reviewers={['copilot']} usernames={['flaky-bot']} onChange={onChange} />);+ await user.type(screen.getByLabelText('Max review rounds for @flaky-bot'), '3');+ expect(onChange).toHaveBeenCalledWith(expect.objectContaining({ reviewerMaxRounds: { '@flaky-bot': 3 } }));+ });++ it('clearing the input DELETES the entry rather than writing 0 (absent ≠ 0)', async () => {+ const onChange = vi.fn();+ const user = userEvent.setup();+ render(<ReviewerPicker reviewers={['codex', 'ollama']} reviewerMaxRounds={{ ollama: 2 }} onChange={onChange} />);+ await user.clear(screen.getByLabelText('Max review rounds for Ollama'));+ expect(onChange).toHaveBeenCalledWith(expect.objectContaining({ reviewerMaxRounds: {} }));+ });++ it('clamps a cap above the ceiling instead of sending a value the server would drop', () => {+ const onChange = vi.fn();+ render(<ReviewerPicker reviewers={['ollama']} onChange={onChange} />);+ // fireEvent (not user.type) so the whole out-of-range value lands in one+ // change event — a controlled input never accumulates keystrokes.+ fireEvent.change(screen.getByLabelText('Max review rounds for Ollama'), { target: { value: '99' } });+ expect(onChange).toHaveBeenLastCalledWith(expect.objectContaining({ reviewerMaxRounds: { ollama: 10 } }));+ });++ it('clamps a negative cap to 0 rather than dropping the entry silently', () => {+ const onChange = vi.fn();+ render(<ReviewerPicker reviewers={['ollama']} onChange={onChange} />);+ fireEvent.change(screen.getByLabelText('Max review rounds for Ollama'), { target: { value: '-2' } });+ expect(onChange).toHaveBeenLastCalledWith(expect.objectContaining({ reviewerMaxRounds: { ollama: 0 } }));+ });++ it('prunes the cap entry when its reviewer is removed', async () => {+ const onChange = vi.fn();+ const user = userEvent.setup();+ render(<ReviewerPicker reviewers={['codex', 'ollama']} reviewerMaxRounds={{ ollama: 1 }} onChange={onChange} />);+ await user.click(screen.getByLabelText('Remove Ollama'));+ expect(onChange).toHaveBeenCalledWith(expect.objectContaining({ reviewers: ['codex'], reviewerMaxRounds: {} }));+ });++ it('prunes the cap entry when its username reviewer is removed', async () => {+ const onChange = vi.fn();+ const user = userEvent.setup();+ render(<ReviewerPicker reviewers={['copilot']} usernames={['flaky-bot']} reviewerMaxRounds={{ '@flaky-bot': 2 }} onChange={onChange} />);+ await user.click(screen.getByLabelText('Remove @flaky-bot'));+ expect(onChange).toHaveBeenCalledWith(expect.objectContaining({ usernames: [], reviewerMaxRounds: {} }));+ });++ it('keeps the ~opt toggle and the cap independent', async () => {+ const onChange = vi.fn();+ const user = userEvent.setup();+ render(<ReviewerPicker reviewers={['ollama']} reviewerMaxRounds={{ ollama: 1 }} onChange={onChange} />);+ await user.click(screen.getByLabelText('Make Ollama non-blocking'));+ expect(onChange).toHaveBeenCalledWith(expect.objectContaining({+ optionalReviewers: ['ollama'],+ reviewerMaxRounds: { ollama: 1 }+ }));+ });+ });});diff --git a/client/src/components/cos/TaskAddForm.jsx b/client/src/components/cos/TaskAddForm.jsxindex 8721820684..c34dc78414 100644--- a/client/src/components/cos/TaskAddForm.jsx+++ b/client/src/components/cos/TaskAddForm.jsx@@ -25,6 +25,7 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = faconst [reviewers, setReviewers] = useState(DEFAULT_REVIEWERS);const [reviewUsernames, setReviewUsernames] = useState([]);const [optionalReviewers, setOptionalReviewers] = useState([]);+ const [reviewerMaxRounds, setReviewerMaxRounds] = useState({});const [reviewStopMode, setReviewStopMode] = useState(DEFAULT_REVIEW_STOP_MODE);const [reviewerApplies, setReviewerApplies] = useState(false);const [createJiraTicket, setCreateJiraTicket] = useState(false);@@ -68,6 +69,7 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = faif (Array.isArray(d.reviewers) && d.reviewers.length) setReviewers(d.reviewers);if (Array.isArray(d.usernames)) setReviewUsernames(d.usernames);if (Array.isArray(d.optionalReviewers)) setOptionalReviewers(d.optionalReviewers);+ if (d.reviewerMaxRounds && typeof d.reviewerMaxRounds === 'object' && !Array.isArray(d.reviewerMaxRounds)) setReviewerMaxRounds(d.reviewerMaxRounds);if (d.stopMode) setReviewStopMode(d.stopMode);if (d.reviewerApplies === true) setReviewerApplies(true);})@@ -306,6 +308,7 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = fareviewers: 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,reviewStopMode: openPR && prCompletion === 'review-then-merge' ? reviewStopMode : undefined,reviewerApplies: openPR && prCompletion === 'review-then-merge' ? reviewerApplies : undefined,screenshots: screenshots.length > 0 ? screenshots.map(s => s.path) : undefined,@@ -558,12 +561,14 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = fareviewers={reviewers}usernames={reviewUsernames}optionalReviewers={optionalReviewers}+ reviewerMaxRounds={reviewerMaxRounds}stopMode={reviewStopMode}reviewerApplies={reviewerApplies}- onChange={({ reviewers: r, usernames: u, optionalReviewers: o, stopMode, reviewerApplies: ra }) => {+ onChange={({ reviewers: r, usernames: u, optionalReviewers: o, reviewerMaxRounds: m, stopMode, reviewerApplies: ra }) => {setReviewers(r);setReviewUsernames(u);setOptionalReviewers(o);+ setReviewerMaxRounds(m);setReviewStopMode(stopMode);setReviewerApplies(ra);}}diff --git a/client/src/components/cos/constants.js b/client/src/components/cos/constants.jsindex d56661bef2..81cbbc22b2 100644--- a/client/src/components/cos/constants.js+++ b/client/src/components/cos/constants.js@@ -270,6 +270,13 @@ export function normalizeReviewUsernames(list) {return out;}+// Upper bound on a per-reviewer `~max=<n>` round cap. Client mirror of+// MAX_REVIEWER_MAX_ROUNDS in `server/lib/cosValidation.js` — a value above it is+// dropped server-side, so the input must not offer one. `0` is valid and means+// "loop until clean" (slashdo's unlimited mode, bounded by its own guardrail);+// blank/absent means "no cap requested" and keeps slashdo's built-in default.+export const MAX_REVIEWER_MAX_ROUNDS = 10;+// Stop-mode for the multi-reviewer loop (slashdo `--review-stop-on-*`).// Keep in sync with REVIEW_STOP_MODES in `server/lib/validation.js`.export const REVIEW_STOP_MODES = [diff --git a/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx b/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsxindex 4871f41421..c7ccbcfe78 100644--- a/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx+++ b/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx@@ -434,16 +434,17 @@ export default function GlobalConfigControls({ taskType, config, onUpdate, onTrireviewers={config.taskMetadata?.reviewers ?? (config.taskMetadata?.reviewer ? [config.taskMetadata.reviewer] : reviewDefaults.reviewers)}usernames={config.taskMetadata?.usernames ?? reviewDefaults.usernames}optionalReviewers={config.taskMetadata?.optionalReviewers ?? reviewDefaults.optionalReviewers}+ reviewerMaxRounds={config.taskMetadata?.reviewerMaxRounds ?? reviewDefaults.reviewerMaxRounds}stopMode={config.taskMetadata?.reviewStopMode || reviewDefaults.stopMode || DEFAULT_REVIEW_STOP_MODE}reviewerApplies={config.taskMetadata?.reviewerApplies !== undefined? (config.taskMetadata?.reviewerApplies === true || config.taskMetadata?.reviewerApplies === 'true'): reviewDefaults.reviewerApplies}disabled={updating}- onChange={({ reviewers, usernames, optionalReviewers, stopMode, reviewerApplies }) => {+ onChange={({ reviewers, usernames, optionalReviewers, reviewerMaxRounds, 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, reviewStopMode: stopMode, reviewerApplies }+ taskMetadata: { ...rest, reviewers, usernames, optionalReviewers, reviewerMaxRounds, reviewStopMode: stopMode, reviewerApplies }});}}/>diff --git a/client/src/components/providers/CodeReviewDefaultsPanel.jsx b/client/src/components/providers/CodeReviewDefaultsPanel.jsxindex 47699c0d4b..2dcf618444 100644--- a/client/src/components/providers/CodeReviewDefaultsPanel.jsx+++ b/client/src/components/providers/CodeReviewDefaultsPanel.jsx@@ -28,6 +28,7 @@ export default function CodeReviewDefaultsPanel() {const [reviewers, setReviewers] = useState(DEFAULT_REVIEWERS);const [usernames, setUsernames] = useState([]);const [optionalReviewers, setOptionalReviewers] = useState([]);+ const [reviewerMaxRounds, setReviewerMaxRounds] = useState({});const [stopMode, setStopMode] = useState(DEFAULT_REVIEW_STOP_MODE);const [reviewerApplies, setReviewerApplies] = useState(false);const [lmstudioModel, setLmstudioModel] = useState('');@@ -50,6 +51,9 @@ export default function CodeReviewDefaultsPanel() {setReviewers(Array.isArray(defaults.reviewers) && defaults.reviewers.length ? defaults.reviewers : DEFAULT_REVIEWERS);setUsernames(Array.isArray(defaults.usernames) ? defaults.usernames : []);setOptionalReviewers(Array.isArray(defaults.optionalReviewers) ? defaults.optionalReviewers : []);+ setReviewerMaxRounds(defaults.reviewerMaxRounds && typeof defaults.reviewerMaxRounds === 'object' && !Array.isArray(defaults.reviewerMaxRounds)+ ? defaults.reviewerMaxRounds+ : {});setStopMode(defaults.stopMode || DEFAULT_REVIEW_STOP_MODE);setReviewerApplies(defaults.reviewerApplies === true);setLmstudioModel(defaults.lmstudioModel || '');@@ -104,6 +108,7 @@ export default function CodeReviewDefaultsPanel() {reviewers,usernames,optionalReviewers,+ reviewerMaxRounds,stopMode,reviewerApplies,lmstudioModel: lmstudioModel || undefined,@@ -165,13 +170,15 @@ export default function CodeReviewDefaultsPanel() {reviewers={reviewers}usernames={usernames}optionalReviewers={optionalReviewers}+ reviewerMaxRounds={reviewerMaxRounds}stopMode={stopMode}reviewerApplies={reviewerApplies}disabled={saving}- onChange={({ reviewers: r, usernames: u, optionalReviewers: o, stopMode: s, reviewerApplies: a }) => {+ onChange={({ reviewers: r, usernames: u, optionalReviewers: o, reviewerMaxRounds: m, stopMode: s, reviewerApplies: a }) => {setReviewers(r);setUsernames(u);setOptionalReviewers(o);+ setReviewerMaxRounds(m);setStopMode(s);setReviewerApplies(a);}}diff --git a/client/src/hooks/useCodeReviewDefaults.jsx b/client/src/hooks/useCodeReviewDefaults.jsxindex 43a2f3847c..21a90dab35 100644--- a/client/src/hooks/useCodeReviewDefaults.jsx+++ b/client/src/hooks/useCodeReviewDefaults.jsx@@ -11,6 +11,7 @@ const FALLBACK = Object.freeze({reviewers: DEFAULT_REVIEWERS,usernames: [],optionalReviewers: [],+ reviewerMaxRounds: {},stopMode: DEFAULT_REVIEW_STOP_MODE,reviewerApplies: false,lmstudioModel: null,@@ -35,6 +36,9 @@ export function CodeReviewDefaultsProvider({ children }) {reviewers: Array.isArray(d.reviewers) && d.reviewers.length ? d.reviewers : DEFAULT_REVIEWERS,usernames: Array.isArray(d.usernames) ? d.usernames : [],optionalReviewers: Array.isArray(d.optionalReviewers) ? d.optionalReviewers : [],+ reviewerMaxRounds: d.reviewerMaxRounds && typeof d.reviewerMaxRounds === 'object' && !Array.isArray(d.reviewerMaxRounds)+ ? d.reviewerMaxRounds+ : {},stopMode: d.stopMode || DEFAULT_REVIEW_STOP_MODE,reviewerApplies: d.reviewerApplies === true,lmstudioModel: d.lmstudioModel || null,diff --git a/server/lib/cosValidation.js b/server/lib/cosValidation.jsindex a7ea1331cc..356f03d647 100644--- a/server/lib/cosValidation.js+++ b/server/lib/cosValidation.js@@ -98,6 +98,26 @@ export function resolveReviewUsernames(metadataUsernames, defaultUsernames) {: normalizeReviewUsernames(defaultUsernames);}+/**+ * Normalize ONE raw reviewer identity to the exact token `--review-with` emits:+ * a keyed slug from `REVIEWER_VALUES` (aliasing `gemini` → `antigravity`) or an+ * `@<username>`. Returns null for anything else. Single definition of the token+ * identity shared by `normalizeOptionalReviewers` and+ * `normalizeReviewerMaxRounds`, so the `~opt` set and the `~max=<n>` map can't+ * disagree about what a reviewer is called.+ */+function normalizeReviewerToken(raw) {+ if (typeof raw !== 'string') return null;+ const trimmed = raw.trim();+ if (!trimmed) return null;+ if (trimmed.startsWith('@')) {+ const [user] = normalizeReviewUsernames([trimmed]);+ return user ? `@${user}` : null;+ }+ const slug = REVIEWER_ALIASES[trimmed] ?? trimmed;+ return REVIEWER_VALUES.includes(slug) ? slug : null;+}+/*** Reviewer identities the user marked OPTIONAL (non-blocking). slashdo's `~opt`* suffix is appended to each matching `--review-with` token, so an *inconclusive*@@ -119,19 +139,8 @@ export function normalizeOptionalReviewers(list) {const seen = new Set();const out = [];for (const raw of list) {- if (typeof raw !== 'string') continue;- const trimmed = raw.trim();- if (!trimmed) continue;- let token;- if (trimmed.startsWith('@')) {- const [user] = normalizeReviewUsernames([trimmed]);- if (!user) continue;- token = `@${user}`;- } else {- const slug = REVIEWER_ALIASES[trimmed] ?? trimmed;- if (!REVIEWER_VALUES.includes(slug)) continue;- token = slug;- }+ const token = normalizeReviewerToken(raw);+ if (!token) continue;const key = token.toLowerCase();if (seen.has(key)) continue;seen.add(key);@@ -152,6 +161,61 @@ export function resolveOptionalReviewers(metadataOptional, defaultOptional) {: (normalizeOptionalReviewers(defaultOptional) || []);}+// 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.+export const MAX_REVIEWER_MAX_ROUNDS = 10;++/**+ * Per-reviewer iteration caps — slashdo's `~max=<n>` suffix (v3.25.0). Caps how+ * many review → fix → re-review cycles ONE reviewer runs before it stops, so a+ * slow local model can be included in a chain without paying for its otherwise+ * hardcoded 3 rounds (`--review-with claude~max=2,ollama~max=1,codex~max=3`).+ * Stored as a token-keyed map (`{ ollama: 1, '@flaky-bot': 0 }`) rather than a+ * list because the cap carries a value; the key is the same *emitted*+ * `--review-with` token `normalizeOptionalReviewers` uses.+ *+ * **Absent ≠ 0.** slashdo reads `~max=0` as "loop until this reviewer is clean"+ * (bounded by its own 10-round guardrail), which is the OPPOSITE of "no cap+ * requested" (that keeps slashdo's built-in default of 3 for CLI/Ollama+ * reviewers). So a missing key and an explicit `0` must never collapse: an entry+ * whose value isn't a usable cap is DROPPED rather than coerced to `0`.+ * Drops unknown tokens, non-integers, negatives, and anything above+ * 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).+ */+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 };+}++/**+ * Resolve per-reviewer iteration caps 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+ * `resolveOptionalReviewers`.+ */+export function resolveReviewerMaxRounds(metadataMap, defaultMap) {+ const isMap = (v) => !!v && typeof v === 'object' && !Array.isArray(v);+ return isMap(metadataMap)+ ? (normalizeReviewerMaxRounds(metadataMap) || {})+ : (normalizeReviewerMaxRounds(defaultMap) || {});+}+/*** Build the set of lowercased optional-reviewer tokens for a fast membership* test in the builders. Tolerates the raw (unnormalized) list.@@ -160,9 +224,28 @@ function optionalReviewerSet(optionalReviewers) {return new Set((normalizeOptionalReviewers(optionalReviewers) || []).map(t => t.toLowerCase()));}-/** Append slashdo's `~opt` marker to `token` when it's in the optional set. */-function markOptional(token, optSet) {- return optSet.has(token.toLowerCase()) ? `${token}~opt` : token;+/**+ * Build a lowercased-token → cap lookup for the builders. Tolerates the raw+ * (unnormalized) map. A `Map` (not a plain object) so a reviewer token can never+ * collide with `Object.prototype` keys, and so `.get()` distinguishes an absent+ * cap (`undefined`) from an explicit `0`.+ */+function reviewerMaxRoundsLookup(reviewerMaxRounds) {+ const normalized = normalizeReviewerMaxRounds(reviewerMaxRounds) || {};+ return new Map(Object.entries(normalized).map(([token, max]) => [token.toLowerCase(), max]));+}++/**+ * Append slashdo's per-entry suffixes to `token` in slashdo's canonical storage+ * order — `~opt` first, then `~max=<n>` (the grammar accepts either order, and+ * neither is part of the reviewer's dedupe identity). A reviewer with no cap+ * emits no `~max` at all, which is what leaves slashdo's built-in default in+ * place; `~max=0` is a real, distinct value meaning "loop until clean".+ */+function markSuffixes(token, optSet, maxLookup) {+ const key = token.toLowerCase();+ const max = maxLookup?.get(key);+ return `${token}${optSet.has(key) ? '~opt' : ''}${max === undefined ? '' : `~max=${max}`}`;}/**@@ -215,15 +298,17 @@ export function resolveKeyedReviewers(reviewers, hasUsernames) {* Build the comma-separated reviewer token list used to fill the `{reviewers}`* placeholder in claim/plan prompts: keyed reviewers (falling back to the* default when empty) followed by `@user` tokens for the reviewer usernames.- * Reviewers in `optionalReviewers` get slashdo's `~opt` non-blocking suffix.+ * Reviewers in `optionalReviewers` get slashdo's `~opt` non-blocking suffix, and+ * reviewers carrying a `reviewerMaxRounds` cap get `~max=<n>` after it.* The flag-string variant is `buildReviewWithArgs`.*/-export function buildReviewersCsv(reviewers, usernames = [], optionalReviewers = []) {+export function buildReviewersCsv(reviewers, usernames = [], optionalReviewers = [], reviewerMaxRounds = {}) {const keyed = Array.isArray(reviewers) && reviewers.length ? reviewers : [...DEFAULT_REVIEWERS];const users = normalizeReviewUsernames(usernames);const optSet = optionalReviewerSet(optionalReviewers);+ const maxLookup = reviewerMaxRoundsLookup(reviewerMaxRounds);const combined = [...keyed, ...users.map(u => `@${u}`)];- return combined.map(t => markOptional(t, optSet)).join(',');+ return combined.map(t => markSuffixes(t, optSet, maxLookup)).join(',');}/**@@ -238,20 +323,25 @@ export function buildReviewersCsv(reviewers, usernames = [], optionalReviewers =* username reviewer is an external PR reviewer, not a CLI that applies fixes).* - Reviewers in `optionalReviewers` get slashdo's `~opt` non-blocking suffix on* their emitted token, so an inconclusive verdict from them doesn't gate the- * merge. A lone default `copilot` that is marked optional DOES force the flag- * on (otherwise the `~opt` — the whole point — would be dropped with the flag).+ * merge. Reviewers with a `reviewerMaxRounds` cap get `~max=<n>` after it.+ * A lone default `copilot` that is marked optional OR carries a cap DOES force+ * the flag on (otherwise the suffix — the whole point — would be dropped with+ * the flag).*/-export function buildReviewWithArgs(reviewers, stopMode = DEFAULT_REVIEW_STOP_MODE, reviewerApplies = false, usernames = [], optionalReviewers = []) {+export function buildReviewWithArgs(reviewers, stopMode = DEFAULT_REVIEW_STOP_MODE, reviewerApplies = false, usernames = [], optionalReviewers = [], reviewerMaxRounds = {}) {const users = normalizeReviewUsernames(usernames);const keyed = resolveKeyedReviewers(reviewers, users.length > 0);const combined = [...keyed, ...users.map(u => `@${u}`)];const optSet = optionalReviewerSet(optionalReviewers);- // The lone-default-copilot suppression only applies when copilot is NOT marked- // optional — a `copilot~opt`-only list must still emit the flag to carry `~opt`.- const isDefaultOnly = combined.length === 1 && combined[0] === DEFAULT_REVIEWER && !optSet.has(DEFAULT_REVIEWER);+ const maxLookup = reviewerMaxRoundsLookup(reviewerMaxRounds);+ // The lone-default-copilot suppression only applies when copilot carries NO+ // per-entry suffix — a `copilot~opt` / `copilot~max=2`-only list must still+ // emit the flag to carry that suffix.+ const isDefaultOnly = combined.length === 1 && combined[0] === DEFAULT_REVIEWER+ && !optSet.has(DEFAULT_REVIEWER) && maxLookup.get(DEFAULT_REVIEWER) === undefined;const hasNonCopilot = keyed.some(r => r !== DEFAULT_REVIEWER);const parts = [];- if (!isDefaultOnly) parts.push(`--review-with ${combined.map(t => markOptional(t, optSet)).join(',')}`);+ if (!isDefaultOnly) parts.push(`--review-with ${combined.map(t => markSuffixes(t, optSet, maxLookup)).join(',')}`);if (combined.length >= 2) {if (stopMode === 'on-findings') parts.push('--review-stop-on-findings');else if (stopMode === 'on-clean') parts.push('--review-stop-on-clean');@@ -367,6 +457,15 @@ export const createCosTaskSchema = z.object({v => Array.isArray(v) ? normalizeOptionalReviewers(v) : undefined,z.array(z.string()).optional()),+ // Per-reviewer iteration caps (slashdo `~max=<n>`), keyed by the emitted+ // `--review-with` token. Normalized so a hand-crafted request can't smuggle in+ // an unbounded or non-integer budget. Absent → undefined (not `{}`); an entry+ // with no usable cap is dropped rather than coerced to `0` (which slashdo reads+ // as "loop until clean").+ reviewerMaxRounds: z.preprocess(+ v => normalizeReviewerMaxRounds(v),+ z.record(z.number().int().min(0).max(MAX_REVIEWER_MAX_ROUNDS)).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()),@@ -598,6 +697,13 @@ export const codeReviewSettingsSchema = z.object({v => Array.isArray(v) ? normalizeOptionalReviewers(v) : undefined,z.array(z.string()).optional()),+ // Per-reviewer iteration caps (slashdo `~max=<n>`) keyed by emitted token —+ // e.g. `{ ollama: 1 }` buys one review-and-fix pass from a slow local model.+ // Absent → undefined; an unusable entry is dropped, never coerced to `0`.+ reviewerMaxRounds: z.preprocess(+ v => normalizeReviewerMaxRounds(v),+ z.record(z.number().int().min(0).max(MAX_REVIEWER_MAX_ROUNDS)).optional()+ ),stopMode: z.enum(REVIEW_STOP_MODES).optional(),reviewerApplies: z.boolean().optional(),lmstudioModel: z.preprocess(emptyToUndefined, z.string().optional()),@@ -703,7 +809,7 @@ function sanitizeQuotaBurnFamilies(raw) {export const slashdoTaskSchema = createCosTaskSchema.pick({model: true, provider: true, effort: true, simplify: true,- reviewers: true, usernames: true, optionalReviewers: true+ reviewers: true, usernames: true, optionalReviewers: true, reviewerMaxRounds: true}).extend({command: z.string().min(1),@@ -773,6 +879,15 @@ export function sanitizeTaskMetadata(raw) {clean.optionalReviewers = normalizeOptionalReviewers(raw.optionalReviewers) || [];hasKeys = true;}+ // `reviewerMaxRounds` caps each reviewer's review→fix→re-review cycles (slashdo+ // `~max=<n>`). Like `optionalReviewers`, an explicitly empty MAP is KEPT so a+ // task/type can override the Code Review Defaults' caps back to "no caps."+ // Individual entries with no usable cap are dropped by the normalizer rather+ // than becoming `0`, which slashdo reads as "loop until clean."+ if (raw.reviewerMaxRounds && typeof raw.reviewerMaxRounds === 'object' && !Array.isArray(raw.reviewerMaxRounds)) {+ clean.reviewerMaxRounds = normalizeReviewerMaxRounds(raw.reviewerMaxRounds) || {};+ 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/validation.test.js b/server/lib/validation.test.jsindex d42b8ae85b..82f1bddc4b 100644--- a/server/lib/validation.test.js+++ b/server/lib/validation.test.js@@ -15,6 +15,9 @@ import {resolveReviewUsernames,normalizeOptionalReviewers,resolveOptionalReviewers,+ normalizeReviewerMaxRounds,+ resolveReviewerMaxRounds,+ MAX_REVIEWER_MAX_ROUNDS,resolveKeyedReviewers,buildReviewersCsv,buildReviewWithArgs,@@ -181,6 +184,20 @@ describe('validation.js', () => {expect(r.success).toBe(true)expect(r.data.usernames).toBeUndefined()})++ it('normalizes reviewerMaxRounds (drops unknown tokens / bad values, keeps an explicit 0)', () => {+ const r = codeReviewSettingsSchema.safeParse({+ reviewerMaxRounds: { ollama: 1, copilot: 0, nope: 2, codex: -1 },+ })+ expect(r.success).toBe(true)+ expect(r.data.reviewerMaxRounds).toEqual({ ollama: 1, copilot: 0 })+ })++ it('leaves reviewerMaxRounds undefined when absent', () => {+ const r = codeReviewSettingsSchema.safeParse({ reviewers: ['copilot'] })+ expect(r.success).toBe(true)+ expect(r.data.reviewerMaxRounds).toBeUndefined()+ })})describe('processSchema', () => {@@ -760,6 +777,29 @@ describe('validation.js', () => {.toEqual({ useWorktree: true });});+ it('should keep a reviewerMaxRounds map (including an explicitly empty one) and drop bad entries', () => {+ expect(sanitizeTaskMetadata({ reviewerMaxRounds: { ollama: 1 } }))+ .toEqual({ reviewerMaxRounds: { ollama: 1 } });+ // An explicitly empty map is a real "no caps for this task/type" override+ // of the Code Review Defaults — the same contract optionalReviewers has.+ expect(sanitizeTaskMetadata({ reviewerMaxRounds: {} }))+ .toEqual({ reviewerMaxRounds: {} });+ // 0 is a REAL value (slashdo: loop until clean) and must survive; unknown+ // tokens and non-integers are dropped without collapsing to 0.+ expect(sanitizeTaskMetadata({ reviewerMaxRounds: { copilot: 0, nope: 2, codex: '3' } }))+ .toEqual({ reviewerMaxRounds: { copilot: 0 } });+ // A non-object never becomes an empty override.+ expect(sanitizeTaskMetadata({ reviewerMaxRounds: [1, 2] })).toBeNull();+ expect(sanitizeTaskMetadata({ reviewerMaxRounds: 'ollama=1' })).toBeNull();+ });++ it('should keep an optionalReviewers list (including an explicitly empty one)', () => {+ expect(sanitizeTaskMetadata({ optionalReviewers: ['ollama', 'nope'] }))+ .toEqual({ optionalReviewers: ['ollama'] });+ expect(sanitizeTaskMetadata({ optionalReviewers: [] }))+ .toEqual({ optionalReviewers: [] });+ });+it('should accept a valid issueAuthorFilter and drop invalid ones', () => {expect(sanitizeTaskMetadata({ issueAuthorFilter: 'self' })).toEqual({ issueAuthorFilter: 'self' });expect(sanitizeTaskMetadata({ issueAuthorFilter: 'owner' })).toEqual({ issueAuthorFilter: 'owner' });@@ -1024,6 +1064,110 @@ describe('validation.js', () => {expect(buildReviewersCsv(['claude', 'ollama'], ['@Bot'], ['ollama', '@Bot'])).toBe('claude,ollama~opt,@Bot~opt');});++ it('appends ~max=<n> after ~opt, in slashdo\'s canonical order', () => {+ // The CSV fills the `{reviewers}` prompt placeholder, so it must carry the+ // same suffixes buildReviewWithArgs emits or the two paths disagree.+ expect(buildReviewersCsv(['claude', 'ollama'], ['@Bot'], ['ollama'], { ollama: 1, '@Bot': 2, claude: 0 }))+ .toBe('claude~max=0,ollama~opt~max=1,@Bot~max=2');+ });++ it('emits no ~max for a reviewer with no cap (absent ≠ 0)', () => {+ expect(buildReviewersCsv(['claude', 'ollama'], [], [], { ollama: 1 }))+ .toBe('claude,ollama~max=1');+ });+ });++ describe('normalizeReviewerMaxRounds', () => {+ it('keeps non-negative integer caps for known tokens, aliasing gemini→antigravity', () => {+ expect(normalizeReviewerMaxRounds({ ollama: 1, '@Bot': 3, gemini: 2 }))+ .toEqual({ ollama: 1, '@Bot': 3, antigravity: 2 });+ });++ it('keeps an explicit 0 (slashdo: loop until clean) — never collapsed with absent', () => {+ const out = normalizeReviewerMaxRounds({ ollama: 0 });+ expect(out).toEqual({ ollama: 0 });+ expect(Object.prototype.hasOwnProperty.call(out, 'codex')).toBe(false);+ });++ it('drops unknown tokens, non-integers, negatives, and over-cap values', () => {+ expect(normalizeReviewerMaxRounds({+ ollama: 1,+ nope: 2,+ '@bad token': 1,+ codex: 1.5,+ claude: -1,+ copilot: '2',+ grok: MAX_REVIEWER_MAX_ROUNDS + 1,+ lmstudio: null,+ })).toEqual({ ollama: 1 });+ });++ it('accepts a cap exactly at the ceiling', () => {+ expect(normalizeReviewerMaxRounds({ ollama: MAX_REVIEWER_MAX_ROUNDS }))+ .toEqual({ ollama: MAX_REVIEWER_MAX_ROUNDS });+ });++ it('returns undefined for non-object input (an omitted field is not an empty override)', () => {+ expect(normalizeReviewerMaxRounds(undefined)).toBeUndefined();+ expect(normalizeReviewerMaxRounds(null)).toBeUndefined();+ expect(normalizeReviewerMaxRounds([['ollama', 1]])).toBeUndefined();+ expect(normalizeReviewerMaxRounds('ollama=1')).toBeUndefined();+ });++ it('returns a prototype-free plain object (no prototype pollution via a __proto__ key)', () => {+ const out = normalizeReviewerMaxRounds({ __proto__: { polluted: true }, ollama: 1 });+ expect(out).toEqual({ ollama: 1 });+ expect({}.polluted).toBeUndefined();+ });+ });++ describe('resolveReviewerMaxRounds', () => {+ it('lets a task-level map (even empty) override the defaults', () => {+ expect(resolveReviewerMaxRounds({ ollama: 1 }, { codex: 3 })).toEqual({ ollama: 1 });+ expect(resolveReviewerMaxRounds({}, { codex: 3 })).toEqual({});+ });++ it('falls back to the defaults when the task did not pin its own', () => {+ expect(resolveReviewerMaxRounds(undefined, { ollama: 1, nope: 2 })).toEqual({ ollama: 1 });+ expect(resolveReviewerMaxRounds(undefined, undefined)).toEqual({});+ });+ });++ describe('buildReviewWithArgs — ~max round caps', () => {+ it('emits <token>~max=<n> for exactly the tokens carrying a cap', () => {+ expect(buildReviewWithArgs(['claude', 'ollama', 'codex'], 'all', false, [], [], { ollama: 1 }))+ .toBe('--review-with claude,ollama~max=1,codex');+ });++ it('emits ~opt before ~max when a reviewer carries both', () => {+ expect(buildReviewWithArgs(['claude', 'ollama'], 'all', false, [], ['ollama'], { ollama: 1 }))+ .toBe('--review-with claude,ollama~opt~max=1');+ });++ it('round-trips ~max=0 and distinguishes it from no cap', () => {+ expect(buildReviewWithArgs(['claude', 'ollama'], 'all', false, [], [], { ollama: 0 }))+ .toBe('--review-with claude,ollama~max=0');+ expect(buildReviewWithArgs(['claude', 'ollama'], 'all', false, [], [], {}))+ .toBe('--review-with claude,ollama');+ });++ it('caps a @username reviewer by its @-form token', () => {+ expect(buildReviewWithArgs(['codex'], 'all', false, ['Bot'], [], { '@Bot': 2 }))+ .toBe('--review-with codex,@Bot~max=2');+ });++ it('forces the flag on for a lone default copilot carrying a cap (so ~max is not lost)', () => {+ // Without the suffix this is the suppressed lone-default case ('').+ expect(buildReviewWithArgs(['copilot'], 'all', false, [], [], { copilot: 2 }))+ .toBe('--review-with copilot~max=2');+ expect(buildReviewWithArgs(['copilot'], 'all', false, [], [], {})).toBe('');+ });++ it('ignores caps for tokens not present in the emitted list, and invalid entries', () => {+ expect(buildReviewWithArgs(['codex', 'copilot'], 'all', false, [], [], { ollama: 1, nope: 2, codex: -1 }))+ .toBe('--review-with codex,copilot');+ });});describe('createCosTaskSchema reviewers fields', () => {@@ -1063,6 +1207,24 @@ describe('validation.js', () => {expect(withoutUsers.data.usernames).toBeUndefined();});+ it('normalizes reviewerMaxRounds and leaves the field undefined when absent', () => {+ const withCaps = createCosTaskSchema.safeParse({+ description: 'x',+ reviewerMaxRounds: { ollama: 1, copilot: 0, nope: 2, codex: 1.5 },+ });+ expect(withCaps.success).toBe(true);+ // Unknown token + non-integer dropped; the explicit 0 survives.+ expect(withCaps.data.reviewerMaxRounds).toEqual({ ollama: 1, copilot: 0 });+ // Absent → undefined (not coerced to {}), so it isn't persisted as an override.+ const withoutCaps = createCosTaskSchema.safeParse({ description: 'x' });+ expect(withoutCaps.success).toBe(true);+ expect(withoutCaps.data.reviewerMaxRounds).toBeUndefined();+ // An explicitly empty map IS kept — a real "no caps for this task" override.+ const cleared = createCosTaskSchema.safeParse({ description: 'x', reviewerMaxRounds: {} });+ expect(cleared.success).toBe(true);+ expect(cleared.data.reviewerMaxRounds).toEqual({});+ });+it('accepts multiple image screenshots and attachment objects', () => {const parsed = createCosTaskSchema.safeParse({description: 'do a thing',diff --git a/server/routes/cos.test.js b/server/routes/cos.test.jsindex d1b300b4b5..77e4eaf740 100644--- a/server/routes/cos.test.js+++ b/server/routes/cos.test.js@@ -1032,6 +1032,7 @@ describe('CoS Routes', () => {.send({command: 'next', app: 'my-app', target: '#412', issueAuthorFilter: 'any',reviewers: ['claude', 'codex'], usernames: ['alice'], optionalReviewers: ['codex'],+ reviewerMaxRounds: { codex: 2, ollama: 1 },provider: 'claude-cli', model: 'claude-opus-5', effort: 'high', simplify: true});@@ -1043,7 +1044,10 @@ describe('CoS Routes', () => {issueAuthorFilter: 'any',reviewers: ['claude', 'codex'],usernames: ['alice'],- optionalReviewers: ['codex']+ optionalReviewers: ['codex'],+ // Per-reviewer `~max=<n>` caps ride along; `ollama` isn't in the list+ // but stays in the map (the emitter only marks tokens it emits).+ reviewerMaxRounds: { codex: 2, ollama: 1 }});const [taskData] = cos.addTask.mock.calls.at(-1);diff --git a/server/routes/cosTaskRoutes.js b/server/routes/cosTaskRoutes.jsindex 3a05431448..c4a04edef7 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+ target, issueAuthorFilter, reviewers, usernames, optionalReviewers, reviewerMaxRounds} = 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 });+ const claim = await buildClaimWorkTask(appObj, { target, issueAuthorFilter, reviewers, usernames, optionalReviewers, reviewerMaxRounds });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 f71ded4c82..a801f6db9d 100644--- a/server/services/agentPromptBuilder.js+++ b/server/services/agentPromptBuilder.js@@ -16,7 +16,7 @@ import { getToolsSummaryForPrompt } from './tools.js';import { getActiveProvider } from './providers.js';import { runPromptThroughProvider } from '../lib/promptRunner.js';import { readJSONFile, loadSlashdoFile, loadSlashdoLib, writeResolvedSlashdoBody, PATHS, tryReadFile } from '../lib/fileUtils.js';-import { DEFAULT_REVIEWER, DEFAULT_REVIEWERS, DEFAULT_REVIEW_STOP_MODE, LOCAL_LLM_REVIEWERS, MODEL_CAPABLE_CLI_REVIEWERS, normalizeReviewers, normalizeReviewUsernames, normalizeOptionalReviewers, resolveReviewUsernames, resolveOptionalReviewers, resolveKeyedReviewers, buildReviewWithArgs, buildReviewersCsv } from '../lib/validation.js';+import { DEFAULT_REVIEWER, DEFAULT_REVIEWERS, DEFAULT_REVIEW_STOP_MODE, LOCAL_LLM_REVIEWERS, MODEL_CAPABLE_CLI_REVIEWERS, normalizeReviewers, normalizeReviewUsernames, normalizeOptionalReviewers, normalizeReviewerMaxRounds, resolveReviewUsernames, resolveOptionalReviewers, resolveReviewerMaxRounds, 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';@@ -373,6 +373,7 @@ async function applySlashdoInvocation(task, {const resolvedReviewers = normalizeReviewers(task.metadata, defaultReviewers);const resolvedUsernames = resolveReviewUsernames(task.metadata?.usernames, codeReviewDefaults?.usernames);const resolvedOptional = resolveOptionalReviewers(task.metadata?.optionalReviewers, codeReviewDefaults?.optionalReviewers);+ const resolvedMaxRounds = resolveReviewerMaxRounds(task.metadata?.reviewerMaxRounds, codeReviewDefaults?.reviewerMaxRounds);// A resolved lone `copilot` with no usernames is ambiguous: it's what an// unconfigured install produces (`pickCodeReviewDefaults` and@@ -381,19 +382,22 @@ async function applySlashdoInvocation(task, {// treat it as unconfigured and prune nothing — pinning `--review-with copilot`// where Copilot review isn't enabled is the #2507 stall.//- // Marking copilot OPTIONAL is such an explicit naming: nothing defaults to- // `~opt`, so it's a deliberate "review but don't gate the merge" choice, and- // dropping it would silently turn a non-blocking review into a blocking one.- // `buildReviewWithArgs` makes the same exemption for its lone-default- // suppression — keep the two in step.+ // Marking copilot OPTIONAL — or giving it a `~max=<n>` round cap — is such an+ // explicit naming: nothing defaults to either suffix, so both are deliberate+ // choices, and dropping one would silently turn a non-blocking review blocking+ // or spend an unbudgeted number of rounds. `buildReviewWithArgs` makes the same+ // exemption for its lone-default suppression — keep the two in step.const taskPinnedReviewer = (Array.isArray(task.metadata?.reviewers) && task.metadata.reviewers.length > 0)|| (typeof task.metadata?.reviewer === 'string' && !!task.metadata.reviewer);const optionalDefaultReviewer = resolvedOptional.some(t => t.toLowerCase() === DEFAULT_REVIEWER);+ const cappedDefaultReviewer = Object.keys(resolvedMaxRounds)+ .some(t => t.toLowerCase() === DEFAULT_REVIEWER);const isBareDefault = resolvedReviewers.length === 1&& resolvedReviewers[0] === DEFAULT_REVIEWER&& !resolvedUsernames.length&& !taskPinnedReviewer- && !optionalDefaultReviewer;+ && !optionalDefaultReviewer+ && !cappedDefaultReviewer;const skipIncludes = isBareDefault? []: unreachableReviewerIncludes({ reviewers: resolvedReviewers, usernames: resolvedUsernames });@@ -415,7 +419,7 @@ async function applySlashdoInvocation(task, {: null;const reviewWith = skipIncludes.length- ? buildReviewersCsv(resolvedReviewers, resolvedUsernames, resolvedOptional)+ ? buildReviewersCsv(resolvedReviewers, resolvedUsernames, resolvedOptional, resolvedMaxRounds): '';const section = buildSlashdoSection(resolved, body, { bodyPath, reviewWith });return { ...task, description: `${task.description}\n\n${section}` };@@ -487,6 +491,9 @@ export function buildReviewLoopFollowUpSection(metadata = {}, { verbose = false,const reviewers = resolveKeyedReviewers(reviewerSource, usernames.length > 0);// Reviewer identities marked non-blocking — emitted with slashdo's `~opt`.const optionalReviewers = normalizeOptionalReviewers(metadata.reviewLoopOptionalReviewers) || [];+ // Per-reviewer `~max=<n>` iteration caps, keyed by emitted token. An absent key+ // leaves slashdo's built-in per-loop default; `0` means "loop until clean".+ const reviewerMaxRounds = normalizeReviewerMaxRounds(metadata.reviewLoopReviewerMaxRounds) || {};const stopMode = metadata.reviewLoopStopMode || DEFAULT_REVIEW_STOP_MODE;const reviewerApplies = metadata.reviewLoopReviewerApplies === true;const hasCopilot = reviewers.includes(DEFAULT_REVIEWER);@@ -539,7 +546,7 @@ export function buildReviewLoopFollowUpSection(metadata = {}, { verbose = false,...reviewers.map(r => `\`${r}\``),...usernames.map(u => `\`@${u}\``),].join(' → ');- const equivArgs = buildReviewWithArgs(reviewers, stopMode, reviewerApplies, usernames, optionalReviewers);+ const equivArgs = buildReviewWithArgs(reviewers, stopMode, reviewerApplies, usernames, optionalReviewers, reviewerMaxRounds);const equiv = equivArgs ? ` (equivalent to \`/do:pr ${equivArgs}\`)` : '';// First step: how to obtain a review. For a single copilot/CLI reviewer keep the@@ -615,7 +622,19 @@ Only a successfully extracted \`.findings\` value is the review text; treat it l'```','A `409` (`CHALLENGE_EXHAUSTED` = the one challenge is spent, or `CHALLENGE_BUDGET_EXHAUSTED` = the task is out of retry budget) means you can\'t dispute — then fix the finding or, if genuinely blocked, post a PR comment and stop. After filing, RE-CHECK: re-run the disputed reviewer (or another configured reviewer) against the current diff, then resolve — overturned → `POST .../challenge/resolve` with `{"outcome":"upheld"}` and continue to merge; confirmed → fix it, or send `{"outcome":"escalated"}` to hand the dispute to the user.' + (hasLocalLlm ? ' For a local reviewer you may instead POST `{"recheck":{"backend":"<lmstudio|ollama>","diff":"<unified diff>"}}` and let the server re-run it and auto-derive the outcome.' : ''),].join('\n');- const extraNotes = [stopModeNote, applyNote].filter(Boolean);+ // Per-reviewer round caps. This prompt drives the loop in PROSE (it isn't+ // slashdo parsing a `~max=<n>` suffix), so a configured cap only binds if it's+ // spelled out here — the `equiv` flag string alone documents intent without+ // constraining the agent. `0` is slashdo's "loop until clean", so it's rendered+ // as such rather than as a zero-round budget.+ const maxRoundsEntries = Object.entries(reviewerMaxRounds)+ .filter(([token]) => reviewers.includes(token) || usernames.some(u => `@${u}`.toLowerCase() === token.toLowerCase()))+ .map(([token, max]) => `\`${token}\` → ${max === 0 ? 'loop until clean (no cap)' : `${max} round${max === 1 ? '' : 's'}`}`);+ const maxRoundsNote = maxRoundsEntries.length+ ? `**Round caps (~max):** stop these reviewers after their budget even if findings remain, then advance: ${maxRoundsEntries.join(', ')}. Spending a configured budget is a SUCCESS, not a failure — do not block the merge on it. Reviewers not listed keep the default cap below.`+ : '';++ const extraNotes = [stopModeNote, applyNote, maxRoundsNote].filter(Boolean);// Inline slashdo's local-agent review loop verbatim when a spawnable CLI// reviewer is configured. This is the maintained, precise recipe — exact@@ -1162,6 +1181,7 @@ After completing your work and before committing, ${simplifyInstruction}. Fix anconst taskReviewers = normalizeReviewers(task.metadata, defaultReviewers);const taskReviewerUsernames = resolveReviewUsernames(task.metadata?.usernames, codeReviewDefaults?.usernames);const taskOptionalReviewers = resolveOptionalReviewers(task.metadata?.optionalReviewers, codeReviewDefaults?.optionalReviewers);+ const taskReviewerMaxRounds = resolveReviewerMaxRounds(task.metadata?.reviewerMaxRounds, codeReviewDefaults?.reviewerMaxRounds);const taskReviewStopMode = task.metadata?.reviewStopMode || codeReviewDefaults?.stopMode || DEFAULT_REVIEW_STOP_MODE;const taskReviewerApplies = task.metadata?.reviewerApplies !== undefined? isTruthyMetaFn(task.metadata?.reviewerApplies)@@ -1201,6 +1221,7 @@ After completing your work and before committing, ${simplifyInstruction}. Fix anreviewers: taskReviewers,usernames: taskReviewerUsernames,optionalReviewers: taskOptionalReviewers,+ reviewerMaxRounds: taskReviewerMaxRounds,reviewStopMode: taskReviewStopMode,reviewerApplies: taskReviewerApplies})@@ -1471,6 +1492,7 @@ function buildLightContextSections(task, workspaceDir, worktreeInfo, isTruthyMetconst lightReviewers = normalizeReviewers(task.metadata, defaultReviewers);const lightReviewerUsernames = resolveReviewUsernames(task.metadata?.usernames, codeReviewDefaults?.usernames);const lightOptionalReviewers = resolveOptionalReviewers(task.metadata?.optionalReviewers, codeReviewDefaults?.optionalReviewers);+ const lightReviewerMaxRounds = resolveReviewerMaxRounds(task.metadata?.reviewerMaxRounds, codeReviewDefaults?.reviewerMaxRounds);const lightReviewStopMode = task.metadata?.reviewStopMode || codeReviewDefaults?.stopMode || DEFAULT_REVIEW_STOP_MODE;const lightReviewerApplies = task.metadata?.reviewerApplies !== undefined? isTruthyMetaFn(task.metadata?.reviewerApplies)@@ -1589,10 +1611,10 @@ function buildLightContextSections(task, workspaceDir, worktreeInfo, isTruthyMetbranchName: worktreeInfo?.branchName || null,baseBranch: worktreeInfo?.baseBranch || null,leavePrOpen: leavesPrForHuman(task),- reviewers: lightReviewers, usernames: lightReviewerUsernames, optionalReviewers: lightOptionalReviewers, reviewStopMode: lightReviewStopMode, reviewerApplies: lightReviewerApplies+ reviewers: lightReviewers, usernames: lightReviewerUsernames, optionalReviewers: lightOptionalReviewers, reviewerMaxRounds: lightReviewerMaxRounds, reviewStopMode: lightReviewStopMode, reviewerApplies: lightReviewerApplies}));} else {- sections.push(buildCliCompletionSection({ worktreeInfo, willOpenPR, prCompletion, hasSlashdo, simplifyEnabled, leavePrOpen: leavesPrForHuman(task), reviewers: lightReviewers, usernames: lightReviewerUsernames, optionalReviewers: lightOptionalReviewers, reviewStopMode: lightReviewStopMode, reviewerApplies: lightReviewerApplies }));+ sections.push(buildCliCompletionSection({ worktreeInfo, willOpenPR, prCompletion, hasSlashdo, simplifyEnabled, leavePrOpen: leavesPrForHuman(task), reviewers: lightReviewers, usernames: lightReviewerUsernames, optionalReviewers: lightOptionalReviewers, reviewerMaxRounds: lightReviewerMaxRounds, reviewStopMode: lightReviewStopMode, reviewerApplies: lightReviewerApplies }));}return { taskSections, contractSections };@@ -1686,7 +1708,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 = [], 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 = {}, reviewStopMode = DEFAULT_REVIEW_STOP_MODE, reviewerApplies = false }) {const policyLeavesOpen = prCompletion === PR_COMPLETIONS.LEAVE_OPEN;const runsReviewLoop = prCompletion === PR_COMPLETIONS.REVIEW_THEN_MERGE;if (slashdoFree) {@@ -1701,7 +1723,7 @@ function buildTuiCompletionSection({ willOpenPR, prCompletion = PR_COMPLETIONS.M// when the task's Review Loop control is off so that default cannot start a// Copilot (or other external) review unexpectedly.const reviewArgs = willOpenPR- ? (runsReviewLoop ? buildReviewWithArgs(reviewers, reviewStopMode, reviewerApplies, reviewUsernames, optionalReviewers) : '--review-with none')+ ? (runsReviewLoop ? buildReviewWithArgs(reviewers, reviewStopMode, reviewerApplies, reviewUsernames, optionalReviewers, reviewerMaxRounds) : '--review-with none'): '';// A saved slashdo `merge: true` default would otherwise merge a PR that must// stay open — dropping our own merge steps isn't enough, `/do:pr` has to be@@ -1856,7 +1878,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 = [], 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 = {}, 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);@@ -1867,7 +1889,7 @@ function buildCliCompletionSection({ worktreeInfo, willOpenPR, prCompletion = PRlines.push(`${step++}. \`/simplify\` — review the changed code for reuse, quality, and efficiency, and fix any findings.`);}const reviewArgs = runsReviewLoop- ? buildReviewWithArgs(reviewers, reviewStopMode, reviewerApplies, reviewUsernames, optionalReviewers)+ ? buildReviewWithArgs(reviewers, reviewStopMode, reviewerApplies, reviewUsernames, optionalReviewers, reviewerMaxRounds): '--review-with none';// `--no-merge` overrides a saved slashdo `merge: true` default, which would// otherwise merge a PR this task must leave open (see lib/prDisposition.js).diff --git a/server/services/agentPromptBuilder.test.js b/server/services/agentPromptBuilder.test.jsindex 0651ff581c..24f6dde74e 100644--- a/server/services/agentPromptBuilder.test.js+++ b/server/services/agentPromptBuilder.test.js@@ -920,6 +920,33 @@ describe('buildLightContextPrompt', () => {expect(prompt).toMatch(/--review-with codex,ollama~opt,@alice --review-stop-on-findings --reviewer-applies/);});+ it('threads per-reviewer ~max caps from the Code Review Defaults into the inline /do:pr', () => {+ const codeReviewDefaults = {+ reviewers: ['codex', 'ollama'],+ optionalReviewers: ['ollama'],+ // `~opt` first, then `~max=<n>` — slashdo's canonical order.+ reviewerMaxRounds: { ollama: 1, codex: 2 },+ };+ const prompt = buildLightContextPrompt(+ makeTask({ metadata: { openPR: true, reviewLoop: true } }),+ '/r',+ { branchName: 'b', worktreePath: '/tmp/wt' },+ isTruthyMeta,+ { isTui: true, defaultReviewers: codeReviewDefaults.reviewers, codeReviewDefaults });+ expect(prompt).toMatch(/--review-with codex~max=2,ollama~opt~max=1/);+ });++ it('lets a task-level ~max cap map override the defaults', () => {+ const prompt = buildLightContextPrompt(+ makeTask({ metadata: { openPR: true, reviewLoop: true, reviewers: ['ollama'], reviewerMaxRounds: { ollama: 0 } } }),+ '/r',+ { branchName: 'b', worktreePath: '/tmp/wt' },+ isTruthyMeta,+ { isTui: true, defaultReviewers: ['ollama'], codeReviewDefaults: { reviewers: ['ollama'], reviewerMaxRounds: { ollama: 3 } } });+ // `0` = loop until clean, and it must not be mistaken for "no cap".+ expect(prompt).toMatch(/--review-with ollama~max=0/);+ });+it('does not leak default usernames/stop-mode/reviewer-applies when no Code Review Defaults are set', () => {// Same task, no `codeReviewDefaults` option → the lone-copilot default,// which suppresses `--review-with` entirely and emits none of the flags.@@ -993,6 +1020,49 @@ describe('buildLightContextPrompt', () => {expect(prompt).toMatch(/claude --model qwen2\.5:7b/);});+ it('spells out per-reviewer ~max round caps in the follow-up loop instructions', () => {+ const prompt = buildLightContextPrompt(+ makeTask({ metadata: {+ reviewLoopFollowUp: true,+ reviewLoopPRUrl: 'https://github.com/o/r/pull/9',+ reviewLoopPRBranch: 'b',+ reviewLoopPRNumber: 9,+ reviewLoopReviewers: ['codex', 'ollama'],+ // `bogus` isn't in the list, so it must not reach the prose.+ reviewLoopReviewerMaxRounds: { ollama: 1, codex: 0, copilot: 3 },+ sourceTaskId: 'task-src-max',+ }}),+ '/r',+ { branchName: 'b', worktreePath: '/tmp/wt' },+ isTruthyMeta);+ // This prompt drives the loop in prose, so the cap has to be stated —+ // the `equiv` flag string alone wouldn't bind the agent.+ expect(prompt).toMatch(/Round caps \(~max\)/);+ expect(prompt).toMatch(/`ollama` → 1 round/);+ // 0 renders as unlimited, not as a zero-round budget.+ expect(prompt).toMatch(/`codex` → loop until clean/);+ expect(prompt).not.toMatch(/`copilot` →/);+ // And the equivalent flag string carries the same suffixes.+ expect(prompt).toMatch(/--review-with codex~max=0,ollama~max=1/);+ });++ it('omits the round-caps note when no cap is configured', () => {+ const prompt = buildLightContextPrompt(+ makeTask({ metadata: {+ reviewLoopFollowUp: true,+ reviewLoopPRUrl: 'https://github.com/o/r/pull/9',+ reviewLoopPRBranch: 'b',+ reviewLoopPRNumber: 9,+ reviewLoopReviewers: ['codex', 'ollama'],+ sourceTaskId: 'task-src-nomax',+ }}),+ '/r',+ { branchName: 'b', worktreePath: '/tmp/wt' },+ isTruthyMeta);+ expect(prompt).not.toMatch(/Round caps \(~max\)/);+ expect(prompt).toMatch(/--review-with codex,ollama/);+ });+it('threads a configured claude model (Ollama-backed reviewer) via the map', () => {const prompt = buildLightContextPrompt(makeTask({ metadata: {diff --git a/server/services/agentWorktreeCleanup.js b/server/services/agentWorktreeCleanup.jsindex 95d3400e10..7a9d20a864 100644--- a/server/services/agentWorktreeCleanup.js+++ b/server/services/agentWorktreeCleanup.js@@ -24,7 +24,7 @@ import { PATHS } from '../lib/fileUtils.js';import { 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_CAPABLE_CLI_REVIEWERS, normalizeReviewers, normalizeReviewUsernames, normalizeOptionalReviewers } from '../lib/validation.js';+import { DEFAULT_REVIEWER, DEFAULT_REVIEWERS, DEFAULT_REVIEW_STOP_MODE, MODEL_CAPABLE_CLI_REVIEWERS, normalizeReviewers, normalizeReviewUsernames, normalizeOptionalReviewers, normalizeReviewerMaxRounds } from '../lib/validation.js';/*** Clean up a worktree for a completed agent.@@ -43,7 +43,7 @@ import { DEFAULT_REVIEWER, DEFAULT_REVIEWERS, DEFAULT_REVIEW_STOP_MODE, MODEL_CA* the worktree branch into the source workspace because `gh pr merge` already handled it.* Otherwise, merges the worktree branch back to the source branch on success.*/-export async function cleanupAgentWorktree(agentId, success, { openPR = false, prCompletion = null, requestCopilotReview: legacyRequestCopilotReview = false, reviewers = DEFAULT_REVIEWERS, usernames = [], optionalReviewers = [], reviewStopMode = DEFAULT_REVIEW_STOP_MODE, reviewerApplies = false, reviewerModels = null, skipMerge = false, description = null, agentOutput = null, originalTask = null } = {}) {+export async function cleanupAgentWorktree(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 } = {}) {const { getAgent: getAgentState } = await import('./cos.js');const agentState = await getAgentState(agentId).catch(() => null);if (!agentState?.metadata?.isWorktree) return [];@@ -230,6 +230,7 @@ export async function cleanupAgentWorktree(agentId, success, { openPR = false, previewers: runsReviewLoop ? reviewerList : [],usernames: runsReviewLoop ? usernames : [],optionalReviewers: runsReviewLoop ? optionalReviewers : [],+ reviewerMaxRounds: runsReviewLoop ? reviewerMaxRounds : {},reviewStopMode,reviewerApplies,reviewerModels,@@ -295,7 +296,7 @@ export async function cleanupAgentWorktree(agentId, success, { openPR = false, p* 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 = [], 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, leaveOpen = false }) {if (!prUrl || !prBranch) return null;if (prCompletion === PR_COMPLETIONS.LEAVE_OPEN) return null;@@ -318,6 +319,11 @@ export async function spawnReviewLoopFollowUp({ originalAgentId, originalTask, p// Non-blocking (`~opt`) marker set — forge-agnostic, threaded verbatim so the// follow-up's `--review-with` marks the same reviewers optional.const effectiveOptionalReviewers = normalizeOptionalReviewers(optionalReviewers) || [];+ // Per-reviewer iteration caps (`~max=<n>`) — forge-agnostic, threaded verbatim+ // so the follow-up's `--review-with` carries the same budgets. Entries for+ // reviewers that were stripped are inert (the emitter only marks tokens it+ // actually emits), so no narrowing is needed here.+ const effectiveReviewerMaxRounds = normalizeReviewerMaxRounds(reviewerMaxRounds) || {};// Merge-on-green deliberately skips every reviewer. A legacy review loop// whose GitHub-only reviewer vanishes on another forge retains its prior// merge-only fallback instead of leaving an orphaned PR.@@ -405,6 +411,10 @@ export async function spawnReviewLoopFollowUp({ originalAgentId, originalTask, p// and gates the merge on (appended to `--review-with` as `@user`).reviewLoopReviewerUsernames: effectiveUsernames,reviewLoopOptionalReviewers: effectiveOptionalReviewers,+ // Per-reviewer `~max=<n>` caps, keyed by emitted token. Empty object = no+ // caps (leaves slashdo's per-loop built-in default in place); an absent key+ // is NOT `0`, which slashdo reads as "loop until clean".+ reviewLoopReviewerMaxRounds: effectiveReviewerMaxRounds,reviewLoopStopMode: reviewStopMode,reviewLoopReviewerApplies: reviewerApplies,// Empty → null so the prompt builder's "no models configured" path is unambiguous.diff --git a/server/services/cleanupAgentWorktree.test.js b/server/services/cleanupAgentWorktree.test.jsindex 5bc0b39841..178cf18b4a 100644--- a/server/services/cleanupAgentWorktree.test.js+++ b/server/services/cleanupAgentWorktree.test.js@@ -759,6 +759,40 @@ describe('cleanupAgentWorktree - openPR path', () => {expect(followUp.metadata.reviewLoopCodexModel).toBe('gpt-5.6-sol');});+ it('threads per-reviewer ~max round caps into the follow-up metadata', async () => {+ git.push.mockResolvedValue(undefined);+ git.createPR.mockResolvedValue({ success: true, url: 'https://github.com/test/repo/pull/61' });+ git.requestCopilotReview.mockResolvedValue({ success: true });+ addTask.mockResolvedValue({ id: 'sys-rl-max' });++ await cleanupAgentWorktree('agent-1', true, {+ openPR: true, requestCopilotReview: true, reviewers: ['copilot', 'ollama'],+ // `nope` is not a reviewer and `codex: -1` is not a cap — both dropped.+ // An explicit 0 (loop until clean) survives.+ reviewerMaxRounds: { ollama: 1, copilot: 0, nope: 2, codex: -1 },+ description: 'Build',+ originalTask: { id: 'task-orig', priority: 'MEDIUM', metadata: { app: 'sparsetree' }, description: 'Build' }+ });++ const [followUp] = addTask.mock.calls[0];+ expect(followUp.metadata.reviewLoopReviewerMaxRounds).toEqual({ ollama: 1, copilot: 0 });+ });++ it('drops the ~max caps when the run has no review loop', async () => {+ git.push.mockResolvedValue(undefined);+ git.createPR.mockResolvedValue({ success: true, url: 'https://github.com/test/repo/pull/62' });+ addTask.mockResolvedValue({ id: 'sys-rl-nomax' });++ await cleanupAgentWorktree('agent-1', true, {+ openPR: true, prCompletion: 'merge-on-green', reviewers: ['copilot', 'ollama'],+ reviewerMaxRounds: { ollama: 1 }, description: 'Build',+ originalTask: { id: 'task-orig', priority: 'MEDIUM', metadata: { app: 'sparsetree' }, description: 'Build' }+ });++ const [followUp] = addTask.mock.calls[0];+ expect(followUp.metadata.reviewLoopReviewerMaxRounds).toEqual({});+ });+it('threads the claude model when claude is among the reviewers (Ollama-backed reviewer)', async () => {git.push.mockResolvedValue(undefined);git.createPR.mockResolvedValue({ success: true, url: 'https://github.com/test/repo/pull/60' });diff --git a/server/services/codeReview.js b/server/services/codeReview.jsindex 463ad038dc..1b2bbb43a0 100644--- a/server/services/codeReview.js+++ b/server/services/codeReview.js@@ -26,6 +26,8 @@ import {normalizeOptionalReviewers,resolveReviewUsernames,resolveOptionalReviewers,+ normalizeReviewerMaxRounds,+ resolveReviewerMaxRounds,} from '../lib/validation.js'import { getSettings, settingsEvents } from './settings.js'import { getBaseUrl as getLmStudioBaseUrl } from './lmStudioManager.js'@@ -68,6 +70,11 @@ export function pickCodeReviewDefaults(settings) {// Reviewer identities marked non-blocking (`~opt`). Normalized so a// hand-edited settings.json can't smuggle in junk. Empty = none optional.optionalReviewers: normalizeOptionalReviewers(raw?.optionalReviewers) || [],+ // Per-reviewer iteration caps (`~max=<n>`) keyed by emitted `--review-with`+ // token. Normalized so a hand-edited settings.json can't smuggle in a+ // non-integer or unbounded budget. Empty object = no caps configured; an+ // absent key is NOT `0` (which slashdo reads as "loop until clean").+ reviewerMaxRounds: normalizeReviewerMaxRounds(raw?.reviewerMaxRounds) || {},stopMode: REVIEW_STOP_MODES.includes(raw?.stopMode) ? raw.stopMode : DEFAULT_REVIEW_STOP_MODE,reviewerApplies: raw?.reviewerApplies === true,lmstudioModel: typeof raw?.lmstudioModel === 'string' && raw.lmstudioModel ? raw.lmstudioModel : null,@@ -130,6 +137,8 @@ export async function resolveReviewLoopOptions(metadata, { normalize, isTruthyMeconst usernames = resolveReviewUsernames(metadata?.usernames, defaults?.usernames)// Optional (non-blocking, `~opt`) reviewers: same task-over-default precedence.const optionalReviewers = resolveOptionalReviewers(metadata?.optionalReviewers, defaults?.optionalReviewers)+ // Per-reviewer iteration caps (`~max=<n>`): same task-over-default precedence.+ const reviewerMaxRounds = resolveReviewerMaxRounds(metadata?.reviewerMaxRounds, defaults?.reviewerMaxRounds)const reviewStopMode = metadata?.reviewStopMode || defaults?.stopMode || DEFAULT_REVIEW_STOP_MODEconst reviewerApplies = metadata?.reviewerApplies !== undefined? isTruthyMeta(metadata?.reviewerApplies)@@ -142,7 +151,7 @@ export async function resolveReviewLoopOptions(metadata, { normalize, isTruthyMeconst model = defaults?.[`${r}Model`]if (model) reviewerModels[r] = model}- return { reviewers, usernames, optionalReviewers, reviewStopMode, reviewerApplies, reviewerModels }+ return { reviewers, usernames, optionalReviewers, reviewerMaxRounds, reviewStopMode, reviewerApplies, reviewerModels }}const CODE_REVIEW_SYSTEM_PROMPT = `You are a careful senior code reviewer. The user will paste a unified PR diff. Review only what the diff changes (not the whole repo). Produce findings as a markdown list grouped by severity:diff --git a/server/services/codeReview.test.js b/server/services/codeReview.test.jsindex 08f6098f96..12c8724182 100644--- a/server/services/codeReview.test.js+++ b/server/services/codeReview.test.js@@ -58,6 +58,7 @@ describe('codeReview helpers', () => {reviewers: ['copilot'],usernames: [],optionalReviewers: [],+ reviewerMaxRounds: {},stopMode: 'all',reviewerApplies: false,lmstudioModel: null,@@ -69,6 +70,7 @@ describe('codeReview helpers', () => {reviewers: ['copilot'],usernames: [],optionalReviewers: [],+ reviewerMaxRounds: {},stopMode: 'all',reviewerApplies: false,lmstudioModel: null,@@ -117,6 +119,7 @@ describe('codeReview helpers', () => {codeReview: {reviewers: ['codex', 'lmstudio'],optionalReviewers: ['lmstudio', 'bogus'],+ reviewerMaxRounds: { lmstudio: 1, codex: 0, bogus: 2, ollama: -1 },stopMode: 'on-clean',reviewerApplies: true,lmstudioModel: 'qwen2.5-coder:7b',@@ -130,6 +133,9 @@ describe('codeReview helpers', () => {usernames: [],// 'bogus' is dropped (not a known reviewer); 'lmstudio' survives.optionalReviewers: ['lmstudio'],+ // 'bogus' (unknown token) and ollama's negative cap are dropped; an+ // explicit 0 survives as "loop until clean".+ reviewerMaxRounds: { lmstudio: 1, codex: 0 },stopMode: 'on-clean',reviewerApplies: true,lmstudioModel: 'qwen2.5-coder:7b',@@ -192,6 +198,21 @@ describe('codeReview helpers', () => {// ollama's model is injected server-side by /api/code-review/local, never threaded here.expect(out.reviewerModels).toEqual({})})++ it('inherits the defaults\' ~max round caps when the task pinned none', async () => {+ mockedSettings.current = { codeReview: { reviewers: ['ollama'], reviewerMaxRounds: { ollama: 1 } } }+ const out = await resolveReviewLoopOptions({}, testDeps)+ expect(out.reviewerMaxRounds).toEqual({ ollama: 1 })+ })++ it('lets a task-level cap map (including an explicitly empty one) override the defaults', async () => {+ mockedSettings.current = { codeReview: { reviewers: ['ollama'], reviewerMaxRounds: { ollama: 1 } } }+ const pinned = await resolveReviewLoopOptions({ reviewerMaxRounds: { ollama: 3 } }, testDeps)+ expect(pinned.reviewerMaxRounds).toEqual({ ollama: 3 })+ // An explicitly empty map is a real "no caps for this task" choice.+ const cleared = await resolveReviewLoopOptions({ reviewerMaxRounds: {} }, testDeps)+ expect(cleared.reviewerMaxRounds).toEqual({})+ })})describe('runLocalCodeReview', () => {diff --git a/server/services/cosTaskGenerator.js b/server/services/cosTaskGenerator.jsindex 5d9adc2af7..46c7686b1d 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, buildReviewersCsv, LOCAL_LLM_REVIEWERS, SWARM_COUNT_MIN } from '../lib/validation.js';+import { sanitizeTaskMetadata, PIPELINE_BEHAVIOR_FLAGS, MAX_TOTAL_SPAWNS, normalizeReviewers, resolveReviewUsernames, resolveOptionalReviewers, resolveReviewerMaxRounds, buildReviewersCsv, LOCAL_LLM_REVIEWERS, SWARM_COUNT_MIN } from '../lib/validation.js';import { parsePlanItems, extractAllIds, findInProgressIds, pickFirstAvailable, diagnoseUnpickablePlan } from '../lib/planIds.js';import { loadState, saveState, withStateLock, isImprovementEnabled, isDaemonRunning } from './cosState.js';import { getDomainMode } from '../lib/domainAutonomy.js';@@ -329,7 +329,7 @@ export function resolveClaimAuthorFilter(explicit, metadata) {** @returns {Promise<{ tracker, source, promptTaskType, prompt, taskMetadata, target }>}*/-export async function buildClaimWorkTask(app, { issueAuthorFilter, reviewers, usernames, optionalReviewers, target } = {}) {+export async function buildClaimWorkTask(app, { issueAuthorFilter, reviewers, usernames, optionalReviewers, reviewerMaxRounds, target } = {}) {const { resolveAppWorkTracker, trackerToClaimTaskType } = await import('../lib/workTracker.js');const { getTaskPrompt } = await import('./taskPromptService.js');const taskSchedule = await import('./taskSchedule.js');@@ -367,7 +367,10 @@ export async function buildClaimWorkTask(app, { issueAuthorFilter, reviewers, us// explicit option wins, then a task-level list, then the Code Review Defaults.const promptUsernames = resolveReviewUsernames(usernames ?? metadata.usernames, codeReviewDefaults?.usernames);const promptOptionalReviewers = resolveOptionalReviewers(optionalReviewers ?? metadata.optionalReviewers, codeReviewDefaults?.optionalReviewers);- const reviewersCsv = buildReviewersCsv(reviewersList, promptUsernames, promptOptionalReviewers);+ // Per-reviewer `~max=<n>` round caps ride the same explicit-option → task+ // metadata → Code Review Defaults precedence.+ const promptReviewerMaxRounds = resolveReviewerMaxRounds(reviewerMaxRounds ?? metadata.reviewerMaxRounds, codeReviewDefaults?.reviewerMaxRounds);+ const reviewersCsv = buildReviewersCsv(reviewersList, promptUsernames, promptOptionalReviewers, promptReviewerMaxRounds);const issueAuthorFilterBlock = resolveIssueAuthorFilterBlock(promptTaskType, resolvedAuthorFilter);// Swarm mode (`/do:next --swarm`) is prepended (not an in-template// placeholder) so it stays an opt-in orchestration wrapper that needs no@@ -410,8 +413,9 @@ async function resolveClaimReviewersCsv() {.filter((r) => !LOCAL_LLM_REVIEWERS.includes(r));// Arbitrary GitHub reviewer usernames from the Code Review Defaults, appended// 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.- return buildReviewersCsv(list, codeReviewDefaults?.usernames, codeReviewDefaults?.optionalReviewers);+ // 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);}/**@@ -2200,7 +2204,8 @@ async function buildImprovementTaskDescription({ promptTemplate, app, promptTask// list overrides the Code Review Defaults; forge-agnostic, so not filtered.const promptUsernames = resolveReviewUsernames(metadata.usernames, codeReviewDefaults?.usernames);const promptOptionalReviewers = resolveOptionalReviewers(metadata.optionalReviewers, codeReviewDefaults?.optionalReviewers);- const reviewersCsv = buildReviewersCsv(promptReviewers, promptUsernames, promptOptionalReviewers);+ const promptReviewerMaxRounds = resolveReviewerMaxRounds(metadata.reviewerMaxRounds, codeReviewDefaults?.reviewerMaxRounds);+ const reviewersCsv = buildReviewersCsv(promptReviewers, promptUsernames, promptOptionalReviewers, promptReviewerMaxRounds);// {issueAuthorFilter} directive — the filter was already merged (global →// per-app override) and value-constrained by sanitizeTaskMetadata, so read it// from `metadata` (default 'self', the slashdo `/do:next --self` securitydiff --git a/server/services/cosTaskGenerator.test.js b/server/services/cosTaskGenerator.test.jsindex e7ee0973c1..8d5a2a7934 100644--- a/server/services/cosTaskGenerator.test.js+++ b/server/services/cosTaskGenerator.test.js@@ -166,7 +166,17 @@ describe('{reviewers} interpolation honors Code Review Defaults', () => {// into buildReviewersCsv, which owns the fallback to the hardcoded copilot// default when the filter empties the list (unit-tested in validation.test.js).expect(GEN_SRC).toContain('.filter((r) => !LOCAL_LLM_REVIEWERS.includes(r))');- expect(GEN_SRC).toContain('buildReviewersCsv(promptReviewers, promptUsernames, promptOptionalReviewers)');+ expect(GEN_SRC).toContain('buildReviewersCsv(promptReviewers, promptUsernames, promptOptionalReviewers, promptReviewerMaxRounds)');+ });++ it('threads per-reviewer ~max round caps into the prompt CSV on both claim paths', () => {+ // The `{reviewers}` token IS the flag string for the claim flows, so a+ // configured cap only reaches slashdo if the CSV carries it. Both the+ // scheduled path and buildClaimWorkTask resolve it with task-over-default+ // precedence (unit-tested in validation.test.js).+ expect(GEN_SRC).toContain('resolveReviewerMaxRounds(metadata.reviewerMaxRounds, codeReviewDefaults?.reviewerMaxRounds)');+ expect(GEN_SRC).toContain('resolveReviewerMaxRounds(reviewerMaxRounds ?? metadata.reviewerMaxRounds, codeReviewDefaults?.reviewerMaxRounds)');+ expect(GEN_SRC).toContain('buildReviewersCsv(reviewersList, promptUsernames, promptOptionalReviewers, promptReviewerMaxRounds)');});});diff --git a/server/services/cosTaskStore.js b/server/services/cosTaskStore.jsindex a162a717ce..1434c5c55f 100644--- a/server/services/cosTaskStore.js+++ b/server/services/cosTaskStore.js@@ -16,7 +16,7 @@ import { readFile, writeFile } 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 } from '../lib/validation.js';+import { REVIEW_STOP_MODES, normalizeReviewers, normalizeReviewUsernames, normalizeOptionalReviewers, normalizeReviewerMaxRounds } from '../lib/validation.js';import { PR_COMPLETIONS, PR_COMPLETION_VALUES } from '../lib/prDisposition.js';import { loadState, withStateLock, ROOT_DIR } from './cosState.js';import { cosEvents } from './cosEvents.js';@@ -301,6 +301,21 @@ export async function addTask(taskData, taskType = 'user', { raw = false, ignoreif (Array.isArray(taskData.usernames)) {metadata.usernames = normalizeReviewUsernames(taskData.usernames);}+ // Non-blocking (`~opt`) reviewer set. Same explicit-empty semantics as+ // `usernames`: an empty array is a real "none optional for this task" choice+ // that must override the Code Review Defaults. Previously validated by+ // createCosTaskSchema but never persisted here, so the task form's `~opt`+ // badges silently fell back to the defaults on every task.+ if (Array.isArray(taskData.optionalReviewers)) {+ metadata.optionalReviewers = normalizeOptionalReviewers(taskData.optionalReviewers) || [];+ }+ // Per-reviewer `~max=<n>` iteration caps, keyed by emitted `--review-with`+ // token. An explicitly empty MAP overrides the Code Review Defaults' caps;+ // an entry with no usable cap is dropped rather than coerced to `0`, which+ // slashdo reads as "loop until clean" (absent ≠ 0).+ if (taskData.reviewerMaxRounds && typeof taskData.reviewerMaxRounds === 'object' && !Array.isArray(taskData.reviewerMaxRounds)) {+ metadata.reviewerMaxRounds = normalizeReviewerMaxRounds(taskData.reviewerMaxRounds) || {};+ }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;diff --git a/server/services/prWatcher.js b/server/services/prWatcher.jsindex df003ea374..2de930e231 100644--- a/server/services/prWatcher.js+++ b/server/services/prWatcher.js@@ -329,7 +329,8 @@ export async function processPendingMergePrs(app) {prCompletion: PR_COMPLETIONS.MERGE_ON_GREEN,reviewers: [],usernames: [],- optionalReviewers: []+ optionalReviewers: [],+ reviewerMaxRounds: {}});outcomes.set(key, null);result.escalated += 1;