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 (copilot): derive active agent ids from agentState, not subAgentSpawner
Adam Eivy72c95ab7abcb
diff --git a/server/services/autonomousJobs.js b/server/services/autonomousJobs.jsindex 1c69d22533..03073c2f36 100644--- a/server/services/autonomousJobs.js+++ b/server/services/autonomousJobs.js@@ -29,6 +29,7 @@ import { validateCommand, redactOutput, ALLOWED_COMMANDS_SORTED } from '../lib/cimport { getUserTimezone, getLocalParts, nextLocalTime } from '../lib/timezone.js'import { parseCronToNextRun } from './eventScheduler.js'import { cleanupOrphanedWorktrees } from './worktreeManager.js'+import { activeAgents, runnerAgents } from './agentState.js'/*** Run the moltworld-explore.mjs script as a child process (no AI agent needed).@@ -84,9 +85,12 @@ function runMoltworldExploration() {* the daily cadence is purely about reaping abandoned `agent-*` trees.*/async function agentDataCleanup() {- // Get active agent IDs so we never delete data / worktrees for running agents- const { getActiveAgentIds } = await import('./subAgentSpawner.js')- const activeIds = new Set(getActiveAgentIds())+ // Active agent IDs so we never delete data / worktrees for running agents.+ // Read straight from the side-effect-free `agentState.js` maps rather than+ // importing `subAgentSpawner.js` (which runs `initSpawner()` + schedules+ // orphan cleanup at module load) — this is exactly what `getActiveAgentIds()`+ // returns, minus the import-time side effects.+ const activeIds = new Set([...activeAgents.keys(), ...runnerAgents.keys()])const agentsDir = join(PATHS.cos, 'agents')let cleaned = 0