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): scope fresh-dismiss to checkId; gate editorial-checks budget on LLM
[._.]/ Adam Eivy8977e74e0958
diff --git a/server/services/pipeline/manuscriptReview.js b/server/services/pipeline/manuscriptReview.jsindex 094c2fb2ad..dadfd45c2b 100644--- a/server/services/pipeline/manuscriptReview.js+++ b/server/services/pipeline/manuscriptReview.js@@ -178,10 +178,18 @@ const findingKey = (c) => `${c.checkId ?? ''}|${c.issueNumber ?? ''}|${c.anchorQ* resurrected on the next inbound sync. A flip to `dismissed` rides the same* LWW path and converges. `accepted`/`dismissed` comments are untouched.*+ * `checkId` SCOPES the 'fresh' reconciliation to one check's findings: only open+ * comments whose `checkId` matches are eligible for auto-dismissal. The+ * completeness pass seeds with no checkId (its findings carry `checkId: null`),+ * so a fresh completeness run reconciles ONLY the null-checkId space and can't+ * dismiss an editorial-check's open findings (e.g. `prose.info-dumping`), which+ * carry a different checkId. Ignored in 'merge' mode (nothing is auto-dismissed).+ ** New findings resolve their issueId/stageId from the current manuscript* sections by issueNumber.*/-export async function seedReviewFromFindings(seriesId, findings, { runId = null, mode = 'merge' } = {}) {+export async function seedReviewFromFindings(seriesId, findings, { runId = null, mode = 'merge', checkId = null } = {}) {+ const scopeCheckId = checkId ?? null;const sections = await collectManuscriptSections(seriesId);const byNumber = new Map(sections.map((s) => [s.number, s]));return queueReviewWrite(seriesId, async () => {@@ -236,7 +244,7 @@ export async function seedReviewFromFindings(seriesId, findings, { runId = null,let dismissedCount = 0;let backfilledCount = 0;const carried = review.comments.map((c) => {- if (mode === 'fresh' && c.status === 'open' && !freshKeys.has(findingKey(c))) {+ if (mode === 'fresh' && c.status === 'open' && (c.checkId ?? null) === scopeCheckId && !freshKeys.has(findingKey(c))) {dismissedCount += 1;return sanitizeComment({ ...c, status: 'dismissed', updatedAt: now });}diff --git a/server/services/pipeline/manuscriptReview.test.js b/server/services/pipeline/manuscriptReview.test.jsindex bfc4b2db65..d51df9134a 100644--- a/server/services/pipeline/manuscriptReview.test.js+++ b/server/services/pipeline/manuscriptReview.test.js@@ -187,6 +187,26 @@ describe('manuscriptReview — re-run merge vs fresh reconcile', () => {expect(kept).toHaveLength(1);expect(kept[0].status).toBe('dismissed');});++ it('fresh scopes auto-dismissal to its own checkId — leaves other checks open', async () => {+ // A registry check seeds an open finding (its own checkId).+ await seedReviewFromFindings(+ 'ser-fresh-scope',+ [{ problem: 'info dump', anchorQuote: 'as you know', checkId: 'prose.info-dumping' }],+ { mode: 'merge' },+ );+ // A completeness pass (no checkId) re-runs in fresh mode and finds something+ // else entirely. It must NOT dismiss the registry check's open finding.+ const next = await seedReviewFromFindings(+ 'ser-fresh-scope',+ [{ problem: 'Act II sags', anchorQuote: 'the road' }],+ { mode: 'fresh' },+ );+ const infoDump = next.comments.find((c) => c.problem === 'info dump');+ expect(infoDump.status).toBe('open');+ expect(infoDump.checkId).toBe('prose.info-dumping');+ expect(next.comments.find((c) => c.problem === 'Act II sags').status).toBe('open');+ });});describe('manuscriptReview — with-edits fix seeding', () => {diff --git a/server/services/pipeline/seriesAutopilot.js b/server/services/pipeline/seriesAutopilot.jsindex 3ef882d770..971fa866a0 100644--- a/server/services/pipeline/seriesAutopilot.js+++ b/server/services/pipeline/seriesAutopilot.js@@ -90,7 +90,8 @@ import {import * as volumeBeatsRunner from './volumeBeatsRunner.js';import * as autoRunner from './autoRunner.js';import { seedReviewFromFindings, getReview } from './manuscriptReview.js';-import { runEditorialChecks } from './editorial/checkRunner.js';+import { runEditorialChecks, buildEditorialCheckPlan } from './editorial/checkRunner.js';+import { getSettings } from '../settings.js';import { generateManuscriptFix, acceptManuscriptFix } from './manuscriptFix.js';import { verifyComicScript } from './scriptVerify.js';import { checkSeriesCanonReadiness } from './canonReadiness.js';@@ -602,20 +603,27 @@ async function runEditorial(sId, record) {}// STEP 5.2 — run the registry-driven editorial checks once per run, seeding-// their findings into the same manuscript-review comment set. LLM-kind checks-// cost tokens, so gate on the daily budget first; a no-op when no checks are-// enabled (the runner returns zero findings). Failures are surfaced (logged)-// but never block the run — editorial checks are advisory.+// their findings into the same manuscript-review comment set. Only LLM-kind+// checks cost tokens, so gate the daily budget AND bill a cos action only when+// an enabled LLM check will actually run — a deterministic-only (or all-checks-+// disabled) run does cheap local work and must neither pause on an exhausted+// budget nor consume quota. Failures are surfaced (logged) but never block the+// run — editorial checks are advisory.async function runEditorialChecksPass(sId, record) {if (record.cancelRequested) return { canceled: true };- const beforeChecks = await budgetPause();- if (beforeChecks) return beforeChecks;- const result = await runEditorialChecks(sId, providerOverrideOpts(record)).catch((err) => {+ const settings = await getSettings();+ const plan = await buildEditorialCheckPlan(sId, { settings });+ const hasLlmCheck = plan.checks.some((c) => c.kind === 'llm');+ if (hasLlmCheck) {+ const beforeChecks = await budgetPause();+ if (beforeChecks) return beforeChecks;+ }+ const result = await runEditorialChecks(sId, { ...providerOverrideOpts(record), settings }).catch((err) => {console.log(`⚠️ autopilot: editorial checks failed for ${sId.slice(0, 12)}: ${err.message}`);return null;});if (result) {- await recordDomainUsage('cos', { actions: 1 });+ if (hasLlmCheck) await recordDomainUsage('cos', { actions: 1 });broadcast(sId, { type: 'verify:round', scope: 'editorialChecks', round: 1, findings: result.findings.length, blocking: 0 });}record.runState.editorialChecksReviewed = true;diff --git a/server/services/pipeline/seriesAutopilot.test.js b/server/services/pipeline/seriesAutopilot.test.jsindex 5bcd319302..91546d2898 100644--- a/server/services/pipeline/seriesAutopilot.test.js+++ b/server/services/pipeline/seriesAutopilot.test.js@@ -72,6 +72,11 @@ vi.mock('./manuscriptReview.js', () => ({}));vi.mock('./editorial/checkRunner.js', () => ({runEditorialChecks: vi.fn(async () => ({ runId: 'ec', findings: [], perCheck: [], canceled: false })),+ buildEditorialCheckPlan: vi.fn(async () => ({ seriesId: 's', checks: [], enabledCount: 0 })),+}));+vi.mock('../settings.js', async (importOriginal) => ({+ ...(await importOriginal()),+ getSettings: vi.fn(async () => ({})),}));vi.mock('./manuscriptFix.js', () => ({generateManuscriptFix: vi.fn(async () => ({})),