Skip to content

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

Description

@Aias00
  • 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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions