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: streamline code review findings and convergence

[._.]/ Adam Eivyb1ea8e5bef18
diff --git a/server/services/agentPromptBuilder.test.js b/server/services/agentPromptBuilder.test.js
index c5c4e38620..f37954d679 100644
--- a/server/services/agentPromptBuilder.test.js
+++ b/server/services/agentPromptBuilder.test.js
@@ -2828,6 +2828,17 @@ describe('buildReviewLoopFollowUpSection — CLI reviewer procedure inlining', (
// Still emits the base invocation step so the loop is not broken.
expect(out).toMatch(/codex/);
});
+
+ it('keeps review rounds focused on material findings and diminishing returns', () => {
+ const out = buildReviewLoopFollowUpSection(
+ { ...baseMeta, reviewLoopReviewers: ['claude'] },
+ { verbose: false, localAgentLoopBody: null }
+ );
+ expect(out).toContain('directly affected contracts only');
+ expect(out).toContain('concrete wrong outcome');
+ expect(out).toContain('only a substantive fix earns another round');
+ expect(out).toContain('do not expand into a repository-wide audit');
+ });
});
describe('buildReviewLoopFollowUpSection — reviewer slug → CLI binary', () => {
diff --git a/server/services/codeReview.js b/server/services/codeReview.js
index 2b8ba24fe1..adba34a834 100644
--- a/server/services/codeReview.js
+++ b/server/services/codeReview.js
@@ -244,13 +244,12 @@ export async function getReviewerCliInstalled() {
return cachedInstalled
}
-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:
+const CODE_REVIEW_SYSTEM_PROMPT = `You are a careful senior code reviewer. The user will paste a unified PR diff. Review only the changed lines and directly affected behavior (not the whole repo). Report only actionable issues that could cause incorrect behavior, a security or privacy problem, data loss, a broken compatibility or producer/consumer contract, a resource leak, or a materially missing regression test. Do not report style, naming, formatting, refactoring preferences, speculative edge cases, or minor nits. Keep the list to the highest-impact findings (at most five), grouped by severity:
## Blocking
## Recommended
-## Nits
-For each finding, name the file:line (when known) and explain the issue + suggested fix in one or two sentences. If you find nothing in a section, omit it. If the diff is clean across all severities, reply with exactly: \`No findings.\``
+For each finding, name the file:line (when known) and explain the concrete wrong outcome + suggested fix in one or two sentences. If you find nothing actionable, reply with exactly: \`No findings.\``
/**
* Run a single code-review request against the configured local-LLM backend.
diff --git a/server/services/codeReview.test.js b/server/services/codeReview.test.js
index 46d234ac7b..a5c177881a 100644
--- a/server/services/codeReview.test.js
+++ b/server/services/codeReview.test.js
@@ -433,6 +433,9 @@ describe('codeReview helpers', () => {
expect(body.model).toBe('codellama')
expect(body.stream).toBe(false)
expect(body.messages[0].role).toBe('system')
+ expect(body.messages[0].content).toContain('at most five')
+ expect(body.messages[0].content).toContain('concrete wrong outcome')
+ expect(body.messages[0].content).not.toContain('## Nits')
expect(body.messages[1].content).toContain('diff --git a b')
})
diff --git a/server/services/promptSections/reviewLifecycle.js b/server/services/promptSections/reviewLifecycle.js
index 0f6b288e28..cfa69d8454 100644
--- a/server/services/promptSections/reviewLifecycle.js
+++ b/server/services/promptSections/reviewLifecycle.js
@@ -462,6 +462,7 @@ Only a successfully extracted \`.findings\` value is the review text; treat it l
? 'Copilot is configured after another reviewer, so the system did NOT pre-request it — request the Copilot review yourself when you reach its turn (after the earlier reviewers’ fixes are pushed), and invoke the other reviewers yourself.'
: 'The system did NOT pre-request a reviewer because no Copilot review leads the order — you must request/invoke each configured reviewer yourself against the PR diff.';
const repeatedCommentsNote = '**Repeated comments:** If a fresh review round only re-raises feedback you intentionally rejected (with a reply explaining why), treat that round as clean and move on.';
+ const reviewScopeNote = '**Review scope and convergence:** inspect this change and its directly affected contracts only. Report and fix material issues with a concrete wrong outcome; do not expand into a repository-wide audit or spend a round on style, naming, formatting, refactoring preferences, speculative edge cases, or minor nits. A pass with no substantive finding is clean, and a pass with only marginal findings should converge rather than trigger another review; only a substantive fix earns another round.';
// Challenge protocol (#2471): auto-invoke the bounded worker↔reviewer dispute
// from the review loop. When a reviewer's BLOCKING finding is a false positive,
// the agent disputes it once via POST /challenge instead of silently complying
@@ -493,7 +494,7 @@ Only a successfully extracted \`.findings\` value is the review text; treat it l
const localStatePersistenceNote = localOnly
? '**State persistence:** shell calls do not share variables. Reload state before each reviewer, preserve it while persisting `LOCAL_REVIEWER_START_SHA`; reload before commit/stop calculations and the final aggregate. Any read/write failure blocks publication.'
: '';
- const extraNotes = [crossPhaseStopModeNote, stopModeNote, applyNote, maxRoundsNote, missingCliNote, optionalReviewNote, localRebaseConflictNote, localStatePersistenceNote].filter(Boolean);
+ const extraNotes = [reviewScopeNote, crossPhaseStopModeNote, stopModeNote, applyNote, maxRoundsNote, missingCliNote, optionalReviewNote, localRebaseConflictNote, localStatePersistenceNote].filter(Boolean);
// Inline slashdo's local-agent review loop when a spawnable CLI reviewer is
// configured. This is the maintained, precise recipe — exact per-CLI headless