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
fix: fall back from scheduled reviewer overrides
[._.]/ Adam Eivyfb9f3ae2e32b
diff --git a/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx b/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsxindex 1b9f46433f..7ede692235 100644--- a/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx+++ b/client/src/components/cos/tabs/schedule/GlobalConfigControls.jsx@@ -234,6 +234,8 @@ export default function GlobalConfigControls({ taskType, config, onUpdate, onTri: config.taskMetadata?.openPR? prCompletion === '' || prCompletion === 'review-then-merge': !!config.taskMetadata?.reviewLoop;+ const hasTaskReviewerListOverride = (Array.isArray(config.taskMetadata?.reviewers) && config.taskMetadata.reviewers.length > 0)+ || (typeof config.taskMetadata?.reviewer === 'string' && !!config.taskMetadata.reviewer);// `selectedProvider` / `availableModels` come from useTaskModelPins above — it// resolves the pin against the active provider, lists Antigravity's BASE models@@ -763,6 +765,11 @@ export default function GlobalConfigControls({ taskType, config, onUpdate, onTrionUpdate(taskType, { taskMetadata });}}/>+ {hasTaskReviewerListOverride && (+ <p className="mt-2 text-xs text-gray-500">+ This task’s reviewer list is its preferred tier. If any reviewer is paused, scheduled runs use the first healthy system Code Review Defaults tier, or the first configured system tier if all are paused.+ </p>+ )}</div>)}</div>diff --git a/client/src/components/cos/tabs/schedule/GlobalConfigControls.test.jsx b/client/src/components/cos/tabs/schedule/GlobalConfigControls.test.jsxindex 7fc0434f54..bfe18daffb 100644--- a/client/src/components/cos/tabs/schedule/GlobalConfigControls.test.jsx+++ b/client/src/components/cos/tabs/schedule/GlobalConfigControls.test.jsx@@ -122,6 +122,18 @@ describe('GlobalConfigControls — After opening PR', () => {expect(screen.getByTestId('reviewer-picker')).toBeInTheDocument();});+ it('explains that a scheduled task reviewer override can fall back to system tiers', () => {+ renderControls({+ taskMetadata: {+ useWorktree: true,+ openPR: true,+ prCompletion: 'review-then-merge',+ reviewers: ['claude'],+ },+ });+ expect(screen.getByText(/This task’s reviewer list is its preferred tier.*system Code Review Defaults tier/)).toBeInTheDocument();+ });+it('resets the task review override while preserving unrelated task metadata', () => {const onUpdate = renderControls({taskMetadata: {diff --git a/server/lib/README.md b/server/lib/README.mdindex f0e054e6d0..01bf35f0ac 100644--- a/server/lib/README.md+++ b/server/lib/README.md@@ -195,7 +195,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub| `antigravity.js` | Antigravity (`agy`) CLI provider helpers — id/sentinel constants (`ANTIGRAVITY_CLI_ID`, `ANTIGRAVITY_CONFIGURED_DEFAULT`, `LEGACY_GEMINI_*`), `isAntigravityCommand`/`isAntigravityCliProvider` predicates, and `ensureAntigravityPrintArgs(args, {model, effort})`/`ensureAntigravityTuiArgs(args, {model, effort})`/`stripAntigravityUnsupportedArgs` argv normalizers. `parseAntigravityModelList(stdout)` parses `agy models` rows — accepts both the modern `<id>\t<Label>` shape and the older bare-id-per-line one, deduped, sentinel dropped (mirrored in the vendored toolkit's `internal/antigravity.js`; used by both the provider-catalog refresh and Image Gen's agy model picker). `isAntigravityModelId(id)` is the same id shape as a bare predicate, for spawn sites building an `agy --model` argv from a value no route schema bounded. The strip drops legacy Gemini `--yolo`/`-m`/`--output-format` but PRESERVES the long `--model` (agy accepts it as a per-session flag, so a user-baked pin is a real selection and suppresses the injected one); the two builders inject `--model`/`--effort` from the per-run overrides, always ahead of the trailing `--print` marker whose value is the prompt. || `llmText.js` | Pure LLM-output text helpers — `stripCodeFences` (unfence a model reply) and `parseLLMJSON` (unfence then JSON.parse with a descriptive throw). Below the provider layer, so lib can clean model output without importing provider orchestration. || `providerCooldown.js` | Provider bench policy — `resolveProviderBench(analysis)` → `null` (don't bench) / a `usage-limit` marker / an `unavailable` marker with the per-category cooldown from `COOLDOWN_MS_BY_CATEGORY`. Declines to bench request/response-specific categories (`isRequestSpecificCategory` / `isSchemaTypeCategory`) so one bad model id or off-shape response can't take a healthy provider offline. Shared by `services/promptRunner.js` (prompt cascade) and `services/agentFinalization.js` (finished CoS agent run) so both bench a category for the same window. Pure. |-| `reviewerConfig.js` | Review-Loop reviewer vocabulary (split out of `cosValidation.js`, #5702; Zod-free): the reviewer roster + aliases (`REVIEWER_VALUES` / `REVIEWER_ALIASES` / `DEFAULT_REVIEWER`), the local-LLM / PortOS-only / model-capable / effort-selectable subsets, the slug→CLI-binary map (`REVIEWER_CLI_BINARIES`, `isCliReviewer`, `reviewerCliBinary`), the keyed model/effort/max-rounds pin normalizers + resolvers (`normalizeReviewers`, `normalizeReviewerModels`, `normalizeReviewerEfforts`, `resolveReviewerConfig`, `resolveClaimReviewerConfig`, `KEYED_REVIEWER_PINS`), the override-key rosters that say when a task has pinned its own reviewers (`REVIEWER_OVERRIDE_KEYS` — everything the picker writes and its reset clears; `REVIEWER_LIST_OVERRIDE_KEYS` / `hasReviewerOverride` — only the keys that can change the resolved LIST), and the emitters that render a reviewer set into slashdo argv (`buildReviewWithArgs` — which emits `--reviewer-applies` only alongside an `APPLY_CAPABLE_REVIEWERS` slug, the reviewers slashdo lets edit the tree, `buildReviewersCsv`) and into agent-prompt notes (`buildReviewerPinNote`, `buildReviewerEffortNote`). Re-exported flat by `cosValidation.js`, so existing `validation.js` imports keep resolving. Provider-backed identities use `provider:<id>` (`isProviderReviewer`, `isReviewer`, `isToolFreeReviewer`) and additive `providerModels` defaults; legacy scalar pins stay compatible. `REVIEWER_CONFIG_FAULT_CODES` / `isReviewerConfigFault` name the refusals a caller fixes by changing configuration (no model, missing/disabled provider, missing CLI command or unsupported explicitly restricted transport) rather than by retrying, so a reviewer that can never answer is not mistaken for a transient outage. |+| `reviewerConfig.js` | Review-Loop reviewer vocabulary (split out of `cosValidation.js`, #5702; Zod-free): the reviewer roster + aliases (`REVIEWER_VALUES` / `REVIEWER_ALIASES` / `DEFAULT_REVIEWER`), the local-LLM / PortOS-only / model-capable / effort-selectable subsets, the slug→CLI-binary map (`REVIEWER_CLI_BINARIES`, `isCliReviewer`, `reviewerCliBinary`), the keyed model/effort/max-rounds pin normalizers + resolvers (`normalizeReviewers`, `normalizeReviewerModels`, `normalizeReviewerEfforts`, `resolveReviewerGroup` — task reviewer overrides fall back through system tiers when paused, `resolveReviewerConfig`, `resolveClaimReviewerConfig`, `KEYED_REVIEWER_PINS`), the override-key rosters that say when a task has pinned its own reviewers (`REVIEWER_OVERRIDE_KEYS` — everything the picker writes and its reset clears; `REVIEWER_LIST_OVERRIDE_KEYS` / `hasReviewerOverride` — only the keys that can change the resolved LIST), and the emitters that render a reviewer set into slashdo argv (`buildReviewWithArgs` — which emits `--reviewer-applies` only alongside an `APPLY_CAPABLE_REVIEWERS` slug, the reviewers slashdo lets edit the tree, `buildReviewersCsv`) and into agent-prompt notes (`buildReviewerPinNote`, `buildReviewerEffortNote`). Re-exported flat by `cosValidation.js`, so existing `validation.js` imports keep resolving. Provider-backed identities use `provider:<id>` (`isProviderReviewer`, `isReviewer`, `isToolFreeReviewer`) and additive `providerModels` defaults; legacy scalar pins stay compatible. `REVIEWER_CONFIG_FAULT_CODES` / `isReviewerConfigFault` name the refusals a caller fixes by changing configuration (no model, missing/disabled provider, missing CLI command or unsupported explicitly restricted transport) rather than by retrying, so a reviewer that can never answer is not mistaken for a transient outage. || `reviewerHealth.js` | Dependency-free `activeReviewerGroupIndex` (shared runtime/editor pause selection), reviewer configuration-fault vocabulary and `reviewerAccessFailureCode`, which recognizes explicit structured OpenCode access refusals without treating generic HTTP or transport failures as permanent faults. || `providerPrerequisites.js` | Can a provider run on this host AT ALL — `providerPrerequisites(provider, { runtime, gatewayKeySet })` → `{ met, missing: [{ code, label }] }` (CLI binary on PATH, API key stored for a public endpoint, the sibling key a gateway-backed wrapper inherits from the API record of its own gateway id unless it carries its own), plus `providerRuntimeKey` (`null` for an API provider, for a command carrying an explicit path, and for a provider with its own `PATH` in `envVars` — the runtime table only answers "does the BARE binary resolve on PortOS's PATH?", which is not those providers' question), `isPrivateNetworkEndpoint` (mirror of the client copy: loopback/RFC1918/tailnet CGNAT + ULA/`.ts.net`/single-label hosts need no key) and `describeMissingPrerequisites`. `runtime: null` = NOT PROBED and never counts as missing. Feeds BOTH `GET /api/providers` and the fallback chain in `aiToolkit/providerStatus.js` (via `services/providerPrerequisites.js`), so a `NEEDS SETUP` card and the router read one computation (#4611). `ROUTING_BLOCKING_CODES`/`blocksRouting(missing)` narrow what ROUTING may act on to the missing binary. Stored, inherited, and environment-backed credential findings stay presentation-only here because the server cannot assume the eventual process environment; the client card classifies sanitized env metadata through tri-state lookups (#4612). Pure. || `tuiShellLaunch.js` | `buildTuiShellLaunch(provider)` → `{ commandLine, env }` for launching a TUI provider by hand in a Shell session (the AI Providers card's "Launch in Shell" button). Resolves the command via `tuiHandshake.js#buildTuiInvocation` (so the vendor posture flags and `--model`/`--effort` injection match a real TUI spawn) and the env via `cliChildEnv.js#composeProviderEnv`. **The env is why this is server-side and the deep link carries only a provider ID**: a TUI provider's backend lives in `envVars` (`ANTHROPIC_BASE_URL` for an Ollama-backed or Bedrock `claude`, `OPENCODE_CONFIG_CONTENT` for an OpenCode wrapper), so a shell handed only the command line would run the right binary against the vendor cloud instead of the local daemon the user configured — and those values are secret, so they can't ride a URL. Returns null for a non-TUI provider. Must be given a RAW provider, never a client-sanitized one (redacted `'***'` env reads truthy). |diff --git a/server/lib/reviewerConfig.js b/server/lib/reviewerConfig.jsindex 7aa6b3450e..f40496df9b 100644--- a/server/lib/reviewerConfig.js+++ b/server/lib/reviewerConfig.js@@ -15,7 +15,7 @@ import { EFFORT_LEVELS, effortLevelsForProvider, buildEffortArgs, foldCursorEffoimport { ANTIGRAVITY_COMMAND } from './antigravity.js';import { CURSOR_COMMAND } from './cursor.js';import { PR_COMPLETIONS } from './prDisposition.js';-import { isReviewerConfigFault } from './reviewerHealth.js';+import { activeReviewerGroupIndex, isReviewerConfigFault } from './reviewerHealth.js';export { REVIEWER_CONFIG_FAULT_CODES, isReviewerConfigFault } from './reviewerHealth.js';// Reviewer choices for the Review Loop. `copilot` requests a native GitHub@@ -838,7 +838,7 @@ export const resolveReviewerEfforts = keyedReviewerPinResolver(normalizeReviewer*/export function resolveReviewerConfig(metadata, codeReviewDefaults, defaultReviewers) {return {- reviewers: prioritizeToolFreeReviewers(normalizeReviewers(metadata, defaultReviewers)),+ reviewers: resolveReviewerGroup(metadata, codeReviewDefaults, defaultReviewers),usernames: resolveReviewUsernames(metadata?.usernames, codeReviewDefaults?.usernames),optionalReviewers: resolveOptionalReviewers(metadata?.optionalReviewers, codeReviewDefaults?.optionalReviewers),reviewerMaxRounds: resolveReviewerMaxRounds(metadata?.reviewerMaxRounds, codeReviewDefaults?.reviewerMaxRounds),@@ -1313,23 +1313,52 @@ export function normalizeReviewers(meta, fallback = DEFAULT_REVIEWERS) {const source = Array.isArray(raw.reviewers)? raw.reviewers: (typeof raw.reviewer === 'string' && raw.reviewer ? [raw.reviewer] : []);+ const out = normalizeReviewerList(source);+ if (out.length) return out;+ const fallbackList = normalizeReviewerList(fallback);+ return fallbackList.length ? [...fallbackList] : [...DEFAULT_REVIEWERS];+}++/**+ * Resolve an explicit task reviewer list as its preferred tier, followed by+ * the system Code Review Defaults tiers. This lets scheduled task overrides+ * retain their choice while inheriting a configured default when that tier is+ * paused. Tasks without a reviewer-list override keep the existing resolved+ * default selection.+ */+export function resolveReviewerGroup(metadata, codeReviewDefaults, defaultReviewers, normalize = normalizeReviewers) {+ const raw = metadata && typeof metadata === 'object' && !Array.isArray(metadata) ? metadata : {};+ const source = Array.isArray(raw.reviewers)+ ? raw.reviewers+ : (typeof raw.reviewer === 'string' && raw.reviewer ? [raw.reviewer] : []);+ const taskGroup = normalizeReviewerList(source);+ if (!taskGroup.length) {+ return prioritizeToolFreeReviewers(normalize(metadata, defaultReviewers));+ }++ const configuredGroups = Array.isArray(codeReviewDefaults?.reviewerFallbackGroups)+ ? codeReviewDefaults.reviewerFallbackGroups+ : [defaultReviewers ?? codeReviewDefaults?.reviewers];+ const fallbackGroups = configuredGroups+ .map(normalizeReviewerList)+ .filter(group => group.length);+ const groups = [taskGroup, ...fallbackGroups];+ const activeGroup = groups[activeReviewerGroupIndex(groups, codeReviewDefaults?.reviewerHealth)];+ return prioritizeToolFreeReviewers(activeGroup || taskGroup);+}++function normalizeReviewerList(list) {const seen = new Set();const out = [];- for (const r of source) {- const normalized = REVIEWER_ALIASES[r] || r;- if (isReviewer(normalized) && !seen.has(normalized)) { seen.add(normalized); out.push(normalized); }- }- if (out.length) return out;- const fallbackList = [];- const fallbackSeen = new Set();- for (const r of Array.isArray(fallback) ? fallback : []) {- const normalized = REVIEWER_ALIASES[r] || r;- if (isReviewer(normalized) && !fallbackSeen.has(normalized)) {- fallbackSeen.add(normalized);- fallbackList.push(normalized);+ for (const raw of Array.isArray(list) ? list : []) {+ if (typeof raw !== 'string') continue;+ const normalized = REVIEWER_ALIASES[raw] || raw;+ if (isReviewer(normalized) && !seen.has(normalized)) {+ seen.add(normalized);+ out.push(normalized);}}- return fallbackList.length ? [...fallbackList] : [...DEFAULT_REVIEWERS];+ return out;}/**diff --git a/server/lib/reviewerConfig.test.js b/server/lib/reviewerConfig.test.jsindex 24b4aa7cbd..3e67c2149a 100644--- a/server/lib/reviewerConfig.test.js+++ b/server/lib/reviewerConfig.test.js@@ -739,6 +739,23 @@ describe('claim reviewer round-trip (prompt CSV ↔ persisted metadata)', () =>expect(resolveClaimReviewerConfig({ reviewer: 'grok' }, null, ['claude']).reviewers).toEqual(['grok']);});+ it('uses a task reviewer override first, then the first healthy system tier', () => {+ const pausedUntil = Date.now() + 60_000;+ const defaults = {+ reviewers: ['ollama'],+ reviewerFallbackGroups: [['codex'], ['ollama'], ['claude']],+ reviewerHealth: {+ grok: { pausedUntil },+ codex: { pausedUntil },+ },+ };++ expect(resolveClaimReviewerConfig({ reviewers: ['grok'] }, defaults, defaults.reviewers).reviewers)+ .toEqual(['ollama']);+ expect(resolveClaimReviewerConfig({ reviewers: ['claude'] }, defaults, defaults.reviewers).reviewers)+ .toEqual(['claude']);+ });+it('resolveClaimReviewerConfig returns empty reviewers and empty CSV when prCompletion is merge-on-green', () => {const config = resolveClaimReviewerConfig({ prCompletion: 'merge-on-green', reviewers: ['codex'] }, defaults, defaults.reviewers);expect(config.reviewers).toEqual([]);diff --git a/server/services/codeReview.js b/server/services/codeReview.jsindex 36588af962..6bbcd2e0a4 100644--- a/server/services/codeReview.js+++ b/server/services/codeReview.js@@ -39,9 +39,9 @@ import {normalizeReviewerMaxRounds,resolveReviewerMaxRounds,reviewerEffortsFromDefaults,+ resolveReviewerGroup,resolveReviewerPins,normalizeReviewerEffort,- prioritizeToolFreeReviewers,EFFORT_SELECTABLE_REVIEWERS,MODEL_SELECTABLE_REVIEWERS,} from '../lib/reviewerConfig.js'@@ -362,7 +362,7 @@ export async function getCodeReviewDefaults() {*/export async function resolveReviewLoopOptions(metadata, { normalize }) {const defaults = await getCodeReviewDefaults().catch(() => null)- const reviewers = prioritizeToolFreeReviewers(normalize(metadata, defaults?.reviewers))+ const reviewers = resolveReviewerGroup(metadata, defaults, defaults?.reviewers, normalize)// GitHub reviewer usernames: a task-level list (even empty) overrides the// global default; only fall back to the Code Review Defaults when the task// didn't pin its own. Mirrors the reviewers precedence.diff --git a/server/services/codeReview.test.js b/server/services/codeReview.test.jsindex 97298be019..1cb9197d25 100644--- a/server/services/codeReview.test.js+++ b/server/services/codeReview.test.js@@ -373,6 +373,24 @@ describe('codeReview helpers', () => {expect(out.reviewerApplies).toBe(false)})+ it('falls back from a paused scheduled task reviewer to the first healthy system tier', async () => {+ const pausedUntil = Date.now() + 60_000+ mockedSettings.current = {+ codeReview: {+ reviewers: ['codex'],+ reviewerFallbackGroups: [['codex'], ['ollama'], ['claude']],+ reviewerHealth: {+ grok: { pausedUntil },+ codex: { pausedUntil },+ },+ },+ }++ const out = await resolveReviewLoopOptions({ reviewers: ['grok'] }, testDeps)++ expect(out.reviewers).toEqual(['ollama'])+ })+it('assembles a reviewer-keyed model map from the per-CLI-reviewer scalars', async () => {mockedSettings.current = {codeReview: {