fix(telegram): keep DM topic auto-rename user message UTF-16 safe#101781
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 9, 2026, 1:41 AM ET / 05:41 UTC. Summary PR surface: Source +1, Tests +28. Total +29 across 2 files. Reproducibility: yes. for source-level reproduction: current main raw-slices first-turn DM-topic label input at 500 UTF-16 code units, so a boundary emoji can leave a dangling surrogate. I did not establish a live Telegram topic reproduction in this read-only review. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Land the helper replacement after redacted live Telegram proof, equivalent runtime logs, or an explicit maintainer proof override confirms the first-turn emoji-boundary DM-topic rename succeeds. Do we have a high-confidence way to reproduce the issue? Yes for source-level reproduction: current main raw-slices first-turn DM-topic label input at 500 UTF-16 code units, so a boundary emoji can leave a dangling surrogate. I did not establish a live Telegram topic reproduction in this read-only review. Is this the best way to solve the issue? Yes, pending proof. Reusing the shared AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against cc961001f3c5. Label changesLabel justifications:
Evidence reviewedPR surface: Source +1, Tests +28. Total +29 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (7 earlier review cycles)
|
8242fbf to
96c56bd
Compare
|
Squashed to a single commit and rebased on latest Test run @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
Add surrogate-boundary regression for auto-topic label input truncation. Co-authored-by: Cursor <[email protected]>
96c56bd to
f0649f7
Compare
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Land-ready review completed at exact head What I verified:
Live-proof gap: I attempted the repository's real-user Telegram Crabbox harness. It stopped before leasing credentials or creating a box because the configured Convex burner credential file is absent. The current harness also creates an ordinary burner user/group and cannot force the Telegram Business DM-topic update branch. No personal account was used, and I am not claiming live behavior proof. |
|
Merged via squash.
|
…enclaw#101781) * fix(telegram): keep DM topic auto-rename user message UTF-16 safe Add surrogate-boundary regression for auto-topic label input truncation. Co-authored-by: Cursor <[email protected]> * test(telegram): tighten topic label boundary proof --------- Co-authored-by: NIO <[email protected]> Co-authored-by: Cursor <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Telegram DM-topic auto-labeling caps the first user message at 500 UTF-16 code units before sending it to the label model. A raw
slice(0, 500)can stop after the high surrogate of an astral character and make OpenClaw pass malformed text into topic-label generation.Why This Change Was Made
The Telegram-owned boundary now uses the existing
truncateUtf16Safehelper fromopenclaw/plugin-sdk/text-utility-runtime. The 500-unit cap, raw-body preference, first-turn condition, configuration resolution, fire-and-forget behavior, and Telegram topic edit remain unchanged.User Impact
A long first message in a Telegram DM topic no longer acquires a surrogate half when an emoji crosses the auto-label input boundary. Short messages and messages not crossing an astral-character boundary remain unchanged.
Evidence
dispatchTelegramMessageregression places an emoji's high surrogate exactly at code-unit index 499 and asserts thatgenerateTopicLabelreceives the exact 499-character prefix.bot-message-dispatch.test.tsshard passed, 172/172.git diff --check: passed.Live proof status
The required real-user Telegram harness was attempted. It stopped before leasing a credential or creating a Crabbox because the configured Convex burner credential file was absent and no environment override was available. The current harness also exercises an ordinary burner user/group, not a Telegram Business DM-topic update, so it cannot directly force this owner branch. No personal account was used and no live-behavior claim is made.