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: surface the code-quality lane's next-audit ranking and file test-coverage by default

[._.]/ Adam Eivy5c586ebf5c18
diff --git a/client/src/components/cos/tabs/schedule/AppTaskCard.jsx b/client/src/components/cos/tabs/schedule/AppTaskCard.jsx
index d28876d412..864e34c4f9 100644
--- a/client/src/components/cos/tabs/schedule/AppTaskCard.jsx
+++ b/client/src/components/cos/tabs/schedule/AppTaskCard.jsx
@@ -93,6 +93,18 @@ export default function AppTaskCard({ taskType, config, apps, onTrigger, onConfi
{config.runAfter?.length > 0 && (
<div className="truncate" title={`Blocked until these run: ${config.runAfter.join(', ')}`}>waits for: {config.runAfter.join(', ')}</div>
)}
+ {/* The code-quality lane's triage output (#12085): the ranked audits
+ its last run said would find the most. */}
+ {config.recommendedAudits?.items?.length > 0 && (
+ <div className="pt-1" title={`From the last run${config.recommendedAudits.at ? ` ${timeAgo(config.recommendedAudits.at)}` : ''}`}>
+ <div className="text-gray-400">Recommended next audits</div>
+ <ol className="list-decimal list-inside text-gray-300 space-y-0.5">
+ {config.recommendedAudits.items.map((item) => (
+ <li key={item} className="truncate" title={item}>{item}</li>
+ ))}
+ </ol>
+ </div>
+ )}
</div>}
</button>
diff --git a/client/src/components/cos/tabs/schedule/AppTaskCard.test.jsx b/client/src/components/cos/tabs/schedule/AppTaskCard.test.jsx
index 2278677f9a..69521b2d2b 100644
--- a/client/src/components/cos/tabs/schedule/AppTaskCard.test.jsx
+++ b/client/src/components/cos/tabs/schedule/AppTaskCard.test.jsx
@@ -179,6 +179,24 @@ describe('AppTaskCard', () => {
expect(screen.getByText('Never run')).toBeTruthy();
});
+ it("lists the last run's recommended next audits when the triage lane recorded them (#12085)", () => {
+ renderCard({ recommendedAudits: { at: '2026-06-20T10:00:00Z', appId: 'app-1', items: [
+ 'better-structural-drift — drifted registries: server/lib/navManifest.js',
+ 'ux — buried primary action: client/src/pages/Apps.jsx',
+ ] } }, {}, 'code-quality');
+ expect(screen.getByText('Recommended next audits')).toBeTruthy();
+ const items = screen.getAllByRole('listitem').map((item) => item.textContent);
+ expect(items).toEqual([
+ 'better-structural-drift — drifted registries: server/lib/navManifest.js',
+ 'ux — buried primary action: client/src/pages/Apps.jsx',
+ ]);
+ });
+
+ it('omits the recommendation block when the last run recorded none', () => {
+ renderCard({ recommendedAudits: null }, {}, 'code-quality');
+ expect(screen.queryByText('Recommended next audits')).toBeNull();
+ });
+
it('shows a swarm badge when swarmCount ≥ 2 and hides it otherwise', () => {
renderCard({ taskMetadata: { swarmCount: 3 } });
expect(screen.getByText('×3')).toBeTruthy();
diff --git a/docs/features/self-improvement-audits.md b/docs/features/self-improvement-audits.md
index 570f551c1b..9ecf6e6b32 100644
--- a/docs/features/self-improvement-audits.md
+++ b/docs/features/self-improvement-audits.md
@@ -75,7 +75,7 @@ the operator's live checkout.
|---|---|---|---|---|
| `security` | Exposure real under the app's own threat model | `security` | implement | |
| `code-quality` | Conventional maintainability defects | `code-quality` | implement | |
-| `test-coverage` | Untested behavior worth covering | `tests`, `test-gap` | implement | |
+| `test-coverage` | Untested behavior worth covering | `tests`, `test-gap` | file | |
| `performance` | Provably wasted work on a hot path | `performance`, `perf` | implement | |
| `accessibility` | Keyboard, screen-reader, contrast, zoom barriers | `accessibility`, `a11y` | implement | |
| `documentation` | Docs that are wrong, then docs that are missing | `documentation`, `docs` | implement | |
@@ -113,6 +113,14 @@ Lanes only pay off if they do not file each other's findings. Every
mission body names what it cedes and to whom, so two lanes cannot both claim one
problem:
+- **`code-quality` is the triage lane.** After ceding drift, complexity,
+ cognitive load, module hygiene, dead code, runtime defects, logging, and
+ unhandled boundary calls to their owners, its second deliverable is a ranked
+ `Recommended next audits` list in the completion summary; dispatch parses it
+ (`parseRecommendedAudits`) onto the task's execution record, and the Schedule
+ card shows it under the last run (#12085). `test-coverage` files by default
+ for the same reason the other filing lanes do: an unattended test addition
+ has no reviewer weighing the regression it names against suite time (#12087).
- **Complexity is split three ways.** `better-complexity` owns *counted*
branching and must report the number. `better-cognitive-load` owns reader cost
that no metric captures — mixed abstraction levels, flag arguments, names that
diff --git a/server/lib/auditCatalog.js b/server/lib/auditCatalog.js
index fe45a7af57..d5dd36c423 100644
--- a/server/lib/auditCatalog.js
+++ b/server/lib/auditCatalog.js
@@ -167,7 +167,9 @@ export const AUDIT_DEFINITIONS = Object.freeze({
quotaBurnId: 'test-gap-audit',
label: 'Test coverage',
description: 'Test-coverage audit — configurable: file issues or add tests',
- defaultFileIssues: false,
+ // Files by default (#12087): unattended test addition is a CI-time cost with
+ // no reviewer judging whether the regression named is worth the suite time.
+ defaultFileIssues: true,
filing: filing({
slugPrefix: 'test-gap-',
label: 'test-gap-audit',
diff --git a/server/lib/auditCatalog.test.js b/server/lib/auditCatalog.test.js
index 32a04a770c..7fff0f2ec1 100644
--- a/server/lib/auditCatalog.test.js
+++ b/server/lib/auditCatalog.test.js
@@ -79,6 +79,7 @@ describe('AUDIT_DEFINITIONS', () => {
expect(defaultFileIssuesFor('data-safety')).toBe(true);
expect(defaultFileIssuesFor('simplify')).toBe(true);
expect(defaultFileIssuesFor('module-hygiene')).toBe(true);
+ expect(defaultFileIssuesFor('test-coverage')).toBe(true); // #12087
expect(defaultFileIssuesFor('security')).toBe(false);
expect(defaultFileIssuesFor('accessibility')).toBe(false);
expect(defaultFileIssuesFor('unknown')).toBe(false);
diff --git a/server/lib/auditQuality.js b/server/lib/auditQuality.js
index a1f8599acd..e3a24319dd 100644
--- a/server/lib/auditQuality.js
+++ b/server/lib/auditQuality.js
@@ -99,6 +99,33 @@ export function parseAuditQualityReport(summary, category) {
return parsed.success && parsed.data.category === normalizeAuditTaskType(category) ? parsed.data : 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;
+
+/**
+ * The code-quality lane's triage output (#12085): the ranked audits listed
+ * under a `Recommended next audits` heading in the completion summary. Reads
+ * the list lines that follow the heading, up to the first blank line, another
+ * heading, or three entries; each entry keeps the line text the agent wrote
+ * (`<task-type> — <evidence>: <paths>`) with the list marker stripped. Returns
+ * `[]` for a summary with no such block, and ignores a second block.
+ */
+export function parseRecommendedAudits(summary) {
+ if (typeof summary !== 'string') return [];
+ const lines = summary.split(/\r?\n/);
+ const start = lines.findIndex(line => RECOMMENDED_AUDITS_HEADING.test(line));
+ if (start < 0) return [];
+ const items = [];
+ for (const line of lines.slice(start + 1)) {
+ if (!line.trim() || /^\s*#/.test(line) || items.length >= MAX_RECOMMENDED_AUDITS) break;
+ const match = RECOMMENDED_AUDIT_LINE.exec(line);
+ if (!match) break;
+ items.push(match[1].slice(0, 300));
+ }
+ return items;
+}
+
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). */
diff --git a/server/services/agentFinalization.js b/server/services/agentFinalization.js
index 454f74900f..6d039cbf01 100644
--- a/server/services/agentFinalization.js
+++ b/server/services/agentFinalization.js
@@ -2054,6 +2054,18 @@ async function dispatchTaskOutputHook({ agentId, task, success, workspacePath, a
emitLog('warn', `⚠️ Scanner diagnostics were not saved for ${agentId}: ${err.message}`, { agentId });
});
}
+ if (taskType === 'code-quality' && success) {
+ // The triage lane's ranked "Recommended next audits" (#12085) lands on the
+ // task's execution record so the Schedule card shows where to look next.
+ const { parseRecommendedAudits } = await import('../lib/auditQuality.js');
+ const { doneSentinelPath, parseSentinelPayload } = await import('../lib/agentSentinel.js');
+ const { recordRecommendedAudits } = await import('./taskSchedule.js');
+ const path = doneSentinelPath(hookPayloadDir({ task, workspacePath, recovery }), agentId);
+ const summary = path ? parseSentinelPayload(await tryReadFile(path)).summary : null;
+ await recordRecommendedAudits(taskType, task.metadata?.app || null, parseRecommendedAudits(summary)).catch(err => {
+ emitLog('warn', `⚠️ Recommended next audits were not saved for ${agentId}: ${err.message}`, { agentId });
+ });
+ }
const auditDisposition = Number(task.metadata?.auditDispositionVersion) === 1
? await (await import('./auditFindings.js')).settleAuditFindings({
task, agentId, workspacePath: hookPayloadDir({ task, workspacePath, recovery }),
diff --git a/server/services/agentFinalization.outputHooks.test.js b/server/services/agentFinalization.outputHooks.test.js
index 175ecaaac2..9fe57eb26c 100644
--- a/server/services/agentFinalization.outputHooks.test.js
+++ b/server/services/agentFinalization.outputHooks.test.js
@@ -75,6 +75,7 @@ import { emitLog } from './cosEvents.js';
vi.mock('./taskSchedule.js', () => ({
recordTaskTypeFailure: vi.fn(async () => null),
recordTaskTypeSuccess: vi.fn(async () => null),
+ recordRecommendedAudits: vi.fn(async () => null),
}));
import { updateTask, addTask } from './cos.js';
import { completeAgentRun } from './agentRunTracking.js';
@@ -168,6 +169,18 @@ describe('recovery output-hook dispatch (#3182)', () => {
expect(persistedAgent.metadata.securityScan.status).toBe('time-limit');
});
+ it("lands the code-quality lane's ranked next audits on the execution record (#12085)", async () => {
+ const { recordRecommendedAudits } = await import('./taskSchedule.js');
+ const task = { ...TASK, metadata: { ...TASK.metadata, analysisType: 'code-quality' } };
+ tryReadFile.mockResolvedValueOnce('Filed 2 issues.\n## Recommended next audits\n1. better-structural-drift — drifted registries: server/lib\n2. ux — buried action: client/src\nQUALITY_AUDIT_JSON: {}');
+ await dispatchTaskOutputHookOnce({ agentId: 'agent-triage', task, success: true, workspacePath: '/worktree' });
+ expect(recordRecommendedAudits).toHaveBeenCalledWith('code-quality', 'app-example', [
+ 'better-structural-drift — drifted registries: server/lib',
+ 'ux — buried action: client/src',
+ ]);
+ expect(persistedAgent.metadata).toMatchObject({ auditAssessment: { status: 'recorded' } });
+ });
+
it('captures audit telemetry on the shared completion path without waiving fix-mode delivery criteria', async () => {
const task = { ...TASK, metadata: { ...TASK.metadata, analysisType: 'better-complexity' } };
await expect(dispatchTaskOutputHookOnce({ agentId: 'agent-audit', task, success: true, workspacePath: '/worktree' }))
diff --git a/server/services/appQuality.test.js b/server/services/appQuality.test.js
index 0c3c4a798d..25045b8b51 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 { AUDIT_DEFINITIONS } from '../lib/auditCatalog.js';
-import { AUDIT_DISCOVERY, auditQualityInstructions, parseAuditQualityReport, summarizeAppQuality, AUDIT_FRESHNESS_MS, buildAppQualityHistory } from '../lib/auditQuality.js';
+import { AUDIT_DISCOVERY, auditQualityInstructions, parseAuditQualityReport, parseRecommendedAudits, summarizeAppQuality, AUDIT_FRESHNESS_MS, buildAppQualityHistory } 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 });
@@ -182,3 +182,36 @@ it('records honest unscored partial Deep evidence without inventing a score or c
expect(parseAuditQualityReport(sentinel({ ...partial, scannedFiles: 0 }), 'observability')).toBeNull();
expect(auditQualityInstructions('observability')).toContain('For partial coverage, use score:null');
});
+
+// The code-quality lane's triage output (#12085): a ranked list under a
+// `Recommended next audits` heading in the completion summary.
+describe('parseRecommendedAudits', () => {
+ it('reads the ranked list under the heading, stripping markers and stopping at the block end', () => {
+ const summary = [
+ 'Reviewed server/routes. Filed 2 issues.',
+ '## Recommended next audits',
+ '1. better-structural-drift — three hand-synced registries drifted: server/lib/navManifest.js, client/src/lib/navPresentation.js',
+ '2) better-runtime-safety — floating promises in socket handlers: server/services/sockets/',
+ '- error-handling — unhandled fetch failures: client/src/services/api.js',
+ '4. extra-lane — should be ignored beyond three',
+ '',
+ 'QUALITY_AUDIT_JSON: {"version":1}',
+ ].join('\n');
+ expect(parseRecommendedAudits(summary)).toEqual([
+ 'better-structural-drift — three hand-synced registries drifted: server/lib/navManifest.js, client/src/lib/navPresentation.js',
+ 'better-runtime-safety — floating promises in socket handlers: server/services/sockets/',
+ 'error-handling — unhandled fetch failures: client/src/services/api.js',
+ ]);
+ });
+
+ it('accepts a bold or plain heading and stops at the next heading', () => {
+ const summary = '**Recommended next audits**\n1. ux — buried primary action: client/src/pages/Apps.jsx\n## Next\n2. privacy — not part of the block';
+ expect(parseRecommendedAudits(summary)).toEqual(['ux — buried primary action: client/src/pages/Apps.jsx']);
+ });
+
+ it('returns an empty list for a summary with no block, a heading with no list, or a non-string', () => {
+ expect(parseRecommendedAudits('Reviewed and filed nothing.')).toEqual([]);
+ expect(parseRecommendedAudits('## Recommended next audits\n\n1. late — after a blank line')).toEqual([]);
+ expect(parseRecommendedAudits(null)).toEqual([]);
+ });
+});
diff --git a/server/services/taskPromptDefaults.test.js b/server/services/taskPromptDefaults.test.js
index 920723596a..6059f514c3 100644
--- a/server/services/taskPromptDefaults.test.js
+++ b/server/services/taskPromptDefaults.test.js
@@ -217,7 +217,7 @@ describe('taskPromptDefaults integrity snapshot', () => {
it('code-quality v4 keeps conventional defects and cedes drift to its sibling lanes', () => {
const current = DEFAULT_TASK_PROMPTS['code-quality'];
- expect(PROMPT_VERSIONS['code-quality']).toBe(5);
+ expect(PROMPT_VERSIONS['code-quality']).toBe(6);
// Still its own: the conventional maintainability defects.
expect(current).toContain('Brittle conditionals');
expect(current).toContain('Unexplained magic values');
@@ -232,6 +232,20 @@ describe('taskPromptDefaults integrity snapshot', () => {
expect(current).not.toContain('regeneration-only churn');
});
+ // v6: the triage lane must say which focused audit to run next (#12085), and
+ // test-coverage files by default and pays for a new test in a budgeted suite (#12087).
+ it('code-quality v6 ranks the next audits and test-coverage v4 pays for its tests', () => {
+ const quality = DEFAULT_TASK_PROMPTS['code-quality'];
+ expect(quality).toContain('## Lane recommendation');
+ expect(quality).toMatch(/Rank\sthe three focused audits \(by scheduled task type\)/);
+ expect(quality).toContain('`Recommended next audits`');
+ expect(quality).not.toContain('Missing boundary error handling');
+ expect(quality).toContain('failure-path work');
+ const coverage = DEFAULT_TASK_PROMPTS['test-coverage'];
+ expect(PROMPT_VERSIONS['test-coverage']).toBe(4);
+ expect(coverage).toContain('name the redundant test you removed to pay for it');
+ });
+
it('better-structural-drift owns the hunts code-quality gave up', () => {
const current = DEFAULT_TASK_PROMPTS['better-structural-drift'];
diff --git a/server/services/taskPromptDefaults/integrity.snapshot.json b/server/services/taskPromptDefaults/integrity.snapshot.json
index ded1ee229d..842f44004f 100644
--- a/server/services/taskPromptDefaults/integrity.snapshot.json
+++ b/server/services/taskPromptDefaults/integrity.snapshot.json
@@ -15,7 +15,7 @@
"claim-issue": "cea12f4209a3f20ebe1a5ad8cc7b38b5",
"claim-issue-gitlab": "29f025187d20a8583292bb53bb974c06",
"claim-issue-jira": "d0df766dd9ef326c8578efe2953af13e",
- "code-quality": "dc69db26844c074393a59b5a32331676",
+ "code-quality": "175fab48fc713b71b4f0574b7cc5fe0b",
"code-reviewer-implement": "f8cb11be6796874018d0a4d776c8931d",
"code-reviewer-review": "10037a8a366f5c98482d2de11cdb127a",
"console-errors": "5a7f6fd0b119db9d0e01c7f44a7a061c",
@@ -56,7 +56,7 @@
"security": "a66f5ec9d0ed0b42b6e59087783eb9fb",
"simplify": "2eee5529c3bb57d04ba823eed3f5f6ff",
"stash-cleanup": "1c12bac5aac6bb27008c40981e7db08c",
- "test-coverage": "36beffc0c2959be5d818ded54b3fe298",
+ "test-coverage": "1956a18f937cda50343dfa4259d1af30",
"typing": "bd7cb874b2784395280b116369c7e7ac",
"ui-bugs": "06baf650e41fce12aaa59c66030c0357",
"ui-lifecycle": "d156882c73593a54c0fd5754eb4c6fa0",
@@ -79,7 +79,7 @@
"claim-issue": 41,
"claim-issue-gitlab": 37,
"claim-issue-jira": 24,
- "code-quality": 5,
+ "code-quality": 6,
"code-reviewer-a": 1,
"code-reviewer-b": 1,
"console-errors": 4,
@@ -116,7 +116,7 @@
"security": 6,
"simplify": 3,
"stash-cleanup": 2,
- "test-coverage": 3,
+ "test-coverage": 4,
"typing": 3,
"ui-bugs": 4,
"ui-lifecycle": 3,
@@ -286,7 +286,8 @@
"62752723eba7a39aa94e010911923cc8",
"b1cce8f89218844746746ceb576553c1",
"c34792a374dd9868e6381557da582dc1",
- "6762542233cdffb86d4e2244945bf52b"
+ "6762542233cdffb86d4e2244945bf52b",
+ "dc69db26844c074393a59b5a32331676"
],
"console-errors": [
"23b1a2e33cb414f27d4002b51d315e83",
@@ -458,7 +459,8 @@
"test-coverage": [
"ec70fb2b8e193b6a98bec2fbf337b190",
"c2b0f0dee5bc881239684e706ea88324",
- "0d8359170529da12cd63356610b2e220"
+ "0d8359170529da12cd63356610b2e220",
+ "36beffc0c2959be5d818ded54b3fe298"
],
"typing": [
"d8fd1423cf2a523b528ed7d2d7a2bb55",
diff --git a/server/services/taskPromptDefaults/prompts.js b/server/services/taskPromptDefaults/prompts.js
index d7bab6c5cf..019c125166 100644
--- a/server/services/taskPromptDefaults/prompts.js
+++ b/server/services/taskPromptDefaults/prompts.js
@@ -222,8 +222,15 @@ Repository: {repoPath}
documents for itself, including the non-issues it explicitly declares.
- **Stale TODOs and comments that lie** — a comment describing behavior the code
no longer has, or a TODO whose work already shipped.
-- **Missing boundary error handling** — a call across a process, network, or
- filesystem boundary whose failure mode is simply unhandled.
+
+## Lane recommendation
+
+This is the triage lane: its second deliverable is where to look next. Rank
+the three focused audits (by scheduled task type) that the evidence says would
+find the most, each with one sentence of evidence and the paths it points at.
+Put the ranked list in the completion summary under the heading
+\`Recommended next audits\`, one audit per line as
+\`1. <task-type> — <evidence>: <paths>\`.
## Owned by sibling audits — do not file here
@@ -240,7 +247,8 @@ what you found, then leave it to its owner:
- Pure dead-code removal and copy-paste consolidation belong to the
simplification work.
- Latent runtime defects belong to the runtime-safety work; logging gaps to the
- observability work.
+ observability work; a boundary call whose failure is simply unhandled to the
+ failure-path work.
## The evidence bar
@@ -296,6 +304,8 @@ test.
Follow the project's existing test conventions — its runner, file placement,
naming, and mocking patterns — rather than importing a style from elsewhere.
+In implement mode, when you add a test to a suite over the project's documented
+size budget, name the redundant test you removed to pay for it.
## Not yours
diff --git a/server/services/taskPromptDefaults/versions.js b/server/services/taskPromptDefaults/versions.js
index bd2e3615a5..3e44c86dd7 100644
--- a/server/services/taskPromptDefaults/versions.js
+++ b/server/services/taskPromptDefaults/versions.js
@@ -36,9 +36,9 @@ export const PROMPT_VERSIONS = {
// current {appName} body. See the retired-hash history in
// integrity.snapshot.json + the self-heal in taskScheduleStore.js readSchedule().
'security': 6, // v6: generic trust-model pointer (AGENTS.md Security Model + ETHOS.md for PortOS) replaces the PortOS-specific authority paragraph, adds the one-finding-per-class rule, and drops the redaction sentence the mode banners own (#12081, #12080). v5: distinguish delegated authority from untrusted content and require workflow-preserving boundary fixes. v4: adds tenant/resource isolation, SSRF, and unsafe deserialization — the service and data-API defects the v3 list (written for a web app) did not name. v3: carries {modeInstructions} (the pre-v3 body had no placeholder, so its own "fix and commit" steps fought a file-issues dispatch) and defers to the project's documented threat model, requiring an attacker-or-accident story per finding instead of a generic OWASP checklist walk. Previously v2: generic {appName} body (older default hardcoded "PortOS"/"server/routes" paths)
- 'code-quality': 5, // v5: drops the read-instruction-files and scan-then-bound restatements the mode banners and discovery contract own (#12080). v4: hands generated-artifact/hand-synced-registry/layout-coupling drift to the better-structural-drift lane and counted branching + reader cost to better-complexity / better-cognitive-load, keeping conventional maintainability defects — the split across PortOS's specialist tasks. Previously v3: inventory structural drift, duplicate sources of truth, volatile generated artifacts, and incidental-layout coupling before conventional maintainability checks. v2: generic {appName} body (older default hardcoded "PortOS")
- 'test-coverage': 3, // v3: carries {modeInstructions}, ranks gaps by consequence rather than percentage, tests at the highest practical public boundary, requires naming the regression a new test uniquely catches, and hands existing-test quality to better-test-quality. Previously v2: generic {appName} body (older default hardcoded "PortOS")
'performance': 6, // v6: the service/data-path and UI-load sections are "Where present" (apply what exists, skip the rest silently) and the app-specific reference-data sentence is a generic hunt bullet (#12078). v5: adds required service/data-path coverage (query plans, streaming vs buffering, batch shape, pools, partition pruning, cold start), hands spend to cost-efficiency, and replaces PortOS-specific collection names with generic ones — the prompt runs against every managed app. v4: requires UI route-load, idle-network and large-collection evidence; missing measurements are explicitly unverified.
+ 'code-quality': 6, // v6: the triage lane ranks the three focused audits to run next under a `Recommended next audits` heading and cedes unhandled boundary calls to error-handling (#12085). v5: drops the read-instruction-files and scan-then-bound restatements the mode banners and discovery contract own (#12080). v4: hands generated-artifact/hand-synced-registry/layout-coupling drift to the better-structural-drift lane and counted branching + reader cost to better-complexity / better-cognitive-load, keeping conventional maintainability defects — the split across PortOS's specialist tasks. Previously v3: inventory structural drift, duplicate sources of truth, volatile generated artifacts, and incidental-layout coupling before conventional maintainability checks. v2: generic {appName} body (older default hardcoded "PortOS")
+ 'test-coverage': 4, // v4: files issues by default and, in implement mode, names the redundant test removed to pay for a new one in a suite over the size budget (#12087). v3: carries {modeInstructions}, ranks gaps by consequence rather than percentage, tests at the highest practical public boundary, requires naming the regression a new test uniquely catches, and hands existing-test quality to better-test-quality. Previously v2: generic {appName} body (older default hardcoded "PortOS")
'accessibility': 5, // v5: the "skip what static analysis already covers" list now also names keyboard-trap/unreachable-control and faked-semantics findings, matching Biome's `useKeyWithClickEvents`, `noNoninteractiveElementToInteractiveRole`, `useFocusableInteractive`, and `noAriaHiddenOnFocusable` a11y rules (enabled in `client/biome.jsonc` alongside the four from v4) — the live-agent budget shifts further to focus-order/live-region/contrast/zoom issues static analysis still can't establish. Previously v4: checks for an existing JSX a11y linter (Biome's a11y group, jsx-a11y) first and skips findings it already catches deterministically (missing alt/labels, invalid/unsupported ARIA), so the live-agent budget goes to keyboard/focus/live-region/contrast/zoom issues static analysis can't establish. Previously v3: carries {modeInstructions}, names who is blocked and how far they get, and prefers a native element over a custom control with patched attributes. Previously v2: generic {appName} + the app UI (older default hardcoded "PortOS" + http://localhost:5555)
'console-errors': 4, // v4: refer to framework-neutral UI lifecycle audit. v3: carries {modeInstructions}, collects real emitted output before diagnosing, groups duplicates by cause, and forbids "fixing" an error by suppressing it. Previously v2: unified `[Improvement: {appName}]` body (pre-unification defaults shipped separate self- and app-improvement bodies)
'error-handling': 4, // v4: cedes sensitive detail in an error path to privacy and partial writes to data-integrity (#12086). v3: carries {modeInstructions} and covers resilience (timeouts, retry ceilings, degraded-dependency fallback, cleanup on the error path, actionable user-facing text) while handing swallowed errors and log context to observability. Previously v2: unified `[Improvement: {appName}]` body (older default used the `[App Improvement: {appName}]` header)
diff --git a/server/services/taskSchedule.js b/server/services/taskSchedule.js
index 0a01b74e95..5aafc4ece6 100644
--- a/server/services/taskSchedule.js
+++ b/server/services/taskSchedule.js
@@ -348,6 +348,26 @@ export async function getExecutionHistory(taskType) {
return schedule.executions[key] || { lastRun: null, count: 0, perApp: {} };
}
+/**
+ * Keep the latest triage output of an audit beside its execution record so the
+ * Schedule card can show it (#12085). Machine-local: the execution store never
+ * federates. An empty list clears nothing — a run that produced no
+ * recommendation leaves the previous one visible rather than erasing it.
+ */
+export async function recordRecommendedAudits(taskType, appId, items) {
+ if (!Array.isArray(items) || items.length === 0) return null;
+ return updateSchedule(async (schedule) => {
+ const key = taskType.startsWith('task:') ? taskType : `task:${taskType}`;
+ schedule.executions[key] ||= { lastRun: null, count: 0, perApp: {} };
+ schedule.executions[key].recommendedAudits = {
+ at: new Date().toISOString(),
+ appId: appId || null,
+ items: items.slice(0, 3).map(item => String(item).slice(0, 300)),
+ };
+ return { result: schedule.executions[key].recommendedAudits, changed: true };
+ });
+}
+
// ============================================================
// Perpetual (drain-until-done) park state
// ============================================================
@@ -1489,6 +1509,8 @@ export async function getScheduleStatus() {
runCount: execution.count,
globalLastRun: execution.lastRun,
globalRunCount: execution.count,
+ // The triage lane's last ranked "Recommended next audits" (#12085).
+ recommendedAudits: execution.recommendedAudits || null,
perAppCount: Object.keys(execution.perApp).length,
appOverrides,
enabledAppCount,
diff --git a/server/services/taskSchedule.test.js b/server/services/taskSchedule.test.js
index 2d75bf0932..09a112922f 100644
--- a/server/services/taskSchedule.test.js
+++ b/server/services/taskSchedule.test.js
@@ -119,6 +119,7 @@ import {
getTaskInterval,
updateTaskInterval,
recordExecution,
+ recordRecommendedAudits,
getExecutionHistory,
shouldRunTask,
shouldContinuePerpetualDrain,
@@ -3838,3 +3839,30 @@ describe('boundParkedUntil', () => {
expect(boundParkedUntil('never', '2026-01-12T00:00:00.000Z', NOW)).toBe('never')
})
})
+
+// The code-quality lane's ranked triage output lives beside its execution
+// record and surfaces on the Schedule card (#12085).
+describe('recordRecommendedAudits', () => {
+ it('stores the ranked list on the execution record and exposes it on schedule status', async () => {
+ mockSchedule({ tasks: {}, executions: { 'task:code-quality': { lastRun: '2026-10-01T00:00:00Z', count: 2, perApp: {} } } })
+ const recorded = await recordRecommendedAudits('code-quality', 'app-1', [
+ 'better-structural-drift — drifted registries: server/lib/navManifest.js',
+ 'ux — buried primary action: client/src/pages/Apps.jsx',
+ ])
+ expect(recorded).toMatchObject({ appId: 'app-1', items: [expect.stringContaining('better-structural-drift'), expect.stringContaining('ux —')] })
+ expect(Date.parse(recorded.at)).toBeGreaterThan(0)
+ const history = await getExecutionHistory('code-quality')
+ expect(history.count).toBe(2)
+ expect(history.recommendedAudits.items).toHaveLength(2)
+ const status = await getScheduleStatus()
+ expect(status.tasks['code-quality'].recommendedAudits).toEqual(history.recommendedAudits)
+ expect(status.tasks['security'].recommendedAudits).toBeNull()
+ })
+
+ it('keeps the previous recommendation when a run produced none', async () => {
+ const previous = { at: '2026-10-01T00:00:00Z', appId: 'app-1', items: ['ux — one'] }
+ mockSchedule({ tasks: {}, executions: { 'task:code-quality': { lastRun: '2026-10-01T00:00:00Z', count: 1, perApp: {}, recommendedAudits: previous } } })
+ expect(await recordRecommendedAudits('code-quality', 'app-1', [])).toBeNull()
+ expect((await getExecutionHistory('code-quality')).recommendedAudits).toEqual(previous)
+ })
+})
diff --git a/server/services/taskScheduleRegistry.js b/server/services/taskScheduleRegistry.js
index beafdd3e6d..7a0549071f 100644
--- a/server/services/taskScheduleRegistry.js
+++ b/server/services/taskScheduleRegistry.js
@@ -190,7 +190,7 @@ const TASK_INTERVAL_DEFAULTS = {
'model-comparison-refresh': { type: INTERVAL_TYPES.ON_DEMAND, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { ...NON_COMMITTING_COORDINATOR_METADATA } },
'security': { type: INTERVAL_TYPES.ON_DEMAND, enabled: true, providerId: null, model: null, prompt: null, taskMetadata: { fileIssues: false } },
'code-quality': { type: INTERVAL_TYPES.ON_DEMAND, enabled: true, providerId: null, model: null, prompt: null, taskMetadata: { fileIssues: false } },
- 'test-coverage': { type: INTERVAL_TYPES.ON_DEMAND, enabled: true, providerId: null, model: null, prompt: null, taskMetadata: { fileIssues: false } },
+ 'test-coverage': { type: INTERVAL_TYPES.ON_DEMAND, enabled: true, providerId: null, model: null, prompt: null, taskMetadata: { fileIssues: true } },
'performance': { type: INTERVAL_TYPES.ON_DEMAND, enabled: true, providerId: null, model: null, prompt: null, taskMetadata: { fileIssues: false } },
'accessibility': { type: INTERVAL_TYPES.ON_DEMAND, enabled: true, providerId: null, model: null, prompt: null, taskMetadata: { fileIssues: false } },
// branch-reconcile first removes fully-merged, clean orphaned worktrees and