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

address review (codex): fold custom-check prompt into staleness fingerprint (#1387)

Adam Eivya4934350624f
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 04270ac82b..2463768c8d 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -59,7 +59,7 @@
## Changed
-- **[issue-1387] Editorial-check "stale" badges are now scoped to exactly what each check reads, so a single edit no longer marks unrelated findings stale.** A finding's stale badge tells you the manuscript/canon/series content the check analyzed has drifted since it ran. That signal used to be derived from a coarse two-bucket heuristic (manuscript-vs-canon) that folded the *style guide* and the *arc ticking clock* into shared buckets — so editing the ticking clock marked **every** canon-only finding stale (naming, object-attachment, …), and editing the style guide marked **every** manuscript finding stale (even the info-dumping check, which never reads the style guide). Each check now declares the exact inputs it reads (`sources`, a subset of `manuscript` / `canon` / `series.styleGuide` / `series.arc.tickingClock`) and the runner fingerprints precisely those — so editing the ticking clock stales only the ticking-clock-hygiene finding, editing the style guide stales only the style checks, and a future check that reads a new series field can't silently stay falsely "fresh" (a fail-fast guard requires every check to declare a non-empty, known source set, and a `manuscript` source to pair with `needsManuscript`). Staleness is still derived per-read and never stored or synced. (`server/lib/editorial/checkRegistry.js`, `server/services/pipeline/editorial/checkRunner.js`, #1387)
+- **[issue-1387] Editorial-check "stale" badges are now scoped to exactly what each check reads, so a single edit no longer marks unrelated findings stale.** A finding's stale badge tells you the manuscript/canon/series content the check analyzed has drifted since it ran. That signal used to be derived from a coarse two-bucket heuristic (manuscript-vs-canon) that folded the *style guide* and the *arc ticking clock* into shared buckets — so editing the ticking clock marked **every** canon-only finding stale (naming, object-attachment, …), and editing the style guide marked **every** manuscript finding stale (even the info-dumping check, which never reads the style guide). Each check now declares the exact inputs it reads (`sources`, a subset of `manuscript` / `canon` / `series.styleGuide` / `series.arc.tickingClock`) and the runner fingerprints precisely those — so editing the ticking clock stales only the ticking-clock-hygiene finding, editing the style guide stales only the style checks, and a future check that reads a new series field can't silently stay falsely "fresh" (a fail-fast guard requires every check to declare a non-empty, known source set, and a `manuscript` source to pair with `needsManuscript`). A custom check's authored prompt is folded into its fingerprint too, so editing what a custom check looks for stales its prior findings even when the manuscript hasn't changed. Staleness is still derived per-read and never stored or synced. (`server/lib/editorial/checkRegistry.js`, `server/services/pipeline/editorial/checkRunner.js`, #1387)
- **[issue-1348] Your reverse outline now travels with the series across federated machines.** The scene-by-scene Reverse Outline is stored alongside the series, and until now it stayed put — regenerating it on one machine left your other synced machines (and anyone you share a bucket with) showing a stale or empty outline. It now rides the same cross-install sync as the series itself: regenerate it on one peer and the newest outline propagates everywhere, last-writer-wins by generation time. Older installs that don't yet understand outlines simply skip it (the series and its issues still sync fine) and pick it up automatically once they update. (#1348)
diff --git a/server/services/pipeline/editorial/checkRunner.js b/server/services/pipeline/editorial/checkRunner.js
index b6650d8ac2..a52eb73d25 100644
--- a/server/services/pipeline/editorial/checkRunner.js
+++ b/server/services/pipeline/editorial/checkRunner.js
@@ -88,6 +88,14 @@ function fingerprintForCheck(check, resolved) {
const segments = [...new Set(checkSources(check))]
.sort()
.map((token) => `${token}=${resolved[token]}`);
+ // A custom check's run logic IS its authored prompt (user data, not code), so a
+ // prompt edit must stale its prior findings even when the manuscript is unchanged
+ // — fold it into the fingerprint. Built-in checks' logic lives in code (a code
+ // change isn't user content and isn't fingerprinted), so only their declared
+ // content sources matter. (#1346, #1387)
+ if (check?.isCustom && typeof check.prompt === 'string') {
+ segments.push(`definition=${check.prompt}`);
+ }
return sha256(segments.join(HASH_SEP));
}
diff --git a/server/services/pipeline/editorial/checkRunner.test.js b/server/services/pipeline/editorial/checkRunner.test.js
index eb88994224..2a51abb240 100644
--- a/server/services/pipeline/editorial/checkRunner.test.js
+++ b/server/services/pipeline/editorial/checkRunner.test.js
@@ -28,6 +28,15 @@ vi.mock('../../../lib/stageRunner.js', () => ({
],
},
})),
+ // Inline sibling for user-defined (custom) checks (#1346) — same finding shape.
+ runInlineLLM: vi.fn(async () => ({
+ runId: 'inline-run',
+ content: {
+ findings: [
+ { severity: 'medium', issueNumber: 1, location: 'p1', problem: 'Anachronism in opening', suggestion: 'Cut it', anchorQuote: 'As you know, Bob' },
+ ],
+ },
+ })),
// A roomy window by default → manuscript LLM checks run in one whole-corpus call.
resolveStageContext: vi.fn(async () => ({ provider: { type: 'cli' }, model: 'm', contextWindow: 1_000_000 })),
}));
@@ -56,6 +65,7 @@ const { runStagedLLM, resolveStageContext } = await import('../../../lib/stageRu
const { collectManuscriptSections } = await import('../arcPlanner.js');
const { getSeriesCanon } = await import('../seriesCanon.js');
const { getSeries } = await import('../series.js');
+const { getSettings } = await import('../../settings.js');
const { listChecks, getCheck } = await import('../../../lib/editorial/index.js');
// Build a `pipelineEditorialChecks.checks` map that disables every check
@@ -303,6 +313,31 @@ describe('getReviewWithStaleness (#1345)', () => {
expect(review.comments.find((c) => c.checkId === 'prose.info-dumping').stale).toBe(false);
});
+ it('stales a custom-check finding when its authored prompt changes, even if the manuscript is unchanged (#1387)', async () => {
+ // A custom check's run logic is its prompt (user data), so a prompt edit must
+ // stale its prior findings — the manuscript source alone can't catch that.
+ const settingsWithPrompt = (prompt) => ({
+ pipelineEditorialChecks: {
+ customChecks: [{ id: 'custom.anachronism', label: 'Anachronisms', prompt, scope: 'issue', severityDefault: 'medium' }],
+ },
+ });
+ getSettings.mockResolvedValueOnce(settingsWithPrompt('Flag modern tech in a period setting.'));
+ const { findings } = await runEditorialChecks('s1');
+ reviewState = { comments: findings.map((f) => ({ ...f, status: 'open' })) };
+ const custom = findings.find((f) => f.checkId === 'custom.anachronism');
+ expect(custom, 'custom check produced a finding').toBeTruthy();
+
+ // Same prompt → fresh (the manuscript-only segment is unchanged).
+ getSettings.mockResolvedValueOnce(settingsWithPrompt('Flag modern tech in a period setting.'));
+ const fresh = await getReviewWithStaleness('s1');
+ expect(fresh.comments.find((c) => c.checkId === 'custom.anachronism').stale).toBe(false);
+
+ // Edited prompt → stale, despite the unchanged manuscript.
+ getSettings.mockResolvedValueOnce(settingsWithPrompt('Flag anachronistic slang in dialogue.'));
+ const stale = await getReviewWithStaleness('s1');
+ expect(stale.comments.find((c) => c.checkId === 'custom.anachronism').stale).toBe(true);
+ });
+
it('leaves legacy findings (no hash), completeness comments (no checkId), and unknown checks unannotated', async () => {
reviewState = {
comments: [