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

feat: record each audit run's slice and preload it so lanes rotate coverage

[._.]/ Adam Eivy9f6a997444be
diff --git a/docs/features/app-quality.md b/docs/features/app-quality.md
index ccff8efefd..2ea95ee4d8 100644
--- a/docs/features/app-quality.md
+++ b/docs/features/app-quality.md
@@ -74,7 +74,14 @@ The run's recorded start time orders measurements so delayed recovery cannot
replace newer evidence. PostgreSQL retains each run measurement and projects the
recent runs per app/category into the rolling score, locally and within the
ordinary database backup; no old runs are guessed into scores and no extra
-audit batch is enabled automatically. Peers and the `.quality.json` snapshot
+audit batch is enabled automatically. The summary also carries one
+`AUDIT_SLICE: <paths or areas deep-reviewed>` line, stored in the measurement's
+`slice` column (null for runs that predate it, or the v2 report's `slice` when
+the line is missing). Every audit lane preloads its last eight slices for the
+app through the `audit-slice-history` task data input ("Recent audit slices")
+so consecutive runs rotate to other areas instead of re-scanning the same
+inventory; the `ux` and `module-hygiene` prompts read that block for their
+route and slice choice. Peers and the `.quality.json` snapshot
receive the numeric v1 wire shape with a v2 run's `sliceScore` in `score`, so
an older install keeps reading it; the slice text never leaves the machine.
diff --git a/server/lib/auditQuality.js b/server/lib/auditQuality.js
index 20bda4e956..ffd1712cd2 100644
--- a/server/lib/auditQuality.js
+++ b/server/lib/auditQuality.js
@@ -3,6 +3,8 @@ import { AUDIT_DEFINITIONS, normalizeAuditTaskType } from './auditCatalog.js';
import { safeJSONParse } from './jsonIo.js';
const REPORT_PREFIX = 'QUALITY_AUDIT_JSON: ';
+const SLICE_PREFIX = 'AUDIT_SLICE: ';
+const MAX_SLICE_CHARS = 500;
// Each lens must explain how to find candidates before choosing a slice.
export const AUDIT_DISCOVERY = Object.freeze({
@@ -53,7 +55,7 @@ This contract overrides narrower slice-selection or ranking advice in the missio
4. Keep investigation bounded after this scan. Report scanned roots, tools/commands, candidate ranking, exclusions, reviewed paths, unreviewed inventory and stopping reason. If tools or budget prevent broad discovery, report partial coverage, never claim a global worst or a clean repository.
5. Assess the PRE-FIX state of the SLICE you deep-reviewed on 0–100 (higher is healthier): 90–100 no material defect found in the slice after real inspection; 70–89 localized moderate debt; 40–69 significant recurring or widespread problems; 10–39 severe/core-workflow defects; 0–9 pervasive critical failure. Name the slice (the top-level paths or area actually read, not the whole inventory) and rate only what you read; the dashboard derives the category trend server-side from recent slice scores, so never extrapolate a repository-wide number from a signal scan. Rate the slice, not the agent's performance or issue count. Explain the sliceScore using severity, prevalence and concrete evidence from the slice. Do not award points merely for filing or fixing this run. Use sliceScore:null for unavailable or inapplicable assessment; zero is a real score.
6. Score the worst finding's severity separately on 1–10: 1–3 minor localized impact, 4–6 material recurring cost, 7–8 major workflow/reliability impact, 9–10 critical data/security/availability failure. Use 0 only when no material finding was verified. List this severity for every finding in the narrative.
-7. Include exactly one single-line QUALITY_AUDIT_JSON: {...} in your completion sentinel summary AND final response, with no secrets or personal data. Replace the example values with observed evidence. The category is fixed to this task; do not rate other categories. Keep ordinary completion/PR instructions and summaries too.
+7. Include exactly one single-line QUALITY_AUDIT_JSON: {...} in your completion sentinel summary AND final response, with no secrets or personal data. Replace the example values with observed evidence. The category is fixed to this task; do not rate other categories. Beside it, include exactly one line AUDIT_SLICE: <comma-separated top-level paths or areas deep-reviewed> naming the same slice; PortOS records it so later runs of this lane rotate to other areas. Keep ordinary completion/PR instructions and summaries too.
QUALITY_AUDIT_JSON: {"version":2,"category":"${category}","slice":"top-level paths or area deep-reviewed","sliceScore":null,"worstSeverity":0,"coverage":"unavailable","confidence":"low","summary":"Explain the slice assessment and strongest evidence","scannedFiles":0,"totalFiles":0}
Allowed coverage: broad, partial, unavailable, not-applicable. Allowed confidence: low, medium, high. coverage describes the signal scan in step 1, not the deep review: scannedFiles counts files actually included in the category signal scan; totalFiles is the eligible inventory. Broad requires the whole inventory to be scanned (deep review remains bounded). Partial assessments are excluded from the overall score. For partial coverage, use sliceScore:null when the inspected evidence cannot support a slice score; explain why rather than inventing one. A numeric partial score is provisional. If unavailable or not-applicable, sliceScore must be null and explain why. Even a zero-finding audit returns this assessment.`;
}
@@ -131,6 +133,18 @@ export function parseAuditQualityReport(summary, category) {
return parsed.success && parsed.data.category === normalizeAuditTaskType(category) ? parsed.data : null;
}
+/**
+ * The `AUDIT_SLICE: <paths or areas>` line from a completion summary (#12090),
+ * trimmed and bounded, or null when absent or empty. The first such line wins;
+ * the stored value drives the lane's slice rotation on later runs.
+ */
+export function parseAuditSlice(summary) {
+ if (typeof summary !== 'string') return null;
+ const line = summary.split(/\r?\n/).find(candidate => candidate.startsWith(SLICE_PREFIX));
+ const slice = line ? line.slice(SLICE_PREFIX.length).trim().slice(0, MAX_SLICE_CHARS) : '';
+ return slice || null;
+}
+
const RECOMMENDED_AUDITS_HEADING = /^\s*(?:#{1,6}\s*|\*\*)?Recommended next audits\b/i;
const RECOMMENDED_AUDIT_LINE = /^\s*(?:\d+[.)]|[-*])\s+(.+?)\s*$/;
const MAX_RECOMMENDED_AUDITS = 3;
diff --git a/server/lib/db/schema/core.js b/server/lib/db/schema/core.js
index fb4d4146fd..4eb5e16875 100644
--- a/server/lib/db/schema/core.js
+++ b/server/lib/db/schema/core.js
@@ -113,6 +113,10 @@ export const coreDdl = [
PRIMARY KEY (app_id, category, agent_id)
)`,
`CREATE INDEX IF NOT EXISTS idx_app_quality_history ON app_quality_measurements (app_id, assessed_at DESC)`,
+ // The AUDIT_SLICE line of the run's completion summary (#12090): which paths
+ // or areas the lane deep-reviewed, so later runs rotate. Null for runs that
+ // predate it; the report JSON stays the scoring record.
+ `ALTER TABLE app_quality_measurements ADD COLUMN IF NOT EXISTS slice TEXT`,
`ALTER TABLE memories ADD COLUMN IF NOT EXISTS sync_sequence BIGSERIAL`,
`ALTER TABLE memories ADD COLUMN IF NOT EXISTS origin_instance_id VARCHAR(36)`,
`CREATE INDEX IF NOT EXISTS idx_memories_origin_instance ON memories (origin_instance_id)`,
diff --git a/server/lib/taskDataInputCatalog.js b/server/lib/taskDataInputCatalog.js
index 07020479da..7cfe9d7240 100644
--- a/server/lib/taskDataInputCatalog.js
+++ b/server/lib/taskDataInputCatalog.js
@@ -12,6 +12,7 @@ export const TASK_DATA_INPUT_DEFINITIONS = Object.freeze([
Object.freeze({ id: 'open-issues', label: 'Open issues', description: 'Include the target repository\'s current open forge issues, with their labels, excluding help wanted issues.', requiresApp: true, carriesDispatchLabels: true }),
Object.freeze({ id: 'open-pull-requests', label: 'Open pull requests', description: 'Include the target repository\'s current open pull or merge requests.', requiresApp: true }),
Object.freeze({ id: 'closed-unmerged-pull-requests', label: 'Closed unmerged pull requests', description: 'Include recently closed pull or merge requests that were not merged.', requiresApp: true }),
+ Object.freeze({ id: 'audit-slice-history', label: 'Recent audit slices', description: 'Include the areas this audit lane deep-reviewed in its last eight runs for the app, so the run rotates to other areas.', requiresApp: true }),
]);
export const TASK_DATA_INPUT_IDS = Object.freeze(TASK_DATA_INPUT_DEFINITIONS.map(({ id }) => id));
diff --git a/server/scripts/init-db.sql b/server/scripts/init-db.sql
index 878cb33198..e19c124271 100644
--- a/server/scripts/init-db.sql
+++ b/server/scripts/init-db.sql
@@ -2271,6 +2271,9 @@ CREATE TABLE IF NOT EXISTS app_quality_measurements (
CREATE INDEX IF NOT EXISTS idx_app_quality_history ON app_quality_measurements (app_id, assessed_at DESC);
+-- The AUDIT_SLICE line of the run's completion summary (#12090); null for runs that predate it.
+ALTER TABLE app_quality_measurements ADD COLUMN IF NOT EXISTS slice TEXT;
+
-- Machine-local Mind recipe library (#7194).
CREATE TABLE IF NOT EXISTS mind_tool_recipes (
id UUID PRIMARY KEY,
diff --git a/server/services/appQuality.js b/server/services/appQuality.js
index 022519f9cf..eeb1138a6f 100644
--- a/server/services/appQuality.js
+++ b/server/services/appQuality.js
@@ -4,7 +4,7 @@ import { ensureSchema, query } from '../lib/db.js';
import { doneSentinelPath, parseSentinelPayload } from '../lib/agentSentinel.js';
import { tryReadFile } from '../lib/jsonIo.js';
import { normalizeAuditTaskType } from '../lib/auditCatalog.js';
-import { AUDIT_FRESHNESS_MS, parseAuditQualityReport, summarizeAppQuality, buildAppQualityHistory, dailyQualityRecords } from '../lib/auditQuality.js';
+import { AUDIT_FRESHNESS_MS, parseAuditQualityReport, parseAuditSlice, summarizeAppQuality, buildAppQualityHistory, dailyQualityRecords } from '../lib/auditQuality.js';
import { collectAppQuality, qualityRecord, readQualityRecords, readReleaseQuality } from './appQualityFederation.js';
export async function recordAuditQuality({ task, taskType, agentId, workspacePath, success, assessedAt, deepDiscoveryComplete = false }, deps = {}) {
@@ -23,16 +23,36 @@ export async function recordAuditQuality({ task, taskType, agentId, workspacePat
console.warn(`⚠️ Audit quality skipped for ${agentId}: no valid run start time`);
return false;
}
+ // The AUDIT_SLICE line is the rotation record (#12090); a v2 report names the
+ // same slice, so a summary that dropped the line still records one.
+ const slice = parseAuditSlice(summary) ?? (report.version === 2 ? report.slice : null);
await (deps.ensureSchema || ensureSchema)();
await (deps.query || query)(
- `INSERT INTO app_quality_measurements (app_id, category, agent_id, assessed_at, report)
- VALUES ($1, $2, $3, $4, $5::jsonb)
+ `INSERT INTO app_quality_measurements (app_id, category, agent_id, assessed_at, report, slice)
+ VALUES ($1, $2, $3, $4, $5::jsonb, $6)
ON CONFLICT (app_id, category, agent_id) DO NOTHING`,
- [task.metadata.app, category, agentId, assessedAt, JSON.stringify(report)]
+ [task.metadata.app, category, agentId, assessedAt, JSON.stringify(report), slice]
);
return true;
}
+export const AUDIT_SLICE_HISTORY_RUNS = 8;
+
+/**
+ * The slices this lane recorded for an app in its most recent runs, newest
+ * first, for the `audit-slice-history` task data input (#12090). Runs that
+ * recorded no slice (older prompts, summaries without the line) are skipped.
+ */
+export async function readRecentAuditSlices(appId, taskType, deps = {}) {
+ const result = await (deps.query || query)(
+ `SELECT assessed_at, slice FROM app_quality_measurements
+ WHERE app_id = $1 AND category = $2 AND slice IS NOT NULL
+ ORDER BY assessed_at DESC, agent_id DESC LIMIT $3`,
+ [appId, normalizeAuditTaskType(taskType), AUDIT_SLICE_HISTORY_RUNS]
+ );
+ return result.rows.map(row => ({ assessedAt: new Date(row.assessed_at).toISOString(), slice: row.slice }));
+}
+
/**
* @param {object[]} apps - Managed app records
* @param {object} [deps] - Injectable seams. `resolveApplicability(app)` →
diff --git a/server/services/appQuality.test.js b/server/services/appQuality.test.js
index 4a40c62197..26242d3f2d 100644
--- a/server/services/appQuality.test.js
+++ b/server/services/appQuality.test.js
@@ -1,7 +1,7 @@
import { describe, it, expect, vi } from 'vitest';
-import { recordAuditQuality, enrichAppsWithQuality } from './appQuality.js';
+import { recordAuditQuality, enrichAppsWithQuality, readRecentAuditSlices, AUDIT_SLICE_HISTORY_RUNS } from './appQuality.js';
import { AUDIT_DEFINITIONS } from '../lib/auditCatalog.js';
-import { AUDIT_DISCOVERY, auditQualityInstructions, parseAuditQualityReport, parseRecommendedAudits, summarizeAppQuality, AUDIT_FRESHNESS_MS, buildAppQualityHistory, dailyQualityRecords, numericQualityReport, QUALITY_WINDOW_RUNS } from '../lib/auditQuality.js';
+import { AUDIT_DISCOVERY, auditQualityInstructions, parseAuditQualityReport, parseRecommendedAudits, summarizeAppQuality, AUDIT_FRESHNESS_MS, buildAppQualityHistory, dailyQualityRecords, numericQualityReport, parseAuditSlice, QUALITY_WINDOW_RUNS } from '../lib/auditQuality.js';
const report = (overrides = {}) => ({ version: 1, category: 'better-complexity', score: 35, worstSeverity: 8,
coverage: 'broad', confidence: 'high', summary: 'The checkout has a major branching hotspot in the job dispatcher.', scannedFiles: 100, totalFiles: 100, ...overrides });
@@ -31,7 +31,7 @@ describe('scheduled audit measurement workflow', () => {
await expect(recordAuditQuality({ task, taskType: 'better-complexity', agentId: 'agent-1', workspacePath: '/repo', success: true, assessedAt }, {
readFile: vi.fn().mockResolvedValue(JSON.stringify({ summary: sentinel(report()), payload: null })), query, ensureSchema,
})).resolves.toBe(true);
- expect(query.mock.calls[0][1]).toEqual(['portos-default', 'better-complexity', 'agent-1', assessedAt, JSON.stringify(report())]);
+ expect(query.mock.calls[0][1]).toEqual(['portos-default', 'better-complexity', 'agent-1', assessedAt, JSON.stringify(report()), null]);
});
@@ -45,7 +45,7 @@ describe('scheduled audit measurement workflow', () => {
})).resolves.toBe(true);
expect(query.mock.calls[0][1]).toEqual([
'portos-default', 'ui-lifecycle', 'agent-legacy', assessedAt,
- JSON.stringify({ ...legacyReport, category: 'ui-lifecycle' }),
+ JSON.stringify({ ...legacyReport, category: 'ui-lifecycle' }), null,
]);
});
@@ -116,6 +116,27 @@ describe('scheduled audit measurement workflow', () => {
expect(unqualified.categories.find(c => c.id === 'security')).toMatchObject({ score: 90, runScore: 90, window: { runs: 0, worstSeverity: null } });
});
+ // #12090: the AUDIT_SLICE line is the lane's rotation record. A summary
+ // without it still records the report (slice null, or the v2 report's slice).
+ it('stores the AUDIT_SLICE line beside the report and reads the lane\'s recent slices back', async () => {
+ const query = vi.fn().mockResolvedValue({ rows: [] });
+ const run = { task, taskType: 'better-complexity', agentId: 'agent-1', workspacePath: '/repo', success: true, assessedAt };
+ const withLine = `Reviewed the dispatcher.\nAUDIT_SLICE: server/services, server/lib/dispatch \n${sentinel(report())}`;
+ expect(await recordAuditQuality(run, { readFile: async () => withLine, query, ensureSchema: vi.fn() })).toBe(true);
+ expect(query.mock.calls[0][0]).toMatch(/INSERT INTO app_quality_measurements \(app_id, category, agent_id, assessed_at, report, slice\)/);
+ expect(query.mock.calls[0][1][5]).toBe('server/services, server/lib/dispatch');
+ expect(await recordAuditQuality(run, { readFile: async () => sentinel(sliceReport()), query, ensureSchema: vi.fn() })).toBe(true);
+ expect(query.mock.calls[1][1][5]).toBe('server/services');
+ expect(parseAuditSlice('AUDIT_SLICE: \nAUDIT_SLICE: late')).toBeNull();
+ expect(parseAuditSlice(`AUDIT_SLICE: ${'x'.repeat(600)}`)).toHaveLength(500);
+ expect(parseAuditSlice(null)).toBeNull();
+
+ const read = vi.fn().mockResolvedValue({ rows: [{ assessed_at: new Date('2026-09-10T10:00:00Z'), slice: 'server/services' }] });
+ expect(await readRecentAuditSlices('portos-default', 'react-lifecycle', { query: read })).toEqual([{ assessedAt: '2026-09-10T10:00:00.000Z', slice: 'server/services' }]);
+ expect(read.mock.calls[0][0]).toMatch(/slice IS NOT NULL/);
+ expect(read.mock.calls[0][1]).toEqual(['portos-default', 'ui-lifecycle', AUDIT_SLICE_HISTORY_RUNS]);
+ });
+
// The same run reaches the window as the local row and again through the
// day-only release snapshot it was published into; it must count once.
it('collapses each category to its newest run per UTC day before rolling', () => {
diff --git a/server/services/taskDataInputs.js b/server/services/taskDataInputs.js
index 67f6992c0b..c8b9df08ef 100644
--- a/server/services/taskDataInputs.js
+++ b/server/services/taskDataInputs.js
@@ -14,6 +14,8 @@ import { scrubSecretTokens } from '../lib/secretText.js';
import { DISPATCH_HINT_READING_GUIDANCE } from '../lib/dispatchLabels.js';
import { TASK_DATA_INPUT_DEFINITIONS } from '../lib/taskDataInputCatalog.js';
import { githubApiHost, resolveAppWorkTracker } from '../lib/workTracker.js';
+import { PORTOS_APP_ID } from '../lib/appIdentity.js';
+import { isAuditTaskType } from '../lib/auditCatalog.js';
import { resolveForgeTokenEnv } from './forgeAuth.js';
import { classifyGhProbe, execGh, ghRemedy } from './github.js';
import { execGlabJson } from './gitlab.js';
@@ -288,6 +290,18 @@ const INPUT_LOADERS = {
? renderForgeItems(result.items, { emptyMessage: 'No open pull requests.' })
: forgeUnavailable('Open pull requests', forge, result);
},
+ // The slice rotation record (#12090): what this lane deep-reviewed lately,
+ // so the agent prefers other areas. A self-directed PortOS task carries no
+ // app id; its measurements are stored under PortOS's own.
+ 'audit-slice-history': async ({ app, deps, taskType }) => {
+ if (!isAuditTaskType(taskType)) return 'This input applies to audit lanes only; no slice history applies to this task.';
+ const runs = await deps.listAuditSlices(app?.id || PORTOS_APP_ID, taskType)
+ .catch(() => null);
+ if (runs === null) return unavailableMessage('Recent audit slices', 'measurement store unavailable');
+ if (!runs.length) return 'No slice recorded for this lane on this app yet; choose the slice by evidence and name it in AUDIT_SLICE.';
+ const lines = runs.map(({ assessedAt, slice }) => `- ${assessedAt.slice(0, 10)}: ${redactPii(scrubSecretTokens(slice)).slice(0, 300)}`);
+ return truncateWithNotice(`Recently audited by this lane (prefer other areas unless evidence points here):\n${lines.join('\n')}`, MAX_INPUT_CHARS);
+ },
'closed-unmerged-pull-requests': async ({ app, deps, forge }) => {
if (!forge) return unavailableMessage('Closed unmerged pull requests', 'repository forge is unavailable');
const result = await deps.listPullRequests({ cli: forge.cli, cwd: app.repoPath, env: forge.env, state: 'closed-unmerged' });
@@ -312,6 +326,10 @@ export async function resolveTaskDataInputs(inputIds, { app, taskMetadata = {},
return listConfiguredForgeIssues(...args);
},
listPullRequests: listForgePullRequests,
+ listAuditSlices: async (...args) => {
+ const { readRecentAuditSlices } = await import('./appQuality.js');
+ return readRecentAuditSlices(...args);
+ },
environment: process.env,
...dependencies,
};
diff --git a/server/services/taskDataInputs.test.js b/server/services/taskDataInputs.test.js
index 91984d335a..0cf6554e71 100644
--- a/server/services/taskDataInputs.test.js
+++ b/server/services/taskDataInputs.test.js
@@ -19,9 +19,38 @@ describe('taskDataInputs', () => {
'open-issues',
'open-pull-requests',
'closed-unmerged-pull-requests',
+ 'audit-slice-history',
]);
});
+ // #12090: the lane's recent slices are preloaded so it rotates coverage; an
+ // empty history and an unreadable store each say so instead of reading as empty.
+ it('renders the lane\'s recent audit slices, an empty history, and an unreadable store without a forge call', async () => {
+ const resolveTracker = vi.fn();
+ const listAuditSlices = vi.fn().mockResolvedValue([
+ { assessedAt: '2026-09-10T10:00:00.000Z', slice: 'server/services/auth, server/lib/commandSecurity.js' },
+ { assessedAt: '2026-09-03T10:00:00.000Z', slice: 'client/src/components/apps' },
+ ]);
+ const options = { app: APP, taskType: 'better-runtime-safety', dependencies: { resolveTracker, listAuditSlices } };
+ const [section] = await resolveTaskDataInputs(['audit-slice-history'], options);
+ expect(section.label).toBe('Recent audit slices');
+ expect(section.content).toContain('Recently audited by this lane (prefer other areas unless evidence points here):');
+ expect(section.content).toContain('- 2026-09-10: server/services/auth, server/lib/commandSecurity.js');
+ expect(section.content).toContain('- 2026-09-03: client/src/components/apps');
+ expect(listAuditSlices).toHaveBeenCalledWith('app-1', 'better-runtime-safety');
+ expect(resolveTracker).not.toHaveBeenCalled();
+ expect(appendTaskDataInputs('Audit.', [section])).toContain('### Recent audit slices');
+
+ listAuditSlices.mockResolvedValueOnce([]);
+ expect((await resolveTaskDataInputs(['audit-slice-history'], options))[0].content).toContain('No slice recorded for this lane on this app yet');
+ listAuditSlices.mockRejectedValueOnce(new Error('db offline'));
+ expect((await resolveTaskDataInputs(['audit-slice-history'], options))[0].content).toContain('could not be preloaded (measurement store unavailable)');
+ // A self-directed PortOS task has no app id; the lane's measurements live under PortOS's own.
+ await resolveTaskDataInputs(['audit-slice-history'], { ...options, app: { id: null, name: 'PortOS', repoPath: '/repo' } });
+ expect(listAuditSlices).toHaveBeenLastCalledWith('portos-default', 'better-runtime-safety');
+ expect((await resolveTaskDataInputs(['audit-slice-history'], { ...options, taskType: 'plan-feature' }))[0].content).toContain('applies to audit lanes only');
+ });
+
it('resolves selected sources in configured order and reuses one forge resolution', async () => {
const resolveTracker = vi.fn().mockResolvedValue({ forge: 'gh', host: 'github.com' });
const resolveTokenEnv = vi.fn().mockResolvedValue({ GH_TOKEN: 'test-token' });
diff --git a/server/services/taskPromptDefaults.test.js b/server/services/taskPromptDefaults.test.js
index 6059f514c3..cdaa0245df 100644
--- a/server/services/taskPromptDefaults.test.js
+++ b/server/services/taskPromptDefaults.test.js
@@ -115,7 +115,9 @@ describe('taskPromptDefaults integrity snapshot', () => {
it('ux filings use tracker IDs instead of title slugs', () => {
const current = DEFAULT_TASK_PROMPTS.ux;
- expect(PROMPT_VERSIONS.ux).toBe(7);
+ expect(PROMPT_VERSIONS.ux).toBe(8);
+ // v8 (#12090): route rotation reads the preloaded slice block, not only the tracker.
+ expect(current).toMatch(/preloaded Recent audit slices block does not list/);
expect(current).toContain('{trackerInstructions}');
expect(current).toContain('short, human-readable title');
expect(current).not.toContain('[ux-…]');
@@ -194,7 +196,9 @@ describe('taskPromptDefaults integrity snapshot', () => {
it('module-hygiene v1 is generic, evidence-led, and bounded', () => {
const current = DEFAULT_TASK_PROMPTS['module-hygiene'];
- expect(PROMPT_VERSIONS['module-hygiene']).toBe(2);
+ expect(PROMPT_VERSIONS['module-hygiene']).toBe(3);
+ // v3 (#12090): slice choice reads the preloaded slice block.
+ expect(current).toMatch(/Prefer a slice that block does not name/);
expect(current).toContain('{appName}');
expect(current).toContain('{repoPath}');
expect(current).toContain('{modeInstructions}');
diff --git a/server/services/taskPromptDefaults/integrity.snapshot.json b/server/services/taskPromptDefaults/integrity.snapshot.json
index ba7d74712d..8bd1a5f359 100644
--- a/server/services/taskPromptDefaults/integrity.snapshot.json
+++ b/server/services/taskPromptDefaults/integrity.snapshot.json
@@ -37,7 +37,7 @@
"media-render-research": "5164eda916760e6f3604b0c80a5f33ec",
"mobile-responsive": "a1ad3c87dc4c2fc55a3f041f0f61e726",
"model-comparison-refresh": "f66e070fa08e30edda2c3020289f0c67",
- "module-hygiene": "e4ba7f0375bf816b85564bcc6545474d",
+ "module-hygiene": "1637fd164737e20db284fe5c2b440453",
"observability": "243e58bcfae2759f82caf3ff6c8fc9c5",
"performance": "4f8ddada54d7c6f31b7fb35aeb0f29db",
"plan-feature": "7f859397ff16889ffc0cf5a8ba6bddab",
@@ -61,7 +61,7 @@
"ui-bugs": "06baf650e41fce12aaa59c66030c0357",
"ui-lifecycle": "d156882c73593a54c0fd5754eb4c6fa0",
"user-action-review": "1a083430e43f60cdd586cfffbdebc583",
- "ux": "41b02e644f3dc5dcb713700c56a56454",
+ "ux": "14d790bd65e540d00786ecb4e787a61e",
"workflow-recovery": "628d2ec51c3cd3d8bbd76eacb212dada"
},
"PROMPT_VERSIONS": {
@@ -101,7 +101,7 @@
"media-render-research": 1,
"mobile-responsive": 4,
"model-comparison-refresh": 4,
- "module-hygiene": 2,
+ "module-hygiene": 3,
"observability": 2,
"performance": 6,
"plan-feature": 6,
@@ -121,7 +121,7 @@
"ui-bugs": 4,
"ui-lifecycle": 3,
"user-action-review": 2,
- "ux": 7,
+ "ux": 8,
"workflow-recovery": 1
},
"REFERENCE_WATCH_AUDITED_VERSION": 4,
@@ -381,7 +381,8 @@
"219ed3aac32a878ee6f78a90e98daec1"
],
"module-hygiene": [
- "3b7671cd44f719d4b2116b96a279e6d0"
+ "3b7671cd44f719d4b2116b96a279e6d0",
+ "e4ba7f0375bf816b85564bcc6545474d"
],
"observability": [
"fdb4d77df5891cfb653a5da2553ecf8a"
@@ -485,7 +486,8 @@
"b8c0bde4075685625443a405b2c70b50",
"f90b5f38a7c6264e0d40919a2933ba4c",
"9f346b8be4408c5a8207d9a8b6080ff0",
- "bb8670c1e6eb28434ad2d45b6dc62177"
+ "bb8670c1e6eb28434ad2d45b6dc62177",
+ "41b02e644f3dc5dcb713700c56a56454"
]
}
}
diff --git a/server/services/taskPromptDefaults/prompts.js b/server/services/taskPromptDefaults/prompts.js
index a6d81c078f..d22a7809c7 100644
--- a/server/services/taskPromptDefaults/prompts.js
+++ b/server/services/taskPromptDefaults/prompts.js
@@ -908,9 +908,10 @@ keyboard-inaccessible icon") — and file it as the UX finding, not as the a11y
enough: most work happens on record pages. Also open the detail or editor
route (the \`/:id\` view) of each domain that has records, choosing a record
partway through its workflow — in progress, awaiting review, failed — over a
- fresh or finished one. Rotate coverage: prefer routes and domains with no
- finding from this audit in the tracker in the last 30 days, and list the
- routes you chose and why. Describe records by their state, never by their
+ fresh or finished one. Rotate coverage: prefer routes and domains the
+ preloaded Recent audit slices block does not list and with no finding from
+ this audit in the tracker in the last 30 days, and list the routes you chose
+ and why. Describe records by their state, never by their
names or contents. Walk each chosen route with the browser automation
available to this run (a CDP tab, Playwright, or the host's browser tool);
if none is reachable, exit cleanly as step 2 says. For every route:
@@ -1121,9 +1122,9 @@ Repository: {repoPath}
Audit one coherent slice. Rank candidates using several signals together:
size, recent churn, import
-fan-in, mixed responsibilities, and whether prior audit history already covered
-the area. Prefer a previously uncovered slice over repeatedly scanning the same
-hotspot. Name the chosen slice before investigating it.
+fan-in, mixed responsibilities, and whether the preloaded Recent audit slices
+block already lists the area. Prefer a slice that block does not name over
+repeatedly scanning the same hotspot. Name the chosen slice before investigating it.
These numeric thresholds generate candidates only; crossing one is never a
finding by itself:
diff --git a/server/services/taskPromptDefaults/versions.js b/server/services/taskPromptDefaults/versions.js
index a82e8c20b8..480cf84beb 100644
--- a/server/services/taskPromptDefaults/versions.js
+++ b/server/services/taskPromptDefaults/versions.js
@@ -47,11 +47,11 @@ export const PROMPT_VERSIONS = {
'documentation': 9, // v9: hunts instruction files, skills, and shipped task prompts for named files/functions/flags/tools/commands absent from the tree, one finding per file (#12093). v8: drops the read-instruction-files restatement the mode banners own (#12080). v7: carries {modeInstructions} and ranks wrong documentation above missing documentation, verifying instructions against the code rather than trusting the prose. Previously v6: the changelog step names `AGENTS.md` (or `CLAUDE.md`) as the file carrying the repo's documented convention — #4852 made AGENTS.md the canonical cross-vendor agent-instructions filename, and a managed app that adopted it would otherwise be told to read a file it no longer has. v5: the changelog step defers to the convention the repo documents (some repos collect per-branch fragments in a directory so parallel agents don't conflict) instead of prescribing an append to `.changelog/NEXT.md`. v4: generic {appName} body (v1 hardcoded "PortOS"; v2/v3 retired DONE.md wording)
'ui-bugs': 4, // v4: hunts the unhappy branch of each primary action and statically provable crashes (a call to a member the imported module lacks), which no longer count as speculative; cedes stranded workflows to workflow-recovery and unfinished controls to feature-completeness. Previous version: v3: carries {modeInstructions}, exits cleanly when the interface is unreachable instead of filing from imagination, and cedes layout/a11y/UX/copy to their owners. Previously v2: generic {appName} + the app UI (older default hardcoded "PortOS" + http://localhost:5555)
'mobile-responsive': 4, // v4: owns every layout defect at viewport width ≤1024 plus touch; narrow containers on a desktop viewport stay with ux (#12084). v3: carries {modeInstructions} and requires the viewport width plus what a user cannot do there, rather than flagging any layout that merely looks different. Previously v2: generic {appName} app-UI body (older default hardcoded "PortOS" + http://localhost:5555)
- 'ux': 7, // v7: walks routes with whatever browser automation the run has (no Playwright MCP tool names), three viewport classes instead of six exact sizes, and item 8 restricted to a narrow container on a desktop viewport — phone/tablet widths belong to mobile-responsive (#12077, #12084). v6: route selection reaches record detail/editor routes partway through their workflow with tracker-driven rotation, and adds checklist items 12 (a record page says where it stands, the next action, and how to open its output) and 13 (same page family, same shell — provable from layout config). Previous version: v5: adds checklist items 9–11 (instruction text that over-explains, duplicate controls for one action, information hidden when the current state needs it) plus a per-route action/text/state inventory; previous runs only filed what items 1–8 named and treated verbosity as aesthetic. v4: forge issues use plain human-readable titles and tracker-defined IDs; filing syntax/identity comes from {trackerInstructions}. v3: audits narrow monitors and widget containers, including clipped overflow and sidebar/zoom states.
+ 'ux': 8, // v8: route rotation reads the preloaded Recent audit slices block (#12090). v7: walks routes with whatever browser automation the run has (no Playwright MCP tool names), three viewport classes instead of six exact sizes, and item 8 restricted to a narrow container on a desktop viewport — phone/tablet widths belong to mobile-responsive (#12077, #12084). v6: route selection reaches record detail/editor routes partway through their workflow with tracker-driven rotation, and adds checklist items 12 (a record page says where it stands, the next action, and how to open its output) and 13 (same page family, same shell — provable from layout config). Previous version: v5: adds checklist items 9–11 (instruction text that over-explains, duplicate controls for one action, information hidden when the current state needs it) plus a per-route action/text/state inventory; previous runs only filed what items 1–8 named and treated verbosity as aesthetic. v4: forge issues use plain human-readable titles and tracker-defined IDs; filing syntax/identity comes from {trackerInstructions}. v3: audits narrow monitors and widget containers, including clipped overflow and sidebar/zoom states.
// v2: replaces the hardcoded "Read-only on source / no branches, no PRs" paragraph with {modeInstructions} — the audit is registered as file-issues-capable, so a do-work dispatch previously got a mode banner that its own body contradicted in two places. Previously v1: walk the running UI with Playwright MCP against a 7-item named UX checklist and file ONE tracker item per finding via {trackerInstructions} — read-only on source, no branches/PRs. Mode (file-issues vs implement) is injected at dispatch via {modeInstructions} / applyAuditModeWrapper — no prompt bump required.
'data-safety': 3, // v3: cedes read-modify-write races to data-integrity (#12082). v2: generalizes beyond installs to deployments/environments/datasets and adds backup restorability, bulk/backfill safety, retention reach, and long-lived data formats; hands runtime data correctness to data-integrity. v1: data/upgrade-safety audit (migrations, schema parity, version gates). Mode injected at dispatch.
'simplify': 3, // v3: cedes file splits and responsibility boundaries to module-hygiene (#12083). v2: an unreferenced endpoint/setting/job that documentation, UI text or a plan describes is an unfinished feature for feature-completeness, not a deletion. Previous version: v1: dead-code/duplication audit. Mode injected at dispatch.
- 'module-hygiene': 2, // v2: drops the scan-then-bound restatement the discovery contract owns (#12080). v1: evidence-led complexity, responsibility, reuse, and reusable-surface discoverability audit. Mode injected at dispatch.
+ 'module-hygiene': 3, // v3: slice choice reads the preloaded Recent audit slices block (#12090). v2: drops the scan-then-bound restatement the discovery contract owns (#12080). v1: evidence-led complexity, responsibility, reuse, and reusable-surface discoverability audit. Mode injected at dispatch.
'api-contract': 2, // v2: framework-neutral (RPC, GraphQL, event contracts, SDKs — not only Express routes) and adds spec drift, breaking changes to published contracts, idempotency keys, pagination bounds, and long synchronous work. v1: API/route-contract audit (validation gaps, client/server drift, status envelopes, asyncHandler). Net-new type (no retired-hash history needed). Mode injected at dispatch.
'ui-lifecycle': 3, // v3: hunts failed loads rendered as empty collections (#12094). v2: framework-neutral UI lifecycle and state correctness. v1: lifecycle/state audit limited to React effects, stale closures, unmounted setState, and derived state. Mode injected at dispatch.
'observability': 2, // v2: adds correlation across boundaries, alertable metrics for critical paths, truthful health signals, and audit trails, scaled to the project. v1: logging/observability audit (silent catches, log noise, missing error context, uninstrumented pipelines). Net-new type. Mode injected at dispatch.
diff --git a/server/services/taskSchedule.test.js b/server/services/taskSchedule.test.js
index 09a112922f..0880f9536f 100644
--- a/server/services/taskSchedule.test.js
+++ b/server/services/taskSchedule.test.js
@@ -1972,9 +1972,10 @@ describe('taskSchedule', () => {
// product decision ("an unattended scheduled run must not land code"), so
// asserting it in two places 20 lines apart just means a future flag gets
// added to one of them. Every audit includes open issues; some also preload
- // PRs to dedup against work in flight without spending forge calls.
- const OPEN_ISSUES_ONLY = ['open-issues']
- const DEDUP_PRELOAD = ['open-issues', 'open-pull-requests']
+ // PRs to dedup against work in flight without spending forge calls. Every
+ // audit also preloads its recent slices so runs rotate coverage (#12090).
+ const OPEN_ISSUES_ONLY = ['open-issues', 'audit-slice-history']
+ const DEDUP_PRELOAD = ['open-issues', 'open-pull-requests', 'audit-slice-history']
const FILE_ISSUES_LANES = [
['data-safety', OPEN_ISSUES_ONLY],
['simplify', OPEN_ISSUES_ONLY],
@@ -1999,9 +2000,10 @@ describe('taskSchedule', () => {
])
})
- it('ships open issues for every scheduled quality audit', () => {
+ it('ships open issues and the slice rotation record for every scheduled quality audit', () => {
for (const taskType of AUDIT_TASK_TYPES) {
expect(DEFAULT_TASK_INTERVALS[taskType]?.dataInputs, taskType).toContain('open-issues')
+ expect(DEFAULT_TASK_INTERVALS[taskType]?.dataInputs, taskType).toContain('audit-slice-history')
}
})
diff --git a/server/services/taskScheduleRegistry.js b/server/services/taskScheduleRegistry.js
index 7a0549071f..c5aff9e462 100644
--- a/server/services/taskScheduleRegistry.js
+++ b/server/services/taskScheduleRegistry.js
@@ -449,12 +449,13 @@ const TASK_INTERVAL_DEFAULTS = {
// Every catalog audit is displayed as a `better-*` quality task. Give all of
// them the current issue inventory by default so they can avoid filing work
-// that is already tracked. Preserve other configured inputs such as PRs.
+// that is already tracked, and the lane's recent slices so runs rotate
+// coverage (#12090). Preserve other configured inputs such as PRs.
export const DEFAULT_TASK_INTERVALS = Object.fromEntries(
Object.entries(TASK_INTERVAL_DEFAULTS).map(([taskType, interval]) => [
taskType,
isAuditTaskType(taskType)
- ? { ...interval, dataInputs: [...new Set([...(interval.dataInputs || []), 'open-issues'])] }
+ ? { ...interval, dataInputs: [...new Set([...(interval.dataInputs || []), 'open-issues', 'audit-slice-history'])] }
: interval
])
);