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
address review (codex): drop quote-less malformed findings instead of passing un-vetted text through (#1412)
Adam Eivy004195719ce8
diff --git a/server/lib/editorial/checkRegistry.js b/server/lib/editorial/checkRegistry.jsindex 1f2e53d02a..003743c3bf 100644--- a/server/lib/editorial/checkRegistry.js+++ b/server/lib/editorial/checkRegistry.js@@ -1872,16 +1872,21 @@ export const EDITORIAL_CHECKS = [// model's `anchorQuote` + `issueNumber` (facts it's authoritative on). We count// the name's distinct-issue appearances across ALL sections, set the location// label + severity, and collapse the same name surfaced from different chunks.- // A name the matcher can't find in the prose (a stray/garbled LLM token) is- // dropped rather than reported as a "0 appearances" phantom.+ // Malformed findings are DROPPED, not passed through (passing the model's+ // un-vetted text would reopen the contradiction risk this pass closes): one+ // with no quoted name to verify, or one whose quoted name the matcher can't+ // find in any section (a stray/garbled LLM token / 0-appearance phantom).const sections = Array.isArray(ctx.sections) ? ctx.sections : [];const seenNames = new Set();const out = [];for (const f of findings) {const name = (String(f.location || '').match(/"([^"]+)"/) || [])[1];- // No quoted name to verify against the prose — keep the model's finding as-is- // rather than guessing (it may be a general roster note, not a single name).- if (!name) { out.push(f); continue; }+ // The contract requires the model to quote the surfaced name in `location`.+ // A finding without one is malformed — drop it rather than pass the model's+ // un-vetted free text through unrewritten (which would reopen the contradiction+ // risk this deterministic pass exists to close: keep ONLY anchorQuote ++ // issueNumber, never the model's problem/suggestion).+ if (!name) continue;const key = normalizeName(name);if (key && seenNames.has(key)) continue; // same unmodeled name from another chunkif (key) seenNames.add(key);diff --git a/server/lib/editorial/checkRegistry.test.js b/server/lib/editorial/checkRegistry.test.jsindex f10a4cfea2..afda9bc946 100644--- a/server/lib/editorial/checkRegistry.test.js+++ b/server/lib/editorial/checkRegistry.test.js@@ -1052,18 +1052,19 @@ describe('roster.unmodeled-names — LLM check (#1412)', () => {expect(findings[0].location).toBe('Unmodeled character — "Marguerite" (2 issues)');});- it('keeps a quote-less finding as-is but drops a quoted name absent from the prose', async () => {+ it('drops malformed findings — no quoted name, or a quoted name absent from the prose', async () => {const ctx = wholeCtx({sections: [{ number: 1, content: 'Nothing matching here.' }],callStagedLLM: async () => ({ content: { findings: [- { severity: 'low', issueNumber: 1, location: 'General note (no quoted name)', problem: 'malformed' },+ // Quote-less ⇒ can't verify the name against the prose, and we won't pass the+ // model's un-vetted text through ⇒ dropped.+ { severity: 'low', issueNumber: 1, location: 'General note (no quoted name)', problem: 'malformed, appears only once' },+ // Quoted but matches 0 sections (garbled token) ⇒ dropped.{ severity: 'low', issueNumber: 1, location: 'Unmodeled character — "Ghostname"', problem: 'not actually in prose' },] } }),});const findings = await getCheck(UNMODELED_NAMES).run(ctx);- // The quote-less note is kept untouched (can't verify a name); the quoted- // "Ghostname" matches 0 sections, so it's dropped rather than reported.- expect(findings.map((f) => f.location)).toEqual(['General note (no quoted name)']);+ expect(findings).toEqual([]);});});