• 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
..
admin Loading commit data...
api Loading commit data...
backends Loading commit data...
broker Loading commit data...
frontproxy Loading commit data...
models Loading commit data...
openai Loading commit data...
pydantic Loading commit data...
queue Loading commit data...
tasks Loading commit data...
__init__.py Loading commit data...
cli.py Loading commit data...
config.py Loading commit data...
main.py Loading commit data...
platform_paths.py Loading commit data...