Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: run an inapplicable audit the user explicitly chose

[._.]/ Adam Eivy5eaddac78950
diff --git a/client/src/components/apps/AppQuality.test.jsx b/client/src/components/apps/AppQuality.test.jsx
index 258f095143..9400d66ab4 100644
--- a/client/src/components/apps/AppQuality.test.jsx
+++ b/client/src/components/apps/AppQuality.test.jsx
@@ -179,3 +179,16 @@ describe('AppQuality snapshot publishing', () => {
expect(toast.success).not.toHaveBeenCalled();
});
});
+
+it('lists categories that cannot apply last, with their reason instead of evidence', async () => {
+ const app = { id: 'example', quality: { score: 70, ratedCategories: 1, totalCategories: 3, applicableCategories: 2, categories: [
+ { id: 'accessibility', label: 'Accessibility', score: null, coverage: 'unavailable', applicable: false, inapplicableReason: 'no user interface found in this repository' },
+ { id: 'security', label: 'Security', score: 70, coverage: 'broad', confidence: 'high', applicable: true },
+ { id: 'privacy', label: 'Privacy', score: null, coverage: 'unavailable', applicable: true },
+ ] } };
+ render(<MemoryRouter><AppQuality app={app} detail /></MemoryRouter>);
+ const table = await screen.findByRole('table');
+ const rows = within(table).getAllByRole('row').slice(1).map(row => within(row).getByRole('rowheader').textContent);
+ expect(rows).toEqual(['Security', 'Privacy', 'Accessibility']);
+ expect(within(table).getAllByText(/Not applicable · no user interface found in this repository/)).not.toHaveLength(0);
+});
diff --git a/docs/features/app-quality.md b/docs/features/app-quality.md
index 02ca00f369..5bebc760c5 100644
--- a/docs/features/app-quality.md
+++ b/docs/features/app-quality.md
@@ -186,16 +186,20 @@ of evidence — a `git ls-files` that fails falls back to a two-level listing, w
is explicitly not evidence of absence.
**Dispatch-time bail-out.** The same verdict (`resolveAuditApplicability`) is
-checked again before any agent is spawned, on every lane: the scheduler, a
-manual Run, a maintenance run, and a quota-burn step. An inapplicable audit is
-skipped with a logged reason and no provider call — the scheduled lane records
-the execution so its cadence advances, a manual Run reports why nothing ran, a
-maintenance run completes the step as skipped (recorded in the run's `skipped`
-map) and moves on, and a quota-burn step is declined so the burn picks other
-work. Detection failures never block: the gate only removes work it has
-evidence against. The Quality tab's **Run checks** batch selections leave
-inapplicable categories out; picking one by name still offers it (and the
-server then explains the skip).
+checked again before an agent is spawned for automated work, with no provider
+call: the scheduled lane skips the audit and records the execution so its
+cadence advances, a maintenance run completes the step as skipped (recorded in
+the run's `skipped` map, and named in its completion reason) and moves on, and
+a quota-burn step is declined so the burn picks other work. Detection failures
+never block: the gate only removes work it has evidence against.
+
+An explicit choice always wins over the verdict. A manual **Run** of one task
+type is not gated. The Quality tab's **Run checks** batch selections leave
+inapplicable categories out, but picking a single category by name runs it
+(its step carries `runInapplicableAudit`). A check the user selects in the
+weekly schedule form despite its skip reason is saved with
+`runInapplicableAudit: true` in that app's task metadata, so the scheduled
+lane runs it; the flag is cleared when a later plan finds the check applies.
**When.** The selection is spread across the week as evenly as it allows — the
30 shipped checks become five slots a day, filled 5,5,4,4,4,4,4 so no day is
diff --git a/server/lib/cosValidation.js b/server/lib/cosValidation.js
index f2ef31c03c..8380218d78 100644
--- a/server/lib/cosValidation.js
+++ b/server/lib/cosValidation.js
@@ -941,6 +941,11 @@ const ALLOWED_TASK_METADATA_KEYS = [
// Audit-type toggle: file tracker issues (no code) vs implement the fix.
// Dispatch stamps `noCodeOutput` when this is true. See server/lib/auditCatalog.js.
'fileIssues',
+ // The user chose to run this audit although the repository scan says it
+ // cannot apply (a UI audit of a repo with no UI). Set by the quality schedule
+ // form and a single-check quality run; without it, the scheduled and batch
+ // lanes skip an inapplicable audit before spawning an agent.
+ 'runInapplicableAudit',
// Dispatch gate: when true, the generated system task is always awaiting-
// approve — including an explicit Run Now. Absent/false keeps the default
// (Run Now consents; unattended runs follow confidence/safety-kind).
diff --git a/server/lib/maintenanceSequence.js b/server/lib/maintenanceSequence.js
index dccc80b6fc..56ddc32e82 100644
--- a/server/lib/maintenanceSequence.js
+++ b/server/lib/maintenanceSequence.js
@@ -61,6 +61,10 @@ export function buildMaintenanceSteps({ appId, idPrefix, providerId = null, mode
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}`,
@@ -70,6 +74,6 @@ export function buildMaintenanceSteps({ appId, idPrefix, providerId = null, mode
jobType: 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 } : {}) } : maintenanceStepParams(taskType, mode) },
+ 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) },
}));
}
diff --git a/server/lib/qualitySchedulePlan.js b/server/lib/qualitySchedulePlan.js
index 153d7158e5..2fdf158cf2 100644
--- a/server/lib/qualitySchedulePlan.js
+++ b/server/lib/qualitySchedulePlan.js
@@ -288,7 +288,9 @@ export function planQualitySchedule({ taskTypes = [], fileIssuesByType = {}, bus
return { checksPerDay: 0, slots: [], claim: null, warnings, options: settings };
}
- const cells = weeklyCells(ordered.length, auditHours.length, Number.isInteger(requested) && requested > 0);
+ // Pack only when the user asked for MORE per day than the week needs; a request
+ // at or below the floor was raised to it and spreads like the default.
+ const cells = weeklyCells(ordered.length, auditHours.length, Number.isInteger(requested) && requested > minimumPerDay);
const slots = ordered.map((taskType, index) => {
// Monday-first so the head of the suggested order (security, data safety)
// opens the working week rather than landing on a Sunday.
diff --git a/server/lib/qualitySchedulePlan.test.js b/server/lib/qualitySchedulePlan.test.js
index 1662604296..ca2299d353 100644
--- a/server/lib/qualitySchedulePlan.test.js
+++ b/server/lib/qualitySchedulePlan.test.js
@@ -135,6 +135,19 @@ describe('planQualitySchedule', () => {
const plan = planAll({ options: { checksPerDay: 1 } });
expect(plan.checksPerDay).toBe(Math.ceil(AUDIT_TASK_TYPE_LIST.length / 7));
expect(plan.warnings.join(' ')).toMatch(new RegExp(`1 a day was raised to ${Math.ceil(AUDIT_TASK_TYPE_LIST.length / 7)}`));
+ // Raised to the floor, it spreads like the default rather than packing and
+ // leaving a day empty.
+ expect(new Set(plan.slots.map(slot => slot.day)).size).toBe(7);
+ });
+
+ it('packs each day full when asked for more checks a day than the week needs', () => {
+ const perDay = Math.ceil(AUDIT_TASK_TYPE_LIST.length / 7) + 3;
+ const plan = planAll({ options: { checksPerDay: perDay } });
+ const days = new Set(plan.slots.map(slot => slot.day));
+ expect(days.size).toBe(Math.ceil(AUDIT_TASK_TYPE_LIST.length / perDay));
+ // Monday-first: the packed week starts on Monday and never reaches Sunday.
+ expect(days.has(1)).toBe(true);
+ expect(days.has(0)).toBe(false);
});
it('says so when an overnight window is collapsed rather than planning a window nobody chose', () => {
@@ -188,7 +201,7 @@ describe('planQualitySchedule', () => {
});
it('reports rather than silently drops checks when the week runs out of free hours', () => {
- // Every hour but one occupied leaves 7 weekly cells for 26 checks.
+ // Every hour but one occupied leaves 7 weekly cells for the whole catalog.
const busy = buildBusySlots([{ days: [0, 1, 2, 3, 4, 5, 6], hours: Array.from({ length: 23 }, (_, h) => h + 1) }], { padBeforeHours: 0, padAfterHours: 0 });
const plan = planAll({ busy });
expect(plan.checksPerDay).toBe(1);
diff --git a/server/services/appQuality.test.js b/server/services/appQuality.test.js
index a67bd24f25..a2e65b31d5 100644
--- a/server/services/appQuality.test.js
+++ b/server/services/appQuality.test.js
@@ -117,6 +117,21 @@ describe('scheduled audit measurement workflow', () => {
expect(app.quality).toMatchObject({ unavailable: true, score: null });
log.mockRestore();
});
+
+ // The detail read feeds the repository scan into the summary; a failing scan
+ // must cost only the applicability, never the whole quality read.
+ it('folds the repository-scan verdicts into the summary, and ignores a scan that fails', async () => {
+ const query = vi.fn().mockResolvedValue({ rows: [] });
+ const [scanned] = await enrichAppsWithQuality([{ id: 'app' }], {
+ query, resolveApplicability: async () => ({ accessibility: 'no user interface found' }),
+ });
+ expect(scanned.quality.categories.find(c => c.id === 'accessibility')).toMatchObject({ applicable: false, inapplicableReason: 'no user interface found' });
+ expect(scanned.quality.applicableCategories).toBe(Object.keys(AUDIT_DEFINITIONS).length - 1);
+ const [failed] = await enrichAppsWithQuality([{ id: 'app' }], {
+ query, resolveApplicability: async () => { throw new Error('git unavailable'); },
+ });
+ expect(failed.quality.applicableCategories).toBe(Object.keys(AUDIT_DEFINITIONS).length);
+ });
});
it('retains historical scores without hindsight, expires old evidence and exposes changed coverage', () => {
diff --git a/server/services/appQualityFederation.test.js b/server/services/appQualityFederation.test.js
index f1cafad22f..4acfcaa8b7 100644
--- a/server/services/appQualityFederation.test.js
+++ b/server/services/appQualityFederation.test.js
@@ -130,6 +130,23 @@ it('loads release evidence without peers and never re-exports it', async () => {
expect(await readReleaseQuality({ ...local, readFile: async () => 'broken' })).toEqual([]);
});
+
+const newerInstallSnapshot = (repository, assessedAt) => JSON.stringify({
+ schemaVersion: 2, repository, reportVersion: 1,
+ categories: ['security', 'example-future-lens'],
+ coverage: ['broad', 'partial', 'unavailable', 'not-applicable'], confidence: ['low', 'medium', 'high'],
+ measurements: [[assessedAt, 0, 76, 3, 0, 2, 10, 10], [assessedAt, 1, 50, 3, 0, 2, 10, 10]],
+});
+
+it('reads the known rows of a snapshot a newer install wrote with categories this one lacks', async () => {
+ const getOriginInfo = async () => ({ host: 'github.com', fullName: 'owner/app' });
+ const managed = { id: 'local-id', repoPath: '/repo/example-app' };
+ const { repository } = await buildQualitySnapshot(managed, 30, { ...deps([row('security', 76)]), getOriginInfo });
+ const body = newerInstallSnapshot(repository, '2026-09-10T10:00:00.000Z');
+ const records = await readReleaseQuality({ ...deps([]), getOriginInfo, getPeers: async () => [], readFile: async () => body }, managed);
+ expect(records.map(record => record.category)).toEqual(['security']);
+});
+
it('reads a managed app\'s committed .quality.json as release evidence and rejects a foreign or broken one', async () => {
const getOriginInfo = async () => ({ host: 'github.com', fullName: 'owner/app' });
const managed = { id: 'local-id', repoPath: '/repo/example-app' };
diff --git a/server/services/appQualitySchedule.js b/server/services/appQualitySchedule.js
index 2466bbfd4a..cf4410252a 100644
--- a/server/services/appQualitySchedule.js
+++ b/server/services/appQualitySchedule.js
@@ -367,14 +367,19 @@ export async function applyQualitySchedulePlan(app, options = {}) {
const scheduled = new Map(plan.slots.map(slot => [slot.taskType, slot]));
const existing = await getAppTaskTypeOverrides(app.id);
+ const inapplicable = new Set(built.checks.filter(check => !check.applicable).map(check => check.taskType));
const patches = {};
for (const taskType of AUDIT_TASK_TYPE_LIST) {
const slot = scheduled.get(taskType);
+ // A check the user selected although it was marked not applicable is an
+ // explicit override: record it so the scheduled lane's applicability gate
+ // runs it instead of skipping it. Cleared again once the check applies.
+ const { runInapplicableAudit: _previousOverride, ...storedMetadata } = existing[taskType]?.taskMetadata || {};
patches[taskType] = slot
// Merge rather than replace: the stored metadata may carry a provider
// pin or reviewer choice the user set on the Schedule page, and the plan
// only has an opinion about the delivery mode.
- ? { enabled: true, interval: slot.cron, taskMetadata: { ...existing[taskType]?.taskMetadata, fileIssues: slot.fileIssues } }
+ ? { enabled: true, interval: slot.cron, taskMetadata: { ...storedMetadata, fileIssues: slot.fileIssues, ...(inapplicable.has(taskType) ? { runInapplicableAudit: true } : {}) } }
// Clearing the interval alongside `enabled: false` keeps a stale cron
// from reviving on the next manual enable.
: { enabled: false, interval: null };
diff --git a/server/services/appQualitySchedule.test.js b/server/services/appQualitySchedule.test.js
index 9287839e3f..4b28e81939 100644
--- a/server/services/appQualitySchedule.test.js
+++ b/server/services/appQualitySchedule.test.js
@@ -230,6 +230,18 @@ describe('buildQualitySchedulePlan', () => {
});
describe('applyQualitySchedulePlan', () => {
+ // Without the recorded override the scheduled lane's applicability gate would
+ // skip, every week, a check the user deliberately selected.
+ it('records an override on a check selected although it does not apply, and clears it once it does', async () => {
+ getAppTaskTypeOverrides.mockResolvedValue({ security: { enabled: true, taskMetadata: { runInapplicableAudit: true, reviewer: 'codex' } } });
+ await applyQualitySchedulePlan(appWith(NODE_SERVICE), { taskTypes: ['accessibility', 'security'], claimBetween: false });
+ const [, patches] = updateAppTaskTypeOverrides.mock.calls[0];
+ expect(patches.accessibility.taskMetadata).toMatchObject({ runInapplicableAudit: true });
+ expect(patches.security.taskMetadata).not.toHaveProperty('runInapplicableAudit');
+ // Unrelated stored settings survive the merge.
+ expect(patches.security.taskMetadata).toMatchObject({ reviewer: 'codex' });
+ });
+
it('retires a claim drain an earlier plan planted when the drain is switched off', async () => {
getAppTaskTypeOverrides.mockResolvedValue({ 'claim-work': { enabled: true, interval: '0 6,14 * * *' } });
const app = appWith(NODE_SERVICE);
@@ -276,7 +288,7 @@ describe('applyQualitySchedulePlan', () => {
});
it('writes each audit\u2019s catalog delivery default when the form states no preference', async () => {
- const app = appWith(NODE_SERVICE);
+ const app = appWith([...NODE_SERVICE, 'client/App.jsx']);
await applyQualitySchedulePlan(app, { taskTypes: ['security', 'ux'] });
const [, patches] = updateAppTaskTypeOverrides.mock.calls[0];
// security ships defaultFileIssues:false, ux ships true — a form-wide
diff --git a/server/services/appQualitySnapshotFile.test.js b/server/services/appQualitySnapshotFile.test.js
index 908bef6205..41451fa5e5 100644
--- a/server/services/appQualitySnapshotFile.test.js
+++ b/server/services/appQualitySnapshotFile.test.js
@@ -389,6 +389,18 @@ it('leaves a future, unrecognized, or unreadable snapshot in place', async () =>
expect((await publishAppQualitySnapshot(app, unreadable)).reason).toBe('unsupported-format');
expect(unreadable.writeFile).not.toHaveBeenCalled();
expect(log).toHaveBeenCalledWith('📊 Quality snapshot left untouched for app example-id: future');
+
+ // Readable, but rewriting it canonically would drop the newer install's rows.
+ const newer = testDeps({
+ git: gitDouble({ execGit: showFiles({ '.quality.json': JSON.stringify({
+ schemaVersion: 2, repository: 'a'.repeat(64), reportVersion: 1,
+ categories: ['security', 'example-future-lens'],
+ coverage: ['broad', 'partial', 'unavailable', 'not-applicable'], confidence: ['low', 'medium', 'high'],
+ measurements: [['2026-09-20T00:00:00.000Z', 1, 50, 3, 0, 2, 10, 10]],
+ }) }) }),
+ });
+ expect((await publishAppQualitySnapshot(app, newer)).reason).toBe('unsupported-format');
+ expect(newer.writeFile).not.toHaveBeenCalled();
});
it('migrates a legacy file to v2 without inventing measurements or writing the live checkout', async () => {
diff --git a/server/services/cosTaskGenerator.auditMode.test.js b/server/services/cosTaskGenerator.auditMode.test.js
index a7cec0fcce..b60e80e40b 100644
--- a/server/services/cosTaskGenerator.auditMode.test.js
+++ b/server/services/cosTaskGenerator.auditMode.test.js
@@ -185,6 +185,16 @@ describe('issues-only audit dispatch never acquires code-shipping instructions (
expect(await generate('reliability')).not.toBeNull();
});
+ 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.
+ expect(await generate('mobile-responsive', { skipPreconditions: 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();
+ });
+
it.each(AUDIT_TYPES)('%s — file-issues mode renders no commit/push/PR/auto-merge directive', async (taskType) => {
const { getTaskInterval } = await import('./taskSchedule.js');
getTaskInterval.mockResolvedValue({ type: 'weekly', taskMetadata: { fileIssues: true } });
diff --git a/server/services/cosTaskGenerator.js b/server/services/cosTaskGenerator.js
index 671ea8806e..45445b065d 100644
--- a/server/services/cosTaskGenerator.js
+++ b/server/services/cosTaskGenerator.js
@@ -2274,8 +2274,8 @@ export async function emitOnDemandEmpty({ taskScheduleMod, request, targetApp, t
const app = await getAppById(appId).catch(() => null);
reason = app?.layeredIntelligence?.lastRunReason || null;
}
- if (outcome === 'idle' && (request.taskType === 'pr-reviewer' || isAuditTaskType(request.taskType))) {
- reason = takePerpetualTransient(request.taskType, appId)?.reason ?? null;
+ if (outcome === 'idle' && request.taskType === 'pr-reviewer') {
+ reason = takePerpetualTransient('pr-reviewer', appId)?.reason ?? null;
}
// 'transient' says "the forge probe failed, try again shortly" — only true when
@@ -2400,8 +2400,7 @@ function buildImprovementTaskMetadata(taskType, app, interval, taskSchedule, app
/**
* The dispatch-side half of audit applicability (see `resolveAuditApplicability`).
* A detection failure never blocks work — the gate only removes what it has
- * evidence against. The verdict is parked as a transient so a manual Run's
- * "produced nothing" notice can say WHY (`emitOnDemandEmpty`).
+ * evidence against.
*
* @returns {Promise<boolean>} true when the dispatch must be skipped
*/
@@ -2413,7 +2412,6 @@ async function skipInapplicableAudit(app, taskType, taskSchedule) {
});
if (verdict.applicable) return false;
emitLog('info', `⏭️ Skipping ${taskType} for ${app.name}: not applicable — ${verdict.reason}`, { appId: app.id, analysisType: taskType });
- recordPerpetualTransient(taskType, app.id, { reason: `Not applicable to this repository: ${verdict.reason}` });
await taskSchedule.recordExecution(taskType, app.id);
return true;
}
@@ -2749,14 +2747,6 @@ export async function prepareManagedAppImprovementTask(taskType, app, state, {
// Also protect requests queued before the target-scope gate was installed.
if (requiresInstallWideTarget(taskType)) return null;
- // Audit applicability bail-out — before metadata, preflights, or a spawn slot.
- // A quality audit this repository cannot have findings for (a 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". Covers every lane that reaches this generator: the clock,
- // a manual Run, a maintenance run, and a quota-burn step. Execution is
- // recorded so the cadence advances rather than retrying every tick.
- if (isAuditTaskType(taskType) && await skipInapplicableAudit(app, taskType, taskSchedule)) return null;
// NOTE: `updateAppActivity` + the "Generating improvement task" log are
// intentionally deferred until AFTER every gate returns non-null (see end
@@ -2801,6 +2791,18 @@ export async function prepareManagedAppImprovementTask(taskType, app, state, {
const sanitizedRunMeta = sanitizeTaskMetadata(runOverrides);
if (sanitizedRunMeta) Object.assign(metadata, sanitizedRunMeta);
+ // Audit applicability bail-out — before preflights or a spawn slot. On the
+ // SCHEDULED lane, a quality audit this repository cannot have findings for (a
+ // 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
+ && await skipInapplicableAudit(app, taskType, taskSchedule)) return null;
+
if (taskType === 'pr-reviewer') ensurePrReviewerPipeline(metadata);
initializePipelineMetadata(metadata);
const { preflightReporter } = await import('./preflightTaskCard.js');
diff --git a/server/services/maintenanceRun.js b/server/services/maintenanceRun.js
index 64f1b9ec2e..8921270660 100644
--- a/server/services/maintenanceRun.js
+++ b/server/services/maintenanceRun.js
@@ -327,7 +327,8 @@ async function evaluate(id, { ignoreTaskId }) {
// 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 ? null : await (await import('./appQualitySchedule.js')).inapplicableAuditReason(run.appId, step.taskRef?.taskType);
+ 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;
diff --git a/server/services/maintenanceRun.test.js b/server/services/maintenanceRun.test.js
index 04442ab624..69d3039872 100644
--- a/server/services/maintenanceRun.test.js
+++ b/server/services/maintenanceRun.test.js
@@ -70,6 +70,12 @@ beforeEach(async () => {
afterAll(cleanup);
describe('manual maintenance run', () => {
+ it('runs a single explicitly chosen check 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'] });
+ expect(run.steps[0].overrides.params).toMatchObject({ runInapplicableAudit: true });
+ expect(dispatchedTypes()).toEqual(['mobile-responsive']);
+ });
// The regression: a refused request would leave the step pending, so the run
// re-dispatched an audit that could never apply on every evaluation.
it('completes an inapplicable audit as skipped without dispatching it, then moves on', async () => {
diff --git a/server/services/quotaBurnInvoke.js b/server/services/quotaBurnInvoke.js
index 1d559d8f54..cb37032ffd 100644
--- a/server/services/quotaBurnInvoke.js
+++ b/server/services/quotaBurnInvoke.js
@@ -453,8 +453,10 @@ async function runBuiltinTaskStep({ resolved, step, family, candidate, maintenan
// 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 = await inapplicableAuditReason(resolved.ref.appId, resolved.ref.taskType);
+ 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);
diff --git a/server/services/quotaBurnInvoke.test.js b/server/services/quotaBurnInvoke.test.js
index 45113dc16f..8ef46d9bbf 100644
--- a/server/services/quotaBurnInvoke.test.js
+++ b/server/services/quotaBurnInvoke.test.js
@@ -37,6 +37,13 @@ vi.mock('./taskScheduleStore.js', () => ({
loadSchedule: vi.fn(async () => ({ tasks: state.schedule, onDemandRequests: state.onDemandRequests })),
}));
+// Applicability comes from the repository scan (appQualitySchedule.test.js);
+// these cases only pin how a burn step reacts to the verdict.
+const inapplicable = vi.hoisted(() => ({ byType: {} }));
+vi.mock('./appQualitySchedule.js', () => ({
+ inapplicableAuditReason: vi.fn(async (_appId, taskType) => inapplicable.byType[taskType] || null),
+}));
+
vi.mock('./apps.js', () => ({
getActiveApps: vi.fn(async () => state.apps.map((app) => ({ ...app, taskTypeOverrides: state.appOverrides[app.id] || {} }))),
}));
@@ -403,6 +410,17 @@ 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 () => {
+ inapplicable.byType = { ux: 'no user interface found in this repository' };
+ const auditStep = (params) => step({ taskRef: { kind: 'builtin', taskType: 'ux', appId: 'app-1' }, overrides: { params } });
+ 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(state.triggered).toHaveLength(0);
+ const forced = await invokeQuotaBurnStep({ step: auditStep({ fileIssues: true, runInapplicableAudit: true }), family: grok, candidate });
+ expect(forced.dispatched).toBe(true);
+ inapplicable.byType = {};
+ });
+
const uxStep = () => step({
taskRef: { kind: 'builtin', taskType: 'ux', appId: 'app-1' },
overrides: { effort: 'high', params: { fileIssues: false } },