Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

add optional (non-blocking) reviewers: emit slashdo ~opt from the reviewer-config UI

[._.]/ Adam Eivy1f0ff5b75a8d
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index fbe594cf5e..ce78f7ad4b 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -2,6 +2,8 @@
## Changes
+- **Code reviewers can now be marked non-blocking, so a flaky local reviewer no longer strands your PRs.** Each reviewer chip in the Code Review Defaults panel, the task form, and the per-task-type schedule config gains a `~opt` toggle. A reviewer marked non-blocking still runs and still has its findings fixed, but its *inconclusive* verdict (timeout / no result / partial review) is excluded from the merge gate — it no longer flips the aggregate to `inconclusive`, so a saved `--merge` proceeds. A hard failure (broken build / failed tests) from it still blocks. This is the answer to a valuable-but-flaky reviewer like a local Ollama model that frequently returns no verdict and would otherwise block every auto-merge. Under the hood the setting is a new `optionalReviewers` list (additive, no migration) threaded through the CoS reviewer config into slashdo's new `--review-with …~opt` suffix (requires the bundled slashdo submodule bump in this release). GitHub `@username` reviewers can be marked non-blocking too.
+
- **The Claude reviewer now takes an optional model, including an Ollama-backed Claude for local-only setups (#2377).** Code Review Defaults gains a **Claude model** field alongside the existing Codex one: pick a Claude tier, or — if you run `claude` pointed at a local Ollama daemon — type or pick one of your installed Ollama models, and the Review Loop invokes the reviewer as `claude --model <id>`. Under the hood the codex-only model threading is generalized into a reviewer-keyed model map, so any CLI reviewer that supports `--model` (today: Codex and Claude) threads its configured model through the review-loop follow-up with a single code path instead of a per-reviewer special case. Older in-flight review tasks that stored only the legacy Codex tier still work unchanged.
- **The MIDI transcription button now shows a distinct "Downloading model…" phase with a toast, instead of an opaque multi-minute spinner.** MuScriptor auto-downloads its (gated, multi-hundred-MB) weights from HuggingFace on first use, but the sidecar reported that first-run download as the same generic `load-model` stage as a fast cached load — so the Transcribe MIDI / MIDI buttons just sat in an animation state with no explanation for minutes. `transcribe_muscriptor.py` now peeks at the HF hub cache and emits a separate `download-model` STAGE only when a download is actually about to happen; the shared `useMidiTranscription` hook maps it to a "Downloading model…" label (now exposed as a ready-to-render `stageLabel` both the Rounds and Music Video surfaces use — the Music Video button previously showed only a static "MIDI · Cancel" with no progress) and fires a one-time toast ("Downloading the MuScriptor model — first use only, this can take a few minutes.") when the download begins. Cache detection is best-effort — a wrong guess only mislabels the stage, never fails the transcription.
diff --git a/client/src/components/cos/ReviewerPicker.jsx b/client/src/components/cos/ReviewerPicker.jsx
index c3f8549907..efb30614b4 100644
--- a/client/src/components/cos/ReviewerPicker.jsx
+++ b/client/src/components/cos/ReviewerPicker.jsx
@@ -28,6 +28,7 @@ const normalizeReviewerValue = (value) => value === 'gemini' ? 'antigravity' : v
export default function ReviewerPicker({
reviewers = [],
usernames = [],
+ optionalReviewers = [],
stopMode = DEFAULT_REVIEW_STOP_MODE,
reviewerApplies = false,
onChange,
@@ -46,15 +47,47 @@ export default function ReviewerPicker({
const hasNonCopilot = selected.some(r => r !== 'copilot');
const selectedUsernames = normalizeReviewUsernames(usernames);
const atMaxUsernames = selectedUsernames.length >= MAX_REVIEW_USERNAMES;
+ // Optional (non-blocking) reviewers — emitted with slashdo's `~opt` suffix.
+ // Each token mirrors an emitted `--review-with` token: a keyed slug or `@user`,
+ // so membership is a plain lookup (server `normalizeOptionalReviewers` owns the
+ // authoritative shape; this is the display mirror).
+ const optionalTokens = Array.isArray(optionalReviewers) ? [...new Set(optionalReviewers.map(String))] : [];
+ 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());
const emit = (next) => onChange?.({
reviewers: selected,
usernames: selectedUsernames,
+ optionalReviewers: optionalTokens,
stopMode,
reviewerApplies,
...next
});
+ const toggleOptional = (token) => emit({
+ optionalReviewers: isOptional(token) ? withoutToken(token) : [...optionalTokens, token]
+ });
+
+ // 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.
+ const renderOptToggle = (token, subject, title) => (
+ <button
+ type="button"
+ disabled={disabled}
+ onClick={() => toggleOptional(token)}
+ title={title}
+ className={`text-[10px] font-mono leading-none px-1 py-0.5 rounded border ${isOptional(token)
+ ? 'text-port-warning border-port-warning/50 bg-port-warning/10'
+ : 'text-gray-600 border-transparent hover:text-gray-300 hover:border-port-border'} disabled:opacity-40`}
+ aria-pressed={isOptional(token)}
+ aria-label={isOptional(token) ? `Make ${subject} blocking` : `Make ${subject} non-blocking`}
+ >
+ ~opt
+ </button>
+ );
+
const addUsername = () => {
const clean = cleanReviewUsername(usernameInput);
if (!clean) {
@@ -74,10 +107,16 @@ export default function ReviewerPicker({
setUsernameInput('');
setUsernameError('');
};
- const removeUsername = (value) => emit({ usernames: selectedUsernames.filter(u => u !== value) });
+ const removeUsername = (value) => emit({
+ usernames: selectedUsernames.filter(u => u !== value),
+ optionalReviewers: withoutToken(`@${value}`)
+ });
const add = (value) => emit({ reviewers: [...selected, value] });
- const remove = (value) => emit({ reviewers: selected.filter(r => r !== value) });
+ const remove = (value) => emit({
+ reviewers: selected.filter(r => r !== value),
+ optionalReviewers: withoutToken(value)
+ });
const move = (index, delta) => {
const target = index + delta;
if (target < 0 || target >= selected.length) return;
@@ -116,6 +155,9 @@ export default function ReviewerPicker({
>
<ChevronDown size={12} />
</button>
+ {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).`)}
<button
type="button"
disabled={disabled}
@@ -132,6 +174,12 @@ export default function ReviewerPicker({
)}
</div>
+ {(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.
+ </span>
+ )}
+
{available.length > 0 && (
<div className="flex flex-wrap items-center gap-1.5">
<span className="text-xs text-gray-600 mr-1">Add:</span>
@@ -164,6 +212,9 @@ export default function ReviewerPicker({
>
<span className="text-port-accent font-mono">@</span>
{value}
+ {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.`)}
<button
type="button"
disabled={disabled}
diff --git a/client/src/components/cos/ReviewerPicker.test.jsx b/client/src/components/cos/ReviewerPicker.test.jsx
index 66072a7a32..e0519cb09a 100644
--- a/client/src/components/cos/ReviewerPicker.test.jsx
+++ b/client/src/components/cos/ReviewerPicker.test.jsx
@@ -111,4 +111,36 @@ describe('ReviewerPicker', () => {
await user.click(screen.getByLabelText('Remove @CodeReviewbot'));
expect(onChange).toHaveBeenCalledWith(expect.objectContaining({ usernames: ['other-bot'] }));
});
+
+ it('toggles a keyed reviewer non-blocking (adds its slug to optionalReviewers)', async () => {
+ const onChange = vi.fn();
+ const user = userEvent.setup();
+ render(<ReviewerPicker reviewers={['codex', 'ollama']} onChange={onChange} />);
+ await user.click(screen.getByLabelText('Make Ollama non-blocking'));
+ expect(onChange).toHaveBeenCalledWith(expect.objectContaining({ optionalReviewers: ['ollama'] }));
+ });
+
+ it('toggles a non-blocking reviewer back to blocking (removes it)', async () => {
+ const onChange = vi.fn();
+ const user = userEvent.setup();
+ render(<ReviewerPicker reviewers={['codex', 'ollama']} optionalReviewers={['ollama']} onChange={onChange} />);
+ await user.click(screen.getByLabelText('Make Ollama blocking'));
+ expect(onChange).toHaveBeenCalledWith(expect.objectContaining({ optionalReviewers: [] }));
+ });
+
+ it('marks a GitHub reviewer username non-blocking with the @-form token', async () => {
+ const onChange = vi.fn();
+ const user = userEvent.setup();
+ render(<ReviewerPicker reviewers={['copilot']} usernames={['flaky-bot']} onChange={onChange} />);
+ await user.click(screen.getByLabelText('Make @flaky-bot non-blocking'));
+ expect(onChange).toHaveBeenCalledWith(expect.objectContaining({ optionalReviewers: ['@flaky-bot'] }));
+ });
+
+ it('prunes the optional token when its reviewer is removed', async () => {
+ const onChange = vi.fn();
+ const user = userEvent.setup();
+ render(<ReviewerPicker reviewers={['codex', 'ollama']} optionalReviewers={['ollama']} onChange={onChange} />);
+ await user.click(screen.getByLabelText('Remove Ollama'));
+ expect(onChange).toHaveBeenCalledWith(expect.objectContaining({ reviewers: ['codex'], optionalReviewers: [] }));
+ });
});
diff --git a/client/src/components/cos/TaskAddForm.jsx b/client/src/components/cos/TaskAddForm.jsx
index b8c7e220c9..5fc88d732e 100644
--- a/client/src/components/cos/TaskAddForm.jsx
+++ b/client/src/components/cos/TaskAddForm.jsx
@@ -27,6 +27,7 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = fa
const [reviewLoop, setReviewLoop] = useState(false);
const [reviewers, setReviewers] = useState(DEFAULT_REVIEWERS);
const [reviewUsernames, setReviewUsernames] = useState([]);
+ const [optionalReviewers, setOptionalReviewers] = useState([]);
const [reviewStopMode, setReviewStopMode] = useState(DEFAULT_REVIEW_STOP_MODE);
const [reviewerApplies, setReviewerApplies] = useState(false);
const [createJiraTicket, setCreateJiraTicket] = useState(false);
@@ -63,6 +64,7 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = fa
if (cancelled || !d) return;
if (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.stopMode) setReviewStopMode(d.stopMode);
if (d.reviewerApplies === true) setReviewerApplies(true);
})
@@ -266,6 +268,7 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = fa
reviewLoop,
reviewers: reviewLoop ? reviewers : undefined,
usernames: reviewLoop ? reviewUsernames : undefined,
+ optionalReviewers: reviewLoop ? optionalReviewers : undefined,
reviewStopMode: reviewLoop ? reviewStopMode : undefined,
reviewerApplies: reviewLoop ? reviewerApplies : undefined,
screenshots: screenshots.length > 0 ? screenshots.map(s => s.path) : undefined,
@@ -508,11 +511,13 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = fa
<ReviewerPicker
reviewers={reviewers}
usernames={reviewUsernames}
+ optionalReviewers={optionalReviewers}
stopMode={reviewStopMode}
reviewerApplies={reviewerApplies}
- onChange={({ reviewers: r, usernames: u, stopMode, reviewerApplies: ra }) => {
+ onChange={({ reviewers: r, usernames: u, optionalReviewers: o, stopMode, reviewerApplies: ra }) => {
setReviewers(r);
setReviewUsernames(u);
+ setOptionalReviewers(o);
setReviewStopMode(stopMode);
setReviewerApplies(ra);
}}
diff --git a/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx b/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx
index 6a9c1cd33a..7623a097b4 100644
--- a/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx
+++ b/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx
@@ -413,16 +413,17 @@ export default function GlobalConfigControls({ taskType, config, onUpdate, onTri
<ReviewerPicker
reviewers={config.taskMetadata?.reviewers ?? (config.taskMetadata?.reviewer ? [config.taskMetadata.reviewer] : reviewDefaults.reviewers)}
usernames={config.taskMetadata?.usernames ?? reviewDefaults.usernames}
+ optionalReviewers={config.taskMetadata?.optionalReviewers ?? reviewDefaults.optionalReviewers}
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, stopMode, reviewerApplies }) => {
+ onChange={({ reviewers, usernames, optionalReviewers, 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, reviewStopMode: stopMode, reviewerApplies }
+ taskMetadata: { ...rest, reviewers, usernames, optionalReviewers, reviewStopMode: stopMode, reviewerApplies }
});
}}
/>
diff --git a/client/src/components/providers/CodeReviewDefaultsPanel.jsx b/client/src/components/providers/CodeReviewDefaultsPanel.jsx
index c1cd0f7183..47699c0d4b 100644
--- a/client/src/components/providers/CodeReviewDefaultsPanel.jsx
+++ b/client/src/components/providers/CodeReviewDefaultsPanel.jsx
@@ -27,6 +27,7 @@ export default function CodeReviewDefaultsPanel() {
const [saving, setSaving] = useState(false);
const [reviewers, setReviewers] = useState(DEFAULT_REVIEWERS);
const [usernames, setUsernames] = useState([]);
+ const [optionalReviewers, setOptionalReviewers] = useState([]);
const [stopMode, setStopMode] = useState(DEFAULT_REVIEW_STOP_MODE);
const [reviewerApplies, setReviewerApplies] = useState(false);
const [lmstudioModel, setLmstudioModel] = useState('');
@@ -48,6 +49,7 @@ export default function CodeReviewDefaultsPanel() {
if (defaults) {
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 : []);
setStopMode(defaults.stopMode || DEFAULT_REVIEW_STOP_MODE);
setReviewerApplies(defaults.reviewerApplies === true);
setLmstudioModel(defaults.lmstudioModel || '');
@@ -101,6 +103,7 @@ export default function CodeReviewDefaultsPanel() {
const payload = {
reviewers,
usernames,
+ optionalReviewers,
stopMode,
reviewerApplies,
lmstudioModel: lmstudioModel || undefined,
@@ -161,12 +164,14 @@ export default function CodeReviewDefaultsPanel() {
<ReviewerPicker
reviewers={reviewers}
usernames={usernames}
+ optionalReviewers={optionalReviewers}
stopMode={stopMode}
reviewerApplies={reviewerApplies}
disabled={saving}
- onChange={({ reviewers: r, usernames: u, stopMode: s, reviewerApplies: a }) => {
+ onChange={({ reviewers: r, usernames: u, optionalReviewers: o, stopMode: s, reviewerApplies: a }) => {
setReviewers(r);
setUsernames(u);
+ setOptionalReviewers(o);
setStopMode(s);
setReviewerApplies(a);
}}
diff --git a/client/src/hooks/useCodeReviewDefaults.jsx b/client/src/hooks/useCodeReviewDefaults.jsx
index 8415471feb..43a2f3847c 100644
--- a/client/src/hooks/useCodeReviewDefaults.jsx
+++ b/client/src/hooks/useCodeReviewDefaults.jsx
@@ -10,6 +10,7 @@ import { DEFAULT_REVIEWERS, DEFAULT_REVIEW_STOP_MODE } from '../components/cos/c
const FALLBACK = Object.freeze({
reviewers: DEFAULT_REVIEWERS,
usernames: [],
+ optionalReviewers: [],
stopMode: DEFAULT_REVIEW_STOP_MODE,
reviewerApplies: false,
lmstudioModel: null,
@@ -33,6 +34,7 @@ export function CodeReviewDefaultsProvider({ children }) {
setValue({
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 : [],
stopMode: d.stopMode || DEFAULT_REVIEW_STOP_MODE,
reviewerApplies: d.reviewerApplies === true,
lmstudioModel: d.lmstudioModel || null,
diff --git a/docs/plans/2026-07-12-optional-non-blocking-reviewers.md b/docs/plans/2026-07-12-optional-non-blocking-reviewers.md
new file mode 100644
index 0000000000..76ca30f787
--- /dev/null
+++ b/docs/plans/2026-07-12-optional-non-blocking-reviewers.md
@@ -0,0 +1,48 @@
+# Optional (non-blocking) code reviewers
+
+**Date:** 2026-07-12
+**Status:** DONE — slashdo side merged (PR #110); PortOS side implemented (this PR, closes #2481).
+**Motivation:** A local Ollama reviewer is a useful second opinion but frequently returns no verdict (timeout / empty / partial coverage). Today that flips the multi-reviewer aggregate to `inconclusive`, which blocks a saved `--merge` and strands the PR behind a reviewer that was never meant to gate. See memory `project_ollama_reviewer_no_verdict_blocks_merge`.
+
+## Design decisions (locked with the user)
+
+1. **Marker syntax:** a shell-safe inline suffix `~opt` on a `--review-with` slot — `claude,ollama~opt,codex`, `ollama[qwen2.5-coder:32b]~opt`, `@flaky-bot~opt`. Chosen over the originally-proposed `(o)` because `()` are shell metacharacters (subshell) and would violate the "inert wherever it lands in a command string" property the reviewer-token grammar maintains. Chosen over a separate `--review-optional` flag to keep the marker co-located and riding through saved defaults verbatim.
+2. **Semantics — inconclusive-only:** an optional reviewer still runs and still has its findings fixed; only its *inconclusive* result (timeout / skipped / incomplete / no-verdict) is excluded from the merge gate. A **hard-error** from it (broken build / failed tests / rejected) still blocks — optionality never merges a broken tree.
+
+## Part 1 — slashdo (`atomantic/slashdo`) — DONE (PR #110)
+
+`~opt` is stripped into a per-entry `{OPTIONAL}` flag before slug/`[model]`/`@login` parsing; not part of the dedup identity (`ollama~opt` == `ollama`, optional-wins on collapse). `lib/multi-reviewer-loop.md` excludes optional passes from the `{OVERALL_STATUS}=inconclusive` determination (series + parallel) and adds an Optional column; every `--review-with` command + `/do:config` save-path recognizes it; `next` inherits via pass-through. Once merged, **bump the PortOS submodule** (`git submodule update --remote lib/slashdo`, commit the pointer).
+
+## Part 2 — PortOS (this repo) — PENDING (gated on Part 1 merge + submodule bump)
+
+PortOS already owns the reviewer config that feeds agentic (`/do:next`, `/do:pr`) runs — extend it, don't rebuild it.
+
+### Data / schema (`server/lib/cosValidation.js`)
+- Add `optionalReviewers: string[]` to **`codeReviewSettingsSchema`** (the Code Review Defaults slice) and to the **task-metadata** reviewer shape (the `reviewers` sub-object near line 237). Additive + optional (defaults to `[]`) — settings merge is additive, so **no data migration** needed; the loader already tolerates absent keys.
+- Entries are reviewer identities: the keyed slugs (`ollama`, `lmstudio`, `claude`, `codex`, `copilot`, …) and `@username` tokens. Validate each is a member of the effective reviewer list (drop unknowns), mirroring `normalizeReviewUsernames`.
+
+### Builder (`server/lib/cosValidation.js`)
+- `buildReviewWithArgs(reviewers, stopMode, reviewerApplies, usernames, optionalReviewers = [])`: when emitting each token, append `~opt` if that reviewer identity is in `optionalReviewers`. Keep the existing ordering/default-only/stop-mode logic intact.
+- `buildReviewersCsv(...)`: same `~opt` appending for the prompt `{reviewers}` placeholder.
+- Note: PortOS's `ollama`/`lmstudio` are flat enum keys that route through PortOS's own local code-review endpoint; the optional flag here is a per-key boolean, independent of slashdo's `[model]` bracket (PortOS configures the model separately). So `optionalReviewers` stores plain keys/`@user`, and `buildReviewWithArgs` appends `~opt` to the matching emitted token.
+
+### Prompt builder (`server/services/agentPromptBuilder.js`)
+- The three `buildReviewWithArgs(...)` call sites (~lines 330, 1159, 1300) must thread `optionalReviewers` through. Mirror how the reviewer-`--model` map is threaded (memory `project_reviewer_model_threading_map`): thread the value verbatim, do not remap.
+
+### UI
+- `client/src/components/cos/ReviewerPicker.jsx`: add a per-reviewer "non-blocking" toggle (a small badge/checkbox on each selected reviewer chip). Selecting it adds the reviewer key to `optionalReviewers`.
+- `client/src/components/providers/CodeReviewDefaultsPanel.jsx`: surface the same toggle for the saved defaults.
+- `client/src/hooks/useCodeReviewDefaults.jsx` + `client/src/services/apiCodeReview.js`: carry `optionalReviewers` through load/save.
+- `client/src/components/cos/constants.js`: no change (REVIEWER_OPTIONS unchanged); the picker gains the toggle.
+
+### Tests
+- `cosValidation` builder tests: `buildReviewWithArgs` / `buildReviewersCsv` emit `~opt` for the marked reviewers, in the right position, and only for members.
+- `ReviewerPicker` test: toggling non-blocking updates `optionalReviewers`.
+
+### Changelog
+- `.changelog/NEXT.md` entry once implemented.
+
+## Sequencing
+1. Merge slashdo PR #110.
+2. Bump PortOS `lib/slashdo` submodule to the merged commit; commit the pointer.
+3. Implement Part 2 as its own PortOS PR.
diff --git a/lib/slashdo b/lib/slashdo
index 8e9c45a32d..174529856a 160000
--- a/lib/slashdo
+++ b/lib/slashdo
@@ -1 +1 @@
-Subproject commit 8e9c45a32dca9be4cde917b53612c01e999e29fc
+Subproject commit 174529856a30d711a7c5a60f2f69a01b227db423
diff --git a/server/lib/cosValidation.js b/server/lib/cosValidation.js
index 98d4547b6e..2f23278b97 100644
--- a/server/lib/cosValidation.js
+++ b/server/lib/cosValidation.js
@@ -95,6 +95,73 @@ export function resolveReviewUsernames(metadataUsernames, defaultUsernames) {
: normalizeReviewUsernames(defaultUsernames);
}
+/**
+ * Reviewer identities the user marked OPTIONAL (non-blocking). slashdo's `~opt`
+ * suffix is appended to each matching `--review-with` token, so an *inconclusive*
+ * verdict from that reviewer (timeout / no-verdict / partial) no longer gates the
+ * merge — a hard-error from it still does (slashdo `lib/multi-reviewer-loop.md`).
+ * This is the escape hatch for a valuable-but-flaky reviewer (a local Ollama
+ * model that often returns nothing) that would otherwise strand every PR on an
+ * `inconclusive` aggregate.
+ *
+ * Each entry mirrors an *emitted* `--review-with` token so the builder's
+ * membership test is a plain lookup: a keyed slug from `REVIEWER_VALUES`
+ * (`ollama`, `lmstudio`, …) or an `@<username>`. Normalizes like the sibling
+ * helpers — drop non-strings/unknown slugs/unsafe usernames, alias `gemini` →
+ * `antigravity`, dedupe case-insensitively preserving order. Non-array → undefined
+ * (an omitted field isn't persisted as an empty override).
+ */
+export function normalizeOptionalReviewers(list) {
+ if (!Array.isArray(list)) return undefined;
+ 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 key = token.toLowerCase();
+ if (seen.has(key)) continue;
+ seen.add(key);
+ out.push(token);
+ }
+ return out;
+}
+
+/**
+ * Resolve optional (non-blocking) reviewers with task-over-default precedence:
+ * a task-level list (even explicitly empty) overrides the Code Review Defaults;
+ * only fall back to the defaults when the task didn't pin its own. Mirrors
+ * `resolveReviewUsernames`.
+ */
+export function resolveOptionalReviewers(metadataOptional, defaultOptional) {
+ return Array.isArray(metadataOptional)
+ ? (normalizeOptionalReviewers(metadataOptional) || [])
+ : (normalizeOptionalReviewers(defaultOptional) || []);
+}
+
+/**
+ * Build the set of lowercased optional-reviewer tokens for a fast membership
+ * test in the builders. Tolerates the raw (unnormalized) list.
+ */
+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;
+}
+
/**
* Resolve task metadata to an ordered, deduped reviewer list. Prefers the new
* `reviewers` array; falls back to the legacy single `reviewer` string. When
@@ -145,12 +212,15 @@ 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.
* The flag-string variant is `buildReviewWithArgs`.
*/
-export function buildReviewersCsv(reviewers, usernames = []) {
+export function buildReviewersCsv(reviewers, usernames = [], optionalReviewers = []) {
const keyed = Array.isArray(reviewers) && reviewers.length ? reviewers : [...DEFAULT_REVIEWERS];
const users = normalizeReviewUsernames(usernames);
- return [...keyed, ...users.map(u => `@${u}`)].join(',');
+ const optSet = optionalReviewerSet(optionalReviewers);
+ const combined = [...keyed, ...users.map(u => `@${u}`)];
+ return combined.map(t => markOptional(t, optSet)).join(',');
}
/**
@@ -163,15 +233,22 @@ export function buildReviewersCsv(reviewers, usernames = []) {
* meaningless for one).
* - `--reviewer-applies` only when a non-copilot KEYED reviewer is present (a
* 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).
*/
-export function buildReviewWithArgs(reviewers, stopMode = DEFAULT_REVIEW_STOP_MODE, reviewerApplies = false, usernames = []) {
+export function buildReviewWithArgs(reviewers, stopMode = DEFAULT_REVIEW_STOP_MODE, reviewerApplies = false, usernames = [], optionalReviewers = []) {
const users = normalizeReviewUsernames(usernames);
const keyed = resolveKeyedReviewers(reviewers, users.length > 0);
const combined = [...keyed, ...users.map(u => `@${u}`)];
- const isDefaultOnly = combined.length === 1 && combined[0] === DEFAULT_REVIEWER;
+ 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 hasNonCopilot = keyed.some(r => r !== DEFAULT_REVIEWER);
const parts = [];
- if (!isDefaultOnly) parts.push(`--review-with ${combined.join(',')}`);
+ if (!isDefaultOnly) parts.push(`--review-with ${combined.map(t => markOptional(t, optSet)).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');
@@ -262,6 +339,13 @@ export const createCosTaskSchema = z.object({
v => Array.isArray(v) ? normalizeReviewUsernames(v) : undefined,
z.array(z.string()).optional()
),
+ // Reviewer identities (keyed slugs and/or `@username`) marked non-blocking —
+ // emitted with slashdo's `~opt` suffix. Normalized so a hand-crafted request
+ // can't smuggle junk in. Absent → undefined (not `[]`).
+ optionalReviewers: z.preprocess(
+ v => Array.isArray(v) ? normalizeOptionalReviewers(v) : undefined,
+ z.array(z.string()).optional()
+ ),
});
export const updateCosTaskSchema = z.object({
@@ -424,6 +508,13 @@ export const codeReviewSettingsSchema = z.object({
v => Array.isArray(v) ? normalizeReviewUsernames(v) : undefined,
z.array(z.string()).optional()
),
+ // Reviewer identities (keyed slugs and/or `@username`) marked non-blocking —
+ // emitted with slashdo's `~opt` suffix so an inconclusive verdict from them
+ // doesn't gate the merge (a hard-error still does). Absent → undefined.
+ optionalReviewers: z.preprocess(
+ v => Array.isArray(v) ? normalizeOptionalReviewers(v) : undefined,
+ z.array(z.string()).optional()
+ ),
stopMode: z.enum(REVIEW_STOP_MODES).optional(),
reviewerApplies: z.boolean().optional(),
lmstudioModel: z.preprocess(emptyToUndefined, z.string().optional()),
@@ -530,6 +621,13 @@ export function sanitizeTaskMetadata(raw) {
clean.usernames = normalizeReviewUsernames(raw.usernames);
hasKeys = true;
}
+ // `optionalReviewers` marks reviewers non-blocking (slashdo `~opt`). Like
+ // `usernames`, an explicitly empty array is KEPT so a task/type can override
+ // the Code Review Defaults' optional set back to "none optional."
+ if (Array.isArray(raw.optionalReviewers)) {
+ clean.optionalReviewers = normalizeOptionalReviewers(raw.optionalReviewers) || [];
+ 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.js
index 69d53493c6..6bd9a69f83 100644
--- a/server/lib/validation.test.js
+++ b/server/lib/validation.test.js
@@ -13,6 +13,8 @@ import {
normalizeReviewers,
normalizeReviewUsernames,
resolveReviewUsernames,
+ normalizeOptionalReviewers,
+ resolveOptionalReviewers,
resolveKeyedReviewers,
buildReviewersCsv,
buildReviewWithArgs,
@@ -902,6 +904,65 @@ describe('validation.js', () => {
expect(buildReviewWithArgs(['copilot'], 'all', false, ['@Bot', 'bad token', 'bot']))
.toBe('--review-with copilot,@Bot');
});
+
+ it('appends ~opt to the tokens named in optionalReviewers (keyed + @user)', () => {
+ // ollama marked optional → its token carries ~opt; codex stays blocking.
+ expect(buildReviewWithArgs(['claude', 'ollama', 'codex'], 'all', false, [], ['ollama']))
+ .toBe('--review-with claude,ollama~opt,codex');
+ // a username can be optional too — matched by its @-form.
+ expect(buildReviewWithArgs(['codex'], 'all', false, ['Bot'], ['@Bot']))
+ .toBe('--review-with codex,@Bot~opt');
+ // aliases resolve before matching: gemini→antigravity.
+ expect(buildReviewWithArgs(['antigravity', 'codex'], 'all', false, [], ['gemini']))
+ .toBe('--review-with antigravity~opt,codex');
+ });
+
+ it('forces the flag on for a lone default copilot marked optional (so ~opt is not lost)', () => {
+ // Without the marker this is the suppressed lone-default case ('').
+ expect(buildReviewWithArgs(['copilot'], 'all', false, [], ['copilot']))
+ .toBe('--review-with copilot~opt');
+ });
+
+ it('ignores optionalReviewers entries not present in the emitted list', () => {
+ expect(buildReviewWithArgs(['codex', 'copilot'], 'all', false, [], ['ollama', 'bad token']))
+ .toBe('--review-with codex,copilot');
+ });
+ });
+
+ describe('normalizeOptionalReviewers', () => {
+ it('keeps known keyed slugs and @usernames, aliases gemini→antigravity', () => {
+ expect(normalizeOptionalReviewers(['ollama', '@Bot', 'gemini', 'lmstudio']))
+ .toEqual(['ollama', '@Bot', 'antigravity', 'lmstudio']);
+ });
+
+ it('drops unknown slugs, unsafe usernames, non-strings, and dedupes case-insensitively', () => {
+ expect(normalizeOptionalReviewers(['ollama', 'OLLAMA', 'nope', '@bad token', 42, null, '@Bot', '@bot']))
+ .toEqual(['ollama', '@Bot']);
+ });
+
+ it('returns undefined for non-array input (an omitted field is not an empty override)', () => {
+ expect(normalizeOptionalReviewers(undefined)).toBeUndefined();
+ expect(normalizeOptionalReviewers('ollama')).toBeUndefined();
+ });
+ });
+
+ describe('resolveOptionalReviewers', () => {
+ it('lets a task-level list (even empty) override the defaults', () => {
+ expect(resolveOptionalReviewers(['ollama'], ['codex'])).toEqual(['ollama']);
+ expect(resolveOptionalReviewers([], ['codex'])).toEqual([]);
+ });
+
+ it('falls back to the defaults when the task did not pin its own', () => {
+ expect(resolveOptionalReviewers(undefined, ['ollama', 'nope'])).toEqual(['ollama']);
+ expect(resolveOptionalReviewers(undefined, undefined)).toEqual([]);
+ });
+ });
+
+ describe('buildReviewersCsv — optional markers', () => {
+ it('appends ~opt to the CSV tokens named optional', () => {
+ expect(buildReviewersCsv(['claude', 'ollama'], ['@Bot'], ['ollama', '@Bot']))
+ .toBe('claude,ollama~opt,@Bot~opt');
+ });
});
describe('createCosTaskSchema reviewers fields', () => {
diff --git a/server/routes/cosTaskRoutes.js b/server/routes/cosTaskRoutes.js
index 03c42ea0e2..b840c8e31e 100644
--- a/server/routes/cosTaskRoutes.js
+++ b/server/routes/cosTaskRoutes.js
@@ -49,7 +49,8 @@ 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.
- return buildReviewersCsv(list, codeReviewDefaults?.usernames);
+ // Optional-reviewer set rides along so a `~opt` reviewer stays non-blocking.
+ return buildReviewersCsv(list, codeReviewDefaults?.usernames, codeReviewDefaults?.optionalReviewers);
}
// Append a "claim exactly this ticket" constraint to the claim-issue-jira body
diff --git a/server/services/agentPromptBuilder.js b/server/services/agentPromptBuilder.js
index abe3b8f376..702bd7d902 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, PATHS, tryReadFile } from '../lib/fileUtils.js';
-import { DEFAULT_REVIEWER, DEFAULT_REVIEWERS, DEFAULT_REVIEW_STOP_MODE, LOCAL_LLM_REVIEWERS, MODEL_CAPABLE_CLI_REVIEWERS, normalizeReviewers, normalizeReviewUsernames, resolveKeyedReviewers, buildReviewWithArgs } from '../lib/validation.js';
+import { DEFAULT_REVIEWER, DEFAULT_REVIEWERS, DEFAULT_REVIEW_STOP_MODE, LOCAL_LLM_REVIEWERS, MODEL_CAPABLE_CLI_REVIEWERS, normalizeReviewers, normalizeReviewUsernames, normalizeOptionalReviewers, resolveKeyedReviewers, buildReviewWithArgs } from '../lib/validation.js';
import { PROVIDER_TYPES } from '../lib/aiToolkit/constants.js';
import { isOpencodeCommand } from '../lib/providerModels.js';
import { shellQuote } from '../lib/shellQuote.js';
@@ -300,6 +300,8 @@ export function buildReviewLoopFollowUpSection(metadata = {}, { verbose = false,
? metadata.reviewLoopReviewers
: (metadata.reviewLoopReviewer ? [metadata.reviewLoopReviewer] : undefined);
const reviewers = resolveKeyedReviewers(reviewerSource, usernames.length > 0);
+ // Reviewer identities marked non-blocking — emitted with slashdo's `~opt`.
+ const optionalReviewers = normalizeOptionalReviewers(metadata.reviewLoopOptionalReviewers) || [];
const stopMode = metadata.reviewLoopStopMode || DEFAULT_REVIEW_STOP_MODE;
const reviewerApplies = metadata.reviewLoopReviewerApplies === true;
const hasCopilot = reviewers.includes(DEFAULT_REVIEWER);
@@ -343,7 +345,7 @@ export function buildReviewLoopFollowUpSection(metadata = {}, { verbose = false,
...reviewers.map(r => `\`${r}\``),
...usernames.map(u => `\`@${u}\``),
].join(' → ');
- const equivArgs = buildReviewWithArgs(reviewers, stopMode, reviewerApplies, usernames);
+ const equivArgs = buildReviewWithArgs(reviewers, stopMode, reviewerApplies, usernames, optionalReviewers);
const equiv = equivArgs ? ` (equivalent to \`/do:pr ${equivArgs}\`)` : '';
// First step: how to obtain a review. For a single copilot/CLI reviewer keep the
@@ -708,6 +710,7 @@ After completing your work and before committing, ${simplifyInstruction}. Fix an
// up here so the TUI completion block can thread `--review-with …` into `/do:pr`.
const taskReviewers = normalizeReviewers(task.metadata);
const taskReviewerUsernames = normalizeReviewUsernames(task.metadata?.usernames);
+ const taskOptionalReviewers = normalizeOptionalReviewers(task.metadata?.optionalReviewers) || [];
const taskReviewStopMode = task.metadata?.reviewStopMode || DEFAULT_REVIEW_STOP_MODE;
const taskReviewerApplies = isTruthyMetaFn(task.metadata?.reviewerApplies);
@@ -731,6 +734,7 @@ After completing your work and before committing, ${simplifyInstruction}. Fix an
sentinelPath,
reviewers: taskReviewers,
usernames: taskReviewerUsernames,
+ optionalReviewers: taskOptionalReviewers,
reviewStopMode: taskReviewStopMode,
reviewerApplies: taskReviewerApplies
})
@@ -979,6 +983,7 @@ function buildLightContextSections(task, workspaceDir, worktreeInfo, isTruthyMet
// Flows as `/do:pr --review-with a,b,c [--review-stop-on-*] [--reviewer-applies]`.
const lightReviewers = normalizeReviewers(task.metadata);
const lightReviewerUsernames = normalizeReviewUsernames(task.metadata?.usernames);
+ const lightOptionalReviewers = normalizeOptionalReviewers(task.metadata?.optionalReviewers) || [];
const lightReviewStopMode = task.metadata?.reviewStopMode || DEFAULT_REVIEW_STOP_MODE;
const lightReviewerApplies = isTruthyMetaFn(task.metadata?.reviewerApplies);
// Claude Code CLI providers can drive `/simplify` + `/do:pr` themselves
@@ -1083,10 +1088,10 @@ function buildLightContextSections(task, workspaceDir, worktreeInfo, isTruthyMet
sentinelPath: `${worktreeInfo?.worktreePath || workspaceDir}/.agent-done`,
branchName: worktreeInfo?.branchName || null,
baseBranch: worktreeInfo?.baseBranch || null,
- reviewers: lightReviewers, usernames: lightReviewerUsernames, reviewStopMode: lightReviewStopMode, reviewerApplies: lightReviewerApplies
+ reviewers: lightReviewers, usernames: lightReviewerUsernames, optionalReviewers: lightOptionalReviewers, reviewStopMode: lightReviewStopMode, reviewerApplies: lightReviewerApplies
}));
} else {
- sections.push(buildCliCompletionSection({ worktreeInfo, willOpenPR, willReviewLoop, hasSlashdo, simplifyEnabled, reviewers: lightReviewers, usernames: lightReviewerUsernames, reviewStopMode: lightReviewStopMode, reviewerApplies: lightReviewerApplies }));
+ sections.push(buildCliCompletionSection({ worktreeInfo, willOpenPR, willReviewLoop, hasSlashdo, simplifyEnabled, reviewers: lightReviewers, usernames: lightReviewerUsernames, optionalReviewers: lightOptionalReviewers, reviewStopMode: lightReviewStopMode, reviewerApplies: lightReviewerApplies }));
}
return { taskSections, contractSections };
@@ -1160,7 +1165,7 @@ function buildPostPRMergeSteps(startStep, { reviewers = DEFAULT_REVIEWERS, usern
* slash commands), the agent can't run `/do:pr` / `/do:push`, so it delegates to
* the plain-git/`gh` variant below — same sentinel handshake, no slashdo.
*/
-function buildTuiCompletionSection({ willOpenPR, willReviewLoop, simplifyEnabled, sentinelPath, providerId = null, slashdoFree = false, branchName = null, baseBranch = null, reviewers = DEFAULT_REVIEWERS, usernames = [], reviewStopMode = DEFAULT_REVIEW_STOP_MODE, reviewerApplies = false }) {
+function buildTuiCompletionSection({ willOpenPR, willReviewLoop, simplifyEnabled, sentinelPath, providerId = null, slashdoFree = false, branchName = null, baseBranch = null, reviewers = DEFAULT_REVIEWERS, usernames = [], optionalReviewers = [], reviewStopMode = DEFAULT_REVIEW_STOP_MODE, reviewerApplies = false }) {
if (slashdoFree) {
// The manual path never auto-merges (it opens the PR for review), so it
// doesn't need willReviewLoop — the review gate holds unconditionally.
@@ -1172,7 +1177,7 @@ function buildTuiCompletionSection({ willOpenPR, willReviewLoop, simplifyEnabled
// when the task's Review Loop control is off so that default cannot start a
// Copilot (or other external) review unexpectedly.
const reviewArgs = willOpenPR
- ? (willReviewLoop ? buildReviewWithArgs(reviewers, reviewStopMode, reviewerApplies, reviewUsernames) : '--review-with none')
+ ? (willReviewLoop ? buildReviewWithArgs(reviewers, reviewStopMode, reviewerApplies, reviewUsernames, optionalReviewers) : '--review-with none')
: '';
const reviewerArg = reviewArgs ? ` ${reviewArgs}` : '';
const copilotOnly = reviewers.length === 1 && reviewers[0] === DEFAULT_REVIEWER && reviewUsernames.length === 0;
@@ -1304,7 +1309,7 @@ function buildManualTuiCompletionSection({ willOpenPR, simplifyEnabled, sentinel
* CLI providers fall through to the legacy commit-only block where PortOS
* handles push+PR on exit.
*/
-function buildCliCompletionSection({ worktreeInfo, willOpenPR, willReviewLoop = false, hasSlashdo = false, simplifyEnabled = false, reviewers = DEFAULT_REVIEWERS, usernames = [], reviewStopMode = DEFAULT_REVIEW_STOP_MODE, reviewerApplies = false }) {
+function buildCliCompletionSection({ worktreeInfo, willOpenPR, willReviewLoop = false, hasSlashdo = false, simplifyEnabled = false, reviewers = DEFAULT_REVIEWERS, usernames = [], optionalReviewers = [], reviewStopMode = DEFAULT_REVIEW_STOP_MODE, reviewerApplies = false }) {
const reviewUsernames = normalizeReviewUsernames(usernames);
if (hasSlashdo && worktreeInfo && willOpenPR) {
const lines = ['## Completion', 'When finished, run these in order:'];
@@ -1313,7 +1318,7 @@ function buildCliCompletionSection({ worktreeInfo, willOpenPR, willReviewLoop =
lines.push(`${step++}. \`/simplify\` — review the changed code for reuse, quality, and efficiency, and fix any findings.`);
}
const reviewArgs = willReviewLoop
- ? buildReviewWithArgs(reviewers, reviewStopMode, reviewerApplies, reviewUsernames)
+ ? buildReviewWithArgs(reviewers, reviewStopMode, reviewerApplies, reviewUsernames, optionalReviewers)
: '--review-with none';
const reviewerArg = reviewArgs ? ` ${reviewArgs}` : '';
const completionNote = willReviewLoop
diff --git a/server/services/agentWorktreeCleanup.js b/server/services/agentWorktreeCleanup.js
index e9f5999c8c..d47bc0fdee 100644
--- a/server/services/agentWorktreeCleanup.js
+++ b/server/services/agentWorktreeCleanup.js
@@ -22,7 +22,7 @@ import { removeWorktree } from './worktreeManager.js';
import { isTruthyMeta } from './agentState.js';
import { PATHS } from '../lib/fileUtils.js';
import { RECOVERY_TASK_PREFIX } from './recoveryTasks.js';
-import { DEFAULT_REVIEWER, DEFAULT_REVIEWERS, DEFAULT_REVIEW_STOP_MODE, MODEL_CAPABLE_CLI_REVIEWERS, normalizeReviewers, normalizeReviewUsernames } from '../lib/validation.js';
+import { DEFAULT_REVIEWER, DEFAULT_REVIEWERS, DEFAULT_REVIEW_STOP_MODE, MODEL_CAPABLE_CLI_REVIEWERS, normalizeReviewers, normalizeReviewUsernames, normalizeOptionalReviewers } from '../lib/validation.js';
/**
* Clean up a worktree for a completed agent.
@@ -41,7 +41,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, requestCopilotReview: shouldRequestCopilot = false, reviewers = DEFAULT_REVIEWERS, usernames = [], 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, requestCopilotReview: shouldRequestCopilot = false, reviewers = DEFAULT_REVIEWERS, usernames = [], optionalReviewers = [], 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 [];
@@ -178,6 +178,7 @@ export async function cleanupAgentWorktree(agentId, success, { openPR = false, r
sourceWorkspace,
reviewers: reviewerList,
usernames,
+ optionalReviewers,
reviewStopMode,
reviewerApplies,
reviewerModels
@@ -238,7 +239,7 @@ export async function cleanupAgentWorktree(agentId, success, { openPR = false, r
* 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, reviewers = DEFAULT_REVIEWERS, usernames = [], reviewStopMode = DEFAULT_REVIEW_STOP_MODE, reviewerApplies = false, reviewerModels = null }) {
+export async function spawnReviewLoopFollowUp({ originalAgentId, originalTask, prUrl, prBranch, sourceWorkspace, reviewers = DEFAULT_REVIEWERS, usernames = [], optionalReviewers = [], reviewStopMode = DEFAULT_REVIEW_STOP_MODE, reviewerApplies = false, reviewerModels = null }) {
if (!prUrl || !prBranch) return null;
const parsedPr = git.parsePullRequestUrl(prUrl);
@@ -253,6 +254,9 @@ export async function spawnReviewLoopFollowUp({ originalAgentId, originalTask, p
// NOT stripped on a non-GitHub forge — a username reviewer alone can drive the
// loop even when copilot was dropped.
const effectiveUsernames = normalizeReviewUsernames(usernames);
+ // 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) || [];
if (effectiveReviewers.length === 0 && effectiveUsernames.length === 0) return null;
// Reviewer-keyed CLI model map, narrowed to the model-capable reviewers actually
@@ -299,6 +303,7 @@ export async function spawnReviewLoopFollowUp({ originalAgentId, originalTask, p
// Arbitrary GitHub reviewer usernames the follow-up requests as PR reviewers
// and gates the merge on (appended to `--review-with` as `@user`).
reviewLoopReviewerUsernames: effectiveUsernames,
+ reviewLoopOptionalReviewers: effectiveOptionalReviewers,
reviewLoopStopMode: reviewStopMode,
reviewLoopReviewerApplies: reviewerApplies,
// Empty → null so the prompt builder's "no models configured" path is unambiguous.
diff --git a/server/services/codeReview.js b/server/services/codeReview.js
index 0b714baa6a..463ad038dc 100644
--- a/server/services/codeReview.js
+++ b/server/services/codeReview.js
@@ -23,7 +23,9 @@ import {
REVIEWER_VALUES,
REVIEW_STOP_MODES,
normalizeReviewUsernames,
+ normalizeOptionalReviewers,
resolveReviewUsernames,
+ resolveOptionalReviewers,
} from '../lib/validation.js'
import { getSettings, settingsEvents } from './settings.js'
import { getBaseUrl as getLmStudioBaseUrl } from './lmStudioManager.js'
@@ -63,6 +65,9 @@ export function pickCodeReviewDefaults(settings) {
// tokens. Empty array = none configured (distinct from the copilot fallback
// reviewers get).
usernames: normalizeReviewUsernames(raw?.usernames),
+ // 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) || [],
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,
@@ -123,6 +128,8 @@ export async function resolveReviewLoopOptions(metadata, { normalize, isTruthyMe
// global default; only fall back to the Code Review Defaults when the task
// didn't pin its own. Mirrors the reviewers precedence.
const usernames = resolveReviewUsernames(metadata?.usernames, defaults?.usernames)
+ // Optional (non-blocking, `~opt`) reviewers: same task-over-default precedence.
+ const optionalReviewers = resolveOptionalReviewers(metadata?.optionalReviewers, defaults?.optionalReviewers)
const reviewStopMode = metadata?.reviewStopMode || defaults?.stopMode || DEFAULT_REVIEW_STOP_MODE
const reviewerApplies = metadata?.reviewerApplies !== undefined
? isTruthyMeta(metadata?.reviewerApplies)
@@ -135,7 +142,7 @@ export async function resolveReviewLoopOptions(metadata, { normalize, isTruthyMe
const model = defaults?.[`${r}Model`]
if (model) reviewerModels[r] = model
}
- return { reviewers, usernames, reviewStopMode, reviewerApplies, reviewerModels }
+ return { reviewers, usernames, optionalReviewers, 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.js
index 3b3d00d71e..08f6098f96 100644
--- a/server/services/codeReview.test.js
+++ b/server/services/codeReview.test.js
@@ -57,6 +57,7 @@ describe('codeReview helpers', () => {
expect(pickCodeReviewDefaults(null)).toEqual({
reviewers: ['copilot'],
usernames: [],
+ optionalReviewers: [],
stopMode: 'all',
reviewerApplies: false,
lmstudioModel: null,
@@ -67,6 +68,7 @@ describe('codeReview helpers', () => {
expect(pickCodeReviewDefaults({})).toEqual({
reviewers: ['copilot'],
usernames: [],
+ optionalReviewers: [],
stopMode: 'all',
reviewerApplies: false,
lmstudioModel: null,
@@ -114,6 +116,7 @@ describe('codeReview helpers', () => {
const out = pickCodeReviewDefaults({
codeReview: {
reviewers: ['codex', 'lmstudio'],
+ optionalReviewers: ['lmstudio', 'bogus'],
stopMode: 'on-clean',
reviewerApplies: true,
lmstudioModel: 'qwen2.5-coder:7b',
@@ -125,6 +128,8 @@ describe('codeReview helpers', () => {
expect(out).toEqual({
reviewers: ['codex', 'lmstudio'],
usernames: [],
+ // 'bogus' is dropped (not a known reviewer); 'lmstudio' survives.
+ optionalReviewers: ['lmstudio'],
stopMode: 'on-clean',
reviewerApplies: true,
lmstudioModel: 'qwen2.5-coder:7b',
diff --git a/server/services/cosTaskGenerator.js b/server/services/cosTaskGenerator.js
index e6357b206f..1642d0fbbd 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, buildReviewersCsv, LOCAL_LLM_REVIEWERS, SWARM_COUNT_MIN } from '../lib/validation.js';
+import { sanitizeTaskMetadata, PIPELINE_BEHAVIOR_FLAGS, MAX_TOTAL_SPAWNS, normalizeReviewers, resolveReviewUsernames, resolveOptionalReviewers, 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';
@@ -336,7 +336,8 @@ export async function buildClaimWorkTask(app, { issueAuthorFilter, reviewers } =
// claim prompt's `/do:next --review-with` gates the merge on them too. A
// task-level list overrides the Code Review Defaults.
const promptUsernames = resolveReviewUsernames(metadata.usernames, codeReviewDefaults?.usernames);
- const reviewersCsv = buildReviewersCsv(reviewersList, promptUsernames);
+ const promptOptionalReviewers = resolveOptionalReviewers(metadata.optionalReviewers, codeReviewDefaults?.optionalReviewers);
+ const reviewersCsv = buildReviewersCsv(reviewersList, promptUsernames, promptOptionalReviewers);
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
@@ -2047,7 +2048,8 @@ export async function generateManagedAppImprovementTaskForType(taskType, app, st
// prompt's `/do:next --review-with` gates the merge on them too. A task-level
// list overrides the Code Review Defaults; forge-agnostic, so not filtered.
const promptUsernames = resolveReviewUsernames(metadata.usernames, codeReviewDefaults?.usernames);
- const reviewersCsv = buildReviewersCsv(promptReviewers, promptUsernames);
+ const promptOptionalReviewers = resolveOptionalReviewers(metadata.optionalReviewers, codeReviewDefaults?.optionalReviewers);
+ const reviewersCsv = buildReviewersCsv(promptReviewers, promptUsernames, promptOptionalReviewers);
// {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` security
diff --git a/server/services/cosTaskGenerator.test.js b/server/services/cosTaskGenerator.test.js
index ff763627be..1a6d7673fe 100644
--- a/server/services/cosTaskGenerator.test.js
+++ b/server/services/cosTaskGenerator.test.js
@@ -153,7 +153,7 @@ 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)');
+ expect(GEN_SRC).toContain('buildReviewersCsv(promptReviewers, promptUsernames, promptOptionalReviewers)');
});
});