sshiv012 opened a new issue, #9080:
URL: https://github.com/apache/texera/issues/9080

   ### What happened?
   
   On our Kubernetes deployment, the AI agent stopped working with the error 
**"Failed to process successful response"**. Every chat request failed, even 
though LiteLLM itself answered fine.
   
   **Why it happens:** the access-control-service sits between the agent and 
LiteLLM and passes chat requests through (`LiteLLMProxyResource`, `POST 
/api/chat/*`). It breaks compressed replies:
   
   1. The agent asks for a compressed reply (Bun's `fetch` sends 
`Accept-Encoding: gzip` by default), and the proxy passes that request on to 
LiteLLM.
   2. LiteLLM sends back a gzip-compressed reply.
   3. The proxy reads the compressed bytes as if they were text, which 
scrambles them.
   4. It then copies LiteLLM's headers back, so the agent is still told "this 
is gzip".
   5. The agent tries to unzip the scrambled bytes and fails.
   
   ```
   Before:  agent -> proxy -> LiteLLM (gzip reply) -> proxy reads it as text -> 
scrambled "gzip" -> agent fails
   After:   agent -> proxy -> LiteLLM (plain reply) -> proxy passes it through 
correctly -> agent works
   ```
   
   **Why only on Kubernetes:** the k8s chart uses the unpinned LiteLLM image 
`litellm/litellm:main-stable` (`bin/k8s/values.yaml`), so it picked up a newer 
LiteLLM build that compresses chat replies. The single-node setup pins 
`v1.83.10-stable`, so it isn't affected yet.
   
   `GET /api/models` (`LiteLLMModelsResource`) is written the same way: it 
reads the reply as text and copies all headers back. It doesn't forward the 
agent's `Accept-Encoding`, so it is less likely to break, but it should get the 
same fix.
   
   **Expected:** the proxy should not ask LiteLLM for compression, should pass 
the reply body through untouched, and should not copy headers that no longer 
match the body (`Content-Encoding`, `Content-Length`, `Transfer-Encoding`, 
`Connection`).
   
   ### How to reproduce?
   
   1. Deploy with the k8s chart (LiteLLM image `litellm/litellm:main-stable`) 
and enable Copilot.
   2. Open a workflow and send any message to the AI agent.
   3. The agent fails with "Failed to process successful response", and 
agent-service logs show a `ZlibError` while reading the reply.
   
   ### Version/Branch
   
   1.4.0-incubating-SNAPSHOT (main)
   
   ### Commit Hash (Optional)
   
   3ba45ee5a
   
   ### Relevant log output
   
   ```shell
   ZlibError ... Failed to process successful response
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to