{"record":{"id":"3a09d469bd9c626f","repo":"ruvnet/ruflo","slug":"queen-override-not-allowed-for-decision-type-de","errorCode":null,"errorMessage":"Queen override not allowed for decision type: ${decision.type}","messagePattern":"Queen override not allowed for decision type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/swarm/src/queen-coordinator.ts","lineNumber":1762,"sourceCode":"        approvalRate: result.approvalRate,\n        latencyMs: latency,\n      });\n\n      return result;\n    } finally {\n      this.activeDecisions.delete(decision.decisionId);\n    }\n  }\n\n  private queenOverride(decision: Decision): ConsensusResult {\n    // Queen can make immediate decisions for:\n    // - Emergency actions\n    // - Agent termination\n    // - Priority overrides\n    const allowedTypes: DecisionType[] = ['emergency-action', 'agent-termination', 'priority-override'];\n\n    if (!allowedTypes.includes(decision.type)) {\n      throw new Error(`Queen override not allowed for decision type: ${decision.type}`);\n    }\n\n    return {\n      proposalId: decision.decisionId,\n      approved: true,\n      approvalRate: 1.0,\n      participationRate: 1.0,\n      finalValue: decision.proposal,\n      rounds: 1,\n      durationMs: 0,\n    };\n  }\n\n  private async majorityConsensus(decision: Decision): Promise<ConsensusResult> {\n    // Use swarm's consensus engine with majority threshold\n    const result = await this.swarm.proposeConsensus({\n      decision,\n      threshold: 0.51,","sourceCodeStart":1744,"sourceCodeEnd":1780,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/swarm/src/queen-coordinator.ts#L1744-L1780","documentation":"QueenCoordinator.queenOverride() is an autocratic fast path that lets the queen decide alone, but only for decision types emergency-action, agent-termination, and priority-override. Every other DecisionType is rejected because it must go through the full consensus voting flow. The throw happens before the synthetic approved ConsensusResult is built.","triggerScenarios":"Forcing the queen-override path (a decide() call in override/immediate mode, or calling queenOverride directly) for a decision whose type is something like config-change, resource-allocation, or any custom type not in the allowlist.","commonSituations":"Adding a custom DecisionType and assuming the queen can fast-track it; porting decision code from a version where override was unrestricted; test fixtures using arbitrary type strings.","solutions":["Route non-listed decision types through the normal consensus flow (consensusEngine.propose/decide) instead of the override path","If the new type genuinely needs queen fast-track, add it to allowedTypes inside queenOverride and re-run consensus tests","Check decision.type spelling against the DecisionType union; a typo never matches the allowlist"],"exampleFix":"// before\nconst result = queenCoordinator.queenOverride({ decisionId: 'd1', type: 'config-change', proposal: value }); // throws\n\n// after\n// normal decisions go through full consensus voting\nconst result = await consensusEngine.propose(queenId, 'config-change', value);","handlingStrategy":"type-guard","validationCode":"const QUEEN_OVERRIDABLE = new Set(['emergency-action', 'agent-termination', 'priority-override']);\n\nif (!QUEEN_OVERRIDABLE.has(decision.type)) {\n  // not overridable: use the full consensus flow\n  const result = await consensusEngine.propose(queenId, decision.type, decision.proposal);\n} else {\n  const result = queenCoordinator.queenOverride(decision);\n}","typeGuard":"const QUEEN_OVERRIDABLE: ReadonlySet<string> = new Set(['emergency-action', 'agent-termination', 'priority-override']);\nfunction isQueenOverridable(type: DecisionType): boolean {\n  return QUEEN_OVERRIDABLE.has(type);\n}","tryCatchPattern":"try {\n  return queenCoordinator.queenOverride(decision);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith('Queen override not allowed')) {\n    return await runFullConsensus(decision); // degrade gracefully to voting\n  }\n  throw err;\n}","preventionTips":["Keep the allowlist in one exported constant shared by caller and queenOverride","Unit-test every DecisionType against the override path","Log decision.type on every override attempt so misrouted types are visible"],"tags":["queen-coordinator","consensus","decision-types","governance"],"backgroundTag":"operation-not-permitted","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"}