{"record":{"id":"f26dca20aaedcc8e","repo":"ruvnet/ruflo","slug":"trigger-detection-exceeded-5ms-target-detection","errorCode":null,"errorMessage":"Trigger detection exceeded 5ms target: ${detectionTime.toFixed(2)}ms","messagePattern":"Trigger detection exceeded 5ms target: (.+?)ms","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/swarm/src/workers/worker-dispatch.ts","lineNumber":438,"sourceCode":"  detectTriggers(text: string): TriggerDetectionResult {\n    const startTime = performance.now();\n    const detectedTriggers: WorkerTrigger[] = [];\n    let totalMatches = 0;\n\n    for (const [trigger, patterns] of Object.entries(TRIGGER_PATTERNS) as [WorkerTrigger, RegExp[]][]) {\n      for (const pattern of patterns) {\n        if (pattern.test(text)) {\n          if (!detectedTriggers.includes(trigger)) {\n            detectedTriggers.push(trigger);\n          }\n          totalMatches++;\n        }\n      }\n    }\n\n    const detectionTime = performance.now() - startTime;\n    if (detectionTime > 5) {\n      console.warn(`Trigger detection exceeded 5ms target: ${detectionTime.toFixed(2)}ms`);\n    }\n\n    const confidence = detectedTriggers.length > 0\n      ? Math.min(1, totalMatches / (detectedTriggers.length * 2))\n      : 0;\n\n    return {\n      detected: detectedTriggers.length > 0,\n      triggers: detectedTriggers,\n      confidence,\n      context: text.slice(0, 100),\n    };\n  }\n\n  /**\n   * Get worker status\n   *\n   * @param workerId - Worker ID","sourceCodeStart":420,"sourceCodeEnd":456,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/swarm/src/workers/worker-dispatch.ts#L420-L456","documentation":"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.","triggerScenarios":"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.","commonSituations":"See trigger scenarios.","solutions":["Optimize the trigger detection hot path: precompile regexes, index triggers, and avoid repeated parsing.","Cache trigger evaluation results where inputs are unchanged.","Profile detection to locate the slow check and move non-critical work off the 5ms path."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}