• Stefy Lanza (nextime / spora )'s avatar
    engine: stop event-loop freeze from huge --debug dumps; name processes by role · fd715097
    Stefy Lanza (nextime / spora ) authored
    Root cause of "engine 'nvidia' not responding" during generation: in --debug
    mode the streaming response generator print()s the ENTIRE generated text (raw
    + repr), and a prompt-echoing/runaway generation makes that multi-MB. The
    engine writes stdout to a pipe drained by the front; once the pipe fills, that
    synchronous print() — running on the event-loop thread inside the SSE generator
    — BLOCKS, freezing the engine so health polls time out and the front flips it
    to "not responding" (seen ~3s into each debug flood in debug.log).
    
    - api/text.py: add _clip_for_log() and bound every large debug/dump print
      (generated_text, second_pass/reasoning/final text, formatted_response,
      extracted_tool_calls) to ~4KB head+tail. Shared layer, so both engines covered.
    - engine_supervisor: enlarge each engine's stdout pipe to 1 MiB (F_SETPIPE_SZ)
      so bursts can't stall the event loop even if the pump lags briefly.
    
    Also: name processes by role — coderai-front for the front, coderai-<name> for
    each engine (CODERAI_ENGINE_NAME passed at spawn), coderai for single-process.
    Co-Authored-By: 's avatarClaude Opus 4.8 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_011DDv7BchtZQWsnPG6Jm49m
    fd715097
Name
Last commit
Last update
..
__init__.py Loading commit data...
app.py Loading commit data...
assignment.py Loading commit data...
engine_supervisor.py Loading commit data...
gpu_detect.py Loading commit data...
registry.py Loading commit data...
router.py Loading commit data...