openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

AI repeats every Chinese response twice when asked to answer in Chinese

Open tiedan126 opened this issue 6 months ago • 4 comments

Issue Description When I ask OpenHuman to respond in Chinese, the AI outputs every sentence or paragraph twice (duplicated). This significantly affects the reading experience and makes conversations inefficient.

Steps to Reproduce

Start a conversation with OpenHuman (local core mode).

Ask a question in Chinese, or explicitly request: “请用中文回答” (Please answer in Chinese).

Observe the AI’s reply.

Expected Behavior The AI should respond once in fluent, natural Chinese.

Actual Behavior The entire response is repeated verbatim. For example, if the AI should say “你好,我是OpenHuman”,it outputs “你好,我是OpenHuman 你好,我是OpenHuman”.

Screenshots / Logs (optional) (You can attach a screenshot or copy a conversation snippet if needed.)

Environment (please complete the following information):

OS: [e.g. Windows 11, macOS Sequoia]

OpenHuman version: [e.g. latest as of 2026-05-14]

Deployment mode: Local (embedded core)

Connected providers: Gmail (optional)

Language settings: Default, but occurs only when Chinese is used

Additional Context

The issue does not occur when the AI answers in English – only when replying in Chinese.

It might be related to the token handling or the response formatting pipeline for CJK languages.

I am using the default local model (or please specify if you are using a specific LLM like Ollama, GPT, etc.). In my case: [e.g. local Ollama with qwen2.5, or default OpenHuman cloud model] – you can fill in your actual backend model.

Possible Hypothesis The duplication could be caused by the TokenJuice compression or the memory tree’s output generation step accidentally appending the same response twice when processing Unicode (Chinese) characters.

Thank you for looking into this!

tiedan126 avatar May 13 '26 18:05 tiedan126

@CursorAgent use the Cursor Cloud environment for tinyhumansai/openhuman.

Work issue #1675. Expected path: /workspace/openhuman. Start from latest origin/main. Create branch cursor/1675-ai-repeats-every-chinese-response-twice-when-asked. Lane: rust-core/agent. Owned paths: src/openhuman/agent/. Do not edit any file outside those subtrees. Follow docs/agent-workflows/cursor-cloud-agents.md exactly. Do not open duplicate PRs. If validation is blocked, report the exact command and error in the PR body and on this issue.

CodeGhost21 avatar May 14 '26 12:05 CodeGhost21

Unable to authenticate your request. Please make sure to connect your GitHub account to Cursor. Go to Cursor

cursor[bot] avatar May 14 '26 12:05 cursor[bot]

Thanks for the detailed report. This turned out to be a real bug that has already been fixed — the timing just missed you by about an hour and a half.

Root cause: the verbatim duplication came from the frontend segment-reconcile path in app/src/providers/ChatRuntimeProvider.tsx. The old code decided a multi-segment reply was "complete" by comparing the empty-string-joined segments against the raw full_response (reconstructed === event.full_response). The core trims each segment and joins delivered bubbles with \n\n, while chat_done.full_response carries the raw model text, so that equality essentially never held on a multi-segment turn. When it failed, the handler re-appended the entire full_response on top of the per-segment bubbles already shown — rendering the whole answer twice. CJK replies hit this far more often because a short Chinese reply is long enough (in UTF-8 bytes) to be split into multiple segments where the English equivalent is not.

Fixed by #1648 ("fix(chat): stop duplicating assistant replies on multi-segment turns", merged 2026-05-13 15:17 UTC), which replaced the fragile string-equality check with index-set completeness (all expected segment indices received ⇒ complete, no re-append).

Why you saw it: this issue was filed 2026-05-13 18:34 UTC. The newest downloadable release at that moment was v0.53.40 (published 13:44 UTC), which does not contain #1648. The fix first shipped in v0.53.43 (published 20:10 UTC) — about 1h36m after you filed. So your build genuinely had the bug; current releases do not.

Action: please update to the latest release (v0.54.0, or any v0.53.43+) and the duplicate Chinese responses should be gone. I've verified the duplication path no longer exists on main.

Closing as already-resolved — please reopen with your version string if you still see this on v0.53.43 or newer.

sanil-23 avatar May 19 '26 18:05 sanil-23

Resolved by #1648 (shipped v0.53.43); reporter's build (v0.53.40) predated the fix. See comment above.

sanil-23 avatar May 19 '26 18:05 sanil-23