fix: use actual consensus confidence for peers instead of hardcoded 0.8

- Federation endpoint was hardcoding confidence: 0.8 for all peer responses
- Local swarm uses actual calculated confidence (often 1.0 for single worker)
- This created unfair bias toward local responses
- Now uses result.confidence from actual consensus calculation
- Peers and local now compete on equal footing
- All 41 tests passing
This commit is contained in:
2026-02-25 22:21:19 +01:00
parent 896e9d6d9b
commit e0d04ae664
+5 -1
View File
@@ -451,9 +451,13 @@ async def federation_vote(request: Request):
logger.info(f"✅ Federation vote complete ({response.tokens_generated} tokens, {elapsed_ms:.0f}ms)")
# Use actual confidence from consensus result instead of hardcoded value
# This ensures fair comparison between local and peer swarms
actual_confidence = result.confidence if hasattr(result, 'confidence') else 0.8
return {
"response": response.text,
"confidence": 0.8, # Could be calculated from consensus
"confidence": actual_confidence,
"latency_ms": elapsed_ms,
"worker_count": len(swarm_manager.workers) if hasattr(swarm_manager, 'workers') else 1,
"tokens_per_second": response.tokens_per_second,