🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
fix(monitoring): escalate warnings on critical readings
Rudy Celeklia391ff47e88e
diff --git a/tests/monitor-alert-escalation.test.mjs b/tests/monitor-alert-escalation.test.mjsnew file mode 100644index 0000000000..d0c9b2a737--- /dev/null+++ b/tests/monitor-alert-escalation.test.mjs@@ -0,0 +1,13 @@+import test from 'node:test';+import assert from 'node:assert/strict';+import { MonitoringHooks } from '../v3/@claude-flow/cli/src/production/monitoring.ts';+test('critical readings escalate an existing warning instead of being suppressed', () => {+ const m = new MonitoringHooks({ alertThresholds: { load: { warning: 10, critical: 20 } } });+ m.gauge('load', 11); const id = m.getAlerts()[0].id;+ m.gauge('load', 25);+ const alerts = m.getAlerts(); assert.equal(alerts.length, 1); assert.equal(alerts[0].id, id); assert.equal(alerts[0].level, 'critical'); assert.equal(alerts[0].value, 25); assert.equal(alerts[0].threshold, 20); assert.match(alerts[0].message, /critical/);+ m.gauge('load', 12); assert.equal(m.getAlerts()[0].level, 'critical');+});+test('repeated warning readings stay deduplicated', () => {+ const m = new MonitoringHooks({ alertThresholds: { load: { warning: 10, critical: 20 } } }); m.gauge('load', 11); m.gauge('load', 12); assert.equal(m.getAlerts().length, 1);+});diff --git a/v3/@claude-flow/cli/src/production/monitoring.ts b/v3/@claude-flow/cli/src/production/monitoring.tsindex 15298fad19..c353f81d56 100644--- a/v3/@claude-flow/cli/src/production/monitoring.ts+++ b/v3/@claude-flow/cli/src/production/monitoring.ts@@ -430,7 +430,12 @@ export class MonitoringHooks {Date.now() - a.timestamp < 60000);- if (!recentAlert) {+ if (recentAlert && level === 'critical' && recentAlert.level !== 'critical') {+ Object.assign(recentAlert, {+ level, value, threshold, timestamp: Date.now(),+ message: `${name} exceeded ${level} threshold: ${value} >= ${threshold}`,+ });+ } else if (!recentAlert) {this.alerts.push({id: `alert_${Date.now()}_${Math.random().toString(36).substring(7)}`,level,