Files
LEGSTECH Optimizer 20fd86f065 fix: dashboard goes silent during Phase 1 (no AI thinking, empty Param Changes panel)
Three issues caused the dashboard to look frozen during the long Phase 1
exploration phase, even when 2+ runs had completed:

1. AI Thinking feed only got ONE entry (the phase-start banner) and then
   went silent until Phase 2. Phase 1 is LHS sampling so there are no AI
   calls — but we can still narrate observations rule-based. Added
   _narrate_phase1_run() that emits a per-result message tuned to what
   actually happened: 'PF 1.8, DD 14% — strong region, worth refining'
   (success), '$-734 loss with 191 trades — skipping' (warning), 'only
   3 trades — params too restrictive' (info), etc. Mediocre runs are
   throttled to 1-in-5 to avoid feed spam

2. Parameter Changes panel showed 'No iterations yet — AI-driven param
   edits appear per iteration' which is misleading during Phase 1
   (where there are no iterations YET, by design). Empty-state message
   now phase-aware: shows 'Exploration phase — changes appear in Phase
   2' during phase1, 'Waiting for first AI iteration' if autonomous, or
   'Random-neighbor refinement — enable Autonomous AI for AI changes'
   if not autonomous

3. AI Summary still said 'Waiting for optimization to start...' even
   while the optimization was actively running. New refreshAIWaitingState()
   updates the message based on (a) whether a run is active and (b)
   whether the API key is set. When running with no key, shows 'AI
   insights are off — no Anthropic API key set' with a 'Configure API
   key in Settings →' link

Frontend now also tracks state.phase and state.autonomous from
phase_start events so all empty-state messages stay in sync.
2026-04-25 14:47:49 +00:00
..