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): neutralize markdown fence delimiters in page-turn digest
Adam Eivy37c74a768b20
diff --git a/server/lib/editorial/comicPacing.js b/server/lib/editorial/comicPacing.jsindex 945e2b58a2..a49d375d7a 100644--- a/server/lib/editorial/comicPacing.js+++ b/server/lib/editorial/comicPacing.js@@ -42,9 +42,16 @@ export function comicSpreadLayout(pageCount) {return layout;}-// Collapse whitespace and truncate a text field to `max` chars for the digest.+// Collapse whitespace, neutralize markdown fence delimiters, and truncate a text+// field to `max` chars for the digest. The rendered layout is embedded inside a+// ``` fenced block in the page-turn prompt, so a backtick run in authored script+// text (a panel that quotes code/markdown) could otherwise close the fence early+// and turn the rest of the prompt into unstructured text. Backtick fidelity is+// irrelevant to the model's pacing judgment, so collapse any run of backticks to a+// single quote — a delimiter-safe transform applied at the one chokepoint every+// user-authored snippet (description / caption / dialogue / SFX) passes through.const clip = (s, max) => {- const t = typeof s === 'string' ? s.trim().replace(/\s+/g, ' ') : '';+ const t = typeof s === 'string' ? s.trim().replace(/\s+/g, ' ').replace(/`+/g, "'") : '';return t.length > max ? `${t.slice(0, max)}…` : t;};diff --git a/server/lib/editorial/comicPacing.test.js b/server/lib/editorial/comicPacing.test.jsindex 353024b965..afbe470fc7 100644--- a/server/lib/editorial/comicPacing.test.js+++ b/server/lib/editorial/comicPacing.test.js@@ -60,6 +60,15 @@ describe('summarizeComicPages', () => {expect(pg.panels[0]).toContain('sfx: BOOM');});+ it('neutralizes markdown fence delimiters in authored text (prompt-fence safety)', () => {+ const pages = [{ panels: [{ description: 'a ```code``` beat', caption: 'cap ```', dialogue: [], sfx: '' }] }];+ const [pg] = summarizeComicPages(pages);+ // The page layout is embedded in a ``` fenced prompt block — no raw backtick+ // run may survive, or it could close the fence early.+ expect(pg.panels[0]).not.toContain('`');+ expect(pg.panels[0]).toContain("'code'");+ });+it('truncates long text fields and tolerates a bare-string dialogue entry', () => {const longLine = 'word '.repeat(40).trim(); // 199 charsconst pages = [{ panels: [{ description: 'd', caption: '', dialogue: ['a bare line'], sfx: '' }, { description: 'e', caption: longLine, dialogue: [], sfx: '' }] }];