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: add 30s grace period for agents without PID before marking zombie

Adam Eivy5017136066be
diff --git a/server/services/cos.js b/server/services/cos.js
index c750f567e7..a61f557640 100644
--- a/server/services/cos.js
+++ b/server/services/cos.js
@@ -2047,9 +2047,18 @@ export async function cleanupZombieAgents() {
// Process is still running, don't mark as zombie
continue;
}
+ } else {
+ // No PID yet - agent might still be initializing
+ // Give it a 30 second grace period before marking as zombie
+ const startedAt = agent.startedAt ? new Date(agent.startedAt).getTime() : 0;
+ const ageMs = Date.now() - startedAt;
+ if (ageMs < 30000) {
+ // Agent is less than 30 seconds old and has no PID - still initializing
+ continue;
+ }
}
- // Agent is not tracked anywhere and process is dead (or no PID) - it's a zombie
+ // Agent is not tracked anywhere and process is dead (or no PID after grace period) - it's a zombie
console.log(`🧟 Zombie agent detected: ${agent.id} (PID ${agent.pid || 'unknown'} not running)`);
state.agents[agent.id] = {
...agent,