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: resolve CoS review-loop reviewer from Code Review Defaults, not hardcoded copilot (#2507)

Adam Eivyf2de545007f4
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 4960cd05cb..4010f5a0fa 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -19,6 +19,7 @@
## Fixed
+- **[issue-2507] CoS app-improve / self-improvement tasks no longer stall waiting on a Copilot review that never arrives.** These scheduled tasks pin no `reviewers`, so the agent-prompt builder resolved the review-loop reviewer straight to the hardcoded `copilot` default — and on installs without GitHub Copilot code review enabled the agent requested a review that never came and idled out in the merge/review-loop phase. The two reviewer-resolution sites in `agentPromptBuilder.js` now thread the install's configured **Code Review Defaults** (`settings.codeReview.reviewers`) as the fallback — the same source the scheduler and review-loop follow-up already honor — so a user who sets `claude,codex,ollama` there has their app-improve tasks use it. With nothing configured, behavior is unchanged (copilot); a settings read error degrades to the hardcoded default.
- **Codex agents no longer idle out when a new codex release is available.** On every interactive startup codex checks for a newer release and, if one exists, renders a blocking "✨ Update available!" modal whose highlighted default is "1. Update now (runs `brew upgrade --cask codex`)". A headless CoS/TUI agent has no human to steer it: the paste handshake's submit-Enter landed on "Update now", codex shelled out to a ~100 MB brew upgrade, and the session ended at "🎉 Update ran successfully! Please restart Codex." — a dead box that never processed the prompt, so the agent idled out reporting "prompt likely never submitted" (observed repeatedly on gpt-5.6-sol codex-tui runs). PortOS now spawns codex with `-c check_for_update_on_startup=false` across every codex spawn path — interactive TUI, the two `codex exec` CLI builders, and the vision-caption path — via a shared `buildCodexStartupArgs` helper (alongside the existing `buildEffortArgs`), so the input box comes up live and no run wastes startup time on an unattended upgrade it can't complete. The override is skipped when a provider already pins the key.
- **Local image gen: fixed a black band at the bottom of Z-Image-Turbo (and other diffusers-runner) outputs.** The shared runner helper unconditionally enabled VAE *tiling*, whose overlap-blend leaves a seam / dark strip at a content-dependent point near the bottom of the image — most visible at tall aspect ratios like 576×1024 (9:16). Tiling only saves memory on very large decodes and the small-to-mid resolutions PortOS renders never need it (the same reason both runners already disable tiling for image-to-image). VAE tiling is now applied only above a ~6.5 MP area floor that no standard or experimental preset reaches, so ordinary renders decode in one clean pass; pathologically large custom dimensions still get tiling as an out-of-memory safety valve. VAE slicing and attention slicing (which never affect spatial layout) stay on for every render.
- **AI Providers warns before enabling the Grok Build CLI/TUI.** The Grok harness uploads your entire working repo to xAI (GCP) as it works. A callout now appears both on the `grok-cli` / `grok-tui` provider cards and in the create/edit form (when the command is `grok`) — before you enable it — telling you to add `[harness]` / `disable_codebase_upload = true` to `~/.grok/config.toml` to keep your code local. The plain `grok` API provider — which doesn't run the harness — is intentionally excluded.
diff --git a/server/services/agentPromptBuilder.js b/server/services/agentPromptBuilder.js
index 702bd7d902..7fe1b2c540 100644
--- a/server/services/agentPromptBuilder.js
+++ b/server/services/agentPromptBuilder.js
@@ -23,6 +23,7 @@ import { shellQuote } from '../lib/shellQuote.js';
import * as jiraService from './jira.js';
import { emitLog } from './cosEvents.js';
import { PORTOS_APP_ID } from './apps.js';
+import { getCodeReviewDefaults } from './codeReview.js';
const ROOT_DIR = PATHS.root;
const AGENTS_DIR = PATHS.cosAgents;
@@ -626,8 +627,20 @@ export async function buildAgentPrompt(task, config, workspaceDir, worktreeInfo
const providerCommand = options.providerCommand || null;
const isTui = providerType === PROVIDER_TYPES.TUI;
+ // Install-wide default reviewer list (Code Review Defaults panel →
+ // `settings.codeReview.reviewers`). Threaded as the `normalizeReviewers`
+ // fallback so a task that pins no `reviewers` (e.g. every app-improve /
+ // self-improvement scheduled task) resolves to the configured default
+ // instead of the hardcoded `copilot` — which stalls the review loop on
+ // installs without GitHub Copilot review enabled (issue #2507). Unset →
+ // `['copilot']` (getCodeReviewDefaults returns the copilot fallback), so
+ // behavior is unchanged when nothing is configured. A settings read error
+ // degrades to the hardcoded default inside normalizeReviewers.
+ const codeReviewDefaults = await getCodeReviewDefaults().catch(() => null);
+ const defaultReviewers = codeReviewDefaults?.reviewers;
+
if (LIGHT_CONTEXT_PROVIDER_TYPES.has(providerType)) {
- const lightOptions = { isTui, providerId, providerCommand, leanMode: options.leanMode === true };
+ const lightOptions = { isTui, providerId, providerCommand, leanMode: options.leanMode === true, defaultReviewers };
return options.split === true
? buildLightContextPromptParts(task, workspaceDir, worktreeInfo, isTruthyMetaFn, lightOptions)
: buildLightContextPrompt(task, workspaceDir, worktreeInfo, isTruthyMetaFn, lightOptions);
@@ -706,9 +719,10 @@ Use the findings from the previous stage to inform your work. If the previous st
After completing your work and before committing, ${simplifyInstruction}. Fix any issues found, then ${worktreeInfo && willOpenPR ? 'commit your changes (do NOT push — on a successful run the system will push and open the PR after you exit; if the run fails, no push or PR happens)' : 'commit and push using `/do:push`'}.
` : '';
- // Resolve the user's ordered reviewer list + flags (default `[copilot]`). Declared
- // up here so the TUI completion block can thread `--review-with …` into `/do:pr`.
- const taskReviewers = normalizeReviewers(task.metadata);
+ // Resolve the user's ordered reviewer list + flags (task metadata wins; else the
+ // install's configured Code Review Defaults; else `[copilot]`). Declared up here
+ // so the TUI completion block can thread `--review-with …` into `/do:pr`.
+ const taskReviewers = normalizeReviewers(task.metadata, defaultReviewers);
const taskReviewerUsernames = normalizeReviewUsernames(task.metadata?.usernames);
const taskOptionalReviewers = normalizeOptionalReviewers(task.metadata?.optionalReviewers) || [];
const taskReviewStopMode = task.metadata?.reviewStopMode || DEFAULT_REVIEW_STOP_MODE;
@@ -968,7 +982,7 @@ export function buildLightContextPromptParts(task, workspaceDir, worktreeInfo, i
const BEGIN_WORKING_LINE = 'Begin working on the task now.';
-function buildLightContextSections(task, workspaceDir, worktreeInfo, isTruthyMetaFn, { isTui = true, providerId = null, providerCommand = null, leanMode = false } = {}) {
+function buildLightContextSections(task, workspaceDir, worktreeInfo, isTruthyMetaFn, { isTui = true, providerId = null, providerCommand = null, leanMode = false, defaultReviewers } = {}) {
// Idempotent with the reconcile in buildAgentPrompt; also protects the
// directly-exported buildLightContextPrompt/Parts entry points.
task = reconcileSplitContext(task);
@@ -979,9 +993,11 @@ function buildLightContextSections(task, workspaceDir, worktreeInfo, isTruthyMet
const discardWorktree = isTruthyMetaFn(task.metadata?.discardWorktree);
const isReviewLoopFollowUp = isTruthyMetaFn(task.metadata?.reviewLoopFollowUp);
const isWorktreeOnExistingBranch = worktreeInfo?.existingBranch === true;
- // Ordered reviewer list + flags for the Review Loop (default `[copilot]`).
- // Flows as `/do:pr --review-with a,b,c [--review-stop-on-*] [--reviewer-applies]`.
- const lightReviewers = normalizeReviewers(task.metadata);
+ // Ordered reviewer list + flags for the Review Loop (task metadata wins; else
+ // the install's configured Code Review Defaults threaded from buildAgentPrompt;
+ // else `[copilot]`). Flows as `/do:pr --review-with a,b,c [--review-stop-on-*]
+ // [--reviewer-applies]`.
+ const lightReviewers = normalizeReviewers(task.metadata, defaultReviewers);
const lightReviewerUsernames = normalizeReviewUsernames(task.metadata?.usernames);
const lightOptionalReviewers = normalizeOptionalReviewers(task.metadata?.optionalReviewers) || [];
const lightReviewStopMode = task.metadata?.reviewStopMode || DEFAULT_REVIEW_STOP_MODE;
diff --git a/server/services/agentPromptBuilder.test.js b/server/services/agentPromptBuilder.test.js
index e0877e486d..3371e0f7d2 100644
--- a/server/services/agentPromptBuilder.test.js
+++ b/server/services/agentPromptBuilder.test.js
@@ -54,8 +54,15 @@ vi.mock('./jira.js', () => ({
tryReadFile: vi.fn().mockResolvedValue(null),
createTicket: vi.fn().mockResolvedValue(null),
}));
+// Code Review Defaults resolver — mocked so tests can control the install-wide
+// default reviewer list threaded into buildAgentPrompt without touching disk.
+// Default matches pickCodeReviewDefaults's unset shape (`['copilot']`).
+vi.mock('./codeReview.js', () => ({
+ getCodeReviewDefaults: vi.fn().mockResolvedValue({ reviewers: ['copilot'] }),
+}));
import { buildLightContextPrompt, buildAgentPrompt, buildCompletionGuidelineBullet, reconcileSplitContext } from './agentPromptBuilder.js';
+import { getCodeReviewDefaults } from './codeReview.js'; // mocked above — control the configured default
import { isTruthyMeta } from './agentState.js';
import { buildPrompt } from './promptService.js'; // mocked above — inspect call args
@@ -1063,3 +1070,46 @@ describe('discardWorktree (reasoning-only) completion contract', () => {
expect(prompt).not.toMatch(/## Simplify Step/);
});
});
+
+// #2507 — CoS app-improve/self-improvement tasks pin no `reviewers`, so the
+// review loop must resolve them from the install's Code Review Defaults
+// (settings.codeReview.reviewers) rather than the hardcoded copilot default,
+// which stalls on installs without GitHub Copilot review enabled.
+describe('buildAgentPrompt — reviewer resolution honors Code Review Defaults (#2507)', () => {
+ const reviewLoopTask = () => makeTask({ metadata: { openPR: true, reviewLoop: true, simplify: false } });
+ // Claude Code CLI keeps the slashdo /do:pr workflow, so the reviewer list
+ // surfaces as `--review-with <csv>` in the completion block.
+ const claudeCliOpts = { providerType: 'cli', providerId: 'claude-code', providerCommand: 'claude' };
+
+ it('threads a configured default reviewer list into --review-with when the task pins none', async () => {
+ vi.mocked(getCodeReviewDefaults).mockResolvedValueOnce({ reviewers: ['claude', 'codex'] });
+ const prompt = await buildAgentPrompt(reviewLoopTask(), {}, '/r', { branchName: 'b', worktreePath: '/tmp/wt' }, isTruthyMeta, claudeCliOpts);
+ expect(prompt).toMatch(/`\/do:pr --review-with claude,codex`/);
+ // The stalling copilot default must not leak in.
+ expect(prompt).not.toMatch(/--review-with copilot/);
+ });
+
+ it('falls back to copilot (unchanged behavior) when no default is configured', async () => {
+ vi.mocked(getCodeReviewDefaults).mockResolvedValueOnce({ reviewers: ['copilot'] });
+ const prompt = await buildAgentPrompt(reviewLoopTask(), {}, '/r', { branchName: 'b', worktreePath: '/tmp/wt' }, isTruthyMeta, claudeCliOpts);
+ // Lone-copilot default is suppressed from --review-with (buildReviewWithArgs
+ // isDefaultOnly), so /do:pr runs without an explicit reviewer flag.
+ expect(prompt).toMatch(/`\/do:pr`/);
+ expect(prompt).not.toMatch(/--review-with claude/);
+ });
+
+ it('a task-pinned reviewer list still wins over the configured default', async () => {
+ vi.mocked(getCodeReviewDefaults).mockResolvedValueOnce({ reviewers: ['claude', 'codex'] });
+ const task = makeTask({ metadata: { openPR: true, reviewLoop: true, simplify: false, reviewers: ['grok'] } });
+ const prompt = await buildAgentPrompt(task, {}, '/r', { branchName: 'b', worktreePath: '/tmp/wt' }, isTruthyMeta, claudeCliOpts);
+ expect(prompt).toMatch(/`\/do:pr --review-with grok`/);
+ expect(prompt).not.toMatch(/--review-with claude/);
+ });
+
+ it('degrades to the hardcoded copilot default when the settings read fails', async () => {
+ vi.mocked(getCodeReviewDefaults).mockRejectedValueOnce(new Error('settings unavailable'));
+ const prompt = await buildAgentPrompt(reviewLoopTask(), {}, '/r', { branchName: 'b', worktreePath: '/tmp/wt' }, isTruthyMeta, claudeCliOpts);
+ expect(prompt).toMatch(/`\/do:pr`/);
+ expect(prompt).not.toMatch(/--review-with claude/);
+ });
+});