Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: give Deep audit agents the exact checkpoint evidence schema (#10569)
[._.]/e5eca8fcd80d
diff --git a/server/lib/deepAudit.js b/server/lib/deepAudit.jsindex 920ab2507f..10f3a0168f 100644--- a/server/lib/deepAudit.js+++ b/server/lib/deepAudit.js@@ -3,6 +3,7 @@ import { POLLUTING_KEYS } from './objects.js';import { canonicalSnapshotChecksum } from './snapshotChecksum.js';export const DEEP_AUDIT_VERSION = 1;+export const DEEP_AUDIT_CONTRACT_VERSION = 2;export const DEEP_AUDIT_PASSES = Object.freeze(['static', 'trace', 'adversarial', 'challenge']);export const DEEP_AUDIT_SCENARIOS = Object.freeze(['normal', 'failure', 'concurrency-recovery']);const text = z.string().trim().min(1).max(12000);@@ -185,11 +186,16 @@ export function refreshDeepAuditScope(ledger, scope) {}export function deepAuditInstructions({ ledger, attempt, ledgerPath, reportPath }) {- return `## Deep audit coverage contract v${DEEP_AUDIT_VERSION} — highest-priority audit scope+ return `## Deep audit coverage contract v${DEEP_AUDIT_CONTRACT_VERSION} — highest-priority audit scopeThis overrides ALL bounded-slice, one-finding, five-findings, high-score and early-stop discovery instructions in saved/custom/legacy prompts and completion templates. Delivery mode stays ${ledger.delivery}. Small coherent remediation PRs remain required; do not expand a PR to contain the findings register.Read the entire server-generated ledger at ${JSON.stringify(ledgerPath)}. Audit every assigned unit of pass ${attempt.pass}; follow all remaining units after finding a defect. The denominator is ${ledger.units.length} category/subsystem/scenario units, each requiring static, end-to-end trace, adversarial failure/concurrency/recovery and independent challenge evidence. Static scans alone never certify review. Inventory is a minimum: enroll discovered workflows, entry points and scenarios through additionalUnits before claiming completeness. Inaccessible evidence remains blocked.Assignment: attemptId=${attempt.id}; scopeHash=${ledger.scopeHash}; prerequisiteHash=${attempt.prerequisiteHash}. Do not change the ledger or self-assign another pass. Independent challenge is a separate server-assigned invocation after prior passes. Discovery passes must not edit source; only the post-fix pass may implement one coherent fix, test/review/deliver it under the selected policy. Other confirmed findings stay in the register for later small PRs. File-issues mode may file findings after substantive review; filing limits never limit discovery or the register.During the run, atomically replace ${JSON.stringify(reportPath)} with a JSON checkpoint after each completed unit. This file is imported on exit, failure or interruption; never wait until context is exhausted. Time/context/budget exhaustion means PARTIAL with a stopReason and remaining units, not success. Resume requires another explicit launch; never create automatic retry loops or launch other audits.Report shape: {version:1,scopeHash,attemptId,prerequisiteHash,pass,units:[{id,status:"evidenced"|"blocked"|"inapplicable",reason,sources:[{path,blob}],evidence:{...}}],candidates:[{id,unitId,finding,disposition:"pending"|"confirmed"|"rejected"|"duplicate"|"deferred"|"resolved",resolution,resolvedRevision?}],additionalUnits?:[{subsystem,scenario,files,reason}],stopReason${attempt.pass === 'post-fix' ? ',validationRevision:"exact tested workspace HEAD"' : ''}}. Use resolved only in post-fix with resolvedRevision matching the tested HEAD and concrete fix/test evidence in resolution. Omit optional keys rather than spelling question marks in JSON. No extra keys. Include all checkpoints from this attempt in each atomic write. Copy identities and source blob hashes from the ledger. Static reports must account for EVERY file in their unit. Required evidence fields for ${attempt.pass}: ${EVIDENCE_FIELDS[attempt.pass].join(', ')}. Every field needs concrete observations, paths and outcomes, including when no findings survive. Inapplicability needs a scenario-specific reason and evidence in every pass, including independent confirmation; inaccessible evidence is BLOCKED, not inapplicable. Never invent commands, results or inspection evidence. These are agent attestations, not independent proof that tests ran.+Every evidence value must be a non-empty JSON string, never an array, object, number or boolean. Combine multiple observations or trace steps into one string using escaped newlines. Each text value must contain 1–12000 characters after trimming. Validate the entire checkpoint against this schema before atomically publishing it; do not coerce or invent evidence to satisfy validation.+Checkpoint JSON schema (authoritative field types and limits):+\`\`\`json+${JSON.stringify(z.toJSONSchema(deepAuditReportSchema))}+\`\`\`Keep all candidates in the register, triage every one, including duplicates/rejections/deferred fixes. Delivery completion is distinct from discovery and does not mean all confirmed findings were remediated. Also preserve the ordinary QUALITY_AUDIT_JSON assessment and completion sentinel; neither a score nor process success can replace this checkpoint. Report missing evidence honestly.`;}diff --git a/server/services/deepAudit.js b/server/services/deepAudit.jsindex ed69f32657..8ab01b07cf 100644--- a/server/services/deepAudit.js+++ b/server/services/deepAudit.js@@ -7,7 +7,7 @@ import { tryReadFile } from '../lib/jsonIo.js';import { canonicalSnapshotChecksum } from '../lib/snapshotChecksum.js';import { normalizeAuditTaskType, isAuditTaskType } from '../lib/auditCatalog.js';import { createDeepAuditLedger, assignDeepAuditAttempt, deepAuditProgress, deepAuditInstructions,- mergeDeepAuditReport, refreshDeepAuditScope, DEEP_AUDIT_VERSION } from '../lib/deepAudit.js';+ mergeDeepAuditReport, refreshDeepAuditScope, DEEP_AUDIT_CONTRACT_VERSION } from '../lib/deepAudit.js';import { PROMPT_VERSIONS } from './taskPromptDefaults/versions.js';import { resolveTaskHookType } from './taskTypeHooks.js';@@ -54,7 +54,7 @@ async function inventoryDeepAudit(workspacePath, { promptHash, category }) {const capabilities = { ...detected.capabilities, git: true, trackedFiles: files.length, submodules: files.filter(file => file.kind === 'commit').map(file => file.path) };return { revision, inventoryHash: canonicalSnapshotChecksum(files), files, capabilities,exclusions: ['Git-ignored files are outside the tracked-source inventory; required runtime evidence must be reported blocked when unavailable.'],- promptVersions: { contract: DEEP_AUDIT_VERSION, category: PROMPT_VERSIONS[category] ?? null }, promptHash };+ promptVersions: { contract: DEEP_AUDIT_CONTRACT_VERSION, category: PROMPT_VERSIONS[category] ?? null }, promptHash };}async function mutateLedger(id, initial, mutate) {diff --git a/server/services/deepAudit.test.js b/server/services/deepAudit.test.jsindex 32fada0d0d..1c04c036d9 100644--- a/server/services/deepAudit.test.js+++ b/server/services/deepAudit.test.js@@ -60,6 +60,20 @@ async function finish(agentId, selected = task, success = true) {}describe('Deep coverage workflow across serialized restarts', () => {+ it('gives the agent exact evidence types and rejects array observations without crediting coverage', async () => {+ const prompt = await prepare('typed-report');+ const contract = JSON.parse(prompt.match(/```json\n([^]*?)\n```/)[1]);+ expect(contract.properties.version.const).toBe(1);+ expect(contract.properties.units.items.properties.evidence.additionalProperties)+ .toMatchObject({ type: 'string', minLength: 1, maxLength: 12000 });+ report = JSON.stringify(payload('typed-report', { units: payload('typed-report').units.map(unit => ({+ ...unit, evidence: { method: 'Read source and callers', observations: ['Inspected source'] },+ })) }));+ expect(await finish('typed-report')).toMatchObject({ complete: false, satisfiedPasses: 0 });+ report = JSON.stringify(payload('typed-report'));+ expect(await finish('typed-report')).toMatchObject({ complete: false, satisfiedPasses: 6 });+ });+it('does not equate no findings, successful exit or all files scanned with complete discovery', async () => {for (const [index, pass] of ['static', 'trace', 'adversarial', 'challenge'].entries()) {const agentId = `agent-${index}`;@@ -183,6 +197,7 @@ it('pins an actual Git inventory and refuses tracked and untracked drift', asyncconst inspect = () => prepareDeepAudit({ task, agentId: 'git-agent', workspacePath: directory }, { ...deps, inventory: undefined });await inspect();const pinned = saved().scope;+ expect(pinned.promptVersions.contract).toBe(2);expect(pinned.files).toHaveLength(1);expect(pinned.files[0]).toMatchObject({ path: 'source.js', kind: 'blob' });await writeFile(join(directory, 'untracked.js'), 'new source');