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
fix: address PR review feedback
Adam Eivy66b129de7cfd
diff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsxindex 36e541375f..a352443cdb 100644--- a/client/src/components/Layout.jsx+++ b/client/src/components/Layout.jsx@@ -157,11 +157,11 @@ export default function Layout() {return false;};- const renderNavItem = (item) => {+ const renderNavItem = (item, index) => {// Separatorif (item.separator) {return (- <div key="separator" className="mx-4 my-2 border-t border-port-border" />+ <div key={`separator-${index}`} className="mx-4 my-2 border-t border-port-border" />);}diff --git a/client/src/pages/DevTools.jsx b/client/src/pages/DevTools.jsxindex 9325b809f0..68afa75f8c 100644--- a/client/src/pages/DevTools.jsx+++ b/client/src/pages/DevTools.jsx@@ -323,13 +323,18 @@ export function RunsHistoryPage() {setLoading(false);};- // Filter runs by status+ // Filter runs by source and statusconst filteredRuns = runs.filter(run => {- if (statusFilter === 'all') return true;- if (statusFilter === 'success') return run.success === true;- if (statusFilter === 'running') return run.success === null;- if (statusFilter === 'failed') return run.success === false;- return true;+ // Source filter (already applied via API, but kept for client-side consistency)+ const matchesSource = sourceFilter === 'all' || run.source === sourceFilter;++ // Status filter+ let matchesStatus = true;+ if (statusFilter === 'success') matchesStatus = run.success === true;+ else if (statusFilter === 'running') matchesStatus = run.success === null;+ else if (statusFilter === 'failed') matchesStatus = run.success === false;++ return matchesSource && matchesStatus;});const handleDelete = async (id, e) => {diff --git a/client/src/pages/PromptManager.jsx b/client/src/pages/PromptManager.jsxindex 2db745c2ee..2eb9d8bdb7 100644--- a/client/src/pages/PromptManager.jsx+++ b/client/src/pages/PromptManager.jsx@@ -122,11 +122,23 @@ export default function PromptManager() {const createStage = async () => {setSaving(true);- await fetch('/api/prompts', {+ const res = await fetch('/api/prompts', {method: 'POST',headers: { 'Content-Type': 'application/json' },body: JSON.stringify(newStageForm)});++ if (!res.ok) {+ let message = 'Failed to create stage';+ const errorBody = await res.json().catch(() => null);+ if (errorBody?.error || errorBody?.message) {+ message = errorBody.error || errorBody.message;+ }+ setSaving(false);+ alert(message);+ return;+ }+setSaving(false);setCreatingStage(false);setNewStageForm({diff --git a/server/index.js b/server/index.jsindex 4def0cb174..1ab8b9c548 100644--- a/server/index.js+++ b/server/index.js@@ -86,9 +86,10 @@ const aiToolkit = createAIToolkit({});},onRunFailed: (metadata, error, output) => {+ const errorMessage = error?.message ?? String(error);errorEvents.emit('error', {code: 'AI_PROVIDER_EXECUTION_FAILED',- message: `AI provider ${metadata.providerName} execution failed: ${error}`,+ message: `AI provider ${metadata.providerName} execution failed: ${errorMessage}`,severity: 'error',canAutoFix: true,timestamp: Date.now(),@@ -101,9 +102,8 @@ const aiToolkit = createAIToolkit({duration: metadata.duration,workspacePath: metadata.workspacePath,workspaceName: metadata.workspaceName,- errorDetails: error,- promptPreview: metadata.prompt,- outputTail: output ? output.slice(-2000) : null+ errorDetails: errorMessage+ // Note: promptPreview and outputTail intentionally omitted to avoid leaking sensitive data}});}diff --git a/server/lib/fileUtils.js b/server/lib/fileUtils.jsindex a86dce9cbc..8d3e0dc806 100644--- a/server/lib/fileUtils.js+++ b/server/lib/fileUtils.js@@ -142,10 +142,16 @@ export function safeJSONParse(str, defaultValue = null, { allowArray = true, logreturn defaultValue;}- // Attempt actual parse - the validation above catches most issues- // but we still need to handle syntax errors gracefully- const result = JSON.parse(str);- return result;+ // Attempt actual parse - the validation above catches structural issues+ // but syntax errors like trailing commas still need handling+ try {+ return JSON.parse(str);+ } catch (err) {+ if (logError) {+ console.error(`⚠️ Failed to parse JSON${context ? ` in ${context}` : ''}: ${err.message}`);+ }+ return defaultValue;+ }}/**diff --git a/server/lib/taskParser.js b/server/lib/taskParser.jsindex bd28c84cbe..95ddab81f8 100644--- a/server/lib/taskParser.js+++ b/server/lib/taskParser.js@@ -88,19 +88,39 @@ function parseTaskLine(line) {}/**- * Unescape newlines in metadata values- * Converts \\n back to actual newlines+ * Unescape newlines in metadata values.+ *+ * For values stored as JSON string literals (produced by escapeNewlines),+ * this uses JSON.parse to correctly restore backslashes, newlines, etc.+ * For legacy or simple values, falls back to simple replacement for backwards compatibility.*/function unescapeNewlines(value) {+ if (typeof value !== 'string') return value;+ // Check if this looks like a JSON-encoded string (starts and ends with quotes)+ if (value.length >= 2 && value.startsWith('"') && value.endsWith('"')) {+ try {+ return JSON.parse(value);+ } catch {+ // Fall through to legacy behavior if parsing fails+ }+ }+ // Legacy fallback for backwards compatibility with existing datareturn value.replace(/\\n/g, '\n');}/**- * Escape newlines in metadata values- * Converts newlines to \\n for single-line storage+ * Escape newlines in metadata values.+ *+ * For values containing special characters (newlines, backslashes), uses JSON+ * string escaping for reversibility. Simple values are stored as-is.*/function escapeNewlines(value) {- return value.replace(/\n/g, '\\n');+ if (typeof value !== 'string') return String(value);+ // Only use JSON encoding if the value contains characters that need escaping+ if (value.includes('\n') || value.includes('\\')) {+ return JSON.stringify(value);+ }+ return value;}/**