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): skip investigation task creation for API access errors
Adam Eivy4e204bb3c5ad
diff --git a/server/services/subAgentSpawner.js b/server/services/subAgentSpawner.jsindex 3a482f3065..d1d641aeeb 100644--- a/server/services/subAgentSpawner.js+++ b/server/services/subAgentSpawner.js@@ -972,6 +972,21 @@ Review the error, fix the configuration or code issue, and retry the original tareturn investigationTask;}+// Error categories where the LLM API itself is unavailable — spawning an+// investigation agent would fail for the same reason, so skip it.+const API_ACCESS_ERROR_CATEGORIES = new Set([+ 'auth-error',+ 'forbidden',+ 'usage-limit',+]);++async function maybeCreateInvestigationTask(agentId, task, analysis) {+ if (API_ACCESS_ERROR_CATEGORIES.has(analysis?.category)) return;+ await createInvestigationTask(agentId, task, analysis).catch(err => {+ emitLog('warn', `Failed to create investigation task: ${err.message}`, { agentId });+ });+}+/*** Handle task status update after agent failure.* Tracks retry count and blocks the task after MAX_TASK_RETRIES,@@ -985,9 +1000,7 @@ async function resolveFailedTaskUpdate(task, errorAnalysis, agentId) {emitLog('warn', `🚫 Task ${task.id} blocked: ${errorAnalysis.message} (${errorAnalysis.category})`, {taskId: task.id, category: errorAnalysis.category});- await createInvestigationTask(agentId, task, errorAnalysis).catch(err => {- emitLog('warn', `Failed to create investigation task: ${err.message}`, { agentId });- });+ await maybeCreateInvestigationTask(agentId, task, errorAnalysis);return {status: 'blocked',metadata: {@@ -1013,9 +1026,7 @@ async function resolveFailedTaskUpdate(task, errorAnalysis, agentId) {suggestedFix: `Task has failed ${failureCount} consecutive times with ${lastErrorCategory} errors. ${errorAnalysis?.suggestedFix || 'Investigate agent output logs.'}`,category: lastErrorCategory};- await createInvestigationTask(agentId, task, blockedAnalysis).catch(err => {- emitLog('warn', `Failed to create investigation task: ${err.message}`, { agentId });- });+ await maybeCreateInvestigationTask(agentId, task, blockedAnalysis);return {status: 'blocked',metadata: {