Repository navigation
fix(client): Join split surrogate pairs when encoding task parameters - #835
Merged
enochtangg merged 1 commit intoOct 29, 2026
Merged
Conversation
A Python string can hold an emoji as two separate surrogate code points (for example after `ast.literal_eval` on escaped text). msgpack encodes strings as strict UTF-8, so `create_activation` raised `UnicodeEncodeError` and the caller's task failed. When msgpack raises `UnicodeEncodeError`, join the pairs back into one character and retry. Lone halves can't be rebuilt, so they become U+FFFD. The retry only runs after the error, so normal tasks are unchanged. Each retry increments `taskworker.producer.surrogates_repaired`. Refs STREAM-1999 Co-Authored-By: Claude <noreply@anthropic.com>
untitaker
approved these changes
Oct 28, 2026
enochtangg
deleted the
enochtang/stream-1999-handle-split-emoji-in-task-params
branch
October 29, 2026 17:00
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
create_activationfails withUnicodeEncodeErrorwhen a string argument holds an emoji as two separate surrogate characters instead of one. This change catches that error, joins the pairs back into one character, and retries.Python allows a string like
"hi " + chr(0xD83D) + chr(0xDE00), for example afterast.literal_evalon escaped text. That isn't valid UTF-8, and msgpack encodes strings as strict UTF-8, so the producer raises before the task is sent. This caused SENTRY-5SB5 which caused theprocess_segmenttask to failChange:
"hi " + chr(0xD83D) + chr(0xDE00)becomes"hi 😀")packbraises, so normal tasks encode exactly as before.taskworker.producer.surrogates_repaired, tagged with namespace, taskname, and topic.Refs STREAM-1999