Bugfix: How to fix EXECUTE phase wasting 15+ minutes on code generat...

Documentation for Sessions

🐛 Bugfix: How to fix EXECUTE phase wasting 15+ minutes on code generat...

Date: 2026-02-23
Time: 20:16:34 UTC
Session: gspace1-139.2
Agent: angular
Confidence: 97%
Status: ✅ Documented


📋 Decision Context

Question:

How to fix EXECUTE phase wasting 15+ minutes on code generation timeouts that produce zero output?

Task: S138.4 fix EXECUTE phase hanging on code gen timeouts


🎯 Decision Made

Chosen:

Added withTimeout() helper using Promise.race with 90-second per-call cap. Also added emitProgress() for per-module SSE events so the UI shows real-time generation progress.

Options Considered:

  1. Add timeout to SendOptions in LLM types (requires provider changes)
  2. Wrap each LLM call with Promise.race timeout at the call site
  3. Skip code generation entirely in both mode

💭 Reasoning

Terminal logs showed the provider's built-in timeout is 2-3+ minutes per call, and code generation fails for EVERY module ('Request timed out' for trainer-management, studio-access-control, class-booking-system, workout-tracking). With 5-6 modules, that's 12-20 minutes of dead time producing zero files. The visual path succeeds quickly for every module. The 90s cap via Promise.race is the right approach because: (1) It works regardless of provider configuration. (2) It's non-destructive — returns null instead of throwing, so the pipeline continues. (3) 90 seconds is generous for visual gen (typically 10-30s) and gives code gen a fair shot. (4) Per-module SSE events ensure the UI shows 'Generating module: X (3/6)' instead of a frozen timer. Did NOT skip code generation entirely because it may work when the LLM provider isn't under load — the timeout just prevents it from blocking the pipeline.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation