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 — clear killTimer on agent exit; dedupe git re-export

Adam Eivy6b964614300f
diff --git a/server/services/agentCliSpawning.js b/server/services/agentCliSpawning.js
index 7b47039cd9..20922fbcae 100644
--- a/server/services/agentCliSpawning.js
+++ b/server/services/agentCliSpawning.js
@@ -450,6 +450,12 @@ export async function spawnDirectly(agentId, task, prompt, workspacePath, model,
completeExecution(executionId, { success: false });
}
+ const agentDataErr = activeAgents.get(agentId);
+ if (agentDataErr?.killTimer) {
+ clearTimeout(agentDataErr.killTimer);
+ agentDataErr.killTimer = null;
+ }
+
cosEvents.emit('agent:error', { agentId, error: err.message });
await completeAgent(agentId, { success: false, error: err.message });
await completeAgentRun(runId, outputBuffer, 1, 0, { message: err.message, category: 'spawn-error' });
@@ -463,6 +469,13 @@ export async function spawnDirectly(agentId, task, prompt, workspacePath, model,
const agentData = activeAgents.get(agentId);
const duration = Date.now() - (agentData?.startedAt || Date.now());
+ // If terminateAgent scheduled a SIGKILL fallback, the process exited
+ // before it fired — clear it so we don't leak the timer.
+ if (agentData?.killTimer) {
+ clearTimeout(agentData.killTimer);
+ agentData.killTimer = null;
+ }
+
// Flush remaining stream parser data
if (streamParser) {
const remaining = streamParser.flush();
diff --git a/server/services/git.js b/server/services/git.js
index 594ea030f4..3022fecdb8 100644
--- a/server/services/git.js
+++ b/server/services/git.js
@@ -2,9 +2,11 @@ import { existsSync } from 'fs';
import { join } from 'path';
import { safeJSONParse, PATHS } from '../lib/fileUtils.js';
import { listWorktrees } from './worktreeManager.js';
-export { execGit } from '../lib/execGit.js';
import { execGit } from '../lib/execGit.js';
+// Re-export so callers that used to import from services/git.js keep working.
+export { execGit };
+
const PROTECTED_BRANCHES = ['main', 'master', 'dev', 'develop', 'release'];
// Like execGit but catches rejections (e.g. timeout) into a failed-result shape