fix(memory-host): keep redacted token hints UTF-16 safe#103813
Merged
Conversation
Completes the sibling memory-host masker missed by #103341. Co-authored-by: 张贵萍0668001030 <[email protected]>
Contributor
Author
|
Land-ready proof for exact head
Known proof gaps: none. |
Contributor
Author
|
Merged via squash.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Jul 11, 2026
) Completes the sibling memory-host masker missed by openclaw#103341. Co-authored-by: 张贵萍0668001030 <[email protected]>
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.
What Problem This Solves
#103341 fixed malformed Unicode token hints in the core logger, but the independently localized memory-host error formatter retained the same raw UTF-16 slicing pattern. A secret with an emoji crossing either retained edge could therefore still produce an unpaired surrogate in memory-host errors exposed through embedding batch helpers, SQLite/QMD diagnostics, or JSON result surfaces.
Why This Change Was Made
This completes the bug-class fix at the remaining owner. Both retained memory-host hint edges now use the existing
sliceUtf16Safehelper. The memory-host format remains deliberately unchanged: six/four UTF-16-unit budgets,...as its separator, full masking for short values, and no additional disclosed characters.The regression exercises the exported memory-host engine entrypoint rather than only the private formatter. It covers both split edges, intact emoji pairs, ASCII parity, a JSON serialize/parse round trip, and absence of the original secret.
User Impact
Memory indexing and embedding error paths no longer introduce malformed Unicode while redacting long secrets. Existing ASCII hints and masking thresholds are unchanged.
Evidence
packages/memory-host-sdk/src/host/error-utils.tsstill used rawslice(0, 6)andslice(-4)after fix(logging): keep redacted token hints UTF-16 safe #103341 landed; either boundary can return a lone surrogate.git diff --check: passed.oxfmt --checkon both touched files: passed.c436e835f1b32af9aa8cabc0183f8a2ec085e2dband tree6dd00937f64dda6068efcaa524e5dc219342f440before and after proof. The memory-host negative control failed only the leading/trailing split cases while intact emoji and ASCII cases passed; the pre-fix(logging): keep redacted token hints UTF-16 safe #103341 logger failed its matching regression.node --import tsxprobe exercised the exported memory-host entrypoint and production logger through a JSON round trip; both strings were well-formed, the raw token was absent, and each surface retained its existing.../…separator.check:changedpassed forcoreandcoreTests, including production/test typechecks, lint with zero findings, import-cycle analysis, and repository guards.Follow-up credit is preserved from #103341: co-authored with @zhangguiping-xydt.