apache / apache/shenyu

[BUG] ShenyuMcpResponseDecorator completes future on first chunk (truncates multi-chunk bodies)

Open
#6,640 2 comments 0 reactions 1 assignee Claimed by @wy471x View on GitHub
feature: plugin priority: high type: bug
Dominant language
Java
Stars
8.8k
Forks
3.1k
Avg merge
7d 1h
Merged PRs (30d)
85

Description

- severity: High
- files: `shenyu-plugin/shenyu-plugin-mcp-server/src/main/java/org/apache/shenyu/plugin/mcp/server/response/ShenyuMcpResponseDecorator.java:72-78`
- description: In `writeWith`, `doOnNext` appends each chunk to `body` and, if `!future.isDone()`, immediately completes `responseFuture` with `applyResponseTemplate(this.body.toString())` — i.e. with only the first chunk accumulated so far. Subsequent chunks append to `body` but the future is already done.
- impact: Tool-call results are truncated to the first chunk for any response delivered in more than one DataBuffer.
- suggested_fix: Complete the future only in `setComplete()` (or use `collectList()` then complete), not per-chunk.
- confidence: High
- related_existing: none

---
_Identified during the 2026-08-02 deep re-scan; full list in [`docs/scan2-2026-08-02/00-consolidated-critical-high.md`](docs/scan2-2026-08-02/00-consolidated-critical-high.md)._

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.