Reasoning models spend tokens thinking before writing the visible answer,
and those tokens count against max_tokens. The seed-keyword step's
max_tokens=400 left GLM-5.2 (the default model) no room to answer: the
API returned content=None with finish_reason=length, and re.search(None)
crashed every default-settings plan generation with 'Unexpected error:
expected string or bytes-like object'.
- app.py: raise the seed-keyword budget 400 -> 2000 (verified sufficient
against the live API with the real prompt).
- llm.py chat(): retry once with +3000 headroom when content is empty at
finish_reason=length, and raise a clear LLMError instead of returning
None if content is still empty - covers every call site centrally.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add PYTHONUNBUFFERED=1 so startup logs flush promptly