{"record":{"id":"6f9ab7027cb2e937","repo":"ruvnet/ruflo","slug":"invalid-apsc-agentid","errorCode":null,"errorMessage":"invalid APSC agentId","messagePattern":"invalid APSC agentId","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/services/pheromone-adaptive.ts","lineNumber":161,"sourceCode":"\nfunction counts(state: ApscState): { activeAgents: number; suspendedAgents: number } {\n  const values = Object.values(state.agents);\n  return {\n    activeAgents: values.filter((agent) => agent.status === 'active').length,\n    suspendedAgents: values.filter((agent) => agent.status === 'suspended').length,\n  };\n}\n\nfunction protectedRole(state: ApscState, role: string): boolean {\n  return state.config.protectedRoles.includes(role.toLowerCase());\n}\n\nexport function recordApscSignal(\n  current: ApscState,\n  signal: ApscSignal,\n  now = Date.now(),\n): { state: ApscState; decision: ApscDecision } {\n  if (!/^[A-Za-z0-9._:-]{1,160}$/.test(signal.agentId)) throw new Error('invalid APSC agentId');\n  if (!/^[A-Za-z0-9._:-]{1,100}$/.test(signal.role)) throw new Error('invalid APSC role');\n  const config = normalizeApscConfig(current.config);\n  const state: ApscState = {\n    ...current,\n    config,\n    round: current.round + 1,\n    roleBaselines: { ...current.roleBaselines },\n    agents: Object.fromEntries(Object.entries(current.agents).map(([id, agent]) => [id, { ...agent }])),\n  };\n  const success = unit(signal.taskSuccess, 'taskSuccess');\n  const latency = unit(signal.normalizedLatency, 'normalizedLatency');\n  const alignment = unit(signal.consensusAlignment, 'consensusAlignment');\n  const rawScore = config.alpha * success + config.beta * (1 - latency) + config.gamma * alignment;\n\n  const role = signal.role.toLowerCase();\n  // Compare against peers in the same role, excluding the current agent.\n  // Letting an agent update its own baseline before normalization caused a\n  // persistently weak agent to redefine \"normal\" downward and reactivate","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/cli/src/services/pheromone-adaptive.ts#L143-L179","documentation":"recordApscSignal() rejected the incoming signal's agentId — it failed whatever identity validation the function applies (empty/non-string). The signal is dropped before it can touch the agent table because there is no agent record to attribute it to.","triggerScenarios":"Thrown at v3/@claude-flow/cli/src/services/pheromone-adaptive.ts:161 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a valid APSC agent identifier (non-empty string)"],"exampleFix":"Pass a valid APSC agentId (non-empty string of a known agent).","handlingStrategy":"validation","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-14T05:17:10.506Z"}