Skip to content

fix(agent): sanitize surrogate characters from API responses and before API calls#5074

Closed
ygd58 wants to merge 1 commit into
NousResearch:mainfrom
ygd58:fix/surrogate-sanitization-ollama
Closed

fix(agent): sanitize surrogate characters from API responses and before API calls#5074
ygd58 wants to merge 1 commit into
NousResearch:mainfrom
ygd58:fix/surrogate-sanitization-ollama

Conversation

@ygd58

@ygd58 ygd58 commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

Fixes surrogate character crashes from Ollama models (Kimi K2.5, GLM-5, Qwen).

Fix — 3 call sites

  1. Proactive sanitization before API call
  2. Sanitize assistant response before storing
  3. Fixed retry path to use api_messages

_sanitize_surrogates() already existed — this wires it to missing call sites.

@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #10782. Your surrogate sanitization fix was cherry-picked onto current main with your authorship preserved in git log. Prevents json.dumps crashes from Ollama model output.

@teknium1 teknium1 closed this Apr 16, 2026
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