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
refactor: decide audit applicability once per lane and open pickers on the default provider
[._.]/ Adam Eivy527bcd22d375
diff --git a/client/src/components/apps/AppQualityRunner.jsx b/client/src/components/apps/AppQualityRunner.jsxindex 9c82037c2e..4ec248b672 100644--- a/client/src/components/apps/AppQualityRunner.jsx+++ b/client/src/components/apps/AppQualityRunner.jsx@@ -34,7 +34,7 @@ export default function AppQualityRunner({ app, children }) {const [runs, setRuns] = useState([]);const [loaded, setLoaded] = useState(false);const revision = useRef(0);- const picker = useProviderModels({ filter: enabledProcessProviderFilter, withEffort: true, preselectDefaults: true });+ const picker = useProviderModels({ filter: enabledProcessProviderFilter, withEffort: true });const taskTypes = categories.filter(category => (selection === 'all' && isApplicable(category)) || (selection === 'missing' ? needsCheck(category) : category.id === selection)).map(category => category.id);const loadRuns = useCallback(async () => {const requestedRevision = revision.current;@@ -49,7 +49,10 @@ export default function AppQualityRunner({ app, children }) {setBusy(true);setError('');const response = await startMaintenanceRun({ appId: app.id, providerId: picker.selectedProviderId, model: picker.selectedModel,- effort: effort || null, mode, claimBetweenAudits: false, taskTypes }, { silent: true }).catch(err => { setError(err.message); return null; });+ effort: effort || null, mode, claimBetweenAudits: false, taskTypes,+ // A category picked by name is the user's explicit choice and runs even if+ // the repository scan says it cannot apply; batch selections stay gated.+ ...(selection !== 'missing' && selection !== 'all' ? { explicitCheck: true } : {}) }, { silent: true }).catch(err => { setError(err.message); return null; });if (response) setRuns(previous => [response.run, ...previous.filter(entry => entry.id !== response.run.id)]);setBusy(false);};diff --git a/client/src/components/apps/AppQualityRunner.test.jsx b/client/src/components/apps/AppQualityRunner.test.jsxindex e9a2404302..dca453d1b0 100644--- a/client/src/components/apps/AppQualityRunner.test.jsx+++ b/client/src/components/apps/AppQualityRunner.test.jsx@@ -53,7 +53,7 @@ it('preserves run overrides when reopening the drawer for one category', async (expect(screen.getByLabelText('Mode')).toHaveValue('fix');fireEvent.click(screen.getByRole('button', { name: 'Run now' }));await waitFor(() => expect(startMaintenanceRun).toHaveBeenCalledWith(- { appId: 'app-1', providerId: 'codex', model: 'gpt-5', effort: 'high', mode: 'fix', claimBetweenAudits: false, taskTypes: ['security'] },+ { appId: 'app-1', providerId: 'codex', model: 'gpt-5', effort: 'high', mode: 'fix', claimBetweenAudits: false, taskTypes: ['security'], explicitCheck: true },{ silent: true }));});@@ -101,12 +101,6 @@ it('excludes known unavailable and N/A assessments from suggestions while allowiawait waitFor(() => expect(startMaintenanceRun).toHaveBeenLastCalledWith(expect.objectContaining({ taskTypes: ['typing', 'console-errors', 'security'] }), { silent: true }));});-it('opens on the configured default provider instead of a hardcoded one', async () => {- render(<MemoryRouter><AppQualityRunner app={app} /></MemoryRouter>);- await waitFor(() => expect(useProviderModels).toHaveBeenCalled());- expect(useProviderModels.mock.calls[0][0]).toMatchObject({ preselectDefaults: true });-});-it('leaves audits that cannot apply to this repository out of batch runs, but runs one on request', async () => {const categories = [{ id: 'security', label: 'Security', score: null, applicable: true },@@ -117,12 +111,14 @@ it('leaves audits that cannot apply to this repository out of batch runs, but ruconst missing = await findEnabledByRole('button', { name: 'Run now' });fireEvent.click(missing);await waitFor(() => expect(startMaintenanceRun).toHaveBeenLastCalledWith(expect.objectContaining({ taskTypes: ['security'] }), { silent: true }));+ // A batch selection is never an explicit override.+ expect(startMaintenanceRun.mock.lastCall[0]).not.toHaveProperty('explicitCheck');await findEnabledByLabelText('Checks');fireEvent.change(screen.getByLabelText('Checks'), { target: { value: 'all' } });expect(screen.getByRole('button', { name: 'Run now' })).toBeInTheDocument();fireEvent.change(screen.getByLabelText('Checks'), { target: { value: 'accessibility' } });fireEvent.click(await findEnabledByRole('button', { name: 'Run now' }));- await waitFor(() => expect(startMaintenanceRun).toHaveBeenLastCalledWith(expect.objectContaining({ taskTypes: ['accessibility'] }), { silent: true }));+ await waitFor(() => expect(startMaintenanceRun).toHaveBeenLastCalledWith(expect.objectContaining({ taskTypes: ['accessibility'], explicitCheck: true }), { silent: true }));});it('offers every enabled process provider regardless of subscription family, and hides disabled ones', async () => {diff --git a/client/src/hooks/useProviderModels.js b/client/src/hooks/useProviderModels.jsindex d3da333b0b..6b0719b42f 100644--- a/client/src/hooks/useProviderModels.js+++ b/client/src/hooks/useProviderModels.js@@ -29,8 +29,13 @@ const sourceModels = (provider, withEffort) => {return withEffort ? selectableModelsForProvider(provider, models) : models;};-/** The provider a `preselectDefaults` picker opens on (see that option). */-export function preferredInitialProvider(providers, activeProviderId, { allowDefault = false } = {}) {+/**+ * The provider a picker opens on. With an Auto option (`allowDefault`), only the+ * active provider or nothing. Without one, the configured active provider, else+ * the first TUI provider (the shipped agent default), else the first listed —+ * never simply whichever provider the registry happens to list first.+ */+function preferredInitialProvider(providers, activeProviderId, { allowDefault = false } = {}) {const active = providers.find(provider => provider.id === activeProviderId);if (active || allowDefault) return active || null;return providers.find(isTuiProvider) || providers[0] || null;@@ -48,10 +53,7 @@ export function preferredInitialProvider(providers, activeProviderId, { allowDef* `ProviderModelSelector`.* @param {boolean} [options.preselectDefaults] - Seed a session override with the* active provider and its configured model. If the active provider is excluded- * by the picker policy, leave Auto selected rather than choosing another —- * unless `allowDefault` is false, where there is no Auto to leave: the picker- * then prefers the first TUI provider (the shipped agent default) over list- * order, so it never lands on whichever CLI happens to be listed first.+ * by the picker policy, leave Auto selected rather than choosing another.* @param {boolean} [options.silent] - Suppress the default error toast when the* provider fetch fails (the empty-list fallback still applies). Use when the* picker is a secondary control whose failure shouldn't interrupt the page.@@ -154,9 +156,7 @@ export default function useProviderModels({ filter, allowDefault = false, preselsetProviders(filtered);if ((!allowDefault || preselectDefaults) && filtered.length > 0 && !hasSetInitialRef.current) {hasSetInitialRef.current = true;- const initial = preselectDefaults- ? preferredInitialProvider(filtered, data.activeProvider, { allowDefault })- : filtered[0];+ const initial = preferredInitialProvider(filtered, data.activeProvider, { allowDefault });if (initial) {setSelectedProviderId(initial.id);setSelectedModel(pickInitialModelRef.current(initial));diff --git a/client/src/hooks/useProviderModels.test.js b/client/src/hooks/useProviderModels.test.jsindex a6b225004c..0a7c96a98b 100644--- a/client/src/hooks/useProviderModels.test.js+++ b/client/src/hooks/useProviderModels.test.js@@ -62,7 +62,7 @@ describe('useProviderModels — Antigravity base models', () => {it('opens a required picker on the configured default provider and its default model', async () => {const CLAUDE_TUI = { id: 'claude-code-tui', type: 'tui', enabled: true, defaultModel: 'example-model', models: ['example-model'] };api.getProviders.mockResolvedValue({ activeProvider: 'claude-code-tui', providers: [CODEX, CLAUDE_TUI] });- const { result } = renderHook(() => useProviderModels({ preselectDefaults: true }));+ const { result } = renderHook(() => useProviderModels());await waitFor(() => expect(result.current.loading).toBe(false));expect(result.current.selectedProviderId).toBe('claude-code-tui');expect(result.current.selectedModel).toBe('example-model');@@ -71,7 +71,7 @@ describe('useProviderModels — Antigravity base models', () => {it('falls back to a TUI provider, not list order, when a required picker filters out the default', async () => {const TUI = { id: 'example-tui', type: 'tui', enabled: true, defaultModel: 'm', models: ['m'] };api.getProviders.mockResolvedValue({ activeProvider: 'example-api', providers: [CODEX, TUI] });- const { result } = renderHook(() => useProviderModels({ preselectDefaults: true }));+ const { result } = renderHook(() => useProviderModels());await waitFor(() => expect(result.current.loading).toBe(false));expect(result.current.selectedProviderId).toBe('example-tui');});diff --git a/client/src/services/apiAgents.js b/client/src/services/apiAgents.jsindex b894e3c786..ea2e05b968 100644--- a/client/src/services/apiAgents.js+++ b/client/src/services/apiAgents.js@@ -382,9 +382,9 @@ export const updateCosTaskInterval = (taskType, settings, options = {}) => reque// Manual maintenance runs — the Schedule tab's "Run maintenance now" (server:// services/maintenanceRun.js).export const getMaintenanceRuns = (options) => request('/cos/schedule/maintenance-runs', options);-export const startMaintenanceRun = ({ appId, providerId, model, effort = null, mode = 'file-issues', claimBetweenAudits = true, claimHandler, taskTypes }, options = {}) => request('/cos/schedule/maintenance-runs', {+export const startMaintenanceRun = ({ appId, providerId, model, effort = null, mode = 'file-issues', claimBetweenAudits = true, claimHandler, taskTypes, explicitCheck }, options = {}) => request('/cos/schedule/maintenance-runs', {method: 'POST',- body: JSON.stringify({ appId, providerId, model, effort, mode, claimBetweenAudits, claimHandler, taskTypes }),+ body: JSON.stringify({ appId, providerId, model, effort, mode, claimBetweenAudits, claimHandler, taskTypes, explicitCheck }),...options});export const stopMaintenanceRun = (id, options = {}) => request(`/cos/schedule/maintenance-runs/${id}/stop`, { method: 'POST', ...options });diff --git a/server/lib/auditQuality.js b/server/lib/auditQuality.jsindex ddb227da60..652baf1688 100644--- a/server/lib/auditQuality.js+++ b/server/lib/auditQuality.js@@ -90,6 +90,12 @@ export function parseAuditQualityReport(summary, category) {export const AUDIT_FRESHNESS_MS = 30 * 24 * 60 * 60 * 1000;+/** Whether an assessment taken at `assessedAt` still counts at `now` (not future-dated, not older than the window). */+export function isFreshAssessment(assessedAt, now = Date.now()) {+ const age = now - Date.parse(assessedAt);+ return Number.isFinite(age) && age >= 0 && age <= AUDIT_FRESHNESS_MS;+}+/*** Roll the newest measurement per category into the app's quality summary.*@@ -112,8 +118,7 @@ export function summarizeAppQuality(records = [], now = Date.now(), { inapplicabconst report = auditQualityReportSchema.safeParse(record?.report);const valid = report.success && report.data.category === id;const assessedAt = record?.assessedAt;- const age = now - Date.parse(assessedAt);- const stale = valid && (!Number.isFinite(age) || age < 0 || age > AUDIT_FRESHNESS_MS);+ const stale = valid && !isFreshAssessment(assessedAt, now);const contributes = valid && !stale && report.data.coverage === 'broad' && report.data.confidence !== 'low' && report.data.score !== null;const reportedNotApplicable = valid && !stale && report.data.coverage === 'not-applicable';const detectedReason = Object.hasOwn(inapplicable, id) ? inapplicable[id] : null;diff --git a/server/lib/maintenanceSequence.js b/server/lib/maintenanceSequence.jsindex 56ddc32e82..c25c655131 100644--- a/server/lib/maintenanceSequence.js+++ b/server/lib/maintenanceSequence.js@@ -56,15 +56,11 @@ export const maintenanceStepParams = (taskType, mode = 'file-issues') => (taskTy* invocation yields fresh step identities. An optional claimHandler replaces* the provider/model/effort bundle for drains only; omitted keeps legacy pins.*/-export function buildMaintenanceSteps({ appId, idPrefix, providerId = null, model = null, effort = null, mode = 'file-issues', claimBetweenAudits = true, claimHandler = null, taskTypes = null }) {+export function buildMaintenanceSteps({ appId, idPrefix, providerId = null, model = null, effort = null, mode = 'file-issues', claimBetweenAudits = true, claimHandler = null, taskTypes = null, explicitCheck = false }) {if (taskTypes !== null && (!Array.isArray(taskTypes) || !taskTypes.length || taskTypes.some(type => !Object.hasOwn(AUDIT_DEFINITIONS, type)))) {throw new Error('Quality checks must name known audit categories');}// An explicit quality selection runs only those audits, without backlog drains.- // One named check is the user's explicit choice (the Quality tab's per-category- // Run) and runs even where the repository scan says it cannot apply; a batch- // selection is gated, so an inapplicable audit never rides along unnoticed.- const singleExplicitCheck = Array.isArray(taskTypes) && new Set(taskTypes).size === 1;const types = taskTypes ? [...new Set(taskTypes)] : mode === 'fix' ? [...MAINTENANCE_TASK_ORDER, MAINTENANCE_DRAIN_TASK] : claimBetweenAudits ? MAINTENANCE_SEQUENCE_TYPES : MAINTENANCE_TASK_ORDER;return types.map((taskType, index) => ({id: `${idPrefix}-${index}`,@@ -74,6 +70,6 @@ export function buildMaintenanceSteps({ appId, idPrefix, providerId = null, modejobType: null,runOnce: true,drain: taskType === MAINTENANCE_DRAIN_TASK,- overrides: { ...(taskType === MAINTENANCE_DRAIN_TASK && claimHandler ? claimHandler : { providerId, model, effort }), params: taskTypes ? { fileIssues: mode !== 'fix', ...(mode === 'fix' ? { useWorktree: true, openPR: true } : {}), ...(singleExplicitCheck ? { runInapplicableAudit: true } : {}) } : maintenanceStepParams(taskType, mode) },+ overrides: { ...(taskType === MAINTENANCE_DRAIN_TASK && claimHandler ? claimHandler : { providerId, model, effort }), params: taskTypes ? { fileIssues: mode !== 'fix', ...(mode === 'fix' ? { useWorktree: true, openPR: true } : {}), ...(explicitCheck ? { runInapplicableAudit: true } : {}) } : maintenanceStepParams(taskType, mode) },}));}diff --git a/server/lib/quotaBurnTaskRef.js b/server/lib/quotaBurnTaskRef.jsindex 306fbe9010..8ac5bd1215 100644--- a/server/lib/quotaBurnTaskRef.js+++ b/server/lib/quotaBurnTaskRef.js@@ -75,6 +75,12 @@ export const QUOTA_BURN_UNAVAILABLE = Object.freeze({* lives in CoS → Config, and every step reports it at once.*/IMPROVEMENT_DISABLED: 'improvement-disabled',+ /**+ * A quality audit the target repository cannot have findings for (a UI audit+ * of a repo with no UI) — see `resolveAuditApplicability`. A step carrying+ * the user's `runInapplicableAudit` override is exempt.+ */+ NOT_APPLICABLE: 'not-applicable',});const MAX_REF_FIELD = 64;diff --git a/server/routes/cosScheduleRoutes.js b/server/routes/cosScheduleRoutes.jsindex 6ed6456e45..e29516544a 100644--- a/server/routes/cosScheduleRoutes.js+++ b/server/routes/cosScheduleRoutes.js@@ -40,6 +40,9 @@ const suggestedAfterSchema = z.array(z.string()).max(SUGGESTED_AFTER_MAX);// scheduled task's saved effort.const maintenanceRunStartSchema = z.object({taskTypes: z.array(z.enum(Object.keys(AUDIT_DEFINITIONS))).min(1).max(Object.keys(AUDIT_DEFINITIONS).length).optional(),+ // The user named these checks one by one (the Quality tab's per-category Run),+ // so each runs even where the repository scan says it cannot apply.+ explicitCheck: z.boolean().optional(),mode: z.enum(['file-issues', 'fix']).optional(),claimBetweenAudits: z.boolean().optional(),claimHandler: z.object({diff --git a/server/services/appQualitySchedule.js b/server/services/appQualitySchedule.jsindex cf4410252a..088783f195 100644--- a/server/services/appQualitySchedule.js+++ b/server/services/appQualitySchedule.js@@ -36,7 +36,7 @@ import {resolveQualityScheduleOptions,} from '../lib/qualitySchedulePlan.js';import { cronWeekdayHours } from '../lib/cronFields.js';-import { AUDIT_FRESHNESS_MS } from '../lib/auditQuality.js';+import { isFreshAssessment } from '../lib/auditQuality.js';import { getAppById, getAppTaskTypeOverrides, updateAppTaskTypeOverrides } from './apps.js';import { loadSchedule } from './taskScheduleStore.js';import { INTERVAL_TYPES, decodeIntervalType, isCronExpression } from './taskScheduleConstants.js';@@ -73,6 +73,10 @@ const CAPABILITY_PATTERNS = {*/const CAPABILITY_TTL_MS = 60 * 1000;const capabilityCache = new Map();+// The not-applicable rulings, on the same TTL: every automated dispatch lane and+// the burn status page ask per step, and the answer changes only when an audit+// of this app completes.+const notApplicableCache = new Map();const missingPatterns = AUDIT_REPO_CAPABILITIES.filter(capability => !CAPABILITY_PATTERNS[capability]);if (missingPatterns.length) {@@ -139,10 +143,15 @@ async function scanRepoCapabilities(repoPath) {const capabilities = Object.fromEntries(AUDIT_REPO_CAPABILITIES.map(key => [key, false]));const { files, complete } = await listRepoFiles(repoPath);const scanned = files.filter(path => !VENDOR_SEGMENTS.test(path));+ const pending = Object.entries(CAPABILITY_PATTERNS);for (const path of scanned) {- for (const [capability, patterns] of Object.entries(CAPABILITY_PATTERNS)) {- if (!capabilities[capability] && patterns.some(pattern => pattern.test(path))) capabilities[capability] = true;+ for (let index = pending.length - 1; index >= 0; index -= 1) {+ const [capability, patterns] = pending[index];+ if (!patterns.some(pattern => pattern.test(path))) continue;+ capabilities[capability] = true;+ pending.splice(index, 1);}+ if (!pending.length) break;}return { capabilities, scanned: scanned.length, complete: complete && scanned.length > 0 };}@@ -158,15 +167,20 @@ async function scanRepoCapabilities(repoPath) {* not evidence about this one.*/async function loadNotApplicableCategories(appId, now = Date.now()) {+ const cached = notApplicableCache.get(appId);+ if (cached && now - cached.at < CAPABILITY_TTL_MS) return cached.value;const result = await query(`SELECT DISTINCT ON (category) category, assessed_at, report FROM app_quality_measurementsWHERE app_id = $1 ORDER BY category, assessed_at DESC, agent_id DESC`,[appId]).catch(() => null);+ // A failed read is "no rulings known", and is not cached — the next ask retries.if (!result) return new Set();- return new Set(result.rows.filter(row => row.report?.coverage === 'not-applicable'- && now - Date.parse(row.assessed_at) <= AUDIT_FRESHNESS_MS)+ const value = new Set(result.rows.filter(row => row.report?.coverage === 'not-applicable'+ && isFreshAssessment(row.assessed_at, now)).map(row => normalizeAuditTaskType(row.category)));+ notApplicableCache.set(appId, { at: now, value });+ return value;}/**@@ -189,17 +203,10 @@ export async function resolveQualityChecks(app) {// deselect most of the catalog over a repository nobody actually looked at.const checks = AUDIT_TASK_TYPE_LIST.map(taskType => {- const requirement = auditCapabilityRequirement(taskType);- let applicable = true;- let reason = null;- if (notApplicable.has(taskType)) {- applicable = false;- reason = 'a previous audit reported this category as not applicable here';- } else if (requirement && complete && !capabilities[requirement]) {- applicable = false;- reason = AUDIT_CAPABILITY_MISSING_REASON[requirement];- }- return { taskType, label: AUDIT_DEFINITIONS[taskType].label, applicable, reason };+ const reason = notApplicable.has(taskType)+ ? 'a previous audit reported this category as not applicable here'+ : missingCapabilityReason(taskType, capabilities, complete);+ return { taskType, label: AUDIT_DEFINITIONS[taskType].label, applicable: !reason, reason };});return { checks, capabilities, scanned, complete };}@@ -227,16 +234,30 @@ export async function resolveAuditApplicability(app, taskType) {}/**- * Every category this app's repository cannot have findings for, as- * `{ [category]: reason }` — the shape `summarizeAppQuality` takes, so the- * Quality tab's denominator and runner agree with the dispatch gate.+ * The repository-shape half of the verdict: why `taskType` cannot apply to a+ * checkout with these capabilities, or null. Only a COMPLETE inventory licenses+ * a negative (see `resolveQualityChecks`).+ */+function missingCapabilityReason(taskType, capabilities, complete) {+ const requirement = auditCapabilityRequirement(taskType);+ return requirement && complete && !capabilities[requirement] ? AUDIT_CAPABILITY_MISSING_REASON[requirement] : null;+}++/**+ * Every category this app's repository shape rules out, as+ * `{ [category]: reason }` — the shape `summarizeAppQuality` takes. Reads the+ * cached file scan only: the summary already sees each category's own+ * `not-applicable` report, so re-reading the measurements here would repeat+ * the query the caller just made.** @param {object} app - The managed app record* @returns {Promise<Record<string, string>>}*/export async function inapplicableAuditReasons(app) {- const { checks } = await resolveQualityChecks(app);- return Object.fromEntries(checks.filter(check => !check.applicable).map(check => [check.taskType, check.reason]));+ const { capabilities, complete } = await detectRepoCapabilities(app);+ return Object.fromEntries(AUDIT_TASK_TYPE_LIST+ .map(taskType => [taskType, missingCapabilityReason(taskType, capabilities, complete)])+ .filter(([, reason]) => reason));}/**@@ -251,9 +272,7 @@ export async function inapplicableAuditReasons(app) {*/export async function inapplicableAuditReason(appId, taskType) {if (!appId || !Object.hasOwn(AUDIT_DEFINITIONS, normalizeAuditTaskType(taskType))) return null;- // `.then` rather than a direct call, so even a synchronous throw from the- // app lookup lands in the fail-open catch instead of the caller's lane.- const verdict = await Promise.resolve(appId).then(id => getAppById(id))+ const verdict = await getAppById(appId).then(app => (app ? resolveAuditApplicability(app, taskType) : null)).catch(() => null);return verdict && !verdict.applicable ? verdict.reason || 'not applicable to this repository' : null;diff --git a/server/services/appQualitySnapshotFormat.js b/server/services/appQualitySnapshotFormat.jsindex 90045a6c00..38bf61a940 100644--- a/server/services/appQualitySnapshotFormat.js+++ b/server/services/appQualitySnapshotFormat.js@@ -173,16 +173,12 @@ export function serializeQualitySnapshot(repository, records) {*/const MAX_CATEGORY_NAMES = 256;const CATEGORY_NAME = /^[a-z][a-z0-9-]{0,63}$/;-function parseCategoryDictionary(values) {- if (!Array.isArray(values) || values.length > MAX_CATEGORY_NAMES) return null;- if (values.some(value => typeof value !== 'string' || !CATEGORY_NAME.test(value))) return null;- if (new Set(values).size !== values.length) return null;- return values;-}+const parseCategoryDictionary = values => parseDictionary(values, { max: MAX_CATEGORY_NAMES, accepts: value => CATEGORY_NAME.test(value) });-function parseDictionary(values, allowed) {- if (!Array.isArray(values) || values.length > allowed.size) return null;- if (values.some(value => typeof value !== 'string' || !allowed.has(value))) return null;+/** A dictionary of unique strings, each passing `accepts`, at most `max` long — or null. */+function parseDictionary(values, { max, accepts }) {+ if (!Array.isArray(values) || values.length > max) return null;+ if (values.some(value => typeof value !== 'string' || !accepts(value))) return null;if (new Set(values).size !== values.length) return null;return values;}@@ -245,8 +241,8 @@ function parseV2(value) {}if (typeof value.repository !== 'string' || !REPOSITORY.test(value.repository)) return { status: 'malformed' };const categories = parseCategoryDictionary(value.categories);- const coverage = parseDictionary(value.coverage, COVERAGE);- const confidence = parseDictionary(value.confidence, CONFIDENCE);+ const coverage = parseDictionary(value.coverage, { max: COVERAGE.size, accepts: v => COVERAGE.has(v) });+ const confidence = parseDictionary(value.confidence, { max: CONFIDENCE.size, accepts: v => CONFIDENCE.has(v) });if (!categories || !coverage || !confidence) return { status: 'malformed' };if (!Array.isArray(value.measurements) || value.measurements.length > MAX_QUALITY_SNAPSHOT_ROWS) return { status: 'malformed' };if (value.measurements.length > 0 && (categories.length === 0 || coverage.length === 0 || confidence.length === 0)) {diff --git a/server/services/cosTaskGenerator.auditMode.test.js b/server/services/cosTaskGenerator.auditMode.test.jsindex b60e80e40b..f29cd98abd 100644--- a/server/services/cosTaskGenerator.auditMode.test.js+++ b/server/services/cosTaskGenerator.auditMode.test.js@@ -188,8 +188,10 @@ describe('issues-only audit dispatch never acquires code-shipping instructions (it('runs an inapplicable audit the user explicitly chose: an override or a manual Run', async () => {applicability.inapplicable = { 'mobile-responsive': 'no user interface found in this repository' };const { getTaskInterval } = await import('./taskSchedule.js');- // The on-demand lane (a manual Run) is an explicit choice and is not gated.+ // An on-demand request (a manual Run) is an explicit choice and is not gated —+ // whether the drain serves it or idle review steals it.expect(await generate('mobile-responsive', { skipPreconditions: true })).not.toBeNull();+ expect(await generate('mobile-responsive', { onDemand: true })).not.toBeNull();// The schedule form's recorded override lets the scheduled lane run it too.getTaskInterval.mockResolvedValue({ type: 'weekly', taskMetadata: { runInapplicableAudit: true } });expect(await generate('mobile-responsive')).not.toBeNull();diff --git a/server/services/cosTaskGenerator.js b/server/services/cosTaskGenerator.jsindex 45445b065d..9fea19ef32 100644--- a/server/services/cosTaskGenerator.js+++ b/server/services/cosTaskGenerator.js@@ -2008,10 +2008,14 @@ async function generateManagedAppImprovementTask(app, state, { ignoreTaskId = nu// stealing the request means inheriting its card, because the on-demand drain// will never see that request again. See `finishPreflightDispatch`.let stolenCardId = null;+ // A stolen request's run parameters (a quota-burn or maintenance step's+ // `params`), forwarded exactly as the on-demand drain forwards them.+ let stolenRunOverrides = null;if (appRequests.length > 0) {const request = appRequests[0];targetPullRequest = request.targetPullRequest ?? null;+ stolenRunOverrides = request.burn?.overrides?.params ?? null;const { cardIdForRequest } = await import('./preflightTaskCard.js');stolenCardId = cardIdForRequest(request);await taskSchedule.clearOnDemandRequest(request.id);@@ -2061,6 +2065,8 @@ async function generateManagedAppImprovementTask(app, state, { ignoreTaskId = nuconst prepared = await prepareManagedAppImprovementTask(nextType, app, state, {ignoreTaskId,targetPullRequest,+ onDemand: selectionReason === 'on-demand',+ runOverrides: stolenRunOverrides,// The deterministic pre-agent work (pr-reviewer's security preflight)// reports into the stolen Run's card as it runs, exactly as it does on the// on-demand drain — this is the whole reason the card is opened early.@@ -2732,6 +2738,10 @@ function applyProviderModelPins(metadata, interval, appPin, hookOverride, requesexport async function prepareManagedAppImprovementTask(taskType, app, state, {skipPreconditions = false,ignoreTaskId = null,+ // An on-demand request this call is serving (a user Run, a quota-burn or+ // maintenance step), whichever lane picked it up. Exempts it from the+ // scheduled lane's audit-applicability gate.+ onDemand = false,targetPullRequest = null,// Per-request provider/model/effort pin — see applyProviderModelPins.providerOverride = null,@@ -2747,7 +2757,6 @@ export async function prepareManagedAppImprovementTask(taskType, app, state, {// Also protect requests queued before the target-scope gate was installed.if (requiresInstallWideTarget(taskType)) return null;-// NOTE: `updateAppActivity` + the "Generating improvement task" log are// intentionally deferred until AFTER every gate returns non-null (see end// of function). The original code stamped both eagerly, which was tolerable@@ -2796,11 +2805,12 @@ export async function prepareManagedAppImprovementTask(taskType, app, state, {// mobile audit of a pure API, an infrastructure audit of a repo with no// deployment config) is skipped with a logged reason instead of paying a// provider call to be told "not applicable"; execution is recorded so the- // cadence advances. The on-demand lane (`skipPreconditions`) is not gated- // here: a manual Run is an explicit choice, and the two automated on-demand- // callers — maintenance runs and quota-burn steps — gate before they queue.- // `runInapplicableAudit` is the user's recorded override from the schedule form.- if (!skipPreconditions && isAuditTaskType(taskType) && metadata.runInapplicableAudit !== true+ // cadence advances. An on-demand request is not gated here — whether the+ // drain or idle review serves it: a manual Run is an explicit choice, and the+ // automated on-demand callers (maintenance runs, quota-burn steps) gate in+ // `resolveQuotaBurnStep` before they queue. `runInapplicableAudit` is the+ // user's recorded override from the schedule form.+ if (!skipPreconditions && !onDemand && isAuditTaskType(taskType) && metadata.runInapplicableAudit !== true&& await skipInapplicableAudit(app, taskType, taskSchedule)) return null;if (taskType === 'pr-reviewer') ensurePrReviewerPipeline(metadata);diff --git a/server/services/maintenanceRun.js b/server/services/maintenanceRun.jsindex 8921270660..43dcee5a2e 100644--- a/server/services/maintenanceRun.js+++ b/server/services/maintenanceRun.js@@ -55,6 +55,8 @@ import { createKeyCachedQueue } from '../lib/createKeyCachedQueue.js';import { buildMaintenanceSteps } from '../lib/maintenanceSequence.js';import { familyForProvider } from '../lib/providerFamilies.js';import { quotaBurnProvenance } from '../lib/quotaBurnOrigin.js';+import { QUOTA_BURN_UNAVAILABLE } from '../lib/quotaBurnTaskRef.js';+import { pluralize } from '../lib/textUtils.js';import { isQueuedContinuation } from '../lib/agentOutcome.js';import { cosEvents } from './cosEvents.js';import { getQuotaBurnTaskCatalog, invokeQuotaBurnStep } from './quotaBurnInvoke.js';@@ -176,7 +178,7 @@ async function assertNoRunningRun(appId) {* The first evaluation runs before this returns, so the caller learns whether* step one actually went out (or why it is holding) in the same response.*/-export async function startMaintenanceRun({ appId, providerId, model = null, effort = null, mode = 'file-issues', claimBetweenAudits = true, claimHandler = null, taskTypes = null }) {+export async function startMaintenanceRun({ appId, providerId, model = null, effort = null, mode = 'file-issues', claimBetweenAudits = true, claimHandler = null, taskTypes = null, explicitCheck = false }) {const [{ getAppById }, { getProviderById }, { resolveBurnProvider }] = await Promise.all([import('./apps.js'), import('./providers.js'), import('./scheduledHandlers/providerPick.js'),]);@@ -202,7 +204,7 @@ export async function startMaintenanceRun({ appId, providerId, model = null, effid, appId, familyId, claimFamilyId, ...pins,taskTypes,status: MAINTENANCE_RUN_STATUS.RUNNING,- steps: buildMaintenanceSteps({ appId, idPrefix: id, ...pins, mode, claimBetweenAudits, claimHandler: effectiveClaimHandler, taskTypes }),+ steps: buildMaintenanceSteps({ appId, idPrefix: id, ...pins, mode, claimBetweenAudits, claimHandler: effectiveClaimHandler, taskTypes, explicitCheck }),completed: {},active: null,reason: null,@@ -318,37 +320,36 @@ async function evaluate(id, { ignoreTaskId }) {const catalog = await getQuotaBurnTaskCatalog({ manual: true });const completed = { ...run.completed };- const skippedSteps = {};+ // Step id → why it did not apply. Persisted with every hold, not only on+ // dispatch, so a later hold does not throw away skips this pass decided.+ const skipped = { ...run.skipped };for (const step of run.steps) {if (completed[step.id]) continue;const shape = sequenceStepShapeReason(step);- if (shape) return hold(shape);- // An audit this repository cannot have findings for is COMPLETED as- // skipped, not dispatched: the generator would refuse it anyway, and a- // refused request would leave the step pending — re-dispatched on every- // evaluation. Checked here so the run moves straight to the next step.- const inapplicable = step.drain || step.overrides?.params?.runInapplicableAudit ? null- : await (await import('./appQualitySchedule.js')).inapplicableAuditReason(run.appId, step.taskRef?.taskType);- if (inapplicable) {- completed[step.id] = new Date().toISOString();- skippedSteps[step.id] = inapplicable;- console.log(`⏭️ Maintenance run ${id}: skipped ${step.taskRef.taskType} (${step.id}) — not applicable: ${inapplicable}`);- continue;- }+ if (shape) return hold(shape, { completed, skipped });if (step.drain) {const probe = await probeSequenceDrain(step, { catalog, ignoreTaskId });if (probe.drained) {completed[step.id] = new Date().toISOString();continue;}- if (!probe.job) return hold(probe.reason);+ if (!probe.job) return hold(probe.reason, { completed, skipped });}const result = await invokeQuotaBurnStep({ step, family: stepBurnFamily(step, run), catalog, maintenanceRunId: id });- if (!result.dispatched) return hold(result.reason, { completed, ...skippedPatch(run, skippedSteps) });+ // An audit this repository cannot have findings for is COMPLETED as+ // skipped: holding on it would leave the step pending forever, since the+ // verdict will not change on the next evaluation.+ if (result.code === QUOTA_BURN_UNAVAILABLE.NOT_APPLICABLE) {+ completed[step.id] = new Date().toISOString();+ skipped[step.id] = result.reason;+ console.log(`⏭️ Maintenance run ${id}: skipped ${step.taskRef.taskType} (${step.id}) — ${result.reason}`);+ continue;+ }+ if (!result.dispatched) return hold(result.reason, { completed, skipped });const taskType = step.taskRef.taskType;await patchRun(id, {completed,- ...skippedPatch(run, skippedSteps),+ skipped,steps: run.steps.map(entry => entry.id === step.id ? { ...entry, startedAt: entry.startedAt || new Date().toISOString() } : entry),reason: null,active: { stepId: step.id, taskType, status: 'queued', requestId: result.awaiting?.requestId ?? null, at: new Date().toISOString() },@@ -359,23 +360,18 @@ async function evaluate(id, { ignoreTaskId }) {// Name the skips in the reason the run view shows: a run whose only selected// check did not apply would otherwise finish as a bare "complete" with no// explanation of why nothing ran.- const skippedCount = Object.keys({ ...(run.skipped || {}), ...skippedSteps }).length;+ const skippedCount = Object.keys(skipped).length;const reason = skippedCount- ? `maintenance sequence complete — skipped ${skippedCount} ${skippedCount === 1 ? 'check that does' : 'checks that do'} not apply to this repository`+ ? `maintenance sequence complete — skipped ${pluralize(skippedCount, 'check that does', 'checks that do')} not apply to this repository`: 'maintenance sequence complete';await patchRun(id, {- completed, ...skippedPatch(run, skippedSteps), active: null, reason,+ completed, skipped, active: null, reason,status: MAINTENANCE_RUN_STATUS.COMPLETED, finishedAt: new Date().toISOString(),});console.log(`🧹 Maintenance run ${id} complete for ${run.appId}`);return { dispatched: false, completed: true, reason };}-/** Merge newly skipped steps into the run's `skipped` map (step id → reason), or add nothing. */-const skippedPatch = (run, skippedSteps) => (Object.keys(skippedSteps).length- ? { skipped: { ...(run.skipped || {}), ...skippedSteps } }- : {});-/*** Continuation. An audit step is done when its agent SUCCEEDS; a failed agent* leaves its task blocked, which the next evaluation reports as a hold untildiff --git a/server/services/maintenanceRun.test.js b/server/services/maintenanceRun.test.jsindex 69d3039872..4731511342 100644--- a/server/services/maintenanceRun.test.js+++ b/server/services/maintenanceRun.test.js@@ -8,9 +8,9 @@ const { tempRoot, makeProxy, cleanup } = mockPathsDataRoot({ prefix: 'portos-maivi.mock('../lib/fileUtils.js', async () => makeProxy(await vi.importActual('../lib/fileUtils.js')));const state = vi.hoisted(() => ({ tasks: [], requests: [], invoked: [], dispatch: null, probe: null, inapplicable: {} }));-// Applicability is decided by the repository scan (covered in-// appQualitySchedule.test.js); here only the run's reaction to a verdict matters.-vi.mock('./appQualitySchedule.js', () => ({ inapplicableAuditReason: vi.fn(async (_appId, taskType) => state.inapplicable[taskType] || null) }));+// Applicability is decided by the quota-burn resolver (covered in+// quotaBurnInvoke.test.js); the invoke double below returns its not-applicable+// verdict so these cases pin only the run's reaction to it.vi.mock('./cosState.js', () => ({ loadState: vi.fn(async () => ({ agents: {} })) }));vi.mock('./cosTaskStore.js', () => ({ getAllTasks: vi.fn(async () => ({ cos: { tasks: state.tasks }, user: { tasks: [] } })) }));vi.mock('./taskSchedule.js', () => ({ getOnDemandRequests: vi.fn(async () => state.requests) }));@@ -35,6 +35,8 @@ vi.mock('./scheduledHandlers/providerPick.js', async (importActual) => await impvi.mock('./quotaBurnInvoke.js', () => ({getQuotaBurnTaskCatalog: vi.fn(async () => ({ builtin: {}, custom: {} })),invokeQuotaBurnStep: vi.fn(async (call) => {+ const reason = state.inapplicable[call.step.taskRef.taskType];+ if (reason && !call.step.overrides?.params?.runInapplicableAudit) return { dispatched: false, reason, code: 'not-applicable' };state.invoked.push(call);return state.dispatch || { dispatched: true, summary: `ran ${call.step.taskRef.taskType}`, awaiting: { requestId: `demand-${state.invoked.length}` } };}),@@ -70,9 +72,9 @@ beforeEach(async () => {afterAll(cleanup);describe('manual maintenance run', () => {- it('runs a single explicitly chosen check even where it does not apply', async () => {+ it('runs a check the user chose by name even where it does not apply', async () => {state.inapplicable = { 'mobile-responsive': 'no user interface found in this repository' };- const { run } = await startMaintenanceRun({ appId: 'app-1', providerId: 'codex', model: 'gpt-5', taskTypes: ['mobile-responsive'] });+ const { run } = await startMaintenanceRun({ appId: 'app-1', providerId: 'codex', model: 'gpt-5', taskTypes: ['mobile-responsive'], explicitCheck: true });expect(run.steps[0].overrides.params).toMatchObject({ runInapplicableAudit: true });expect(dispatchedTypes()).toEqual(['mobile-responsive']);});diff --git a/server/services/quotaBurnInvoke.js b/server/services/quotaBurnInvoke.jsindex cb37032ffd..87a0eb0606 100644--- a/server/services/quotaBurnInvoke.js+++ b/server/services/quotaBurnInvoke.js@@ -56,6 +56,7 @@ import {enabledAppIdsByTaskType,resolveQuotaBurnStepAvailability,} from '../lib/quotaBurnTaskRef.js';+import { isAuditTaskType } from '../lib/auditCatalog.js';import { generatedJobTaskFields } from '../lib/autonomousJobTask.js';import { isProgrammaticScheduledTaskType } from '../lib/taskTargetScope.js';import { ON_DEMAND_ORIGINS } from './taskScheduleConstants.js';@@ -207,6 +208,12 @@ export async function resolveQuotaBurnStep(step, catalog = null) {if (!interval) {return { unavailable: { code: QUOTA_BURN_UNAVAILABLE.UNKNOWN_TASK, reason: `scheduled task "${ref.taskType}" could not be read` } };}+ const effective = effectiveSettings(step, interval);+ // Here rather than at invoke, so the status page's probe and the runner agree+ // that an audit which cannot apply to its app is not ready work, and so a+ // maintenance run can complete it as skipped from the same verdict.+ const notApplicable = await notApplicableReason(ref, effective.params);+ if (notApplicable) return { unavailable: { code: QUOTA_BURN_UNAVAILABLE.NOT_APPLICABLE, reason: notApplicable } };return {kind: isProgrammaticScheduledTaskType(ref.taskType) ? 'programmatic' : 'builtin',// Handed back so a caller that resolved through a catalog keeps reading that@@ -214,10 +221,18 @@ export async function resolveQuotaBurnStep(step, catalog = null) {catalog: resolvedCatalog,ref,interval,- effective: effectiveSettings(step, interval),+ effective,};}+/** Why an audit step cannot apply to its app, or null — honoring the user's explicit override. */+async function notApplicableReason(ref, params) {+ if (!ref.appId || params?.runInapplicableAudit === true || !isAuditTaskType(ref.taskType)) return null;+ const { inapplicableAuditReason } = await import('./appQualitySchedule.js');+ const reason = await inapplicableAuditReason(ref.appId, ref.taskType);+ return reason ? `"${ref.taskType}" does not apply to this app: ${reason}` : null;+}+/*** Layer a step's overrides over a task's saved settings.*@@ -404,7 +419,9 @@ async function queuedOnDemandReason(queued, taskType, appId) {*/export async function invokeQuotaBurnStep({ step, family, candidate, context, force = false, catalog = null, maintenanceRunId = null } = {}) {const resolved = await resolveQuotaBurnStep(step, catalog);- if (resolved.unavailable) return declined(resolved.unavailable.reason);+ // The code rides along so a caller can tell "does not apply" (a maintenance+ // run completes that step as skipped) from a refusal it must hold on.+ if (resolved.unavailable) return { ...declined(resolved.unavailable.reason), code: resolved.unavailable.code };if (resolved.kind === 'programmatic') return runProgrammaticStep({ resolved, family, context, force });if (resolved.kind === 'custom') return runCustomJobStep({ resolved, step, family, candidate, maintenanceRunId });@@ -450,14 +467,6 @@ async function runBuiltinTaskStep({ resolved, step, family, candidate, maintenanconst queued = await queuedOnDemandReason(resolved.catalog?.queued, resolved.ref.taskType, resolved.ref.appId);if (queued) return declined(queued);- // An audit that cannot apply to the target repository is declined HERE, so- // the burn moves on to work that can spend the window. The generator would- // refuse it too, but only after the request consumed the step's turn.- // A maintenance run's single explicit check carries the user's override.- const { inapplicableAuditReason } = await import('./appQualitySchedule.js');- const inapplicable = step.overrides?.params?.runInapplicableAudit ? null- : await inapplicableAuditReason(resolved.ref.appId, resolved.ref.taskType);- if (inapplicable) return declined(`"${resolved.ref.taskType}" does not apply to this app: ${inapplicable}`);const picked = await resolveStepProvider(resolved.effective, family);if (picked.error) return declined(picked.error);diff --git a/server/services/quotaBurnInvoke.test.js b/server/services/quotaBurnInvoke.test.jsindex 8ef46d9bbf..e6e618c48c 100644--- a/server/services/quotaBurnInvoke.test.js+++ b/server/services/quotaBurnInvoke.test.js@@ -38,7 +38,7 @@ vi.mock('./taskScheduleStore.js', () => ({}));// Applicability comes from the repository scan (appQualitySchedule.test.js);-// these cases only pin how a burn step reacts to the verdict.+// these cases only pin how the resolver reports it to the probe and the invoke.const inapplicable = vi.hoisted(() => ({ byType: {} }));vi.mock('./appQualitySchedule.js', () => ({inapplicableAuditReason: vi.fn(async (_appId, taskType) => inapplicable.byType[taskType] || null),@@ -222,7 +222,7 @@ describe('refusal paths', () => {it('refuses a disabled task type', async () => {state.schedule.ux.enabled = false;const result = await refuse({ taskRef: { kind: 'builtin', taskType: 'ux', appId: 'app-1' } });- expect(result).toEqual({ dispatched: false, reason: expect.stringContaining('is disabled') });+ expect(result).toEqual({ dispatched: false, reason: expect.stringContaining('is disabled'), code: 'disabled' });dispatchedNothing();});@@ -410,11 +410,13 @@ describe('refusal paths', () => {});describe('built-in agent task invocation', () => {- it('declines an audit that cannot apply to its app, unless the step carries the user override', async () => {+ it('reports an audit that cannot apply as no work and declines it, unless the step carries the user override', async () => {inapplicable.byType = { ux: 'no user interface found in this repository' };const auditStep = (params) => step({ taskRef: { kind: 'builtin', taskType: 'ux', appId: 'app-1' }, overrides: { params } });+ // The status page's probe and the runner agree it is not ready work.+ expect(await countQuotaBurnStepPending({ step: auditStep({ fileIssues: true }), family: grok })).toMatchObject({ count: 0, detail: expect.stringMatching(/does not apply/) });const refused = await invokeQuotaBurnStep({ step: auditStep({ fileIssues: true }), family: grok, candidate });- expect(refused).toEqual({ dispatched: false, reason: expect.stringMatching(/does not apply to this app: no user interface/) });+ expect(refused).toEqual({ dispatched: false, reason: expect.stringMatching(/does not apply to this app: no user interface/), code: 'not-applicable' });expect(state.triggered).toHaveLength(0);const forced = await invokeQuotaBurnStep({ step: auditStep({ fileIssues: true, runInapplicableAudit: true }), family: grok, candidate });expect(forced.dispatched).toBe(true);diff --git a/server/services/taskScheduleRegistry.js b/server/services/taskScheduleRegistry.jsindex 92ef4b1507..41eb94a54d 100644--- a/server/services/taskScheduleRegistry.js+++ b/server/services/taskScheduleRegistry.js@@ -165,6 +165,18 @@ export const createPrReviewerDefaultStages = () => ([// win when a schedule is loaded. A `feature` association is the exception: it// is code-owned and makes the task invisible and non-runnable while that// install-wide feature is disabled.+/**+ * The shared shape of an on-demand audit that files issues by default, with open+ * issues + PRs preloaded so it dedups against in-flight work without spending its+ * own forge calls. A factory, not a shared object: each type gets its own+ * `taskMetadata`, so a write to one row can never leak into another.+ */+const fileIssuesAuditInterval = () => ({+ type: INTERVAL_TYPES.ON_DEMAND, enabled: true, providerId: null, model: null, prompt: null,+ dataInputs: ['open-issues', 'open-pull-requests'],+ taskMetadata: { fileIssues: true, useWorktree: false, openPR: false },+});+export const DEFAULT_TASK_INTERVALS = {[PRIVATE_SECURITY_TASK_TYPE]: { type: INTERVAL_TYPES.ON_DEMAND, enabled: true, providerId: null, model: null, prompt: null, taskMetadata: { ...PRIVATE_SECURITY_DELIVERY } },'model-comparison-refresh': { type: INTERVAL_TYPES.ON_DEMAND, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { ...NON_COMMITTING_COORDINATOR_METADATA } },@@ -343,20 +355,20 @@ export const DEFAULT_TASK_INTERVALS = {// must not land a refactor) and on-demand until the user picks a cadence.// Open issues + PRs are preloaded so the agent dedups against in-flight// work without spending its own forge calls, the way module-hygiene does.- 'better-complexity': { type: INTERVAL_TYPES.ON_DEMAND, enabled: true, providerId: null, model: null, prompt: null, dataInputs: ['open-issues', 'open-pull-requests'], taskMetadata: { fileIssues: true, useWorktree: false, openPR: false } },- 'better-cognitive-load': { type: INTERVAL_TYPES.ON_DEMAND, enabled: true, providerId: null, model: null, prompt: null, dataInputs: ['open-issues', 'open-pull-requests'], taskMetadata: { fileIssues: true, useWorktree: false, openPR: false } },- 'better-structural-drift': { type: INTERVAL_TYPES.ON_DEMAND, enabled: true, providerId: null, model: null, prompt: null, dataInputs: ['open-issues', 'open-pull-requests'], taskMetadata: { fileIssues: true, useWorktree: false, openPR: false } },- 'better-runtime-safety': { type: INTERVAL_TYPES.ON_DEMAND, enabled: true, providerId: null, model: null, prompt: null, dataInputs: ['open-issues', 'open-pull-requests'], taskMetadata: { fileIssues: true, useWorktree: false, openPR: false } },- 'better-dependency-freedom': { type: INTERVAL_TYPES.ON_DEMAND, enabled: true, providerId: null, model: null, prompt: null, dataInputs: ['open-issues', 'open-pull-requests'], taskMetadata: { fileIssues: true, useWorktree: false, openPR: false } },- 'better-test-quality': { type: INTERVAL_TYPES.ON_DEMAND, enabled: true, providerId: null, model: null, prompt: null, dataInputs: ['open-issues', 'open-pull-requests'], taskMetadata: { fileIssues: true, useWorktree: false, openPR: false } },+ 'better-complexity': fileIssuesAuditInterval(),+ 'better-cognitive-load': fileIssuesAuditInterval(),+ 'better-structural-drift': fileIssuesAuditInterval(),+ 'better-runtime-safety': fileIssuesAuditInterval(),+ 'better-dependency-freedom': fileIssuesAuditInterval(),+ 'better-test-quality': fileIssuesAuditInterval(),// Service and data-platform lenses (see AUDIT_DEFINITIONS). File-issues by// default — their findings usually touch production configuration — with// open issues + PRs preloaded for dedup like the do:better lanes above.- 'infrastructure': { type: INTERVAL_TYPES.ON_DEMAND, enabled: true, providerId: null, model: null, prompt: null, dataInputs: ['open-issues', 'open-pull-requests'], taskMetadata: { fileIssues: true, useWorktree: false, openPR: false } },- 'data-integrity': { type: INTERVAL_TYPES.ON_DEMAND, enabled: true, providerId: null, model: null, prompt: null, dataInputs: ['open-issues', 'open-pull-requests'], taskMetadata: { fileIssues: true, useWorktree: false, openPR: false } },- 'reliability': { type: INTERVAL_TYPES.ON_DEMAND, enabled: true, providerId: null, model: null, prompt: null, dataInputs: ['open-issues', 'open-pull-requests'], taskMetadata: { fileIssues: true, useWorktree: false, openPR: false } },- 'privacy': { type: INTERVAL_TYPES.ON_DEMAND, enabled: true, providerId: null, model: null, prompt: null, dataInputs: ['open-issues', 'open-pull-requests'], taskMetadata: { fileIssues: true, useWorktree: false, openPR: false } },- 'cost-efficiency': { type: INTERVAL_TYPES.ON_DEMAND, enabled: true, providerId: null, model: null, prompt: null, dataInputs: ['open-issues', 'open-pull-requests'], taskMetadata: { fileIssues: true, useWorktree: false, openPR: false } },+ 'infrastructure': fileIssuesAuditInterval(),+ 'data-integrity': fileIssuesAuditInterval(),+ 'reliability': fileIssuesAuditInterval(),+ 'privacy': fileIssuesAuditInterval(),+ 'cost-efficiency': fileIssuesAuditInterval(),// Trusted remediation is separate from external intake. Legacy author// filter settings cannot widen this lane into untrusted contributor PRs.'pr-watcher': { type: INTERVAL_TYPES.ON_DEMAND, intervalMs: 1800000, enabled: true, providerId: null, model: null, prompt: null, taskMetadata: { prAuthorFilter: 'trusted', readOnly: false } },