When client disconnects mid-stream, Python GC kills the generator with GeneratorExit (BaseException subclass), which is NOT caught by except Exception. write_llmusage at line 93 was never reached, causing ~16% usage records lost. finally block ensures llmusage is written even on GeneratorExit.