Skip to content

[Bug] amazon-bedrock-openai / openai-responses: streaming emits multiple incremental final_answer phases, causing duplicate channel messages #89531

Description

@pigfoot

Bug Description

The amazon-bedrock-openai provider with api: openai-responses produces multiple incremental phase:"final_answer" text blocks within a single assistant response. Each incremental block is delivered as a separate visible message to downstream channels (Telegram, Discord), resulting in 4–5 progressively-longer duplicate messages for the same user turn.

Repro Evidence

Session history shows a single assistant response containing 4 final_answer text blocks for one user turn (image + calendar request):

# phase Text (truncated)
1 final_answer partial address
2 final_answer partial address + restaurant
3 final_answer partial address + restaurant + street numbers
4 final_answer full address + times + notes

A second turn (calendar event creation) showed 5 incremental final_answer blocks for the same response.

Trajectory event confirms the route:

  • Provider: amazon-bedrock-openai
  • Model: openai.gpt-5.5
  • API: openai-responses

Affected Channels

  • Telegram DM (direct) — 4–5 duplicate messages for a single user turn
  • Discord channel session — 4 duplicate repo-review messages for a single assistant response

Affected Route

  • amazon-bedrock-openai/openai.gpt-5.5
  • API: openai-responses
  • Bedrock Mantle endpoint shape: https://bedrock-mantle.*.api.aws/openai/v1 (redacted)

Hypothesis

The openai-responses streaming adapter/parser for amazon-bedrock-openai treats Bedrock Responses streaming incremental/cumulative snapshots as distinct final-text events, rather than deduplicating or delta-appending to a single final output. This causes the transport layer to emit multiple final_answer phases.

Root-Cause Update (2026-06-03)

Direct curl -N to Bedrock Mantle /openai/v1/responses with stream: true shows only one phase: "final_answer" in the raw SSE stream. The Bedrock Mantle streaming format is correct; the duplicate final_answer phases are produced inside the OpenClaw openai-responses streaming adapter.

See comment below for raw SSE evidence.

Expected Behavior

One final_answer text block per assistant response, containing the complete final text.

Actual Behavior

3–5 incremental final_answer blocks per assistant response, each delivered as a separate channel message.

Not a Duplicate Of

Environment / Version

  • OpenClaw observed on runtime circa 2026-06-02
  • Gateway model: amazon-bedrock-openai/openai.gpt-5.5
  • API: openai-responses
  • Channel streaming modes already set to off (not channel-level issue)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions