openclaw - ✅(Solved) Fix [Bug]: [object Object][object Object]... in agents messages and in memory with mistral thinking [2 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#75268Fetched 2026-05-01 05:36:01
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
2
Author
Timeline (top)
labeled ×2commented ×1cross-referenced ×1referenced ×1

I always get results with several [object Object] in the reply with Mistral(all models), in session files and memory. This issue seems to be related to Mistral as a PROVIDER and not about the model. It was suppose to be corrected several versions ago but still persists.

The problem, I guess, is the json from of the reply from the provider Mistral, as explained in the PR 75339 I paste a screenshot and session.jsonl.

According to the documentation (https://docs.mistral.ai/studio-api/conversations/reasoning/native), Mistral's thinking mode returns structured content objects (e.g. {type: "thinking", content: "..."}) instead of strings. The JSON reply is just converted to string without any interpolation.

This is the third time I open the exact same issue for different version :

And a PR was suppose to fix it: https://github.com/openclaw/openclaw/pull/75339

Root Cause

I always get results with several [object Object] in the reply with Mistral(all models), in session files and memory. This issue seems to be related to Mistral as a PROVIDER and not about the model. It was suppose to be corrected several versions ago but still persists.

The problem, I guess, is the json from of the reply from the provider Mistral, as explained in the PR 75339 I paste a screenshot and session.jsonl.

According to the documentation (https://docs.mistral.ai/studio-api/conversations/reasoning/native), Mistral's thinking mode returns structured content objects (e.g. {type: "thinking", content: "..."}) instead of strings. The JSON reply is just converted to string without any interpolation.

This is the third time I open the exact same issue for different version :

And a PR was suppose to fix it: https://github.com/openclaw/openclaw/pull/75339

Fix Action

Fixed

PR fix notes

PR #75339: fix(agents): normalize structured delta.content blocks to prevent [object Object] in chat replies

Description (problem / solution / changelog)

Bug being fixed

Closes #75268. Same family of bug as the closed #70806.

Mistral with native reasoning enabled returns OpenAI-compatible streaming delta.content as an array of typed blocks instead of a flat string (per Mistral native reasoning docs):

{"delta": {"content": [
  {"type": "thinking", "thinking": "Let me think..."},
  {"type": "text", "text": "Here is the answer."}
]}}

The transport loop at src/agents/openai-transport-stream.ts treated delta.content as a string unconditionally:

if (choice.delta.content) {
  appendTextDelta(choice.delta.content);  // gets an array, downstream concat → "[object Object]"
}

So the array fell through to appendTextDelta and downstream string concatenation produced "[object Object]" repeating once per block in user-visible chat replies. The corruption then propagated into session transcript files and memory, matching the reporter's symptoms exactly.

Fix

Add normalizeStructuredContentDelta() that handles the three observed shapes:

ShapeExampleRouted to
string"hello"text delta (existing behavior)
array of typed blocks[{type: "thinking", ...}, {type: "text", ...}]per-block: thinking or text
single block object{type: "thinking", thinking: "..."}per-block: thinking or text

Block types thinking / reasoning / reasoning.text route to thinking deltas; anything else with a text/content/thinking string field routes to text deltas. Unrecognized objects with no string-valued field produce zero parts (no [object Object] leak).

Reused the same normalizer in the reasoning_content / reasoning / reasoning_text fallback inside getCompletionsReasoningDeltas, so non-string payloads in those fields also stop collapsing to [object Object].

Why this is the best fix

  • Right layer: the OpenAI-compatible transport is shared across all OpenAI-compatible providers, not just Mistral. The fix protects every provider that ever ships structured delta blocks (including future ones), without provider-specific compat flags.
  • Defensive by design: any object/array that doesn't yield string text is dropped silently rather than coerced. The regression test explicitly asserts [object Object] never appears in normalized parts even for unrecognized object shapes.
  • Backwards compatible: the existing string fast path is unchanged; existing 96 tests in the same file still pass.
  • Complements PR #67203: that PR (currently open) tried to extend getCompletionsReasoningDeltas to handle arrays, but it doesn't touch delta.content itself, which is the actual user-visible leak path described in #75268. This PR covers both delta.content and the reasoning_content/reasoning/reasoning_text family with one shared helper.

Test plan

  • pnpm test src/agents/openai-transport-stream.test.ts — 103/103 pass (7 new + 96 existing)
  • pnpm tsgo:core — clean
  • pnpm tsgo:core:test — clean
  • pnpm exec oxfmt --check — clean
  • 7 new regression cases cover: plain string, empty/null/undefined, mixed array, reasoning + reasoning.text block types, untyped block with content field, unrecognized objects (explicit [object Object] non-leak assertion), and skipped empty/non-string text fields.

https://github.com/openclaw/openclaw/issues/75268

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • src/agents/openai-transport-stream.test.ts (modified, +112/-0)
  • src/agents/openai-transport-stream.ts (modified, +119/-6)

Code Example

The session JSONL


{"type":"session","version":3,"id":"555e82e5-01c8-415d-9962-1063d008ae50","timestamp":"2026-05-07T07:37:25.187Z","cwd":"/Users/fredericmatray/.openclaw"}
{"type":"model_change","id":"b4b2dae1","parentId":null,"timestamp":"2026-05-07T07:37:42.753Z","provider":"mistral","modelId":"mistral-small-latest"}
{"type":"thinking_level_change","id":"c150bb12","parentId":"b4b2dae1","timestamp":"2026-05-07T07:37:42.753Z","thinkingLevel":"high"}
{"type":"custom","customType":"model-snapshot","data":{"timestamp":1778139462757,"provider":"mistral","modelApi":"openai-completions","modelId":"mistral-small-latest"},"id":"f2f83fa6","parentId":"c150bb12","timestamp":"2026-05-07T07:37:42.757Z"}
{"type":"message","id":"a2c77572","parentId":"f2f83fa6","timestamp":"2026-05-07T07:37:43.034Z","message":{"role":"user","content":[{"type":"text","text":"[Thu 2026-05-07 09:37 GMT+2] hello"}],"timestamp":1778139462760}}
{"type":"custom_message","customType":"openclaw.runtime-context","content":"Sender (untrusted metadata):\n\n{\n  \"label\": \"openclaw-control-ui\",\n  \"id\": \"openclaw-control-ui\"\n}\n","display":false,"details":{"source":"openclaw-runtime-context"},"id":"283f3347","parentId":"a2c77572","timestamp":"2026-05-07T07:37:43.035Z"}
{"type":"message","id":"93db9a38","parentId":"283f3347","timestamp":"2026-05-07T07:37:44.429Z","message":{"role":"assistant","content":[{"type":"text","text":"[object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object]NO_REPLY"}],"api":"openai-completions","provider":"mistral","model":"mistral-small-latest","usage":{"input":14910,"output":61,"cacheRead":80,"cacheWrite":0,"totalTokens":15051,"cost":{"input":0.0022364999999999998,"output":0.000036599999999999995,"cacheRead":0,"cacheWrite":0,"total":0.0022730999999999997}},"stopReason":"stop","timestamp":1778139463035,"responseId":"46f5cf6f1ce24a6692ded2fd65d36e3c"}}
{"type":"compaction","id":"20a45834","parentId":"93db9a38","timestamp":"2026-05-07T07:37:44.754Z","summary":"## Decisions\nNo prior history.\n\n## Open TODOs\nNone.\n\n## Constraints/Rules\nNone.\n\n## Pending user asks\nNone.\n\n## Exact identifiers\nNone captured.","firstKeptEntryId":"b4b2dae1","tokensBefore":15051,"fromHook":true}
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

I always get results with several [object Object] in the reply with Mistral(all models), in session files and memory. This issue seems to be related to Mistral as a PROVIDER and not about the model. It was suppose to be corrected several versions ago but still persists.

The problem, I guess, is the json from of the reply from the provider Mistral, as explained in the PR 75339 I paste a screenshot and session.jsonl.

According to the documentation (https://docs.mistral.ai/studio-api/conversations/reasoning/native), Mistral's thinking mode returns structured content objects (e.g. {type: "thinking", content: "..."}) instead of strings. The JSON reply is just converted to string without any interpolation.

This is the third time I open the exact same issue for different version :

And a PR was suppose to fix it: https://github.com/openclaw/openclaw/pull/75339

Steps to reproduce

Update openclaw 2026.5.6

  • Send a /new
  • Set up a mistral model WITH thinking (>= medium)
  • Send a "Hello"
  • You get replies WITH [object Object]

Set up a mistral model WITHOUT thinking or another provider and model (ex: ollama + gemma4)

  • Send a "Hello"
  • You get replies WITHOUT [object Object]

Expected behavior

Clean replay without [object Object]

Actual behavior

reply with leading [object Object]

OpenClaw version

2026.5.6

Operating system

macos Tahoe

Install method

nom and openclaw update

Model

Mistral Small and Large WITH thinking

Provider / routing chain

openclaw is local gateway only -> Mistral

Additional provider/model setup details

No response

Logs, screenshots, and evidence

The session JSONL


{"type":"session","version":3,"id":"555e82e5-01c8-415d-9962-1063d008ae50","timestamp":"2026-05-07T07:37:25.187Z","cwd":"/Users/fredericmatray/.openclaw"}
{"type":"model_change","id":"b4b2dae1","parentId":null,"timestamp":"2026-05-07T07:37:42.753Z","provider":"mistral","modelId":"mistral-small-latest"}
{"type":"thinking_level_change","id":"c150bb12","parentId":"b4b2dae1","timestamp":"2026-05-07T07:37:42.753Z","thinkingLevel":"high"}
{"type":"custom","customType":"model-snapshot","data":{"timestamp":1778139462757,"provider":"mistral","modelApi":"openai-completions","modelId":"mistral-small-latest"},"id":"f2f83fa6","parentId":"c150bb12","timestamp":"2026-05-07T07:37:42.757Z"}
{"type":"message","id":"a2c77572","parentId":"f2f83fa6","timestamp":"2026-05-07T07:37:43.034Z","message":{"role":"user","content":[{"type":"text","text":"[Thu 2026-05-07 09:37 GMT+2] hello"}],"timestamp":1778139462760}}
{"type":"custom_message","customType":"openclaw.runtime-context","content":"Sender (untrusted metadata):\n\n{\n  \"label\": \"openclaw-control-ui\",\n  \"id\": \"openclaw-control-ui\"\n}\n","display":false,"details":{"source":"openclaw-runtime-context"},"id":"283f3347","parentId":"a2c77572","timestamp":"2026-05-07T07:37:43.035Z"}
{"type":"message","id":"93db9a38","parentId":"283f3347","timestamp":"2026-05-07T07:37:44.429Z","message":{"role":"assistant","content":[{"type":"text","text":"[object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object][object Object]NO_REPLY"}],"api":"openai-completions","provider":"mistral","model":"mistral-small-latest","usage":{"input":14910,"output":61,"cacheRead":80,"cacheWrite":0,"totalTokens":15051,"cost":{"input":0.0022364999999999998,"output":0.000036599999999999995,"cacheRead":0,"cacheWrite":0,"total":0.0022730999999999997}},"stopReason":"stop","timestamp":1778139463035,"responseId":"46f5cf6f1ce24a6692ded2fd65d36e3c"}}
{"type":"compaction","id":"20a45834","parentId":"93db9a38","timestamp":"2026-05-07T07:37:44.754Z","summary":"## Decisions\nNo prior history.\n\n## Open TODOs\nNone.\n\n## Constraints/Rules\nNone.\n\n## Pending user asks\nNone.\n\n## Exact identifiers\nNone captured.","firstKeptEntryId":"b4b2dae1","tokensBefore":15051,"fromHook":true}

Impact and severity

Affected all channels Severity : annoying and data pollution Frequency : always with thinking Consequence : lower memory quality, extra tokens, cannot use thinking with Mistral

Additional information

<img width="1287" height="1000" alt="Image" src="https://github.com/user-attachments/assets/857c0641-d0bc-44f7-829f-fe338b438783" />

extent analysis

TL;DR

The issue with [object Object] in the reply from Mistral can be addressed by investigating the JSON format of the response and potentially modifying the parsing logic in OpenClaw.

Guidance

  • Review the Mistral documentation (https://docs.mistral.ai/studio-api/conversations/reasoning/native) to understand the expected JSON response format.
  • Verify that the OpenClaw code is correctly parsing the JSON response from Mistral, specifically when using models with thinking enabled.
  • Compare the response handling between Mistral models with and without thinking to identify potential differences in parsing or processing.
  • Consider updating OpenClaw to a newer version if available, as the issue was supposed to be corrected in a later version.

Notes

The provided information suggests that the issue is related to the JSON response from Mistral, but without access to the OpenClaw code or more detailed logs, it's difficult to provide a specific fix.

Recommendation

Apply a workaround by modifying the OpenClaw code to correctly handle the JSON response from Mistral, as updating to a fixed version is not explicitly mentioned as an option for the current version (2026.4.27).

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

Clean replay without [object Object]

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug]: [object Object][object Object]... in agents messages and in memory with mistral thinking [2 pull requests, 1 comments, 2 participants]