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 third round of PR review feedback

Adam Eivy9d3c57cea7ce
diff --git a/client/src/components/digital-twin/NextActionBanner.jsx b/client/src/components/digital-twin/NextActionBanner.jsx
index 48ecce86e6..e9e0e5d2f2 100644
--- a/client/src/components/digital-twin/NextActionBanner.jsx
+++ b/client/src/components/digital-twin/NextActionBanner.jsx
@@ -43,7 +43,7 @@ export default function NextActionBanner({ gaps, status, traits, onRefresh }) {
const [skippedIndices, setSkippedIndices] = useState([]);
const hasTraits = traits && Object.keys(traits).length > 0;
- const hasEnrichment = (status?.enrichmentProgress?.completedCategories || 0) > 0;
+ const hasEnrichment = (status?.enrichmentProgress?.completedCategories?.length || 0) > 0;
const hasGaps = gaps && gaps.length > 0;
const topGap = hasGaps ? gaps[0] : null;
diff --git a/server/services/autonomousJobs.js b/server/services/autonomousJobs.js
index 7171a33709..a93c345a0b 100644
--- a/server/services/autonomousJobs.js
+++ b/server/services/autonomousJobs.js
@@ -295,7 +295,7 @@ async function createJob(jobData) {
description: jobData.description || '',
category: jobData.category || 'custom',
interval: jobData.interval || 'weekly',
- intervalMs: resolveIntervalMs(jobData.interval, jobData.intervalMs),
+ intervalMs: resolveIntervalMs(jobData.interval || 'weekly', jobData.intervalMs),
enabled: jobData.enabled !== undefined ? jobData.enabled : false,
priority: jobData.priority || 'MEDIUM',
autonomyLevel: jobData.autonomyLevel || 'manager',
diff --git a/server/services/runner.js b/server/services/runner.js
index 0fc829b227..760a19846c 100644
--- a/server/services/runner.js
+++ b/server/services/runner.js
@@ -56,13 +56,14 @@ export async function executeCliRun(runId, provider, prompt, workspacePath, onDa
// Call hooks
aiToolkitInstance.config.hooks?.onRunStarted?.({ runId, provider: provider.name, model: provider.defaultModel });
- // Set timeout
- const timeoutHandle = setTimeout(() => {
+ // Set timeout (default 5 min, guard against undefined which would fire immediately)
+ const effectiveTimeout = timeout ?? provider.timeout ?? 300000;
+ const timeoutHandle = effectiveTimeout > 0 ? setTimeout(() => {
if (childProcess && !childProcess.killed) {
- console.log(`⏱️ Run ${runId} timed out after ${timeout}ms`);
+ console.log(`⏱️ Run ${runId} timed out after ${effectiveTimeout}ms`);
childProcess.kill('SIGTERM');
}
- }, timeout);
+ }, effectiveTimeout) : null;
childProcess.stdout?.on('data', (data) => {
const text = data.toString();
@@ -77,7 +78,7 @@ export async function executeCliRun(runId, provider, prompt, workspacePath, onDa
});
childProcess.on('close', async (code) => {
- clearTimeout(timeoutHandle);
+ if (timeoutHandle) clearTimeout(timeoutHandle);
aiToolkitInstance.services.runner._portosActiveRuns?.delete(runId);
await writeFile(outputPath, output);
diff --git a/server/services/subAgentSpawner.js b/server/services/subAgentSpawner.js
index f70bff6f2a..4dc3ee94c6 100644
--- a/server/services/subAgentSpawner.js
+++ b/server/services/subAgentSpawner.js
@@ -1018,6 +1018,7 @@ export async function spawnAgentForTask(task) {
// Wait for lane availability (max 30 seconds)
const laneResult = await waitForLane(laneName, agentId, { timeoutMs: 30000, metadata: { taskId: task.id } });
if (!laneResult.success) {
+ spawningTasks.delete(task.id);
emitLog('warning', `Lane ${laneName} unavailable for task ${task.id}, deferring`, { taskId: task.id, lane: laneName });
cosEvents.emit('agent:deferred', { taskId: task.id, reason: 'lane-capacity', lane: laneName });
return null;
@@ -1025,6 +1026,7 @@ export async function spawnAgentForTask(task) {
} else {
const laneResult = acquire(laneName, agentId, { taskId: task.id });
if (!laneResult.success) {
+ spawningTasks.delete(task.id);
emitLog('warning', `Failed to acquire lane ${laneName}: ${laneResult.error}`, { taskId: task.id });
return null;
}
diff --git a/server/services/taskTemplates.js b/server/services/taskTemplates.js
index dc22701511..63c397a955 100644
--- a/server/services/taskTemplates.js
+++ b/server/services/taskTemplates.js
@@ -106,7 +106,7 @@ const DEFAULT_STATE = {
async function loadState() {
const data = await readJSONFile(TEMPLATES_FILE);
if (!data) return { ...DEFAULT_STATE };
- return data;
+ return { ...DEFAULT_STATE, ...data, userTemplates: data.userTemplates || [], usage: data.usage || {} };
}
/**
diff --git a/server/services/taskTemplates.test.js b/server/services/taskTemplates.test.js
index 3c4e4e2dd6..111316108c 100644
--- a/server/services/taskTemplates.test.js
+++ b/server/services/taskTemplates.test.js
@@ -16,8 +16,7 @@ vi.mock('fs', () => ({
// Import after mocking
const { readJSONFile } = await import('../lib/fileUtils.js');
-const { writeFile, mkdir } = await import('fs/promises');
-const { existsSync } = await import('fs');
+const { writeFile } = await import('fs/promises');
const {
getAllTemplates,
getPopularTemplates,