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: address review — persist either summary, classifier summary fallback, 202 pm2 save, stringier workspacePath

Adam Eivy07c41ae3dc2d
diff --git a/client/src/pages/ProcessesPage.jsx b/client/src/pages/ProcessesPage.jsx
index 3788452223..a74d9ac4d9 100644
--- a/client/src/pages/ProcessesPage.jsx
+++ b/client/src/pages/ProcessesPage.jsx
@@ -27,14 +27,17 @@ export function ProcessesPage() {
const handlePm2Save = async () => {
setSaving(true);
- const result = await fetch('/api/commands/execute', {
+ // /api/commands/execute returns 202 { commandId, status: 'started' } and
+ // runs asynchronously — treat a returned commandId as a successful queue.
+ const res = await fetch('/api/commands/execute', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ command: 'pm2 save' })
- }).then(r => r.json()).catch(() => ({ success: false }));
+ }).catch(() => null);
+ const body = res ? await res.json().catch(() => null) : null;
setSaving(false);
- if (result.success) {
- toast.success('PM2 process list saved to startup');
+ if (res?.ok && body?.commandId) {
+ toast.success('PM2 save queued');
} else {
toast.error('Failed to save PM2 process list');
}
diff --git a/server/routes/commands.js b/server/routes/commands.js
index b797030af3..357ebf7ed9 100644
--- a/server/routes/commands.js
+++ b/server/routes/commands.js
@@ -38,7 +38,10 @@ router.post('/execute', asyncHandler(async (req, res) => {
// symlinks are followed — resolve within an allowed root. Using realpath here
// prevents a symlink like /tmp/escape -> /etc from tricking the containment
// check (which only sees /tmp/escape).
- if (workspacePath) {
+ if (workspacePath !== undefined && workspacePath !== null && workspacePath !== '') {
+ if (typeof workspacePath !== 'string') {
+ throw new ServerError('workspacePath must be a string', { status: 400, code: 'INVALID_PATH' });
+ }
const resolvedPath = resolve(workspacePath);
if (!existsSync(resolvedPath)) {
throw new ServerError('workspacePath does not exist', { status: 400, code: 'INVALID_PATH' });
diff --git a/server/services/agentLifecycle.js b/server/services/agentLifecycle.js
index e08d1c9402..b4b0332433 100644
--- a/server/services/agentLifecycle.js
+++ b/server/services/agentLifecycle.js
@@ -679,8 +679,15 @@ export function extractSimplifySummaries(outputBuffer) {
export async function persistSimplifySummaries(agentId, task, outputBuffer, isTruthyMetaFn) {
if (!isTruthyMetaFn(task.metadata?.simplify)) return;
const summaries = extractSimplifySummaries(outputBuffer);
- if (summaries?.taskSummary) {
- await updateAgent(agentId, { metadata: { taskSummary: summaries.taskSummary, simplifySummary: summaries.simplifySummary } });
+ if (!summaries) return;
+ // Persist whenever *either* summary is present — e.g. if the /simplify
+ // marker appears at the very top of the output, taskSummary will be null
+ // but simplifySummary is still worth keeping.
+ if (summaries.taskSummary || summaries.simplifySummary) {
+ await updateAgent(agentId, { metadata: {
+ taskSummary: summaries.taskSummary || null,
+ simplifySummary: summaries.simplifySummary || null
+ } });
}
}
diff --git a/server/services/memoryClassifier.js b/server/services/memoryClassifier.js
index 1fb142c06f..91fe48ac66 100644
--- a/server/services/memoryClassifier.js
+++ b/server/services/memoryClassifier.js
@@ -90,7 +90,12 @@ async function loadExistingMemorySummary() {
const allMemories = [...active.memories, ...pending.memories];
if (allMemories.length === 0) return '';
- const lines = allMemories.slice(0, 30).map(m => `- [${m.type}] ${(m.content || '').substring(0, 150)}`);
+ // getMemories() returns index/metadata rows without \`content\` — fall back
+ // to \`summary\` so each bullet has a real sentence instead of an empty string.
+ const lines = allMemories.slice(0, 30).map(m => {
+ const text = (m.content || m.summary || '').substring(0, 150);
+ return `- [${m.type}] ${text}`;
+ });
return lines.join('\n');
}