ruvnet/ruflo · error
invalid APSC role
Error message
invalid APSC role
What it means
recordApscSignal() rejected the signal's role string (empty or non-string), so it cannot be checked against the protectedRoles list or used for role-aware suspension logic. A guard on the signal input before any state update occurs.
Source
Thrown at v3/@claude-flow/cli/src/services/pheromone-adaptive.ts:162
function counts(state: ApscState): { activeAgents: number; suspendedAgents: number } {
const values = Object.values(state.agents);
return {
activeAgents: values.filter((agent) => agent.status === 'active').length,
suspendedAgents: values.filter((agent) => agent.status === 'suspended').length,
};
}
function protectedRole(state: ApscState, role: string): boolean {
return state.config.protectedRoles.includes(role.toLowerCase());
}
export function recordApscSignal(
current: ApscState,
signal: ApscSignal,
now = Date.now(),
): { state: ApscState; decision: ApscDecision } {
if (!/^[A-Za-z0-9._:-]{1,160}$/.test(signal.agentId)) throw new Error('invalid APSC agentId');
if (!/^[A-Za-z0-9._:-]{1,100}$/.test(signal.role)) throw new Error('invalid APSC role');
const config = normalizeApscConfig(current.config);
const state: ApscState = {
...current,
config,
round: current.round + 1,
roleBaselines: { ...current.roleBaselines },
agents: Object.fromEntries(Object.entries(current.agents).map(([id, agent]) => [id, { ...agent }])),
};
const success = unit(signal.taskSuccess, 'taskSuccess');
const latency = unit(signal.normalizedLatency, 'normalizedLatency');
const alignment = unit(signal.consensusAlignment, 'consensusAlignment');
const rawScore = config.alpha * success + config.beta * (1 - latency) + config.gamma * alignment;
const role = signal.role.toLowerCase();
// Compare against peers in the same role, excluding the current agent.
// Letting an agent update its own baseline before normalization caused a
// persistently weak agent to redefine "normal" downward and reactivate
// without any recovery.View on GitHub (pinned to fa13ee4ad6)
Solutions
- Provide a valid APSC role string from the allowed set
Example fix
Pass a valid APSC role from the supported role set.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at v3/@claude-flow/cli/src/services/pheromone-adaptive.ts:162 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18).
Data as JSON: /api/errors/a3edc957878db349.
Report an issue: GitHub.