fix(BIZ-42): critical deadlock + major review issues

- Fix #1 (Critical): evaluate_retreat() deadlock — changed _retreat_lock to
  threading.RLock() to allow reentrant acquisition when evaluate_retreat()
  calls get_429_rate() while holding the lock
- Fix #2 (Major): Dashboard queue chart now uses snap.queue.per_priority
  instead of Math.random() mock data
- Fix #3 (Major): structlog uses JSONRenderer instead of ConsoleRenderer
  for JSON-format output as required by acceptance criteria
- Bonus: webui.py _build_snapshot() now async and includes queue data
  with per-priority depth for dashboard consumption

Reviewed-by: 梁思筑 (architect)
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
2026-06-24 12:20:23 +08:00
parent e829a4060b
commit ba5b932f50
4 changed files with 28 additions and 12 deletions
+1 -2
View File
@@ -52,8 +52,7 @@ structlog.configure(
structlog.processors.StackInfoRenderer(),
structlog.processors.format_exc_info,
structlog.processors.UnicodeDecoder(),
# 生产环境推荐 JSONRenderer,开发环境可用 ConsoleRenderer
structlog.dev.ConsoleRenderer(),
structlog.processors.JSONRenderer(),
],
context_class=dict,
logger_factory=structlog.PrintLoggerFactory(),