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

claim-issue: resolve {reviewers} from Code Review Defaults, not hardcoded copilot

[._.]/ Adam Eivy12cb25664b67
diff --git a/server/services/cosTaskGenerator.js b/server/services/cosTaskGenerator.js
index 92214377f8..1cdef20375 100644
--- a/server/services/cosTaskGenerator.js
+++ b/server/services/cosTaskGenerator.js
@@ -36,6 +36,7 @@ import { getActiveApps, getAppTaskTypeOverrides } from './apps.js';
import { getTaskTypeConfidence } from './taskLearning.js';
import { generateProactiveTasks as generateMissionTasks } from './missions.js';
import { isRecoveryTask } from './recoveryTasks.js';
+import { getCodeReviewDefaults } from './codeReview.js';
/**
* Block a task that has exceeded the max spawn limit. Returns true if blocked.
@@ -1383,7 +1384,15 @@ export async function generateManagedAppImprovementTaskForType(taskType, app, st
return null;
}
const planConstraintBlock = buildPlanConstraintBlock(metadata.planId);
- const reviewersCsv = normalizeReviewers(metadata).join(',');
+ // Resolve the `{reviewers}` the agent is told to run. When the task itself
+ // didn't pin reviewers, fall back to the user's PortOS Code Review Defaults
+ // (AI Providers → Code Review Defaults) rather than the hardcoded `copilot` —
+ // otherwise scheduled tasks like claim-issue, whose prompt drives the review
+ // loop directly, would always tell the agent to use Copilot regardless of the
+ // 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(',');
// 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 7496a9889f..6b2859d508 100644
--- a/server/services/cosTaskGenerator.test.js
+++ b/server/services/cosTaskGenerator.test.js
@@ -53,6 +53,24 @@ describe('dry-run hook wiring matches each engine execute path', () => {
});
});
+// The `{reviewers}` prompt token is what tasks like claim-issue use to tell the
+// agent which reviewers to run (the prompt drives the review loop directly, so
+// this IS the operative reviewer list, not just display). It must fall back to
+// the user's PortOS Code Review Defaults when the task didn't pin reviewers —
+// not the bare `normalizeReviewers(metadata)` call, which silently reverts to
+// hardcoded copilot. This guard pins the wiring against that regression.
+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\)/);
+ });
+});
+
describe('exceedsMaxSpawns', () => {
it('is false below the ceiling and true at/above it — no mutation', () => {
expect(exceedsMaxSpawns(task('a', { totalSpawnCount: 0 }))).toBe(false);