MIKE-FIX-LLM-PRODUCTION-01: fix LLM key flow and model picker

✅ merged · #10 · Edu-Carone-SA/mike ← Edu-Carone-SA/mike · opened 1mo ago by EduardoCarone · merged 1mo ago by EduardoCarone · self · +64-27 across 11 files · ↗ on GitHub

From the PR description

What

Fixes all 10 bugs from QA Retest Cycle 3 (issue #188).

P0 - BUG-PROD-CRITICAL-001: PROD answer extraction returns numbers instead of text

  • Added extractProductionAnswer() - text-aware extraction with no number fallback
  • Added mode field to LlmCallInput and RunQuestionParams
  • All 3 flow strategies pass mode through to llmCall()
  • Production engine passes mode="production" to debate flow + SAS baseline
  • SAS baseline now uses extractProductionAnswer instead of extractFinalAnswer

P1 - BUG-EXP-PROD-001: questionText empty in PROD JSON export

  • Export endpoint now branches on clashType (like the results endpoint)
  • Production clashes use getProductionResults() instead of getBenchmarkResults()

P1 - BUG-DASH-001 regression: Dashboard "LOADING MISSION DATA..." on first nav

  • Race bootstrap() with 4s timeout so ready always resolves

P1 - DASH-04: TOKENS EXPENDED = "UNKNOWN"

  • Added totalTokens and totalCost to /clashes API response
  • Dashboard aggregates client-side (same pattern as bestAccuracy)

P1 - BUG-LIVE-001: Identical timestamps per question

  • Added onEvent callback to RunQuestionParams
  • All 3 flow strategies emit events in real-time as they happen
  • Both engines pass emitClashEvent as the callback
  • Removed post-hoc event emission loops from engines

P1 - BUG-LIVE-022: No auto-redirect to AAR after completion

  • 5-second delayed auto-redirect to /operations/{id}/report

P2 - BUG-SET-001 + BUG-DET-002: Black screen on Pricing + Units pages

  • Added inline style fallback for background/text color during CSS hydration

P2 - BUG-LIVE-016: "Q8/?" instead of "Q8/15"

  • Extract questionCount from mission_started event
  • Also fetch questionLimit from clash metadata

P2 - BUG-LIVE-017: Intel Feed no auto-scroll

  • Use requestAnimationFrame for DOM-accurate scroll timing

P2 - BUG-EXP-001: flow: null in JSON export

  • Fixed by BUG-EXP-PROD-001 (export now uses correct results function per clashType)

Why

QA Retest Cycle 3 identified 10 bugs across PROD mode, dashboard, War Room live, and exports.

How to test

  1. PROD mode: Create a production operation → agents should return text answers, not numbers
  2. Dashboard: First navigation should load within 4s; TOKENS EXPENDED should show aggregated count
  3. War Room live: Events should have distinct timestamps; Q counter shows "Q1/15"; auto-scroll works; auto-redirects to AAR after 5s
  4. Export PROD JSON: questionText should be populated with the refined question
  5. Pricing/Units pages: No black screen on navigation

Risk/rollback

  • Event emission moved from engines to flow strategies - if a flow doesn't emit correctly, events won't appear in War Room. All 3 flows updated + tested.
  • mode defaults to "benchmark" for backward compatibility - existing benchmark behavior unchanged.
  • Revert this PR to rollback all changes.

Our analysis

Stabilize production answers and live operations — read the full analysis →

Think the analysis missed something the PR description covers?

Capture this PR into my fork

Download a Markdown prompt that tells Claude how to port every commit in this PR into your working tree. Run it via claude -p < capture-pull-10.md from inside the repo you want the changes in.

⬇ Download capture-pull-10.md