Aias00 opened a new issue, #7646:
URL: https://github.com/apache/shenyu/issues/7646

   ## Goal
   Bound memory used to capture backend responses as MCP tool results and 
validate cancellation behavior. Treat this as captured tool-result processing, 
not generic HTTP streaming passthrough.
   
   ## Current evidence
   `NonCommittingMcpResponseDecorator` consumes buffers incrementally but still 
accumulates the complete result in a `StringBuilder`, converts each chunk to a 
string, and completes a `CompletableFuture<String>` at the end. Removing 
`collectList` did not remove complete-result retention. Templates and the 
future contract may require a complete result even when no template is 
configured.
   
   [Source at reviewed 
commit](https://github.com/apache/shenyu/blob/b4e115367fd57adc8aba332d655b1009932ba394/shenyu-plugin/shenyu-plugin-mcp-server/src/main/java/org/apache/shenyu/plugin/mcp/server/response/NonCommittingMcpResponseDecorator.java#L84)
   
   ## Scope and acceptance criteria
   - [ ] Define an explicit result-size budget and deterministic over-limit 
behavior; check whether limits elsewhere already protect this path before 
adding redundant configuration.
   - [ ] Measure peak heap, allocated bytes/result and concurrency scaling for 
small/large and chunked results, with/without templates.
   - [ ] Preserve UTF-8 decoding across arbitrary byte boundaries, template 
semantics and result correlation.
   - [ ] Verify success, upstream failure, over-limit and cancellation release 
buffers and finish/clean up pending operations correctly.
   - [ ] Avoid a passthrough/zero-copy redesign unless measurements and the MCP 
result contract justify it.
   - [ ] Report measured memory bounds and compatibility implications rather 
than asserting an unmeasured OOM incident.
   
   AI Proxy already has header/idle/total-stream timeouts and response-size 
controls; this task does not duplicate those protections.
   


-- 
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