Skip to content

fix(reflector): strip thinking tags from message content before LLM p…#303

Merged
everettjf merged 2 commits intomicroclaw:mainfrom
mszzukowski:fix/reflector-think-tags
Mar 30, 2026
Merged

fix(reflector): strip thinking tags from message content before LLM p…#303
everettjf merged 2 commits intomicroclaw:mainfrom
mszzukowski:fix/reflector-think-tags

Conversation

@mszzukowski
Copy link
Copy Markdown
Contributor

Problem

The nightly reflector task was failing with JSON parse errors. Investigation showed that message content containing <thinking> tags (from extended reasoning models) was being passed directly to the LLM. The LLM's output would then contain confused/mixed XML-like structures, breaking the JSON parser.

Solution

Strip <thinking>, <notepad>, and <thought> tags from message content before including it in the LLM prompt — matching what the web UI already does for normal responses.

Changes

  • src/scheduler.rs: Apply strip_reflector_thinking_tags() to message content in reflect_for_chat()

Testing

  • Reflector task fires on schedule ✓
  • JSON parse errors in logs cease ✓

@mszzukowski mszzukowski requested a review from everettjf as a code owner March 26, 2026 10:13
@everettjf
Copy link
Copy Markdown
Contributor

Thank you :)

@everettjf everettjf merged commit e78e939 into microclaw:main Mar 30, 2026
10 checks passed
@mszzukowski mszzukowski deleted the fix/reflector-think-tags branch March 30, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants