Improve Cursor-visible thinking display, large-payload stability, and optional Docker#35
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
…twork errors Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
|
Thanks for the pr @optommt-sudo
Do you mean that Cursor is not rendering it at all sometimes? Or is it that you have to click the triangle to trigger the display of
|
Summary
This PR improves how streamed reasoning_content is shown in Cursor (and similar clients), makes long-running / large requests more reliable, and adds an optional Docker deployment path.
Thinking display (streaming + non-streaming)
Problem: Cursor often does not render
Details
HTML well; reasoning showed up as raw tags or awkward fragments.Change: Mirror streaming reasoning_content into content as Markdown blockquotes: first chunk uses > 💭 , continuations use > , then \n\n before normal answer / tool-call phase. Non-streaming responses use the same blockquote shape; multi-line reasoning uses > on continuation lines.
Upstream hygiene: strip_cursor_thinking_blocks() now also removes a leading run of >... lines so mirrored thinking is not replayed to the API as user-visible fluff.
Files: streaming.py, transform.py, tests in test_streaming.py, test_protocol.py, test_trace.py, test_transform.py.
Large context / long requests
Default request_timeout raised 300s → 600s and max_request_body_bytes 20 MiB → 40 MiB (helps ~960k-token style payloads and slow thinking responses).
Files: config.py.
Upstream retries
Retry urlopen on URLError and on HTTPError with 5xx only (not 4xx), up to 3 attempts with 2s / 4s backoff; fresh Request per attempt.
Files: server.py.
Docker (optional)
Dockerfile, docker-compose.yml, .dockerignore, example repo-root config.yaml (e.g. host: 0.0.0.0, timeouts/body limits aligned with above).
Testing
uv run python -m unittest discover -s tests
Docker (optional): docker compose build && docker compose up -d.
Breaking / behavior notes
Client-visible assistant content during streaming is now blockquote Markdown instead of
Details
...