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: redact the message headline too, not just snippet/description (#2442)

Adam Eivyd0fd2258a9cb
diff --git a/server/services/agentErrorAnalysis.js b/server/services/agentErrorAnalysis.js
index e22be9fe52..e7fcabe87d 100644
--- a/server/services/agentErrorAnalysis.js
+++ b/server/services/agentErrorAnalysis.js
@@ -526,13 +526,16 @@ export function analyzeAgentFailure(output, task, model) {
export async function createInvestigationTask(agentId, originalTask, errorAnalysis) {
const analysis = errorAnalysis || {};
const category = analysis.category || 'unknown';
- const message = analysis.message || 'Agent failed with an unrecognized error';
+ const rawMessage = analysis.message || 'Agent failed with an unrecognized error';
const modelAttribution = analysis.affectedModel || analysis.configuredModel || null;
// Every interpolated free-text field is redacted before it lands in the body —
// this task is human-facing and may sync across federated peers, so no
- // hostnames/paths/IPs/PII/secrets from the live instance may leak in.
- const snippet = redactFailureSnippet(analysis.snippet || analysis.details || message);
+ // hostnames/paths/IPs/PII/secrets from the live instance may leak in. `message`
+ // for the `unknown` category is a raw agent output line, so it needs the same
+ // scrub as the snippet — not just the snippet/description fields.
+ const message = redactFailureSnippet(rawMessage) || rawMessage;
+ const snippet = redactFailureSnippet(analysis.snippet || analysis.details || rawMessage);
const originalDesc = redactFailureSnippet((originalTask.description || '').substring(0, 160)) || '(no description)';
// Prefer the pattern's category-specific escalation prose; fall back to the
diff --git a/server/services/agentErrorAnalysis.test.js b/server/services/agentErrorAnalysis.test.js
index 1477cdc700..ab37346c18 100644
--- a/server/services/agentErrorAnalysis.test.js
+++ b/server/services/agentErrorAnalysis.test.js
@@ -338,4 +338,18 @@ describe('createInvestigationTask body', () => {
expect(body).not.toContain('node-alpha.ts.net');
expect(body).not.toContain('192.0.2.10');
});
+
+ it('redacts the message headline for unmatched output whose raw line carries host/path/IP data', async () => {
+ // `unknown` category derives `message` from a raw agent output line, so the
+ // headline + classification interpolations must be scrubbed too.
+ const dirtyLine = 'Error syncing project to build-box.tailnet.ts.net at 192.0.2.10 under /Users/alice/project';
+ const analysis = analyzeAgentFailure(withLead(dirtyLine), { id: 't' }, 'x');
+ expect(analysis.category).toBe('unknown');
+ expect(analysis.message).toContain('build-box'); // raw line survives into message pre-redaction
+ await createInvestigationTask('agent-4', { id: 'task-12', description: 'do y' }, analysis);
+ const body = bodyOf();
+ expect(body).not.toContain('192.0.2.10');
+ expect(body).not.toContain('build-box');
+ expect(body).not.toContain('/Users/alice');
+ });
});