-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
[Bug]: Session tables corrupt Unicode keys at truncation boundaries #103001
Copy link
Copy link
Closed
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.bugSomething isn't workingSomething isn't workingclawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.User-facing flow adds avoidable confusion or support burden without fully blocking progress.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.maintainerMaintainer-authored PRMaintainer-authored PRmaturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.bugSomething isn't workingSomething isn't workingclawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:ux-frictionUser-facing flow adds avoidable confusion or support burden without fully blocking progress.User-facing flow adds avoidable confusion or support burden without fully blocking progress.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.maintainerMaintainer-authored PRMaintainer-authored PRmaturity:stableIssue affects a taxonomy feature currently scored M4/M5.Issue affects a taxonomy feature currently scored M4/M5.
Type
Fields
Priority
None yet
Bug type
Behavior bug (incorrect terminal output without a crash)
Beta release blocker
No
Summary
Long session keys can render replacement characters in
openclaw sessionsandopenclaw sessions cleanup --dry-runwhen a supplementary-plane Unicode character crosses either retained truncation boundary.Steps to reproduce
openclaw sessions --store /tmp/openclaw-sessions-utf16.json --limit all.The formatter's current operation can also be isolated directly:
Encoding that string for terminal output produces
aaaaaaaaaaaaaaa�...�zzzzz.Expected behavior
The fixed-width session key cell should retain the existing prefix/suffix layout without emitting unpaired UTF-16 surrogate halves or replacement characters.
Actual behavior
src/commands/sessions-table.tstruncates with rawslice(0, 16)andslice(-6). For the key above, those slices retain one dangling high surrogate and one dangling low surrogate, which become replacement characters in UTF-8 terminal output.OpenClaw version
Confirmed in the source for shipped tags
v2026.4.27,v2026.6.11, andv2026.7.1-beta.2, and currentmainat4f9a371c9530e9d2eb2912a44054a44228a59612.Operating system
Platform-independent Node.js string/UTF-8 terminal behavior; source reproduction run on macOS.
Install method
Source checkout; shipped-tag source verified.
Model
Not applicable. The bug occurs while formatting persisted session keys before model execution.
Provider / routing chain
Not applicable.
Logs
Impact and severity
Additional information
Both terminal entry points share
formatSessionKeyCell, so one fix at that formatter covers the normal sessions table and cleanup dry-run table. JSON session output is not truncated and is unaffected. The canonicaltruncateUtf16SafeandsliceUtf16Safehelpers already preserve the existing UTF-16-unit budgets without splitting surrogate pairs.