Skip to content

Worker-queue ESC-cancel pattern not ported to AnthropicProvider / MinimaxProvider #279

Description

@ericleepi314

Files: src/providers/anthropic_provider.py, src/providers/minimax_provider.py

Background: PR #148 explicitly carves these providers out:

Not extending the worker+queue to AnthropicProvider or MinimaxProvider. Both use the anthropic SDK and work reliably against direct connections; no user has reported proxy-buffering issues against them.

Note: PR #269 added a central LLM read timeout for all openai-SDK providers, which bounds the hang — but the worker+queue prompt-unwind on ESC is a separate concern and remains unported (grep -n chunk_queue src/providers/anthropic_provider.py src/providers/minimax_provider.py is empty).

Impact: With an HTTP proxy (corporate proxy, LiteLLM, mitmproxy) in front of Anthropic or Minimax, ESC could hang for the same reason it hung for OpenAI-compatible providers — the SDK's sync httpx socket read doesn't honor cross-thread response.close().

Fix sketch: Extract the worker+queue helper from openai_compatible.py into a reusable utility (e.g. src/providers/_stream_worker.py) and call it from both providers' chat_stream_response. Cover with a StuckStream regression test mirroring PR #148's test_abort_unwinds_promptly_even_when_iterator_never_returns.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions