From d100ad3c57f4a18dacb2cbc11cfdc5590f20cf08 Mon Sep 17 00:00:00 2001 From: Agando Date: Fri, 23 Oct 2026 18:15:05 +0200 Subject: fix(newos4): one error counter for errors/dashboard/world-model (v4.6.61) Packet 2 (three surfaces, three answers). Measured first: `errors` scanned /logs/current.log for [ERROR] lines, but that file only ever receives explicit terminal.log('ERROR', ...) calls -- exactly one call site in the whole app -- so it read 0. The dashboard added DebugSupervisor._errorDB plus failed tool calls (18), and the world model read the debug DB alone (11). - terminal.countErrors() / countLogErrors(): the single counter, exposed on the one object all three surfaces already hold - `errors` prints the canonical total with its breakdown, the entry list (hash, count, severity, message), and reports the log scan separately as a mirror - dashboard health.errors and health.errorBreakdown derive from it - world model telemetry.recentErrors derives from it, plus errorsBySource - terminal.log('ERROR', ...) now also records into DebugSupervisor, so the log is a human-readable mirror of one store instead of a second store almost nobody wrote Verified live on v4.6.61: with a seeded debug entry + failed tool call, all three report 2; a single log('ERROR') call moves debug 1->2 and the total by exactly 1 (the mirror line is counted once, in the log, and reported separately). --- modules/core/module-aiassist.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'modules/core/module-aiassist.js') diff --git a/modules/core/module-aiassist.js b/modules/core/module-aiassist.js index 628e68a..3326483 100644 --- a/modules/core/module-aiassist.js +++ b/modules/core/module-aiassist.js @@ -4641,12 +4641,13 @@ buildSystemPrompt() { } // System health - var totalErrors = 0; + var errCounts = { total: 0, debug: 0, latency: 0, log: 0 }; try { - var ds = mm ? mm.modules['DebugSupervisorModule'] : null; - if (ds && ds._errorDB) totalErrors += Object.keys(ds._errorDB.errors).length; - if (sm && sm._latencyLog) totalErrors += sm._latencyLog.filter(function(e) { return e.error; }).length; + if (this.terminal && typeof this.terminal.countErrors === 'function') { + errCounts = this.terminal.countErrors(); + } } catch (e) {} + var totalErrors = errCounts.total; var predictor = mm ? mm.modules['PredictorModule'] : null; var predictorAcc = 'n/a (no paired runs)'; if (predictor && predictor._accuracy && predictor._accuracy.total > 0) { @@ -4658,6 +4659,7 @@ buildSystemPrompt() { vfsSize: data.vfs ? data.vfs.size : '?', online: typeof navigator !== 'undefined' ? navigator.onLine : true, errors: totalErrors, + errorBreakdown: errCounts, predictorAccuracy: predictorAcc }; -- cgit v1.2.3