feat(2.2,2.3): блокирующий файловый IO в bridge → to_thread; таймаут+потолок на агентный Docker-запуск

2.2: openpyxl/zip чтение (glm _read_work_dir_files, claude _preprocess_xlsx) больше не морозит event loop.
2.3: asyncio.wait_for вокруг readline (silence=180с) + общий дедлайн 600с — зависший контейнер
не даёт вечный спиннер и освобождает слот семафора.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
anor
2026-06-10 17:34:54 +10:00
co-authored by Claude Fable 5
parent 0637426d5c
commit 846145a00a
2 changed files with 27 additions and 5 deletions
+4 -2
View File
@@ -5,6 +5,7 @@ resources.json for code lookups, GLM-5 API for generation.
No Docker, no subprocess — pure Python, fast.
"""
import asyncio
import json
import os
import re
@@ -441,8 +442,9 @@ async def stream_claude(
except Exception:
pass
# Read files from work directory if they exist
file_context = _read_work_dir_files(work_dir)
# Read files from work directory if they exist.
# В отдельном потоке: openpyxl/zip синхронны и на тяжёлых xlsx морозят event loop.
file_context = await asyncio.to_thread(_read_work_dir_files, work_dir)
# Search normative RAG (TG posts + PDF)
normative_context = _search_normative(message)