ruvnet/ruflo · error

Trigger detection exceeded 5ms target: ${detectionTime.toFix

Error message

Trigger detection exceeded 5ms target: ${detectionTime.toFixed(2)}ms

What it means

Performance warning in WorkerDispatch.detectTriggers(): regex scanning of the input text for trigger patterns exceeded the 5ms budget. Detection still returns correct results; the warning marks the trigger-pattern set or input as a latency hotspot.

Source

Thrown at v3/@claude-flow/swarm/src/workers/worker-dispatch.ts:438

  detectTriggers(text: string): TriggerDetectionResult {
    const startTime = performance.now();
    const detectedTriggers: WorkerTrigger[] = [];
    let totalMatches = 0;

    for (const [trigger, patterns] of Object.entries(TRIGGER_PATTERNS) as [WorkerTrigger, RegExp[]][]) {
      for (const pattern of patterns) {
        if (pattern.test(text)) {
          if (!detectedTriggers.includes(trigger)) {
            detectedTriggers.push(trigger);
          }
          totalMatches++;
        }
      }
    }

    const detectionTime = performance.now() - startTime;
    if (detectionTime > 5) {
      console.warn(`Trigger detection exceeded 5ms target: ${detectionTime.toFixed(2)}ms`);
    }

    const confidence = detectedTriggers.length > 0
      ? Math.min(1, totalMatches / (detectedTriggers.length * 2))
      : 0;

    return {
      detected: detectedTriggers.length > 0,
      triggers: detectedTriggers,
      confidence,
      context: text.slice(0, 100),
    };
  }

  /**
   * Get worker status
   *
   * @param workerId - Worker ID

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Optimize the trigger detection hot path: precompile regexes, index triggers, and avoid repeated parsing.
  2. Cache trigger evaluation results where inputs are unchanged.
  3. Profile detection to locate the slow check and move non-critical work off the 5ms path.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Trigger-detection pass over the event stream takes longer than the 5ms budget; triggered by oversized event batches, regex-heavy matchers, or GC pauses on the dispatch hot path.

Common situations: See trigger scenarios.


AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18). Data as JSON: /api/errors/f26dca20aaedcc8e. Report an issue: GitHub.