fix(cursor): translate chat completion content blocks to Responses API input - #34782
fix(cursor): translate chat completion content blocks to Responses API input#34782devin-ai-integration[bot] wants to merge 1 commit into
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
|
Greptile SummaryThis PR converts Cursor Chat Completions message payloads into Responses API inputs.
Confidence Score: 3/5The PR should not merge until the conversion preserves assistant text accompanying tool calls and system prompts alongside explicit instructions. The newly applied converter can silently remove two forms of conversation context on valid mixed-content request shapes, causing the provider to answer from an incomplete prompt. Files Needing Attention: litellm/proxy/response_api_endpoints/endpoints.py
|
| Filename | Overview |
|---|---|
| litellm/proxy/response_api_endpoints/endpoints.py | Adds message conversion but exposes loss of assistant text accompanying tool calls and drops converted system prompts when explicit instructions coexist. |
| tests/test_litellm/proxy/response_api_endpoints/test_endpoints.py | Adds focused transformation coverage, but does not cover assistant content plus tool calls or combined system messages and explicit instructions. |
Reviews (1): Last reviewed commit: "fix(cursor): translate chat completion c..." | Re-trigger Greptile
| ) = responses_api_bridge.transformation_handler.convert_chat_completion_messages_to_responses_api( | ||
| data.pop("messages") | ||
| ) |
| if instructions and not data.get("instructions"): | ||
| data["instructions"] = instructions |
There was a problem hiding this comment.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
TLDR
Problem this solves:
How it solves it:
instructionsinstead of raw inputRelevant issues
Fixes #34777
Linear ticket
Pre-Submission checklist
@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Live proxy (
python litellm/proxy/proxy_cli.py --config litellm/proxy/dev_config.yaml), real OpenAI call with a base64 PNG of a blue rectangleRequest body (
req.json), built once and reused for both runs:Before, at 2412326:
{"error":{"message":"litellm.BadRequestError: OpenAIException - {\n \"error\": {\n \"message\": \"Invalid value: 'text'. Supported values are: 'input_text', 'input_image', 'output_text', 'refusal', 'input_file', 'computer_screenshot', 'summary_text', and 'encrypted_content'.\",\n \"type\": \"invalid_request_error\",\n \"param\": \"input[0].content[0].type\",\n \"code\": \"invalid_value\"\n }\n}. Received Model Group=gpt-5.5\nAvailable Model Group Fallbacks=None","type":null,"param":null,"code":"400"}}After, at 3bc9339 (same curl):
{"id":"chatcmpl-6001b2b4-8204-458c-8090-fcb543399620","created":1785157998,"model":"gpt-5.5","object":"chat.completion","choices":[{"finish_reason":"stop","index":0,"message":{"content":"Blue","role":"assistant"}}]}(response truncated to the interesting fields; the model correctly read the image and answered "Blue")
Type
🐛 Bug Fix
Changes
cursor_chat_completionsused to dodata["input"] = data.pop("messages"), handing Chat-Completions-shaped content blocks (text,image_url) to a path that validates Responses API shapes (input_text,input_image), so every vision request died before reaching the provider. It now reusesresponses_api_bridge.transformation_handler.convert_chat_completion_messages_to_responses_api, the same converter the completion-to-responses bridge uses, which maps text and image blocks, tool calls and tool outputs, and pulls system prompts out intoinstructions. Requests that already send Responses-shapedinputare untouchedFinal Attestation
Link to Devin session: https://app.devin.ai/sessions/492caaec5f254cfa84612c8c00beb717