You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.... Clients that depended on the old HTML shape may need to adjust; stripping logic was updated accordingly.
Thinking display (streaming + non-streaming)
Problem: Cursor often does not render
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 detail? Currently we support setting collasible_reasoning: false to disable the folding of details, such that all thinking tokens are displayed as plain text. In fact, we have an issue #20 that requests the feature to hide the thinking details. We have this as an option to hide/unide the thinking details.
The request timeout and retry idea sounds good to me. I would prefer to have that as a separate PR (ideally each PR shall only contain one new feature)
We need to run the pre-commit hooks and fix the tests to pass CI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
...