mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 09:50:24 +08:00
Follow-up to #617, which fixed the N× inflation at three call sites and left the pattern triplicated. record_streamed_usage() + message_content_chars() in core/agentic/usage.py now serve run_labeled_step, chat's _call_llm, and the question summarizer; the redundant _UsageShim (UsageTracker already unwraps .usage), the dead before_usage_calls guard, and both private _message_content_chars copies are gone, along with an unreachable try/except around a dict assignment. Accounting failures are now swallowed and debug-logged at every site — usage bookkeeping can never break a completed stream. Adds contract tests for the shared recorder. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>