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): preserve array/object task metadata across TASKS.md round-trip
[._.]/ Adam Eivy96779084a031
diff --git a/server/lib/taskParser.js b/server/lib/taskParser.jsindex 544d9052e3..5a27545c8c 100644--- a/server/lib/taskParser.js+++ b/server/lib/taskParser.js@@ -301,9 +301,12 @@ export function generateTasksMarkdown(tasks, includeApprovalFlags = false) {: '';lines.push(`- ${checkbox} #${task.id} | ${task.priority}${approvalFlag} | ${task.description}`);- // Add metadata (escape newlines in values for single-line storage)+ // Add metadata (escape newlines in values for single-line storage).+ // Pass the raw value — escapeNewlines JSON-encodes arrays/objects itself;+ // pre-stringifying here would flatten them to "a,b" or "[object Object]"+ // before it ever sees the array/object shape.for (const [key, value] of Object.entries(task.metadata)) {- const escapedValue = escapeNewlines(String(value));+ const escapedValue = escapeNewlines(value);lines.push(` - ${key}: ${escapedValue}`);}}diff --git a/server/lib/taskParser.test.js b/server/lib/taskParser.test.jsindex 793b2421de..13036f0ba6 100644--- a/server/lib/taskParser.test.js+++ b/server/lib/taskParser.test.js@@ -352,6 +352,33 @@ describe('Task Parser', () => {expect(parsed[0].metadata.context).toBe(multiLineContext);});+ it('should round-trip array and object metadata values (screenshots, attachments, reviewers)', () => {+ const tasks = [+ {+ id: 'task-001', status: 'pending', priority: 'MEDIUM', priorityValue: 2, description: 'Test',+ metadata: {+ screenshots: ['/data/screenshots/a.png', '/data/screenshots/b.png'],+ attachments: [{ filename: 'a.png', originalName: 'photo.png', path: '/data/cos/attachments/a.png' }],+ reviewers: ['codex', 'claude'],+ }+ }+ ];++ const markdown = generateTasksMarkdown(tasks);+ // Pre-stringifying before escapeNewlines would flatten the array to a+ // bare comma-joined string ("a.png,b.png") or "[object Object]" — assert+ // the JSON sentinel is present so a regression here fails loudly.+ expect(markdown).toMatch(/- screenshots: __json__:\[/);+ expect(markdown).toMatch(/- attachments: __json__:\[/);++ const parsed = parseTasksMarkdown(markdown);+ expect(parsed[0].metadata.screenshots).toEqual(['/data/screenshots/a.png', '/data/screenshots/b.png']);+ expect(parsed[0].metadata.attachments).toEqual([+ { filename: 'a.png', originalName: 'photo.png', path: '/data/cos/attachments/a.png' }+ ]);+ expect(parsed[0].metadata.reviewers).toEqual(['codex', 'claude']);+ });+it('should sort tasks by priority within sections', () => {const tasks = [{ id: 'task-001', status: 'pending', priority: 'LOW', priorityValue: 1, description: 'Low', metadata: {} },