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

fix([med-pipeline-server-services-pipeline-arcplanner-2]): sanitize season titles in Pass 3 warning

[._.]/ Adam Eivy2ea78687c76d
diff --git a/server/services/pipeline/arcPlanner.js b/server/services/pipeline/arcPlanner.js
index 2adb8f3aa3..5804d8a752 100644
--- a/server/services/pipeline/arcPlanner.js
+++ b/server/services/pipeline/arcPlanner.js
@@ -1147,8 +1147,15 @@ export function buildSeasonRemap(droppedOldSeasons, newlyMintedSeasons) {
const oldRemaining = droppedOldSeasons.filter((s) => !remap.has(s.id));
const newRemaining = newlyMintedSeasons.filter((n) => !claimed.has(n.id));
if (oldRemaining.length === 1 && newRemaining.length === 1) {
+ // Sanitize titles before logging — LLM-generated text can carry newlines
+ // or control chars that would break the project's single-line logging
+ // convention; fall back to the stable id when the title is empty.
+ const safeLabel = (s) => {
+ const t = typeof s.title === 'string' ? s.title.replace(/\s+/g, ' ').trim().slice(0, 60) : '';
+ return t || s.id;
+ };
console.warn(
- `⚠️ buildSeasonRemap Pass 3 fired: forced 1↔1 pairing "${oldRemaining[0].title || oldRemaining[0].id}" → "${newRemaining[0].title || newRemaining[0].id}"`,
+ `⚠️ buildSeasonRemap Pass 3 fired: forced 1↔1 pairing "${safeLabel(oldRemaining[0])}" → "${safeLabel(newRemaining[0])}"`,
);
remap.set(oldRemaining[0].id, newRemaining[0].id);
claimed.add(newRemaining[0].id);
diff --git a/server/services/pipeline/arcPlanner.test.js b/server/services/pipeline/arcPlanner.test.js
index c1a0108a18..33cb996045 100644
--- a/server/services/pipeline/arcPlanner.test.js
+++ b/server/services/pipeline/arcPlanner.test.js
@@ -1046,6 +1046,18 @@ describe('arcPlanner — buildSeasonRemap', () => {
warnSpy.mockRestore();
});
+ it('sanitizes multi-line / control-char titles in the Pass 3 warning to keep logging single-line', () => {
+ const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
+ const dropped = [{ id: 'old1', number: 1, title: 'A\n\tWith newline' }];
+ const minted = [{ id: 'new1', number: 2, title: '' }];
+ planner.buildSeasonRemap(dropped, minted);
+ const msg = warnSpy.mock.calls[0][0];
+ expect(msg).not.toMatch(/\n/);
+ expect(msg).toContain('A With newline');
+ expect(msg).toContain('new1'); // empty title → falls back to id
+ warnSpy.mockRestore();
+ });
+
it('drops orphans to null when 2+ unmatched on each side after pass 1/2', () => {
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
// Titles diverge AND numbers diverge → Pass 1 (title) and Pass 2 (unique