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 (codex): thread manual-vs-scheduled provenance to goal check-in
[._.]/ Adam Eivy539ae9fcd182
diff --git a/server/routes/cosJobRoutes.js b/server/routes/cosJobRoutes.jsindex 01062f504c..ba300faf8a 100644--- a/server/routes/cosJobRoutes.js+++ b/server/routes/cosJobRoutes.js@@ -156,9 +156,12 @@ router.post('/jobs/:id/trigger', asyncHandler(async (req, res) => {return res.json({ success: result.success !== false, type: 'shell', ...result });}- // Script jobs run their built-in handler directly+ // Script jobs run their built-in handler directly. This is the manual+ // "Run now" path — the user explicitly requested it, so mark it foreground+ // (`manual: true`) and any fan-out handler reports failures individually+ // rather than coalescing them as unattended background work.if (autonomousJobs.isScriptJob(job)) {- const result = await autonomousJobs.executeScriptJob(job).catch(err => ({+ const result = await autonomousJobs.executeScriptJob(job, { manual: true }).catch(err => ({success: false,error: err.message}));diff --git a/server/services/autonomousJobs/execution.js b/server/services/autonomousJobs/execution.jsindex e66fc38aec..f0b090ed2b 100644--- a/server/services/autonomousJobs/execution.js+++ b/server/services/autonomousJobs/execution.js@@ -32,7 +32,7 @@ function isScriptJob(job) {* @param {Object} job - The script job to execute* @returns {Promise<Object>} Result of the script execution*/-async function executeScriptJob(job) {+async function executeScriptJob(job, { manual = false } = {}) {if (!isScriptJob(job)) {throw new Error(`Job ${job.id} is not a script job`)}@@ -40,7 +40,12 @@ async function executeScriptJob(job) {const handler = SCRIPT_HANDLERS[job.scriptHandler]console.log(`📜 Executing script job: ${job.name}`)- const result = await handler()+ // A scheduled fire is unattended (`background`); a manual "Run now" trigger is+ // user-initiated (foreground). Pass that provenance to the handler so fan-out+ // handlers (goal-check-in) can decide whether their per-provider error toasts+ // coalesce (scheduled) or report individually (manual). Handlers that don't+ // fan out ignore the context.+ const result = await handler({ background: !manual })// Record the job executionawait recordJobExecution(job.id)diff --git a/server/services/goalCheckIn.js b/server/services/goalCheckIn.jsindex 550d5c6ce8..129381ddda 100644--- a/server/services/goalCheckIn.js+++ b/server/services/goalCheckIn.js@@ -38,7 +38,7 @@ Milestones completed: ${goal.milestones?.filter(m => m.completedAt).length || 0}Respond with JSON only (no markdown fences): { "assessment": "string", "recommendations": ["string", ...] }`;}-export async function runGoalCheckIn() {+export async function runGoalCheckIn({ background = false } = {}) {const { getActiveProvider } = await import('./providers.js');const goals = await readJSONFile(GOALS_FILE, { goals: [] });const activeGoals = goals.goals.filter(g => g.status === 'active' && g.targetDate);@@ -68,12 +68,13 @@ export async function runGoalCheckIn() {return { goal, expectedProgress, actualProgress, status, attendanceRate, prompt };});- // Parallelize LLM calls. `background: true` marks these as an unattended- // fan-out (this runs from a scheduled job — see autonomousJobs/scriptHandlers.js)- // so the client coalesces per-provider error toasts: a systematically-failing- // provider yields one notification, not one red toast per goal.+ // Parallelize LLM calls. `background` provenance comes from the caller: the+ // scheduled fire (executeScriptJob with no `manual`) passes true, so the client+ // coalesces per-provider error toasts — a systematically-failing provider then+ // yields one notification, not one red toast per goal. A manual "Run now" passes+ // false, so its failures report individually, since the user is watching.const llmResults = await Promise.all(- checkInData.map(d => callProviderAISimple(provider, provider.defaultModel, d.prompt, { background: true }))+ checkInData.map(d => callProviderAISimple(provider, provider.defaultModel, d.prompt, { background })));const results = [];