Repository navigation
fix: measure redacted file content with lone surrogates - #893
Open
bandzalkin wants to merge 1 commit into
Open
bandzalkin wants to merge 1 commit into
bandzalkin wants to merge 1 commit into
Conversation
A lone surrogate in band_send_room_file's content made the redactor's byte count raise UnicodeEncodeError, dropping the whole tool_call event. Encode with surrogatepass so the placeholder is measured and emitted.
This was referenced Oct 21, 2026
bandzalkin
added a commit
to bandzalkin/band-sdk-python
that referenced
this pull request
Oct 21, 2026
Source-Base: 490e2d7 Source-Head: 5fb4a4a Upstream-PR: band-ai#893
bandzalkin
added a commit
to bandzalkin/band-sdk-python
that referenced
this pull request
Oct 21, 2026
Source-Base: 490e2d7 Source-Head: 5fb4a4a Upstream-PR: band-ai#893
github-actions Bot
pushed a commit
to bandzalkin/band-sdk-python
that referenced
this pull request
Oct 21, 2026
Source-Base: 490e2d7 Source-Head: 5fb4a4a Upstream-PR: band-ai#893
github-actions Bot
pushed a commit
to bandzalkin/band-sdk-python
that referenced
this pull request
Oct 21, 2026
Source-Base: 490e2d7 Source-Head: 5fb4a4a Upstream-PR: band-ai#893
github-actions Bot
pushed a commit
to bandzalkin/band-sdk-python
that referenced
this pull request
Oct 21, 2026
Source-Base: 490e2d7 Source-Head: 5fb4a4a Upstream-PR: band-ai#893
bandzalkin
marked this pull request as ready for review
October 22, 2026 01:54
bandzalkin
requested review from
AlexanderZ-Band and
amit-gazal-band
as code owners
October 22, 2026 01:54
github-actions Bot
pushed a commit
to bandzalkin/band-sdk-python
that referenced
this pull request
Oct 22, 2026
Source-Base: 490e2d7 Source-Head: 5fb4a4a Upstream-PR: band-ai#893
This branch has not been deployed
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.
Why
redact_tool_call_argsmeasuresband_send_room_filecontent withlen(content.encode("utf-8")). A lone surrogate in that string (half of a UTF-16 pair, a byte-ish blob decoded leniently) makes the encode raiseUnicodeEncodeErrorinside the redactor, so the wholetool_callevent is lost instead of being redacted.What
Measure with
errors="surrogatepass"so the placeholder is computed for anystr. The regression test fails onmainwithUnicodeEncodeErrorand passes with the fix.Scope
One shared runtime function; no adapter behavior changes beyond the event now being emitted. Carved out of #763.