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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
show which reviewers a manual claim will actually run, not the install defaults
[._.]/ Adam Eivyc5c604299ea4
diff --git a/client/src/components/apps/SlashDoRunDrawer.jsx b/client/src/components/apps/SlashDoRunDrawer.jsxindex ccbab708d2..297445924a 100644--- a/client/src/components/apps/SlashDoRunDrawer.jsx+++ b/client/src/components/apps/SlashDoRunDrawer.jsx@@ -7,6 +7,7 @@ import useProviderModels from '../../hooks/useProviderModels';import useReviewerModelOptions from '../../hooks/useReviewerModelOptions';import { reviewerModelsFromDefaults, reviewerEffortsFromDefaults } from '../../lib/reviewerModels';import { CodeReviewDefaultsProvider, useCodeReviewDefaults } from '../../hooks/useCodeReviewDefaults';+import useClaimReviewers from '../../hooks/useClaimReviewers';import { isProcessProvider } from '../../utils/providers';import WorkItemPicker from './WorkItemPicker';import * as api from '../../services/api';@@ -30,6 +31,10 @@ const enabledProcessProviderFilter = (p) => Boolean(p?.enabled) && isProcessProv*/function SlashDoRunDrawerBody({ open, command, label, appId, appName, onClose, onQueued }) {const codeReviewDefaults = useCodeReviewDefaults();+ // What a claim actually resolves for this app — the claim-work override layer+ // the defaults above cannot see. Only `/do:next` reads reviewers server-side,+ // so no other command pays for the lookup.+ const claimReviewers = useClaimReviewers(command === 'next' ? appId : null);// Resolved model lists for the reviewer table's Model column (the picker never// fetches — see its `modelOptions` prop).const reviewerModelOptions = useReviewerModelOptions();@@ -42,19 +47,37 @@ function SlashDoRunDrawerBody({ open, command, label, appId, appName, onClose, oconst [effort, setEffort] = useState('');const [simplify, setSimplify] = useState(true);- // Seeded from the install's Code Review Defaults for display. `reviewDirty`- // gates whether they're SENT — see the component doc.+ // Seeded from what the RUN will resolve for display. `review` staying null is+ // what gates whether the fields are SENT — see the component doc.const [review, setReview] = useState(null);+ // Seeded display for an untouched picker. It has to show the reviewers the run+ // would resolve, which is NOT the Code Review Defaults: a claim resolves its+ // claim-work task metadata first and only falls back to them, so an override+ // there runs a chain this drawer previously never showed (a claim reviewed with+ // `codex` while the picker displayed `antigravity`). `claimReviewers` is that+ // resolution; the defaults remain the fallback for the window before it lands+ // and for a lookup that failed — an unresolved lookup must not seed an empty+ // chain, which would read as "no reviewers configured".+ //// The defaults carry per-reviewer models and efforts as `<reviewer>Model` /// `<reviewer>Effort` scalars; the picker takes the token-keyed maps, so fold them- // in for the seeded (untouched) display.+ // in for that fallback.const seededReview = useMemo(- () => ({- ...codeReviewDefaults,- reviewerModels: reviewerModelsFromDefaults(codeReviewDefaults),- reviewerEfforts: reviewerEffortsFromDefaults(codeReviewDefaults),- }),- [codeReviewDefaults]+ () => (claimReviewers.resolved+ ? {+ reviewers: claimReviewers.reviewers,+ usernames: claimReviewers.usernames,+ optionalReviewers: claimReviewers.optionalReviewers,+ reviewerMaxRounds: claimReviewers.reviewerMaxRounds,+ reviewerModels: claimReviewers.reviewerModels,+ reviewerEfforts: claimReviewers.reviewerEfforts,+ }+ : {+ ...codeReviewDefaults,+ reviewerModels: reviewerModelsFromDefaults(codeReviewDefaults),+ reviewerEfforts: reviewerEffortsFromDefaults(codeReviewDefaults),+ }),+ [claimReviewers, codeReviewDefaults]);const reviewValue = review ?? seededReview;@@ -171,6 +194,17 @@ function SlashDoRunDrawerBody({ open, command, label, appId, appName, onClose, oThe claim flow opens and merges its own PR, so these reviewers gate that merge (slashdo <code>--review-with</code>).{!review && ' Leave them untouched to use this app’s configured reviewers.'}</p>+ {/* Which layer supplied the seeded list. A claim-work override wins+ over Models → Code Reviewers silently, so a user who changed the+ install default and sees a different chain here needs to be told+ where it came from — that mismatch is exactly what sent a claim to+ `codex` after the defaults had been moved to `antigravity`. */}+ {!review && claimReviewers.source === 'task-override' && (+ <p className="text-xs text-amber-400/80">+ These come from the <strong>claim-work</strong> task override in Chief of Staff → Schedule, not from+ Models → Code Reviewers. Clear it there (“Use system Code Review Defaults”) to follow the install default again.+ </p>+ )}</>)}</section>diff --git a/client/src/components/apps/SlashDoRunDrawer.test.jsx b/client/src/components/apps/SlashDoRunDrawer.test.jsxindex 2dfbc27bf8..7d451c8aa0 100644--- a/client/src/components/apps/SlashDoRunDrawer.test.jsx+++ b/client/src/components/apps/SlashDoRunDrawer.test.jsx@@ -9,6 +9,9 @@ const api = vi.hoisted(() => ({// Backs the reviewer table's Model column (useReviewerModelOptions).getLocalLlmStatus: vi.fn(),getAppWorkItems: vi.fn(),+ // What the RUN resolves — the claim-work override layer getCodeReviewDefaults+ // cannot see, and what the untouched picker is seeded from.+ getAppClaimReviewers: vi.fn(),createSlashdoTask: vi.fn()}));@@ -49,6 +52,10 @@ describe('SlashDoRunDrawer', () => {reason: 'actionable-issues',transient: false});+ api.getAppClaimReviewers.mockResolvedValue({+ source: 'defaults', reviewers: ['copilot'], usernames: [], optionalReviewers: [],+ reviewerMaxRounds: {}, reviewerModels: {}, reviewerEfforts: {}, csv: 'copilot'+ });api.createSlashdoTask.mockResolvedValue({ id: 'task-1', status: 'pending' });});@@ -70,6 +77,35 @@ describe('SlashDoRunDrawer', () => {expect(settings.reviewers).toBeUndefined();});+ // The bug this seeding fixes: the picker used to display the Code Review+ // Defaults, which do NOT include the claim-work task override the run resolves+ // FIRST. A user who had moved the install default to `antigravity` saw+ // `antigravity` here while every claim actually reviewed with codex + claude.+ it('seeds the untouched picker from the reviewers the RUN resolves, not the install defaults', async () => {+ api.getCodeReviewDefaults.mockResolvedValue({ reviewers: ['antigravity'], usernames: [], optionalReviewers: [] });+ api.getAppClaimReviewers.mockResolvedValue({+ source: 'task-override', reviewers: ['codex', 'claude'], usernames: [], optionalReviewers: [],+ reviewerMaxRounds: {}, reviewerModels: {}, reviewerEfforts: {}, csv: 'codex,claude'+ });++ renderDrawer();++ // Selected reviewers render as Remove buttons; unselected ones as Add.+ await waitFor(() => expect(screen.getByRole('button', { name: /Remove Codex/ })).toBeInTheDocument());+ expect(screen.getByRole('button', { name: /Remove Claude/ })).toBeInTheDocument();+ expect(screen.queryByRole('button', { name: /Remove Antigravity/ })).not.toBeInTheDocument();+ // …and the user is told WHERE that list comes from, since it isn't the panel+ // they would go to in order to change it.+ expect(screen.getByText(/claim-work/)).toBeInTheDocument();+ });++ it('does not blame a claim-work override when the reviewers came from the install defaults', async () => {+ renderDrawer();++ await waitFor(() => expect(screen.getByText('Reviewers (in order):')).toBeInTheDocument());+ expect(screen.queryByText(/claim-work/)).not.toBeInTheDocument();+ });+it('sends the reviewer list only once the user edits it', async () => {const onQueued = vi.fn();renderDrawer({ onQueued });diff --git a/client/src/components/apps/tabs/IssuesTab.jsx b/client/src/components/apps/tabs/IssuesTab.jsxindex 572e0fc817..5ed74cd409 100644--- a/client/src/components/apps/tabs/IssuesTab.jsx+++ b/client/src/components/apps/tabs/IssuesTab.jsx@@ -12,6 +12,7 @@ import ProviderModelSelector from '../../ProviderModelSelector';import { useThemeContext } from '../../ThemeContext';import { useCosTaskUpdates } from '../../../hooks/useCosTaskUpdates';import useProviderModels from '../../../hooks/useProviderModels';+import useClaimReviewers from '../../../hooks/useClaimReviewers';import { chipColors } from '../../../lib/chipContrast';import { isProcessProvider } from '../../../utils/providers';import * as api from '../../../services/api';@@ -241,8 +242,10 @@ export default function IssuesTab({ appId, appName }) {// Page-level provider/model/effort pin for every Claim AND Replan button on this tab —// left untouched (blank), a claim resolves the install's active provider,// same as the bare button always did (POST /tasks/slashdo -> resolveAgentProviderAndModel;- // this manual path does NOT consult the app's scheduled claim-work override —- // that's a separate resolution used only by the automated claim-work task).+ // this manual path does NOT consult the app's scheduled claim-work override for+ // the PROVIDER — that pin is read only by the automated claim-work task).+ // Scoped to the provider deliberately: the REVIEWERS below do come from that+ // override, which is precisely the mismatch `claimReviewers` exists to surface.// This picker never persists across a reload; it's a session convenience for// "claim the next several issues with model X" without reopening the Agent// Operations drawer each time.@@ -252,6 +255,13 @@ export default function IssuesTab({ appId, appName }) {} = useProviderModels({ filter: enabledProcessProviderFilter, allowDefault: true, silent: true, withEffort: true });const [effort, setEffort] = useState('');const [overrideContext, setOverrideContext] = useState('');+ // The reviewers a Claim launched from this tab will actually run. This tab+ // offers no reviewer picker, so the resolution was previously invisible here —+ // and it is NOT the Models → Code Reviewers list a user would assume: a+ // claim-work task override wins over it, which is how a claim from this tab+ // reviewed with `codex` after the install default had been changed. Surfaced+ // read-only next to the provider pin, with its source named.+ const claimReviewers = useClaimReviewers(appId);// Keep the event-driven path based on the latest runs without putting a// mutable state snapshot in its effect dependencies. Socket callbacks can@@ -575,6 +585,23 @@ export default function IssuesTab({ appId, appName }) {/></div></div>+ {claimReviewers.resolved && (+ <div className="flex flex-col sm:flex-row sm:items-center gap-2">+ <span className="flex items-center gap-1.5 text-xs text-gray-500 uppercase tracking-wide shrink-0">+ <ClipboardCheck size={14} /> Reviewed by+ </span>+ <p className="flex-1 text-xs text-gray-400">+ {claimReviewers.reviewers.length+ ? <code className="text-gray-300">{claimReviewers.csv || claimReviewers.reviewers.join(',')}</code>+ : 'No reviewers resolve for this app.'}+ {claimReviewers.source === 'task-override'+ ? <> — from the <strong className="text-amber-400/90">claim-work</strong> task override in{' '}+ <Link to="/cos/schedule" className="text-port-accent hover:underline">Chief of Staff → Schedule</Link>,+ not Models → Code Reviewers. Clear it there to follow the install default.</>+ : <> — from <Link to="/models/code-reviewers" className="text-port-accent hover:underline">Models → Code Reviewers</Link>.</>}+ </p>+ </div>+ )}<div className="space-y-1"><label htmlFor={overrideContextId} className="block text-xs text-gray-400">Override context or instructions <span className="text-gray-600">(optional)</span>diff --git a/client/src/components/apps/tabs/IssuesTab.test.jsx b/client/src/components/apps/tabs/IssuesTab.test.jsxindex 7750c00c11..b069f5bf9b 100644--- a/client/src/components/apps/tabs/IssuesTab.test.jsx+++ b/client/src/components/apps/tabs/IssuesTab.test.jsx@@ -29,6 +29,9 @@ vi.mock('../../../services/api', () => ({getAppIssues: vi.fn(),createSlashdoTask: vi.fn(),getProviders: vi.fn(),+ // The tab reads the reviewers a claim will actually run so it can name them+ // (and say whether a claim-work override supplied them).+ getAppClaimReviewers: vi.fn(),}));import * as api from '../../../services/api';@@ -77,6 +80,10 @@ beforeEach(() => {api.getAppIssues.mockResolvedValue(okPayload([ISSUE]));api.createSlashdoTask.mockResolvedValue({ id: 'task-1' });api.getProviders.mockResolvedValue({ providers: [] });+ api.getAppClaimReviewers.mockResolvedValue({+ source: 'defaults', reviewers: ['antigravity'], usernames: [], optionalReviewers: [],+ reviewerMaxRounds: {}, reviewerModels: {}, reviewerEfforts: {}, csv: 'antigravity',+ });});afterEach(() => {@@ -267,6 +274,42 @@ describe('IssuesTab', () => {expect(screen.getByRole('link', { name: /Active/ })).toBeInTheDocument();});+ // This tab offers no reviewer picker, so before it named them the reviewer+ // chain a Claim would run was invisible here — and it is not the Code+ // Reviewers panel's list whenever a claim-work override exists. That gap sent+ // claims to codex + claude for weeks after the install default had been moved.+ it('names the reviewers a Claim will run, and blames the claim-work override that supplied them', async () => {+ api.getAppClaimReviewers.mockResolvedValue({+ source: 'task-override', reviewers: ['codex', 'claude'], usernames: [], optionalReviewers: [],+ reviewerMaxRounds: {}, reviewerModels: {}, reviewerEfforts: {}, csv: 'codex,claude',+ });++ await renderTab();++ expect(await screen.findByText('codex,claude')).toBeInTheDocument();+ expect(screen.getByText(/claim-work/)).toBeInTheDocument();+ expect(screen.getByRole('link', { name: /Chief of Staff/ })).toHaveAttribute('href', '/cos/schedule');+ });++ it('points at the Code Reviewers panel when no override is in play', async () => {+ await renderTab();++ expect(await screen.findByText('antigravity')).toBeInTheDocument();+ expect(screen.queryByText(/claim-work/)).not.toBeInTheDocument();+ expect(screen.getByRole('link', { name: /Code Reviewers/ })).toHaveAttribute('href', '/models/code-reviewers');+ });++ it('says nothing about reviewers when the lookup failed, rather than implying none are configured', async () => {+ // "couldn't ask" and "nothing configured" must not collapse — an empty chain+ // rendered here would read as a claim that merges with no review at all.+ api.getAppClaimReviewers.mockRejectedValue(new Error('offline'));++ await renderTab();++ expect(await screen.findByText('Crash on save')).toBeInTheDocument();+ expect(screen.queryByText('Reviewed by')).not.toBeInTheDocument();+ });+it('sends the page-level provider/model/effort pin along with a claim', async () => {api.getProviders.mockResolvedValue({providers: [{diff --git a/client/src/components/cos/constants.js b/client/src/components/cos/constants.jsindex b2ee6a756d..ba06b8bb02 100644--- a/client/src/components/cos/constants.js+++ b/client/src/components/cos/constants.js@@ -335,6 +335,7 @@ export {MAX_REVIEWER_MAX_ROUNDS,REVIEW_STOP_MODES,DEFAULT_REVIEW_STOP_MODE,+ REVIEWER_OVERRIDE_KEYS,normalizeReviewers,MODEL_CAPABLE_CLI_REVIEWERS,LOCAL_LLM_REVIEWERS,diff --git a/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx b/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsxindex 9ca93ca0bd..4f125f53c0 100644--- a/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx+++ b/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx@@ -2,7 +2,7 @@ import { useState, useEffect, useMemo } from 'react';import useFieldDraft from '../../../../hooks/useFieldDraft';import { RotateCcw, AlertCircle } from 'lucide-react';import CronInput from '../../../CronInput';-import { AGENT_OPTIONS, BRANCHES_PER_AGENT_DEFAULT, BRANCHES_PER_AGENT_OPTIONS, BRANCHES_PER_AGENT_TASK_TYPES, DEFAULT_REVIEW_STOP_MODE, IMPLICIT_PR_COMPLETION, PR_AUTHOR_FILTER_OPTIONS, PR_COMPLETION_OPTIONS, pinnedPrCompletion, prCompletionOption, ISSUE_AUTHOR_FILTER_OPTIONS, ISSUE_AUTHOR_FILTER_TASK_TYPES, SWARM_COUNT_OPTIONS, SWARM_TASK_TYPES } from '../../constants';+import { AGENT_OPTIONS, BRANCHES_PER_AGENT_DEFAULT, BRANCHES_PER_AGENT_OPTIONS, BRANCHES_PER_AGENT_TASK_TYPES, DEFAULT_REVIEW_STOP_MODE, REVIEWER_OVERRIDE_KEYS, IMPLICIT_PR_COMPLETION, PR_AUTHOR_FILTER_OPTIONS, PR_COMPLETION_OPTIONS, pinnedPrCompletion, prCompletionOption, ISSUE_AUTHOR_FILTER_OPTIONS, ISSUE_AUTHOR_FILTER_TASK_TYPES, SWARM_COUNT_OPTIONS, SWARM_TASK_TYPES } from '../../constants';import ReviewerPicker from '../../ReviewerPicker';import Banner from '../../../ui/Banner';import InfoTooltip from '../../../ui/InfoTooltip';@@ -27,18 +27,11 @@ const PR_COMPLETION_INHERIT_HINT = `Uses the target app's "After opening PR" def// These fields are the task-local reviewer-loop override. Removing them lets// the picker and server resolver fall back to the install-wide Code Review-// Defaults without changing the task's PR policy or other agent options.-const REVIEW_CONFIG_KEYS = [- 'reviewer',- 'reviewers',- 'usernames',- 'optionalReviewers',- 'reviewerMaxRounds',- 'reviewerModels',- 'reviewerEfforts',- 'reviewStopMode',- 'reviewerApplies',-];+// Defaults without changing the task's PR policy or other agent options. The+// roster is the shared REVIEWER_OVERRIDE_KEYS, so the reset button clears+// exactly what the server counts as an override when it reports which layer a+// claim run's reviewers came from.+const REVIEW_CONFIG_KEYS = REVIEWER_OVERRIDE_KEYS;export default function GlobalConfigControls({ taskType, config, onUpdate, onTrigger, category: _category, providers, providersLoaded = true, activeProviderId, apps, updating, setUpdating, allTaskTypes, improvementDisabled, dataInputCatalog }) {const reviewDefaults = useCodeReviewDefaults();diff --git a/client/src/hooks/README.md b/client/src/hooks/README.mdindex 74710729ab..60db94d25f 100644--- a/client/src/hooks/README.md+++ b/client/src/hooks/README.md@@ -165,6 +165,7 @@ grep -i "what you want to do" client/src/hooks/README.md| `useTaskModelPins` | Provider/model/effort pins for one CoS scheduled task: optimistic write per change (`'' → null` clears; picking a provider clears model+effort, picking a model clears the effort only when that model has no tiers at all), rollback when `onUpdate` resolves falsy, a `saving` flag to gate "Run Now", plus the derived `availableModels` (Antigravity base models, stale pin kept selectable), `effectiveProviderId` and `defaultProviderLabel` a `ProviderModelSelector` needs. | Any surface that retargets a scheduled task's model (schedule card quick controls, config drawer Global defaults) — don't re-roll the select/PUT/rollback trio. || `useCanonPatch` | Optimistic canon-entry patch: rebuild the kind list with one entry mutated, apply locally, PATCH the universe, re-apply the server copy. Targets + staleness-guards on the loaded record's `universe.id` so a mid-flight universe swap can't cross-PATCH or resurrect stale state. `apply` is `setUniverse` or `onUniverseChange`. | Inline canon-field edits on a universe (UniverseCanonSection, NounsStage). Don't re-roll the optimistic-then-confirm dance. || `useColorMatch` | Drives a song color-match run: counts the singer in with the metronome, walks the notated score in tempo, grades each note against the live mic pitch (#1022 tracker + colorMatch lib), and exposes `{ running, countingIn, noteColors, summary, activeIndex, start, stop }` for the `<ScoreSheet>` + an accuracy readout. Taps the passed recording stream (no second mic); tears down on stop/unmount. | The Song editor's color-match panel. Don't re-wire the metronome + tracker + grading loop by hand. |+| `useClaimReviewers` | The reviewers a `/do:next` claim will ACTUALLY run for one app — claim-work task metadata resolved OVER the Code Review Defaults, with `source` naming the layer that won. Stays `resolved: false` on a failed lookup so "couldn't ask" never reads as "nothing configured". | Any claim launcher (SlashDoRunDrawer, IssuesTab). `useCodeReviewDefaults` can't see a claim-work override and would show reviewers the run won't use. || `useCodeReviewDefaults` | Global Code Review Defaults (Review Loop reviewer chain + every per-reviewer `<reviewer>Model` / `<reviewer>Effort` pin scalar) via a small Provider/hook pair. | TaskAddForm, ScheduleTab, anywhere a default reviewer picker is shown. || `useCatalogTypes` | Catalog ingredient type registry (system + user-defined) merged with the static fallback via a Provider/hook pair; synchronous fallback to the built-in six so first render never blanks. | Catalog list/picker/editor; anywhere the catalog type list/lookup is needed. || `useDeathClock` | 1-second countdown for death-clock display. | Mortality / death-clock surfaces. |diff --git a/client/src/hooks/index.js b/client/src/hooks/index.jsindex 3f95bbd845..c7ab19603f 100644--- a/client/src/hooks/index.js+++ b/client/src/hooks/index.js@@ -138,6 +138,7 @@ export * from './useMediaCompletionRefresh.js';export * from './useOpenClawAttachments.js';// === Settings-derived shared state ===+export { default as useClaimReviewers } from './useClaimReviewers.js';export * from './useCodeReviewDefaults.jsx';export { default as useCatalogTypes } from './useCatalogTypes.jsx';export * from './useCatalogTypes.jsx';diff --git a/client/src/hooks/useClaimReviewers.js b/client/src/hooks/useClaimReviewers.jsnew file mode 100644index 0000000000..0a079fd404--- /dev/null+++ b/client/src/hooks/useClaimReviewers.js@@ -0,0 +1,65 @@+import { useEffect, useState } from 'react';+import * as api from '../services/api';++// Sentinel shape while the lookup is in flight or has failed. `reviewers: null`+// is deliberately NOT `[]` — an empty array is a real answer ("this app resolves+// to no reviewers") and a caller that seeds a picker from it would render an+// empty chain as though it were configured. Callers gate on `resolved`.+const PENDING = Object.freeze({+ resolved: false,+ source: null,+ reviewers: null,+ usernames: [],+ optionalReviewers: [],+ reviewerMaxRounds: {},+ reviewerModels: {},+ reviewerEfforts: {},+ csv: ''+});++/**+ * The reviewers a `/do:next` claim will ACTUALLY run for `appId`.+ *+ * Distinct from `useCodeReviewDefaults`, and the distinction is the whole point:+ * the defaults hook reads Models → Code Reviewers, while a claim resolves its+ * reviewers as claim-work task metadata FIRST and only falls back to those+ * defaults. A `claim-work` reviewer override therefore runs a chain the defaults+ * hook cannot see — which is how a claim launched from the Issues tab came to+ * review with `codex` while every reviewer control on screen showed+ * `antigravity`. Seed claim surfaces from here; `source` says which layer won.+ *+ * A failed lookup stays `resolved: false` rather than reporting an empty chain —+ * "couldn't ask" and "nothing configured" must not collapse. Fetches once per+ * mount; a claim drawer is mounted only while open, which is the refresh.+ */+export default function useClaimReviewers(appId) {+ const [value, setValue] = useState(PENDING);++ useEffect(() => {+ if (!appId) {+ setValue(PENDING);+ return undefined;+ }+ let cancelled = false;+ setValue(PENDING);+ api.getAppClaimReviewers(appId)+ .then((data) => {+ if (cancelled || !Array.isArray(data?.reviewers)) return;+ setValue({+ resolved: true,+ source: data.source || null,+ reviewers: data.reviewers,+ usernames: Array.isArray(data.usernames) ? data.usernames : [],+ optionalReviewers: Array.isArray(data.optionalReviewers) ? data.optionalReviewers : [],+ reviewerMaxRounds: data.reviewerMaxRounds || {},+ reviewerModels: data.reviewerModels || {},+ reviewerEfforts: data.reviewerEfforts || {},+ csv: data.csv || ''+ });+ })+ .catch(() => {});+ return () => { cancelled = true; };+ }, [appId]);++ return value;+}diff --git a/client/src/lib/reviewerPins.js b/client/src/lib/reviewerPins.jsindex 751c91b456..c103d294e4 100644--- a/client/src/lib/reviewerPins.js+++ b/client/src/lib/reviewerPins.js@@ -191,6 +191,25 @@ export const REVIEW_STOP_MODES = [];export const DEFAULT_REVIEW_STOP_MODE = 'all';+// The task-metadata keys that together form a task-local reviewer override —+// mirror of REVIEWER_OVERRIDE_KEYS. A task type carrying any of them has pinned+// its own reviewers and no longer tracks the install-wide Code Review Defaults,+// which is what the picker's "Use system Code Review Defaults" reset clears. A+// key missing here leaves that reset visible after it has already removed+// everything it knows about, and leaves the removed key silently pinning a+// reviewer the user thinks they just cleared.+export const REVIEWER_OVERRIDE_KEYS = Object.freeze([+ 'reviewer',+ 'reviewers',+ 'usernames',+ 'optionalReviewers',+ 'reviewerMaxRounds',+ 'reviewerModels',+ 'reviewerEfforts',+ 'reviewStopMode',+ 'reviewerApplies',+]);+// Resolve task metadata to an ordered, deduped reviewer list (mirror of the// server's normalizeReviewers): prefers `reviewers`, falls back to the legacy// single `reviewer`, defaults to DEFAULT_REVIEWERS.diff --git a/client/src/services/apiApps.js b/client/src/services/apiApps.jsindex 3d24513172..57a5b12859 100644--- a/client/src/services/apiApps.js+++ b/client/src/services/apiApps.js@@ -33,6 +33,17 @@ export const getAppWorkItems = (id, { issueAuthorFilter } = {}, options) => {const qs = issueAuthorFilter ? `?issueAuthorFilter=${encodeURIComponent(issueAuthorFilter)}` : '';return request(`/apps/${id}/work-items${qs}`, { silent: true, ...options });};+// The reviewers a `/do:next` claim will ACTUALLY run for this app, resolved+// server-side through the claim-work task metadata AND the install-wide Code+// Review Defaults: `{ source, reviewers, usernames, optionalReviewers,+// reviewerMaxRounds, reviewerModels, reviewerEfforts, csv }`. `source` is+// 'task-override' when a claim-work override supplied the list (the defaults+// were never consulted) or 'defaults' when it came from Settings → Code+// Reviewers. Seed a claim surface from THIS, not from getCodeReviewDefaults —+// the latter can't see the override and so shows reviewers the run won't use.+// Read-only; callers own their fallback, so default to silent.+export const getAppClaimReviewers = (id, options) =>+ request(`/apps/${id}/claim-reviewers`, { silent: true, ...options });// Every OPEN issue on the forge this app's git origin points at (GitHub via gh,// GitLab via glab): { forge, fullName, issues: [{ number, title, body, labels,// assignees, author, url, createdAt, updatedAt }], reason, transient }. Backs thediff --git a/server/lib/apiRouteCatalog.generated.json b/server/lib/apiRouteCatalog.generated.jsonindex f368f055ab..d06e1fbbfe 100644--- a/server/lib/apiRouteCatalog.generated.json+++ b/server/lib/apiRouteCatalog.generated.json@@ -966,6 +966,14 @@"server/routes/apps/lifecycle.js"]},+ {+ "method": "GET",+ "path": "/api/apps/:id/claim-reviewers",+ "mountPath": "/api/apps",+ "sources": [+ "server/routes/apps/taskTypes.js"+ ]+ },{"method": "POST","path": "/api/apps/:id/detect-icon",diff --git a/server/lib/reviewerConfig.js b/server/lib/reviewerConfig.jsindex 6b13e18781..ed5042bbf7 100644--- a/server/lib/reviewerConfig.js+++ b/server/lib/reviewerConfig.js@@ -178,6 +178,37 @@ export function describeReviewerCli(reviewer) {export const REVIEW_STOP_MODES = ['all', 'on-findings', 'on-clean'];export const DEFAULT_REVIEW_STOP_MODE = 'all';+// The task-metadata keys that TOGETHER form a task-local reviewer override. A+// task type carrying ANY of them has pinned its own reviewers and no longer+// tracks the install-wide Code Review Defaults — which is the point of the+// override, and also the reason a claim launched from the UI can name a reviewer+// the Code Reviewers panel no longer lists. One roster so the resolver, the `source`+// claim-reviewer lookup reports, and the picker's "Use system Code Review+// Defaults" reset all agree on what counts as an override.+// Mirrored in client/src/lib/reviewerPins.js.+export const REVIEWER_OVERRIDE_KEYS = Object.freeze([+ // Legacy singular, still stored on schedules saved before the list existed.+ 'reviewer',+ 'reviewers',+ 'usernames',+ 'optionalReviewers',+ 'reviewerMaxRounds',+ 'reviewerModels',+ 'reviewerEfforts',+ 'reviewStopMode',+ 'reviewerApplies',+]);++/**+ * Does this task metadata pin its own reviewers? Key PRESENCE is the signal, not+ * truthiness: an explicitly empty `optionalReviewers: []` or `reviewerModels: {}`+ * is a real override (it clears the defaults' value), so collapsing it into+ * "nothing configured" would report the wrong source.+ */+export function hasReviewerOverride(metadata) {+ return isPlainObject(metadata) && REVIEWER_OVERRIDE_KEYS.some((key) => key in metadata);+}+// Arbitrary GitHub reviewer usernames (e.g. `@CodeReviewbot`) requested as PR// reviewers to gate merging — a class distinct from the fixed REVIEWER_VALUES// enum (which either invoke a CLI, hit the local-LLM endpoint, or request thediff --git a/server/lib/reviewerConfig.test.js b/server/lib/reviewerConfig.test.jsindex e14d087148..342da4f689 100644--- a/server/lib/reviewerConfig.test.js+++ b/server/lib/reviewerConfig.test.js@@ -34,6 +34,8 @@ import {PORTOS_ONLY_REVIEWERS,DEFAULT_REVIEWERS,REVIEW_STOP_MODES,+ REVIEWER_OVERRIDE_KEYS,+ hasReviewerOverride,DEFAULT_REVIEW_STOP_MODE,MAX_REVIEW_USERNAMES,MAX_REVIEWER_MAX_ROUNDS,@@ -437,6 +439,16 @@ describe('client mirror of the reviewer vocabulary', () => {expect(client.MAX_REVIEW_USERNAMES).toBe(MAX_REVIEW_USERNAMES);});+ // The override roster decides two things that must agree: the picker's "Use+ // system Code Review Defaults" reset (client) removes exactly these keys, and+ // the claim-reviewer lookup (server) calls a task an override when any is+ // present. A key on one side only means the reset leaves a pin behind while+ // the lookup keeps reporting `task-override` for a task the user just cleared.+ it('matches the server reviewer-override key roster', async () => {+ const client = await import('../../client/src/lib/reviewerPins.js');+ expect(client.REVIEWER_OVERRIDE_KEYS).toEqual([...REVIEWER_OVERRIDE_KEYS]);+ });+// Stop modes: the client rows carry UI copy, but their `value`s are the enum// the save is validated against. An extra row 400s the whole task update.it('matches the server review stop modes', async () => {@@ -789,3 +801,37 @@ describe('codeReviewDefaultsFromProvider', () => {expect(codeReviewDefaultsFromProvider(null)).toBeNull();});});++// `hasReviewerOverride` is what a claim-reviewer lookup reports as its `source`,+// and the user acts on that answer ("clear the override" vs "change the+// defaults"). The interesting cases are the ones truthiness gets wrong.+describe('hasReviewerOverride', () => {+ it('reports an override for any single reviewer key, including the legacy singular', () => {+ for (const key of REVIEWER_OVERRIDE_KEYS) {+ expect(hasReviewerOverride({ [key]: undefined })).toBe(true);+ }+ expect(hasReviewerOverride({ reviewer: 'codex' })).toBe(true);+ });++ it('treats an explicitly EMPTY pin as an override — it clears the defaults value', () => {+ // `[]`/`{}` are the shape a user gets by unmarking every optional reviewer or+ // clearing every model pin. Gating on truthiness would call that "unset" and+ // send the user to the Code Reviewers panel, which is not where the value+ // they are seeing comes from.+ expect(hasReviewerOverride({ optionalReviewers: [] })).toBe(true);+ expect(hasReviewerOverride({ reviewerModels: {} })).toBe(true);+ expect(hasReviewerOverride({ reviewerApplies: false })).toBe(true);+ expect(hasReviewerOverride({ reviewerMaxRounds: {} })).toBe(true);+ });++ it('reports no override for task metadata that only carries non-reviewer options', () => {+ expect(hasReviewerOverride({ useWorktree: false, openPR: false, claimFlow: true, simplify: true })).toBe(false);+ expect(hasReviewerOverride({ reviewLoop: true, issueAuthorFilter: 'owner' })).toBe(false);+ });++ it('reports no override for a non-object', () => {+ for (const value of [null, undefined, [], 'reviewers', 7]) {+ expect(hasReviewerOverride(value)).toBe(false);+ }+ });+});diff --git a/server/routes/apps/taskTypes.js b/server/routes/apps/taskTypes.jsindex 5e9b5aa8f4..5f37ae84f3 100644--- a/server/routes/apps/taskTypes.js+++ b/server/routes/apps/taskTypes.js@@ -6,6 +6,7 @@* GET /:id/task-types → { taskTypeOverrides }* GET /:id/work-tracker → { tracker info }* GET /:id/work-items → { tracker, items, reason }+ * GET /:id/claim-reviewers → { source, reviewers, csv, … }* GET /:id/layered-intelligence → { config, isPortos }* GET /:id/layered-intelligence/outcomes → { stats, execution, metrics, approvalFunnel, rejections, recent }* PUT /:id/task-types/all → { success, taskTypeOverrides }@@ -19,9 +20,10 @@ import { Router } from 'express';import { logCosScheduleUpdate } from '../../services/userActionScheduleLog.js';import * as appsService from '../../services/apps.js';import { PORTOS_APP_ID } from '../../services/apps.js';-import { sanitizeTaskMetadata, ISSUE_AUTHOR_FILTERS } from '../../lib/validation.js';+import { sanitizeTaskMetadata, ISSUE_AUTHOR_FILTERS, resolveClaimReviewerConfig, hasReviewerOverride } from '../../lib/validation.js';import { listWorkItems } from '../../services/workItems.js';import { resolveClaimWorkMetadata, resolveClaimAuthorFilter } from '../../services/cosTaskGenerator.js';+import { getCodeReviewDefaults } from '../../services/codeReview.js';import { parseCronToNextRun } from '../../services/eventScheduler.js';import { INTERVAL_TYPES, decodeIntervalType, isCronExpression, isKnownIntervalType } from '../../services/taskScheduleConstants.js';import { asyncHandler, ServerError } from '../../lib/errorHandler.js';@@ -96,6 +98,46 @@ router.get('/:id/work-items', loadApp, asyncHandler(async (req, res) => {res.json({ appId: app.id, appName: app.name, issueAuthorFilter, ...result });}));+// GET /api/apps/:id/claim-reviewers - The reviewers a `/do:next` claim will+// ACTUALLY run for this app, resolved through the same+// `resolveClaimWorkMetadata` → `resolveClaimReviewerConfig` chain+// `buildClaimWorkTask` uses to fill the claim prompt's `{reviewers}` token.+//+// The manual claim surfaces used to seed their reviewer display straight from+// `GET /api/code-review/defaults`, which skips the claim-work task metadata+// layer entirely. A `claim-work` override left over from an earlier reviewer+// choice therefore ran reviewers the Code Reviewers panel no longer listed, with the+// drawer confidently showing the panel's list — so the run named `codex` while+// the UI said `antigravity`. `source` is what makes that visible: `task-override`+// means an override supplied the list and the install defaults were not+// consulted, `defaults` means they were.+//+// Read-only: metadata + settings reads, no claim markers, no LLM call.+router.get('/:id/claim-reviewers', loadApp, asyncHandler(async (req, res) => {+ const app = req.loadedApp;+ // Independent reads — the resolver needs both, but neither depends on the other.+ const [{ metadata }, codeReviewDefaults] = await Promise.all([+ resolveClaimWorkMetadata(app),+ // A settings read failure means "no configured defaults", never a failed+ // lookup: the resolver still answers from the task metadata, which is the+ // layer that wins anyway.+ getCodeReviewDefaults().catch(() => null)+ ]);+ const config = resolveClaimReviewerConfig(metadata, codeReviewDefaults, codeReviewDefaults?.reviewers);+ res.json({+ appId: app.id,+ appName: app.name,+ source: hasReviewerOverride(metadata) ? 'task-override' : 'defaults',+ reviewers: config.reviewers,+ usernames: config.usernames,+ optionalReviewers: config.optionalReviewers,+ reviewerMaxRounds: config.reviewerMaxRounds,+ reviewerModels: config.reviewerModels,+ reviewerEfforts: config.reviewerEfforts,+ csv: config.csv+ });+}));+// GET /api/apps/:id/layered-intelligence - Effective Layered Intelligence config// for this app (the self-improvement loop). Merges the app's stored partial// config over the shipped defaults so the UI always renders a complete, safediff --git a/server/routes/apps/taskTypes.test.js b/server/routes/apps/taskTypes.test.jsindex 9900a276be..feb70ec192 100644--- a/server/routes/apps/taskTypes.test.js+++ b/server/routes/apps/taskTypes.test.js@@ -36,11 +36,18 @@ vi.mock('../../services/cosTaskGenerator.js', async (importActual) => ({...(await importActual()),resolveClaimWorkMetadata: vi.fn()}));+// Only the settings READ is mocked; resolveClaimReviewerConfig (the layer+// precedence, the copilot guard, and the emitted CSV) runs for real, so these+// assert the reviewers a claim would genuinely get rather than a restated stub.+vi.mock('../../services/codeReview.js', () => ({+ getCodeReviewDefaults: vi.fn()+}));import * as appsService from '../../services/apps.js';import { listOutcomesResult } from '../../services/layeredIntelligenceOutcomes.js';import { listWorkItems } from '../../services/workItems.js';import { resolveClaimWorkMetadata } from '../../services/cosTaskGenerator.js';+import { getCodeReviewDefaults } from '../../services/codeReview.js';describe('Apps Task-Type Routes', () => {let app;@@ -115,6 +122,73 @@ describe('Apps Task-Type Routes', () => {});});+ // The reviewer chain a manual claim runs is resolved from TWO layers, and the+ // whole point of this route is that the second one can be invisible: a+ // claim-work task override wins over the install-wide Code Review Defaults, so+ // a UI seeded from the defaults alone shows reviewers the run will not use.+ describe('GET /api/apps/:id/claim-reviewers', () => {+ beforeEach(() => {+ appsService.getAppById.mockResolvedValue({ id: 'app-001', name: 'App' });+ getCodeReviewDefaults.mockResolvedValue({ reviewers: ['antigravity'], antigravityModel: 'gemini-3.8-flash' });+ });++ it('answers from the Code Review Defaults, marked `defaults`, when the task pins nothing', async () => {+ resolveClaimWorkMetadata.mockResolvedValue({ metadata: { useWorktree: false, claimFlow: true }, interval: {} });++ const response = await request(app).get('/api/apps/app-001/claim-reviewers');++ expect(response.status).toBe(200);+ expect(response.body.source).toBe('defaults');+ expect(response.body.reviewers).toEqual(['antigravity']);+ expect(response.body.csv).toBe('antigravity[gemini-3.8-flash]');+ });++ it('reports the claim-work override that WINS over the defaults, marked `task-override`', async () => {+ // The #6202 shape: the install default had been moved to `antigravity`, but a+ // claim-work override saved months earlier still named codex + claude, so+ // every manual claim reviewed with those while every reviewer control on+ // screen showed `antigravity`.+ resolveClaimWorkMetadata.mockResolvedValue({+ metadata: { claimFlow: true, reviewers: ['codex', 'claude'] },+ interval: {}+ });++ const response = await request(app).get('/api/apps/app-001/claim-reviewers');++ expect(response.status).toBe(200);+ expect(response.body.source).toBe('task-override');+ expect(response.body.reviewers).toEqual(['codex', 'claude']);+ expect(response.body.csv).toBe('codex,claude');+ });++ it('drops copilot from a claim chain, matching what the claim prompt is given', async () => {+ // claimSafeReviewers: copilot has no CLI, so a claim agent told to review+ // with it stalls. The lookup has to show the SAME post-guard list the+ // prompt gets, or the UI advertises a reviewer the run silently removes.+ resolveClaimWorkMetadata.mockResolvedValue({+ metadata: { reviewers: ['copilot', 'claude'] },+ interval: {}+ });++ const response = await request(app).get('/api/apps/app-001/claim-reviewers');++ expect(response.body.reviewers).toEqual(['claude']);+ });++ it('still answers from the task override when the settings read fails', async () => {+ // A failed settings read means "no configured defaults", never a failed+ // lookup — the layer that wins is the task metadata either way.+ getCodeReviewDefaults.mockRejectedValue(new Error('settings unavailable'));+ resolveClaimWorkMetadata.mockResolvedValue({ metadata: { reviewers: ['grok'] }, interval: {} });++ const response = await request(app).get('/api/apps/app-001/claim-reviewers');++ expect(response.status).toBe(200);+ expect(response.body.source).toBe('task-override');+ expect(response.body.reviewers).toEqual(['grok']);+ });+ });+describe('GET /api/apps/:id/layered-intelligence', () => {it('returns the effective config + isPortos flag', async () => {appsService.getAppById.mockResolvedValue({ id: 'app-001', name: 'App' });