Skip to content

Bedrock Mantle (openai-responses) cumulatively duplicates reply text with reasoning enabled (GPT-5.x) #91959

Description

@phoenixyy

Summary

When using a Bedrock Mantle model through the openai-responses API with reasoning/thinking enabled, the assistant's reply text is cumulatively duplicated: the final visible text contains the same answer repeated many times, each repetition a progressively longer prefix-superset of the previous one. Short replies are usually fine; the bug shows up on longer / structured answers and is dramatically amplified by reasoning.

This appears to live in the core OpenAI-Responses stream consumer, not in a specific provider plugin (reproduced with two different models routed through the same openai-responses path).

Environment

  • OpenClaw 2026.6.5
  • Provider: amazon-bedrock-mantle (@openclaw/[email protected])
  • Provider API: openai-responses
  • Models tested: openai.gpt-5.5, openai.gpt-5.4 (both via Mantle)

Reproduction

Run one agent turn that elicits a longer, structured answer, with reasoning on:

OPENCLAW_STATE_DIR=<state-dir> openclaw agent --local \
  --model amazon-bedrock-mantle/openai.gpt-5.5 \
  --thinking high --json \
  -m "Explain the Transformer self-attention mechanism in detail: Q/K/V, scaled dot-product attention, multi-head, positional encoding (incl. RoPE), and training-stability tricks. ~1500+ words, structured."

Then inspect meta.finalAssistantVisibleText: measure its length and count how many times the first ~60 characters of the answer occur.

Observed results (same prompt unless noted)

Model Thinking Visible length Opening phrase occurrences Notes
gpt-5.5 high 230,823 chars 49× replayInvalid=false
gpt-5.5 low 432,619 chars 80× worse than high
gpt-5.5 off (explicit --thinking off) ~7.5 KB clean
gpt-5.4 high (short answer) cumulative snapshots, replayInvalid=true

The duplicated segments are clearly cumulative: e.g. snapshot 1 ends mid-sentence, snapshot 2 repeats from the start and ends slightly later, etc. — i.e. each is a prefix-superset of the prior, consistent with multiple response.output_item.done (type message) events each carrying a from-the-start snapshot being concatenated downstream rather than de-duplicated to the final item.

Reasoning-off is not a complete workaround

Setting the model entry to reasoning: false (or passing explicit --thinking off) greatly reduces the problem, but does not fully eliminate it:

  • Simple Q&A → clean (1×)
  • Multi-section / structured output (e.g. "rewrite this in 3 styles + translate") → still intermittently (first a partial snapshot, then the full text)

So the frequency/severity scales with answer length and structure; reasoning amplifies it but is not the sole trigger.

Notable

  • Setting agent-level thinkingDefault: "off" is not sufficient when the model entry has reasoning: true — the run still duplicated (observed 5×). Only the model entry reasoning: false, or an explicit --thinking off, reliably suppressed reasoning.
  • This is independent of the specific model (both GPT-5.5 and GPT-5.4 via Mantle reproduce it) and independent of reasoning level (low was actually worse than high), which points to the shared openai-responses stream-consumption path rather than the model or the Mantle plugin.

Expected behavior

The final assistant text should contain the answer exactly once. The Responses stream consumer should treat successive response.output_item.done (type message) events as cumulative snapshots of the same item (replace/last-wins) rather than concatenating them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions