Skip to content

[Bug]: [5.3 regression] lossless-claw: duplicate answers + "missing tool result in session history" synthetic errors #77642

Closed as not planned

Description

@momokeyes

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Bug Description

After upgrading to OpenClaw 5.2 (persists in 5.3.1), there are two related issues:

Issue 1: Duplicate answers

When the user asks a follow-up question, my answer to the new question also contains a repeat of the previous answer. For example:

  • User asks: "What's the weather today?"
  • I answer: "It's sunny today, 25°C."
  • User asks: "And tomorrow?"
  • I answer: "It's sunny today, 25°C. Tomorrow it will be cloudy, 23°C."

The previous answer is repeated within the current answer, as part of the same message.

Issue 2: "missing tool result in session history" synthetic error

Every command executed in the session produces this error in the gateway logs:

Steps to reproduce

The LCM falls back to live context instead of using compacted summaries on every turn.

Impact

  1. Answers are noisy and repetitive due to the duplicate content
  2. Session transcript is polluted with synthetic error records on every tool use

Expected Behavior

  • Each answer should only contain the answer to the current question, not repeat previous answers
  • No synthetic error records should be inserted into the transcript

Notes

  • Before upgrading to 5.2, this issue did not occur
  • FreshTailCount tuning (32→64) was tried as a mitigation but did not fully resolve the issue
  • The issue appears related to how lossless-claw interacts with OpenClaw 5.2/5.3's session transcript handling

Expected behavior

The LCM falls back to live context instead of using compacted summaries on every turn.

Impact

  1. Answers are noisy and repetitive due to the duplicate content
  2. Session transcript is polluted with synthetic error records on every tool use

Expected Behavior

  • Each answer should only contain the answer to the current question, not repeat previous answers
  • No synthetic error records should be inserted into the transcript

Notes

  • Before upgrading to 5.2, this issue did not occur
  • FreshTailCount tuning (32→64) was tried as a mitigation but did not fully resolve the issue
  • The issue appears related to how lossless-claw interacts with OpenClaw 5.2/5.3's session transcript handling

Actual behavior

Environment

  • OpenClaw version: 5.3.1 (upgraded from 5.2)
  • Plugin: lossless-claw (enabled)
  • Channel: Telegram
  • Model: minimax-cn/MiniMax-M2.7-highspeed

Logs

Relevant gateway log excerpt:

OpenClaw version

2026.5.3-1

Operating system

macos15.4

Install method

No response

Model

minimax 2.7-highspeed

Provider / routing chain

minimax- telegram

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

Activity

  1. clawsweeper commented on May 5, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 29, 2026, 2:29 AM ET / 06:29 UTC.

    Summary
    Keep open: current main has useful adjacent repairs, but the reported Telegram duplicate-answer plus synthetic missing-tool-result path is not proven fixed, and current source still has the strict-provider synthetic repair and user-visible tool-result delivery surfaces.

    Reproducibility: no. high-confidence live current-main reproduction was run; source inspection still shows the synthetic repair and visible tool-result delivery paths needed for the reported failure class.

    Ways to help us reproduce this

    • Add a screenshot or short recording showing the behavior.
    • Add expected vs actual behavior.

    Next step
    The remaining work spans provider replay contracts, transcript repair policy, flush timing, and Telegram delivery proof, so a new automated fix PR is not safe yet.

    Review details

    Best possible solution:

    Keep this open until maintainers decide the synthetic-repair visibility policy and land validated narrow fixes with live Telegram/provider proof.

    Do we have a high-confidence way to reproduce the issue?

    No high-confidence live current-main reproduction was run; source inspection still shows the synthetic repair and visible tool-result delivery paths needed for the reported failure class.

    Is this the best way to solve the issue?

    Keeping the issue open for maintainer review is best because current merged work is only partial and open related fixes still need proof and policy decisions.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • No live current-main Telegram/provider reproduction or before/after proof establishes whether the original duplicate-answer path still fires.
    • Merged repairs cover OpenAI Responses message-tool mirror poison and transcript dedupe, but not the whole MiniMax/OpenRouter-style Telegram surface reported here.
    • Changing synthetic repair persistence or visibility is compatibility-sensitive because strict providers still need paired tool results while channels should not expose internal repair text.

    Codex review notes: model internal, reasoning high; reviewed against 18f0eeab20e9.

    Label changes

    Label justifications:

    • P1: The issue reports a regression that can pollute active sessions and duplicate Telegram-visible answers during real agent workflows.
    • impact:session-state: The core failure involves missing tool-result repair, transcript pollution, and stale context being carried into later turns.
    • impact:message-loss: The user-visible symptom is duplicated or stale Telegram replies instead of one correct current response.
    Evidence reviewed

    Acceptance criteria:

    • Run a live Telegram repro on current main with the reported strict-provider route or a close equivalent.
    • Add focused regression coverage proving synthetic missing-tool-result repairs are not delivered as normal visible tool output.
    • Validate strict non-OpenAI Responses replay behavior separately from OpenAI Responses aborted repair behavior.

    What I checked:

    • Live issue state and discussion: The issue is still open, has multiple affected-user confirmations for Telegram/MiniMax/OpenRouter-style duplication, and the latest ClawSweeper comment also kept it open for missing live current-main proof.
    • Strict provider replay can still synthesize No result provided: Current transport replay still enables synthetic tool results for strict APIs and uses No result provided for non-OpenAI-Responses strict APIs before shared pairing repair. (src/agents/transport-message-transform.ts:65, 18f0eeab20e9)
    • Transcript repair still inserts synthetic missing-result records: Current transcript repair still defines the reported synthetic marker and creates synthetic error tool results when no real matching result is found. (src/agents/session-transcript-repair.ts:185, 18f0eeab20e9)
    • Session guard still flushes pending calls as synthetic results: The pending tool-result guard defaults allowSyntheticToolResults to true and flushes pending tool calls by appending synthetic missing results. (src/agents/session-tool-result-guard.ts:642, 18f0eeab20e9)
    • Visible tool-result delivery path remains present: Verbose/full tool-result output can call onToolResult, and auto-reply dispatch can forward the resolved payload through dispatcher.sendToolResult. (src/auto-reply/reply/dispatch-from-config.ts:3197, 18f0eeab20e9)
    • Merged repair is partial and scoped: Merged PR fix(agents): recover message-tool mirror replay poison #84708 repairs an OpenAI Responses message-tool delivery-mirror replay poison shape, but its body and touched code scope do not prove the original Telegram MiniMax/OpenRouter duplicate-answer path fixed. (src/agents/session-file-repair.ts:574, e90fb676414a)

    Likely related people:

    • anyech: Authored merged PR fix(agents): recover message-tool mirror replay poison #84708, which added the current OpenAI Responses message-tool mirror replay repair that partially overlaps this issue. (role: recent adjacent fix author; confidence: high; commits: e90fb676414a; files: src/agents/session-file-repair.ts, src/agents/embedded-agent-runner/replay-history.ts, src/auto-reply/reply/provider-request-error-classifier.ts)
    • Jerry-Xin: Authored merged PR fix(session): prefer real tool result over synthetic error in transcript repair #84419, which changed transcript repair to prefer real tool results over synthetic missing-result placeholders. (role: mitigation author; confidence: high; commits: 56362524ed13; files: src/agents/session-transcript-repair.ts, src/agents/session-transcript-repair.test.ts)
    • Peter Steinberger: Git history shows repeated central work on transcript repair and session tool-result guard invariants. (role: historical transcript and tool-result repair contributor; confidence: medium; commits: 848f154f3e, ee03ade0d6, 0c278bb93c; files: src/agents/session-transcript-repair.ts, src/agents/session-tool-result-guard.ts)
    • Vincent Koc: Git history ties this person to the strict-provider transport replay surface where provider-dependent synthetic result text remains. (role: recent transport and provider replay contributor; confidence: medium; commits: ea4265a820, aa69b12d00; files: src/agents/transport-message-transform.ts)
    • xydt-tanshanshan: Opened PR fix(session): defer flushPendingToolResults by one event-loop tick #97646 against the flush timing race that can leave synthetic tool results in session history before real results arrive. (role: active related PR author; confidence: medium; files: src/agents/embedded-agent-runner/wait-for-idle-before-flush.ts, src/agents/session-tool-result-guard.test.ts)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  2. 100yenadmin commented on May 6, 2026

    @100yenadmin
    Contributor

    Additional sanitized source-trace for the No result provided / duplicate tool-result echo variant:

    • Current main still has an exact "No result provided" generator in src/agents/transport-message-transform.ts: syntheticToolResultText is "No result provided" for strict non-Codex replay APIs, and repairToolUseResultPairing(..., { missingToolResultText: syntheticToolResultText }) can synthesize a toolResult when an assistant tool call has no matching result before the next assistant/user turn.
    • The same file now uses "aborted" for OpenAI Responses-family APIs (openai-responses, openai-codex-responses, Azure/OpenClaw variants), so this is not the old OpenAI-compatible regression from [Bug]: exec tool returns "No result provided" starting in 2026.4.14 #67896 unless a plugin/provider override routes Codex through the non-Codex strict path.
    • There is a second, separate synthetic-repair path in src/agents/session-transcript-repair.ts / src/agents/session-tool-result-guard.ts: missing tool results become [openclaw] missing tool result in session history; inserted synthetic error result for transcript repair. when allowSyntheticToolResults is enabled by resolveTranscriptPolicy().
    • User-visible surfacing appears to happen through the auto-reply tool-result delivery path, not directly from transcript repair: src/agents/pi-embedded-subscribe.ts emits tool summaries/results when verbose is on/full; src/auto-reply/reply/agent-runner-execution.ts forwards those via onToolResult; src/auto-reply/reply/dispatch-from-config.ts then sends them through dispatcher.sendToolResult(...). This path is independent of final assistant text and can make internal/synthetic tool result material visible to Telegram/web/etc.
    • Duplication risk: tool start summaries are guarded per toolCallId, but tool-result output delivery on result events is not obviously de-duped. If replay/compaction/retry re-emits the same result or synthetic result after an LCM smoke/repair turn, the same empty/synthetic tool result can be sent more than once to the channel.

    Suggested regression coverage:

    1. transport-message-transform fixture: assistant tool call with missing result before a user turn, for OpenAI Responses/Codex vs Anthropic/Gemini strict APIs. Assert Codex does not produce user-visible No result provided, and strict non-Codex behavior is intentional/documented or hidden from user channels.
    2. Auto-reply fixture with verbose tool summaries enabled: synthesized missing tool results must be model-visible/transcript-visible only and must not call onToolResult / dispatcher.sendToolResult as a normal user-visible payload.
    3. Duplicate result fixture: emit the same toolCallId result twice across retry/compaction replay and assert at most one user-visible tool-result message is delivered.

    Relation to #78055: this is adjacent but distinct. #78055 is stale subagent_announce inter-session delivery/history inheritance. This path is ordinary tool-result materialization and verbose/channel delivery after tool calls.

    Sanitization: no session JSONL, user IDs, message bodies, or local private tool output included; only public source file names and behavior.

  3. AiD-teng commented on May 8, 2026

    @AiD-teng

    Same issue here. I think this is a very big problem that prevented OpenClaw from working. I can tolerate some performance issues, but I can't stand this – the agent becomes so dumb that I rolled back.

    Channel: Telegram
    I thought the Lossless Claw plugin caused the problem, but it still happens after I uninstalled it.

  4. baghvn commented on May 20, 2026

    @baghvn
    Contributor

    Confirming this regression on OpenClaw 2026.5.18 with lossless-claw enabled. Surface: Telegram. Model: anthropic/claude-opus-4.7 via OpenRouter passthrough. Symptom: occasional full-message duplication — the assistant's reply arrives twice in the channel with identical content. Using default lossless-claw tuning (no FreshTailCount override). Happy to provide more diagnostic details if useful.

  5. openclaw-barnacle commented on Jun 4, 2026

    @openclaw-barnacle

    This issue has been automatically marked as stale due to inactivity.
    Please add updates or it will be closed.

  6. added
    P1High-priority user-facing bug, regression, or broken workflow.
    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: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    on Jun 4, 2026
  7. openclaw-barnacle commented on Jul 14, 2026

    @openclaw-barnacle

    This issue has been automatically marked as stale due to inactivity.
    Please add updates or it will be closed.

  8. openclaw-barnacle commented on Jul 21, 2026

    @openclaw-barnacle

    Closing due to inactivity.
    If this is still an issue, please retry on the latest OpenClaw release and share updated details.
    If you are absolutely sure it still happens on the latest release, open a new issue with fresh steps to reproduce.

  9. locked as resolved and limited conversation to collaborators on Sep 15, 2026
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

    P1High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingclawsweeper: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:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.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.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.regressionBehavior that previously worked and now failsstaleMarked as stale due to inactivity

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions