Skip to content

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

fix: unbreak the ladder-parity test in CI and accept a blank effort

[._.]/ Adam Eivy63a516f8f887
diff --git a/client/src/components/cos/constants.js b/client/src/components/cos/constants.js
index 32bfe41f4f..570a990d25 100644
--- a/client/src/components/cos/constants.js
+++ b/client/src/components/cos/constants.js
@@ -13,11 +13,6 @@ import {
Newspaper,
ChartGantt
} from 'lucide-react';
-import {
- CLAUDE_EFFORT_LEVELS,
- CODEX_EFFORT_LEVELS,
- ANTIGRAVITY_EFFORT_LEVELS
-} from '../../utils/providers';
export const TABS = [
{ id: 'briefing', label: 'Briefing', icon: Newspaper },
@@ -213,69 +208,23 @@ export const REVIEWER_OPTIONS = [
{ value: 'lmstudio', label: 'LM Studio', description: 'Local LM Studio model reviews the diff (set model on AI Providers)' },
{ value: 'ollama', label: 'Ollama', description: 'Local Ollama model reviews the diff (set model on AI Providers)' }
];
-export const LOCAL_LLM_REVIEWERS = ['lmstudio', 'ollama'];
-
-// CLI reviewers whose binary takes a `--model <id>` tier. Client mirror of
-// MODEL_CAPABLE_CLI_REVIEWERS in server/lib/cosValidation.js.
-export const MODEL_CAPABLE_CLI_REVIEWERS = ['codex', 'claude'];
-
-// Every reviewer whose model the user can pick per row in ReviewerPicker — the
-// model-capable CLIs plus the local-LLM backends. Client mirror of
-// MODEL_SELECTABLE_REVIEWERS in server/lib/cosValidation.js; keep in sync so the
-// picker only offers a Model cell where the server would keep the pin.
-// `copilot` and `@username` reviewers take no model.
-export const MODEL_SELECTABLE_REVIEWERS = [...MODEL_CAPABLE_CLI_REVIEWERS, ...LOCAL_LLM_REVIEWERS];
-
-// Upper bound on a pinned reviewer model id. Client mirror of
-// MAX_REVIEWER_MODEL_LENGTH in server/lib/cosValidation.js — a longer id is
-// dropped server-side, so the input must not accept one.
-export const MAX_REVIEWER_MODEL_LENGTH = 200;
-
-// Reasoning-effort ladder for the local-LLM reviewers — the OpenAI-compatible
-// `reasoning_effort` tier names both LM Studio and Ollama accept. Client mirror
-// of LOCAL_LLM_EFFORT_LEVELS in server/lib/cosValidation.js.
-export const LOCAL_LLM_EFFORT_LEVELS = Object.freeze(['low', 'medium', 'high']);
-
-// The effort ladder each reviewer offers, or absent when it has no effort control
-// (`copilot` is a GitHub review, `grok`'s CLI takes no effort flag, and an
-// `@username` reviewer is a person). Client mirror of `reviewerEffortLevels` in
-// server/lib/cosValidation.js — the CLI ladders come from the same
-// providers.js constants the server derives its own from, so the picker can only
-// offer a level the reviewer's binary actually accepts (`agy` really does reject
-// `--effort max`). Keep in sync; a level offered here but rejected there would
-// show the user a pin that never persists.
-export const REVIEWER_EFFORT_LEVELS = Object.freeze({
- claude: CLAUDE_EFFORT_LEVELS,
- codex: CODEX_EFFORT_LEVELS,
- antigravity: ANTIGRAVITY_EFFORT_LEVELS,
- lmstudio: LOCAL_LLM_EFFORT_LEVELS,
- ollama: LOCAL_LLM_EFFORT_LEVELS,
-});
-
-// Every reviewer whose effort the user can pick per row in ReviewerPicker.
-// Client mirror of EFFORT_SELECTABLE_REVIEWERS in server/lib/cosValidation.js.
-export const EFFORT_SELECTABLE_REVIEWERS = Object.freeze(Object.keys(REVIEWER_EFFORT_LEVELS));
-
-// The ladder for one reviewer token, or `null` when it takes no effort. Accepts
-// the `gemini` alias and `@username` tokens (both → null for the latter).
-export const reviewerEffortLevels = (reviewer) => {
- if (typeof reviewer !== 'string') return null;
- const slug = reviewer.trim().toLowerCase();
- return REVIEWER_EFFORT_LEVELS[REVIEWER_ALIASES[slug] || slug] || null;
-};
-
-// Characters that are STRUCTURAL in slashdo's emitted `--review-with` token and
-// have no escape inside the `[<model>]` selector, so the server drops an id
-// containing one (mirror of REVIEWER_MODEL_FORBIDDEN_RE in
-// server/lib/cosValidation.js). Stripped as the user types rather than silently
-// accepted, so the field can't display a pin the server would refuse to store.
-// A space is deliberately legal — `agy[Gemini 3.5 Flash (High)]` is a valid entry.
-const REVIEWER_MODEL_FORBIDDEN_RE = /[[\],\r\n\t]/g;
-
-// Strip the structural characters from a typed model id. Trimming is left to the
-// caller: an id being typed may legitimately have a trailing space mid-entry.
-export const sanitizeReviewerModelInput = (raw) =>
- typeof raw === 'string' ? raw.replace(REVIEWER_MODEL_FORBIDDEN_RE, '') : '';
+// The per-reviewer PIN vocabularies (which reviewers take a model or an effort,
+// and the values each accepts) live in `client/src/lib/reviewerPins.js` and are
+// re-exported here so existing imports keep working. They are NOT defined in this
+// file because the server suite pins them against the server's own ladders, and
+// this module's `lucide-react` icon import isn't installed in that workspace —
+// see the leaf module's header for the full rationale.
+export {
+ MODEL_CAPABLE_CLI_REVIEWERS,
+ LOCAL_LLM_REVIEWERS,
+ MODEL_SELECTABLE_REVIEWERS,
+ MAX_REVIEWER_MODEL_LENGTH,
+ LOCAL_LLM_EFFORT_LEVELS,
+ REVIEWER_EFFORT_LEVELS,
+ EFFORT_SELECTABLE_REVIEWERS,
+ reviewerEffortLevels,
+ sanitizeReviewerModelInput
+} from '../../lib/reviewerPins';
// pr-watcher author gate (taskMetadata.prAuthorFilter). Mirrors
// PR_AUTHOR_FILTERS in server/lib/validation.js. 'self' = PRs opened by the
diff --git a/client/src/lib/README.md b/client/src/lib/README.md
index 4a9b9c4ce9..64f140276a 100644
--- a/client/src/lib/README.md
+++ b/client/src/lib/README.md
@@ -44,6 +44,7 @@ grep -i "what you want to do" client/src/lib/README.md
| `grokVideoClip.js` | Mirror of `server/lib/grokVideoClip.js` — `GROK_VIDEO_DURATIONS` (`[6, 10]`) + `GROK_VIDEO_DEFAULT_DURATION`, the clip lengths grok's `image_to_video` actually delivers. |
| `imageCleaners.js` | Mirror of `resolveCleanersFromConfig` from `server/lib/imageClean.js`. Reads `{cleanC2PA, denoise}` off a per-mode settings record. `cleanC2PA` defaults are mode-aware (on for `codex` + `external` — the backends that emit C2PA chunks today — off otherwise, as an allow-list rather than a deny-list); `denoise` defaults off everywhere (lossy, opt-in only). |
| `reviewerModels.js` | `reviewerModelsFromDefaults` / `reviewerModelsToDefaults` / `reviewerEffortsFromDefaults` / `reviewerEffortsToDefaults` — adapt the Code Review Defaults' per-reviewer SCALARS (`codexModel`, `ollamaModel`, `claudeEffort`, …) to and from the token-keyed maps `ReviewerPicker`'s Model and Effort columns take. Mirrors `reviewerModelsFromDefaults` / `reviewerEffortsFromDefaults` in `server/lib/cosValidation.js`. |
+| `reviewerPins.js` | Client mirrors of the per-reviewer pin vocabularies — `MODEL_SELECTABLE_REVIEWERS` / `EFFORT_SELECTABLE_REVIEWERS` / `REVIEWER_EFFORT_LEVELS` / `reviewerEffortLevels` / `sanitizeReviewerModelInput` and their bounds. Dependency-free on purpose: the server suite imports it to pin the mirror against the server's own ladders, so it must not reach for a client-only package. Re-exported by `components/cos/constants.js`. |
| `runnerFamilies.js` | Mirror of `server/lib/runners.js`. |
| `slashdoCatalog.js` | Mirror of `server/lib/slashdoCatalog.js` — the launchable slashdo workflows (`SLASHDO_WORKFLOWS`, `slashdoWorkflowsForApp(isSwiftApp)`, `SLASHDO_APP_TYPES`) driving the app-overview Agent Operations buttons. Adds only the per-button Tailwind classes; pinned by `server/lib/slashdoCatalog.test.js`. |
| `issueLength.js` | Mirror of `server/lib/issueLength.js`. |
diff --git a/client/src/lib/index.js b/client/src/lib/index.js
index 28d2b92783..669d0e2737 100644
--- a/client/src/lib/index.js
+++ b/client/src/lib/index.js
@@ -41,6 +41,7 @@ export * from './muscriptorModels.js';
export * from './pipelineImageDefaults.js';
export * from './reverseOutlineGrid.js';
export * from './reviewerModels.js';
+export * from './reviewerPins.js';
export * from './runnerFamilies.js';
export * from './slashdoCatalog.js';
export * from './videoGenParams.js';
diff --git a/client/src/lib/reviewerPins.js b/client/src/lib/reviewerPins.js
new file mode 100644
index 0000000000..363263b3ac
--- /dev/null
+++ b/client/src/lib/reviewerPins.js
@@ -0,0 +1,90 @@
+import {
+ CLAUDE_EFFORT_LEVELS,
+ CODEX_EFFORT_LEVELS,
+ ANTIGRAVITY_EFFORT_LEVELS
+} from '../utils/providers';
+
+/**
+ * Client mirrors of the per-reviewer PIN vocabularies in
+ * `server/lib/cosValidation.js` — which reviewers can carry a model or an effort
+ * pin, and which values each one accepts.
+ *
+ * **Why these live in a leaf module rather than in `components/cos/constants.js`.**
+ * The server suite pins this mirror against the server's own derived ladders (see
+ * the `client mirror of the reviewer effort ladders` test in
+ * `server/lib/cosValidation.test.js`) — a level offered here but rejected there
+ * would show the user a pin that silently never persists, and the reverse would
+ * hide a tier their CLI accepts. That test runs in the SERVER workspace, which has
+ * no client dependencies installed, so anything it imports must not reach for one.
+ * `components/cos/constants.js` imports `lucide-react` for its tab/state icons, so
+ * importing the mirror from there fails CI with `Cannot find package
+ * 'lucide-react'` even though the icons have nothing to do with reviewer pins.
+ * Keeping the mirror in a dependency-free leaf lets the drift gate import it.
+ *
+ * `constants.js` re-exports every name here, so existing client imports are
+ * unaffected.
+ */
+
+// CLI reviewers whose binary takes a `--model <id>` tier. Mirror of
+// MODEL_CAPABLE_CLI_REVIEWERS.
+export const MODEL_CAPABLE_CLI_REVIEWERS = ['codex', 'claude'];
+
+// The local-LLM backends, which take both a model and an effort.
+export const LOCAL_LLM_REVIEWERS = ['lmstudio', 'ollama'];
+
+// Every reviewer whose model the user can pick per row in ReviewerPicker — the
+// model-capable CLIs plus the local-LLM backends. Mirror of
+// MODEL_SELECTABLE_REVIEWERS; keep in sync so the picker only offers a Model cell
+// where the server would keep the pin. `copilot` and `@username` take no model.
+export const MODEL_SELECTABLE_REVIEWERS = [...MODEL_CAPABLE_CLI_REVIEWERS, ...LOCAL_LLM_REVIEWERS];
+
+// Upper bound on a pinned reviewer model id. Mirror of MAX_REVIEWER_MODEL_LENGTH —
+// a longer id is dropped server-side, so the input must not accept one.
+export const MAX_REVIEWER_MODEL_LENGTH = 200;
+
+// Reasoning-effort ladder for the local-LLM reviewers — the OpenAI-compatible
+// `reasoning_effort` tier names both LM Studio and Ollama accept. Mirror of
+// LOCAL_LLM_EFFORT_LEVELS.
+export const LOCAL_LLM_EFFORT_LEVELS = Object.freeze(['low', 'medium', 'high']);
+
+// The effort ladder each reviewer offers, or absent when it has no effort control
+// (`copilot` is a GitHub review, `grok`'s CLI takes no effort flag, and an
+// `@username` reviewer is a person). The CLI ladders come from the same
+// providers.js constants the server derives its own from, so the picker can only
+// offer a level the reviewer's binary actually accepts (`agy` really does reject
+// `--effort max`).
+export const REVIEWER_EFFORT_LEVELS = Object.freeze({
+ claude: CLAUDE_EFFORT_LEVELS,
+ codex: CODEX_EFFORT_LEVELS,
+ antigravity: ANTIGRAVITY_EFFORT_LEVELS,
+ lmstudio: LOCAL_LLM_EFFORT_LEVELS,
+ ollama: LOCAL_LLM_EFFORT_LEVELS,
+});
+
+// Every reviewer whose effort the user can pick per row in ReviewerPicker.
+// Mirror of EFFORT_SELECTABLE_REVIEWERS.
+export const EFFORT_SELECTABLE_REVIEWERS = Object.freeze(Object.keys(REVIEWER_EFFORT_LEVELS));
+
+// Reviewer slug aliases. `gemini` is the historical name for the Antigravity CLI.
+const REVIEWER_ALIASES = { gemini: 'antigravity' };
+
+// The ladder for one reviewer token, or `null` when it takes no effort. Accepts
+// the `gemini` alias and `@username` tokens (both → null for the latter).
+export const reviewerEffortLevels = (reviewer) => {
+ if (typeof reviewer !== 'string') return null;
+ const slug = reviewer.trim().toLowerCase();
+ return REVIEWER_EFFORT_LEVELS[REVIEWER_ALIASES[slug] || slug] || null;
+};
+
+// Characters that are STRUCTURAL in slashdo's emitted `--review-with` token and
+// have no escape inside the `[<model>]` selector, so the server drops an id
+// containing one (mirror of REVIEWER_MODEL_FORBIDDEN_RE). Stripped as the user
+// types rather than silently accepted, so the field can't display a pin the server
+// would refuse to store. A space is deliberately legal — `agy[Gemini 3.5 Flash
+// (High)]` is a valid entry.
+const REVIEWER_MODEL_FORBIDDEN_RE = /[[\],\r\n\t]/g;
+
+// Strip the structural characters from a typed model id. Trimming is left to the
+// caller: an id being typed may legitimately have a trailing space mid-entry.
+export const sanitizeReviewerModelInput = (raw) =>
+ typeof raw === 'string' ? raw.replace(REVIEWER_MODEL_FORBIDDEN_RE, '') : '';
diff --git a/server/lib/cosValidation.test.js b/server/lib/cosValidation.test.js
index adc4f58b01..f98ac75340 100644
--- a/server/lib/cosValidation.test.js
+++ b/server/lib/cosValidation.test.js
@@ -291,7 +291,10 @@ describe('per-reviewer reasoning effort (reviewerEfforts)', () => {
// pinned rather than trusted to a "keep in sync" comment.
describe('client mirror of the reviewer effort ladders', () => {
it('matches server reviewerEffortLevels for every reviewer', async () => {
- const client = await import('../../client/src/components/cos/constants.js');
+ // The dependency-free leaf, NOT `components/cos/constants.js` (which re-exports
+ // these but also imports `lucide-react` — absent from the server workspace, so
+ // importing it here fails CI with ERR_MODULE_NOT_FOUND).
+ const client = await import('../../client/src/lib/reviewerPins.js');
expect([...client.EFFORT_SELECTABLE_REVIEWERS].sort()).toEqual([...EFFORT_SELECTABLE_REVIEWERS].sort());
expect(client.LOCAL_LLM_EFFORT_LEVELS).toEqual(LOCAL_LLM_EFFORT_LEVELS);
for (const reviewer of REVIEWER_VALUES) {
diff --git a/server/routes/codeReview.js b/server/routes/codeReview.js
index 2c10d65a87..eca1929295 100644
--- a/server/routes/codeReview.js
+++ b/server/routes/codeReview.js
@@ -24,7 +24,11 @@ const localReviewRequestSchema = z.object({
diff: z.string().min(1, 'diff must be non-empty'),
timeoutMs: z.number().int().positive().max(600000).optional(),
}).strict().superRefine((body, ctx) => {
- if (body.effort === undefined) return
+ // Blank is "not pinned", not "invalid" — same fallback the sibling `model` field
+ // gets from `body.model || configured` below, and what this route's header
+ // documents ("when omitted or empty we fall back"). Only a NON-empty value that
+ // the backend's ladder rejects is a 400.
+ if (!body.effort) return
if (normalizeReviewerEffort(body.effort, body.backend)) return
ctx.addIssue({
code: z.ZodIssueCode.custom,
diff --git a/server/routes/codeReview.test.js b/server/routes/codeReview.test.js
index 52f5cc1c6e..4d75a6133f 100644
--- a/server/routes/codeReview.test.js
+++ b/server/routes/codeReview.test.js
@@ -91,6 +91,24 @@ describe('POST /api/code-review/local', () => {
)
})
+ it('treats a blank effort as unpinned and falls back to the configured default', async () => {
+ settingsSvc.getSettings.mockResolvedValue({
+ codeReview: { ollamaModel: 'm', ollamaEffort: 'high' },
+ })
+ codeReviewSvc.runLocalCodeReview.mockResolvedValue({
+ ok: true, backend: 'ollama', model: 'm', effort: 'high', findings: 'No findings.',
+ })
+
+ const res = await request(makeApp())
+ .post('/api/code-review/local')
+ .send({ backend: 'ollama', effort: '', diff: 'diff --git a b' })
+
+ expect(res.status).toBe(200)
+ expect(codeReviewSvc.runLocalCodeReview).toHaveBeenCalledWith(
+ expect.objectContaining({ effort: 'high' }),
+ )
+ })
+
it('returns 400 for an effort outside the requested backend ladder', async () => {
const res = await request(makeApp())
.post('/api/code-review/local')
diff --git a/server/services/agentPromptBuilder.js b/server/services/agentPromptBuilder.js
index e844c08bb9..cec84b5e9c 100644
--- a/server/services/agentPromptBuilder.js
+++ b/server/services/agentPromptBuilder.js
@@ -17,7 +17,7 @@ import { getActiveProvider } from './providers.js';
import { runPromptThroughProvider } from '../lib/promptRunner.js';
import { readJSONFile, PATHS, tryReadFile, expandHome } from '../lib/fileUtils.js';
import { loadSlashdoFile, loadSlashdoLib, writeResolvedSlashdoBody } from '../lib/slashdoLoader.js';
-import { DEFAULT_REVIEWER, DEFAULT_REVIEWERS, DEFAULT_REVIEW_STOP_MODE, LOCAL_LLM_REVIEWERS, MODEL_CAPABLE_CLI_REVIEWERS, describeReviewerCli, isCliReviewer, reviewerCliBinary, normalizeReviewers, normalizeReviewUsernames, normalizeOptionalReviewers, normalizeReviewerMaxRounds, resolveReviewUsernames, resolveOptionalReviewers, resolveReviewerConfig, reviewerEffortArgs, buildReviewerEffortNote, resolveKeyedReviewers, buildReviewWithArgs, buildReviewersCsv } from '../lib/validation.js';
+import { DEFAULT_REVIEWER, DEFAULT_REVIEWERS, DEFAULT_REVIEW_STOP_MODE, LOCAL_LLM_REVIEWERS, MODEL_CAPABLE_CLI_REVIEWERS, describeReviewerCli, isCliReviewer, reviewerCliBinary, normalizeReviewUsernames, normalizeOptionalReviewers, normalizeReviewerMaxRounds, resolveReviewerConfig, reviewerEffortArgs, buildReviewerEffortNote, resolveKeyedReviewers, buildReviewWithArgs, buildReviewersCsv } from '../lib/validation.js';
import { PROVIDER_TYPES } from '../lib/aiToolkit/constants.js';
import { canTypeSlashCommands, resolveSlashdoInvocation, buildSlashdoSection, unreachableReviewerIncludes, SLASHDO_INLINE_BUDGET_CHARS } from '../lib/slashdoInvocation.js';
import { shellQuote } from '../lib/shellQuote.js';