4ce254193e
The 30s time-to-first-token guard measured from the turn's first model call to the first answer token, so thinking, tool execution and the second call's prefill all counted against it. Long reasoning on a long conversation was cancelled mid-generation (llama-server: stop: cancel task at n_gen=1287). - stream_query: the timeout now fires only when an in-flight model call goes silent for TTFT_TIMEOUT_SECONDS. Any chunk (thinking or empty) resets the clock, each model call starts a fresh one, and time spent in tools between calls doesn't count. - Trim replayed history (blueprints/conversation/context.py): tool results and user messages from earlier turns are capped at 4000 chars (attachments included) and their images replaced by a placeholder. The current turn is untouched. The window no longer starts with orphaned ToolMessages. - Log per-call prefill time, duration and prompt/output tokens (stream_usage=True) plus max_prompt_tokens in the stream_request line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>