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

address review (codex): append later blocked tasks to the investigation body, not just metadata

[._.]/ Adam Eivycf6317d2dca4
diff --git a/server/services/agentErrorAnalysis.js b/server/services/agentErrorAnalysis.js
index c7a1988024..8fcdb6c7c9 100644
--- a/server/services/agentErrorAnalysis.js
+++ b/server/services/agentErrorAnalysis.js
@@ -631,12 +631,16 @@ async function doCreateInvestigationTask(agentId, originalTask, errorAnalysis) {
emitLog('info', `⏭️ Skipping duplicate investigation for ${fingerprint}: ${existing.id} is still ${existing.status}`, {
agentId, taskId: originalTask.id, fingerprint, existingTaskId: existing.id, existingStatus: existing.status
});
- // Union this failure's task id into the surviving investigation, so the
- // record names EVERY task blocked on this cause — resolving it should
- // unblock all of them, not just the first one mentioned in the body.
+ // Union this failure's task id into the surviving investigation — both in
+ // metadata AND appended to the human/agent-facing body — so the record
+ // names EVERY task blocked on this cause: resolving it should unblock all
+ // of them, not just the first one mentioned in "What unblocks".
const affected = Array.isArray(existing.metadata?.affectedTasks) ? existing.metadata.affectedTasks : [];
if (originalTask.id && !affected.includes(originalTask.id)) {
- await updateTask(existing.id, { metadata: { affectedTasks: [...affected, originalTask.id] } }, 'internal');
+ await updateTask(existing.id, {
+ description: `${existing.description}\n- Also blocks task \`${originalTask.id}\` (same cause; agent \`${agentId}\`).`,
+ metadata: { affectedTasks: [...affected, originalTask.id] }
+ }, 'internal');
}
return existing;
}
diff --git a/server/services/agentErrorAnalysis.test.js b/server/services/agentErrorAnalysis.test.js
index 319cfbfb4b..7c3de9633b 100644
--- a/server/services/agentErrorAnalysis.test.js
+++ b/server/services/agentErrorAnalysis.test.js
@@ -316,15 +316,18 @@ describe('createInvestigationTask guards (#2615)', () => {
}), 'internal');
});
- it('unions a later same-fingerprint failure into the surviving investigation\'s affectedTasks', async () => {
+ it('unions a later same-fingerprint failure into the surviving investigation\'s affectedTasks and body', async () => {
const existing = {
- id: 'inv-open', status: 'pending',
+ id: 'inv-open', status: 'pending', description: '[Auto] Investigate agent failure [startup-failure:user:none]: x\n\nbody',
metadata: { investigationFingerprint: 'startup-failure:user:none', affectedTasks: ['task-1'] }
};
getAllTasks.mockResolvedValue({ user: { tasks: [] }, cos: { tasks: [existing] } });
await createInvestigationTask('agent-2', { ...failedTask, id: 'task-2' }, analysis);
expect(addTask).not.toHaveBeenCalled();
- expect(updateTask).toHaveBeenCalledWith('inv-open', { metadata: { affectedTasks: ['task-1', 'task-2'] } }, 'internal');
+ expect(updateTask).toHaveBeenCalledWith('inv-open', {
+ description: `${existing.description}\n- Also blocks task \`task-2\` (same cause; agent \`agent-2\`).`,
+ metadata: { affectedTasks: ['task-1', 'task-2'] }
+ }, 'internal');
});
it('does not re-write affectedTasks when the failed task is already recorded', async () => {