ContextEditingMiddleware blocks the event loop with model-based token counting
When ContextEditingMiddleware uses token_count_method="model" through the async method awrap_model_call, it directly invokes the synchronous model.get_num_tokens_from_messages on the event-loop thread. For models like ChatAnthropic that perform a synchronous HTTP request for token counting, this blocks the entire event loop for the duration of each count, causing severe latency spikes and starving other async tasks.
