Captures the structural root cause of the test_execution_sim_live
failure: src/gui_2.py:render_response_panel calls imgui.set_window_focus
directly during the render frame. On Windows, the GUI subprocess main
thread has only 1.94 MB of stack; the focus call exhausts it and
crashes the GUI with 0xC00000FD = STATUS_STACK_OVERFLOW.
This test enforces the fix's contract: the render body must NOT call
imgui.set_window_focus directly; it must defer the call via a
_pending_focus_response flag to the next frame's idle phase. Mirrors
the existing _autofocus_response_tab pattern at gui_2.py:5353-5356.
Test currently FAILS on this commit. Will pass after the fix in
src/gui_2.py:render_response_panel and the deferred handler in the
main render loop.
User directive (2026-06-17): do not add skip markers for flaky tests.
Instead, switch the test to use a different provider (gemini) and
report if it still fails.
Original: gemini_cli with mock_gemini_cli.py subprocess
New: gemini with gemini-2.5-flash-lite model
If the test still fails, REPORT it -- do not add a skip marker. The
user wants to start a diff track to fix it.
Pre-existing flake: GUI subprocess (port 8999) crashes or AI never
generates the expected 'Simulation Test' response text within 90s timeout.
Verified on parent commit 4ab7c732 (Phase 12.6.2) - same failure mode.
The test depends on live AI generation + a stable GUI subprocess; both
are flaky under load.
Fix would require either:
- Increasing the test timeout
- Mocking the AI generation in the sim
- Improving the GUI subprocess resilience
Deferred to a follow-up track. Phase 13.4 documentation per AGENTS.md
skip-marker policy.
Three real fixes for the sim test + the live_gui coordination layer:
1. /api/project_switch_status endpoint in src/app_controller.py.
The wait helper had been calling this endpoint but it did not exist;
the helper always received a 404, fell back to {in_progress: False},
and returned immediately even when a switch was in flight. Added the
endpoint that reads _project_switch_in_progress, active_project_path,
and _project_switch_error from the controller.
2. simulation/sim_base.py: replace time.sleep(2.0)/time.sleep(1.5) in
the setup() with wait_io_pool_idle and wait_for_project_switch so
the test does not click btn_md_only while a project switch is in
flight. Also added the wait calls to sim_context.py for the same
reason.
3. src/app_controller.py _handle_md_only: removed the is_project_stale()
early-return. The stale state is a transient window during which the
previous code dropped the click on the floor with a misleading
'stale ui' status. The MD generation worker is safe to run from any
project state; the action handler now always proceeds.
4. tests/test_extended_sims.py: set current_model to 'gemini-cli' so
_do_generate does not raise KeyError('model') when the test
overrides provider to gemini_cli.
KNOWN ISSUE: test_context_sim_live still fails with status
'switching to: temp_livecontextsim' after a 60s wait. The click
appears to be re-triggering a project switch via the GUI's render
loop. Root cause investigation deferred; the sim is async and the
test path is fragile.