Skip to content

[BUG] AiProxy stream retry replays the whole upstream, duplicating SSE content #6647

Closed

Description

@Aias00
  • severity: High
  • files: shenyu-plugin/shenyu-plugin-ai/shenyu-plugin-ai-proxy/src/main/java/org/apache/shenyu/plugin/ai/proxy/enhanced/service/AiProxyExecutorService.java:88-115; consumption at AiProxyPlugin.java:171-182
  • description: executeStream wraps doChatStream in Retry.max(1) then .onErrorResume(NonTransientAiException.class, handleFallbackStream). When the upstream stream errors AFTER emitting some chunks, Reactor retryWhen re-subscribes, issuing a brand-new upstream call emitting from the beginning. Those first-attempt chunks were already written to the client SSE response, so the client receives [partial attempt-1][full attempt-2].
  • impact: Corrupted/duplicated AI completions for streaming calls that hit a mid-stream error; non-idempotent streaming calls are replayed.
  • suggested_fix: For streaming, do not blanket-retry mid-stream; retry only before any emission (buffer-first) or fail and let the client reconnect.
  • confidence: High
  • related_existing: none — [BUG] FixedRetryStrategy retries on ALL errors with no filter and no idempotency guard #6575/[BUG] Exponential/Fixed retry strategies: outer timeout neuters configured retry count #6583 concern the generic retry plugin, not the AI-proxy executeStream Flux replay.

Identified during the 2026-08-02 deep re-scan; full list in docs/scan2-2026-08-02/00-consolidated-critical-high.md.

Activity

  1. added
    type: bug
    priority: high
    on Aug 3, 2026
  2. github-actions commented on Aug 3, 2026

    @github-actions
    Contributor

    👋 Hello @Aias00

    A new issue has been opened by @Aias00:

    Please review when you have time. Thank you! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature: pluginpriority: hightype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions