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

address review (codex): filter local-LLM reviewers from claim/plan {reviewers} token

[._.]/ Adam Eivy334c0dfe1a29
diff --git a/server/services/cosTaskGenerator.js b/server/services/cosTaskGenerator.js
index 1cdef20375..0c91f9f63a 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 } from '../lib/validation.js';
+import { sanitizeTaskMetadata, PIPELINE_BEHAVIOR_FLAGS, MAX_TOTAL_SPAWNS, normalizeReviewers, LOCAL_LLM_REVIEWERS, DEFAULT_REVIEWERS } 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';
@@ -1392,7 +1392,16 @@ export async function generateManagedAppImprovementTaskForType(taskType, app, st
// user's configured reviewers. Settings I/O failures degrade to the hardcoded
// default inside normalizeReviewers, so a read error never blocks dispatch.
const codeReviewDefaults = await getCodeReviewDefaults().catch(() => null);
- const reviewersCsv = normalizeReviewers(metadata, codeReviewDefaults?.reviewers).join(',');
+ // Drop local-LLM reviewers (lmstudio/ollama) from the prompt's {reviewers}
+ // token: the claim/plan prompt templates only document how to drive copilot
+ // and the CLI reviewers (claude/codex/antigravity). Unlike the system
+ // review-loop follow-up prompt (agentPromptBuilder.js), they carry no
+ // local-endpoint invocation instructions, so naming a local-LLM reviewer
+ // here would stall the agent's review step. Fall through to the hardcoded
+ // copilot default when filtering empties the list.
+ const promptReviewers = normalizeReviewers(metadata, codeReviewDefaults?.reviewers)
+ .filter((r) => !LOCAL_LLM_REVIEWERS.includes(r));
+ const reviewersCsv = (promptReviewers.length ? promptReviewers : [...DEFAULT_REVIEWERS]).join(',');
// claim-issue: expand {issueAuthorFilter} into a concrete directive telling
// the agent which open issues are claimable. The filter was already merged
// (global → per-app override) and value-constrained by sanitizeTaskMetadata,
diff --git a/server/services/cosTaskGenerator.test.js b/server/services/cosTaskGenerator.test.js
index 6b2859d508..78c5be42cc 100644
--- a/server/services/cosTaskGenerator.test.js
+++ b/server/services/cosTaskGenerator.test.js
@@ -62,12 +62,19 @@ describe('dry-run hook wiring matches each engine execute path', () => {
describe('{reviewers} interpolation honors Code Review Defaults', () => {
it('resolves getCodeReviewDefaults and passes them as the normalizeReviewers fallback', () => {
expect(GEN_SRC).toContain("import { getCodeReviewDefaults } from './codeReview.js'");
- const start = GEN_SRC.indexOf('const reviewersCsv =');
- expect(start, 'reviewersCsv must be assigned').toBeGreaterThan(-1);
- const line = GEN_SRC.slice(start, GEN_SRC.indexOf('\n', start));
- expect(line).toContain('normalizeReviewers(metadata, codeReviewDefaults?.reviewers)');
- // The bare two-arg-less form is the bug we are guarding against.
- expect(line).not.toMatch(/normalizeReviewers\(metadata\)/);
+ expect(GEN_SRC).toContain('normalizeReviewers(metadata, codeReviewDefaults?.reviewers)');
+ // The bare two-arg-less form (which silently reverts to hardcoded copilot)
+ // is the bug we are guarding against. `(?!,)` lets the legitimate two-arg
+ // call through while still catching a regression to `normalizeReviewers(metadata)`.
+ expect(GEN_SRC).not.toMatch(/normalizeReviewers\(metadata\)(?!,)/);
+ });
+
+ it('filters local-LLM reviewers out of the prompt token (no invocation instructions in claim/plan prompts)', () => {
+ // lmstudio/ollama defaults must not reach {reviewers}: the claim/plan
+ // prompts can't drive them, so the loop would stall. The filter falls
+ // through to the hardcoded copilot default when it empties the list.
+ expect(GEN_SRC).toContain('.filter((r) => !LOCAL_LLM_REVIEWERS.includes(r))');
+ expect(GEN_SRC).toContain('promptReviewers.length ? promptReviewers : [...DEFAULT_REVIEWERS]');
});
});