Repository navigation
Conversation
…e pairs chronicle.ts sliced record.body at 1000 UTF-16 units with a bare slice(), which can split an astral-plane character (emoji) in half and emit a lone surrogate / U+FFFD in the timeline summary. Use truncateUtf16Safe (the same UTF-16-safe truncation already applied to record.body in claim-card.ts, vault.ts, evidence-files.ts, and inspection.ts) so summaries never carry a dangling surrogate. Regression test covers an astral char on the boundary.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR preserves surrogate pairs when truncating Knowledge timeline summaries at 1,000 UTF-16 units. Example: A Knowledge record contains 999 x characters followed by 😀.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a concrete Unicode truncation bug still present on current main; the focused patch has no actionable findings and CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherKnowledge temporal tools pass authorized records through a shared chronicle renderer, which returns bounded summaries with dates, source references, and pagination metadata. flowchart TD
A[Knowledge temporal tools] --> B[Authorized storage read]
B --> C[Scoped record snapshot]
C --> D[Shared chronicle renderer]
D --> E[UTF16 safe summary truncation]
E --> F[Bounded paginated tool response]
Technical reviewBest possible solution: Use the existing UTF-16-safe SDK helper in the shared chronicle renderer, as this PR does. Do we have a high-confidence way to reproduce the issue? Current-main source deterministically splits the supplied boundary emoji, and obviyus's built-Gateway trace records that failure and its correction; no target code was executed during this review. Is this the best way to solve the issue? The patch is the smallest complete repair: reuse the established truncation owner, retain the existing cap, and extend an existing behavioral regression without adding machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against fcfe9a652b81. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +1, Tests 0, Docs 0. Total +1 across 3 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReviewed October 28, 2026, 8:07 AM ET / 12:07 UTC (Revision 3). |
|
🦞👀 Re-review progress:
|
Built Gateway / registered Knowledge tool proofCurrent-main baseline: Both complete builds succeeded in secretless Linux Docker on Node 24.22.1. Each built Gateway used task-owned profile/config/state and token authentication, with binary-resolved config/database paths checked before startup. A deterministic local Responses SSE fixture drove a real Gateway Each turn performed 12 registered Knowledge calls:
Observed terminal capture: The boundary summary on main contains an actual lone high surrogate Direct HTTP Regression and test budgetThe contributor's regression is consolidated into the existing full-response-budget/pagination test, using The owner-level production repair remains the contributor's existing |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in b0966db. Thanks @SunnyShu0925. Knowledge timeline summaries no longer end in a broken emoji. |
|
@obviyus Thanks! |
…e pairs (#186707) fix(knowledge): keep timeline summaries from splitting surrogate pairs knowledge_timeline cut each entry's summary at a fixed UTF-16 length. When an emoji or other astral character sat at the cut, the summary ended in a lone surrogate. Summaries now go through the existing truncateUtf16Safe owner, as claim cards and excerpts already do, and the docs list timeline summaries with them. Evidence: built Gateway agent turns with a deterministic local provider, calling the registered Knowledge publish, read and timeline tools (12 calls per build). Main returned a 1000-unit summary ending in a lone D83D (twice); with this change it returned 999 units of valid UTF-16 (twice). ASCII, short emoji and fully in-bound emoji controls behave the same on both refs. Stored bodies are unchanged, and pagination returned every entry once. Details: openclaw/openclaw#186707 (comment). Thanks @SunnyShu0925. Co-authored-by: SunnyShu <0668000539@local> Co-authored-by: Ayaan Zaidi <[email protected]>
#186986) fix(knowledge): keep remembered claim titles from splitting surrogate pairs knowledge_remember derived a stored claim title by cutting the text at 199 UTF-16 units, so an emoji or other astral character at the cut left a lone surrogate in the stored title. The title now goes through the existing truncateUtf16Safe owner, as timeline summaries do since #186707. Full claim bodies are unchanged. Evidence: real built Gateway agent turns calling knowledge_remember and knowledge_record. On main the stored title ended in a lone high surrogate at the 199-unit boundary (not well-formed, shown as a replacement character) (twice); with this change it stored 198 units plus an ellipsis, well-formed (twice), and every full claim body was kept. ASCII, intact-pair and short-Unicode controls behave the same on both refs. Details: #186986 (comment). Thanks @wangmiao0668000666. Co-authored-by: Ayaan Zaidi <[email protected]>
…e pairs (openclaw#186707) fix(knowledge): keep timeline summaries from splitting surrogate pairs knowledge_timeline cut each entry's summary at a fixed UTF-16 length. When an emoji or other astral character sat at the cut, the summary ended in a lone surrogate. Summaries now go through the existing truncateUtf16Safe owner, as claim cards and excerpts already do, and the docs list timeline summaries with them. Evidence: built Gateway agent turns with a deterministic local provider, calling the registered Knowledge publish, read and timeline tools (12 calls per build). Main returned a 1000-unit summary ending in a lone D83D (twice); with this change it returned 999 units of valid UTF-16 (twice). ASCII, short emoji and fully in-bound emoji controls behave the same on both refs. Stored bodies are unchanged, and pagination returned every entry once. Details: openclaw#186707 (comment). Thanks @SunnyShu0925. Co-authored-by: SunnyShu <0668000539@local> Co-authored-by: Ayaan Zaidi <[email protected]>
openclaw#186986) fix(knowledge): keep remembered claim titles from splitting surrogate pairs knowledge_remember derived a stored claim title by cutting the text at 199 UTF-16 units, so an emoji or other astral character at the cut left a lone surrogate in the stored title. The title now goes through the existing truncateUtf16Safe owner, as timeline summaries do since openclaw#186707. Full claim bodies are unchanged. Evidence: real built Gateway agent turns calling knowledge_remember and knowledge_record. On main the stored title ended in a lone high surrogate at the 199-unit boundary (not well-formed, shown as a replacement character) (twice); with this change it stored 198 units plus an ellipsis, well-formed (twice), and every full claim body was kept. ASCII, intact-pair and short-Unicode controls behave the same on both refs. Details: openclaw#186986 (comment). Thanks @wangmiao0668000666. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes: Knowledge timeline summaries contain a lone surrogate when an emoji or other astral character straddles the 1000-unit summary boundary.
User Impact
Timeline summaries remain valid UTF-16 instead of producing a replacement character during UTF-8 encoding. For
"x".repeat(999) + "😀", the preview stops at 999xcharacters rather than keeping half an emoji. ASCII and short-text output remain unchanged. The complete stored body is preserved.Why This Change Was Made
Keep SunnyShu0925's focused owner repair: replace the bare
slice(0, 1000)inchronicle.tswith the existing SDKtruncateUtf16Safehelper. The bound remains at most 1000 UTF-16 units; storage, indexing, dates, metadata, pagination and authority are unchanged.The added maintainer commit folds the regression into the existing Unicode response-budget/pagination fixture without dropping its original assertions, removes the duplicated standalone test and documents timeline preview behavior. Whole-PR production delta +1, test-line delta 0. No new parser, SDK surface or compatibility path was introduced.
Evidence
Built Gateway before/after terminal evidence.
Secretless Linux Docker, Node 24.22.1, complete baseline and candidate builds. A real Gateway agent turn used a deterministic local Responses fixture and the shipped
dispatch_actionroute to invoke registeredknowledge_save_page,knowledge_recordandknowledge_timelinetools. No paid provider or direct service replay.eb82abff…, twice: a published 1001-unit body (999 x + 😀) returns a 1000-unit summary ending in lone high surrogateD83D;isWellFormed()is false and normal UTF-8 encoding yields U+FFFD.x, valid UTF-16 and no replacement character. Production code is identical between compiled contributor headf55c0319…and current repair head7d95f7e9…; only tests/docs changed afterward.recorded_at/instantmetadata and stable snapshots. Both agent turns completed normally, with 12 real Knowledge tool calls each.summary.isWellFormed(); the candidate's complete chronicle suite passes 12 tests. Targeted formatting and Oxlint pass with zero warnings/errors.Direct HTTP tool-invoke setup attempts lacked a host-issued Knowledge memory audience and are not counted as proof. The successful evidence uses the normal authorized agent-tool path. No browser screenshot or real-provider inference claim is made.
Merge danger: two-way door. Reverting restores the broken preview boundary without a migration or stored-data change. Blast radius is Knowledge's shared temporal-result summary renderer; unchanged ordinary text and pagination are controlled above.