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): cap the stored rolling setup summary, not just the digest (#1403)
[._.]/ Adam Eivycec6a3f38350
diff --git a/server/lib/editorial/checkRegistry.js b/server/lib/editorial/checkRegistry.jsindex 5160bf87c9..5d3f814450 100644--- a/server/lib/editorial/checkRegistry.js+++ b/server/lib/editorial/checkRegistry.js@@ -414,7 +414,13 @@ async function runChunkedManuscriptCheck(ctx, { chunks, category, max, callChunk// must not abort the check — keep the prior summary and continue.if (summarizeChunk && i < chunks.length - 1 && !ctx.signal?.aborted) {const next = await summarizeChunk(setupSummary, manuscript).catch(() => setupSummary);- if (typeof next === 'string' && next.trim()) setupSummary = next.trim();+ // Cap the STORED summary, not just the rendered digest: a verbose/echoing+ // summarizer response is fed back into the next summarization prompt as the+ // prior summary, so an uncapped string would compound and could overflow the+ // provider context. Trimming here bounds both the next prompt and the digest.+ if (typeof next === 'string' && next.trim()) {+ setupSummary = next.trim().slice(0, EDITORIAL_SETUP_DIGEST_BODY_CHARS);+ }}}return [...merged.values()].slice(0, Math.max(0, max));diff --git a/server/lib/editorial/checkRegistry.test.js b/server/lib/editorial/checkRegistry.test.jsindex 5f62384c73..5b938f02d7 100644--- a/server/lib/editorial/checkRegistry.test.js+++ b/server/lib/editorial/checkRegistry.test.js@@ -870,6 +870,28 @@ describe('cross-chunk clean-setup digest (#1403)', () => {expect(seen[1]).not.toContain('Setup already established in EARLIER parts');});+ it('caps the STORED rolling summary so a verbose summarizer response cannot compound across chunks', async () => {+ // The summarizer echoes a huge response; the prior summary fed into the NEXT+ // summarization prompt must be capped, not the full string.+ const priorSummariesSeen = [];+ await getCheck('style.conformance').run({+ config: { maxFindings: 12 },+ severityDefault: 'medium',+ series: { styleGuide: { tense: 'past', povPerson: 'first' } },+ planManuscriptChunks: async () => ['CHUNK_ONE', 'CHUNK_TWO', 'CHUNK_THREE'],+ callStagedLLM: async () => ({ content: { findings: [] } }),+ callInlineLLM: async (prompt) => {+ // Capture the "Setup recorded so far" section the prompt embedded.+ const m = prompt.match(/# Setup recorded so far \(from earlier parts\)\n([\s\S]*?)\n\n# New manuscript part/);+ priorSummariesSeen.push(m ? m[1] : '');+ return { content: 'y'.repeat(EDITORIAL_SETUP_DIGEST_BODY_CHARS + 5000) };+ },+ });+ // First summarizer call has no prior summary; the second sees the capped first.+ expect(priorSummariesSeen[0]).toBe('(none yet)');+ expect(priorSummariesSeen[1].length).toBeLessThanOrEqual(EDITORIAL_SETUP_DIGEST_BODY_CHARS);+ });+it('keeps the prior summary when the summarizer throws (a bad call must not abort the check)', async () => {const seen = [];let inlineCalls = 0;