openclaw - ✅(Solved) Fix [Bug]: Duplicated number omitted in TUI [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#43828Fetched 2026-04-08 00:18:22
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
1
Author
Participants
Timeline (top)
labeled ×2commented ×1cross-referenced ×1referenced ×1

When Openclaw uses bc for calculation, the TUI output will omit duplicate number, but get normal when reopen the TUI

Root Cause

When Openclaw uses bc for calculation, the TUI output will omit duplicate number, but get normal when reopen the TUI

Fix Action

Fixed

PR fix notes

PR #43861: fix(gateway): stop deduplicating repeated characters in streaming deltas

Description (problem / solution / changelog)

Problem

When streaming text with repeated characters (e.g. 999999999999), the TUI displays only the first occurrence (e.g. 9). Reopening the TUI loads the correct result from session history.

Root Cause

appendUniqueSuffix() in src/gateway/server-chat.ts tries to detect overlapping text between the tail of accumulated text and the head of a new streaming delta. When the delta contains characters that match the end of the existing text, it incorrectly treats them as "overlap" and deduplicates:

base = "9",  suffix = "9"  → base.endsWith(suffix) → true → returns "9" (should be "99")
base = "99", suffix = "9"  → overlap "9" detected   → returns "99"  (should be "999")

This means streaming 9 * 111111111111 = 999999999999 one token at a time collapses to just "9".

Fix

Replace the overlap detection with simple concatenation. Streaming deltas from providers (OpenAI-compatible, Anthropic, etc.) are purely incremental and never overlap with previously emitted content. The overlap detection was a defensive measure that caused more harm than good.

Tests

  • 9 new unit tests for appendUniqueSuffix covering single-char, multi-char, and word-level repeated deltas
  • All 23 existing server-chat.agent-events integration tests pass
  • All 199 TUI tests pass

AI Disclosure

This PR was authored with AI assistance (OpenClaw/Claude). Changes reviewed and tested locally.

Fixes #43828

Changed files

  • src/gateway/server-chat.append-delta.test.ts (added, +56/-0)
  • src/gateway/server-chat.ts (modified, +15/-11)
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Summary

When Openclaw uses bc for calculation, the TUI output will omit duplicate number, but get normal when reopen the TUI

Steps to reproduce

  1. Install given calculator skill
  2. Open a new openclaw TUI, ask "Calculate 9*111111111111"
  3. Openclaw replies 9(Connected to Qwen3.5-27B-EXL3 bpw 4.00)
  4. Exit and reopen TUI
  5. TUI reads the session history and gives correct result "999999999999"

Expected behavior

TUI outputs correct number, not omitting anything

Actual behavior

Duplicated numbers got emitted and reopen TUI gets correct result

<img width="1679" height="895" alt="Image" src="https://github.com/user-attachments/assets/dacec011-ee49-4278-b9fd-e31276b14719" />

OpenClaw version

2026.3.8 (3caab92)

Operating system

Ubuntu 22.04.5

Install method

npm global

Model

Qwen3.5-27B-EXL3 bpw 4.00(https://huggingface.co/UnstableLlama/Qwen3.5-27B-exl3)

Provider / routing chain

openclaw->tabbyAPI->exllamav3

Config file / key location

No response

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

Fix Summary

The duplicate‑digit loss is caused by streaming the bc output with the default token limit.
When the TUI streams the model’s reply, the very long numeric string exceeds the default max_output_tokens (≈ 64) and the extra digits are silently dropped.
Re‑opening the

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

TUI outputs correct number, not omitting anything

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING