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(cos): route post-restart orphan completions through handleOrphanedTask
Adam Eivy1886f072055e
diff --git a/server/services/subAgentSpawner.js b/server/services/subAgentSpawner.jsindex a086bf02c0..b9bbcdf48b 100644--- a/server/services/subAgentSpawner.js+++ b/server/services/subAgentSpawner.js@@ -1798,20 +1798,11 @@ async function handleAgentCompletion(agentId, exitCode, success, duration) {if (cosAgent.taskId) {const task = await getTaskById(cosAgent.taskId).catch(() => null);if (task && task.status !== 'completed') {- const taskType = task.taskType || 'user';if (success) {- await updateTask(cosAgent.taskId, { status: 'completed' }, taskType);+ await updateTask(cosAgent.taskId, { status: 'completed' }, task.taskType || 'user');} else {- // Preserve existing metadata (retry counts, spawn counts) to prevent counter resets- await updateTask(cosAgent.taskId, {- status: 'pending',- metadata: {- ...task.metadata,- retryReason: 'orphaned-agent',- lastOrphanedAt: new Date().toISOString(),- lastOrphanedAgentId: agentId- }- }, taskType);+ // Route through handleOrphanedTask for consistent retry counting, cooldown, and limits+ await handleOrphanedTask(cosAgent.taskId, agentId, getTaskById);}}}