Skip to content

fix(telegram): preserve UTF-16 model labels - #104037

Merged
steipete merged 1 commit into
mainfrom
codex/fix-telegram-model-label-utf16
Jul 11, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/fix-telegram-model-label-utf16

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Telegram's model picker preserves the tail of model button labels by slicing at 38 UTF-16 code units. When that suffix boundary falls between an emoji's surrogate halves, the button text contains an unpaired surrogate and renders as a replacement character.

This affects both fallback model IDs and configured model display names. The open callback-data PRs #98230 and #98694 change model selection encoding, but do not repair this independent label-rendering boundary.

Why This Change Was Made

Use the existing public sliceUtf16Safe plugin SDK helper for the suffix operation, while retaining the existing 38-code-unit display budget and tail-preserving behavior. Rename the local helper around its actual input, centralize the label limit, and cover both label sources.

User Impact

Long Telegram model labels no longer contain a broken replacement character when truncation lands inside an emoji. Short labels and the existing ellipsis-plus-suffix presentation remain unchanged.

Evidence

  • Blacksmith Testbox tbx_01kx7a49qv2xqp9yt3dbrt1mmh: pnpm test extensions/telegram/src/model-buttons.test.ts — 27/27 tests passed.
  • Same Testbox: path-scoped check:changed for both touched files — extension production/test type checks, lint, import-cycle checks, and repository guards passed.
  • git diff --check passed.
  • Fresh autoreview: no actionable findings; correctness confidence 0.98.
  • Regression coverage verifies both a raw model ID and a configured display name whose old suffix started on a low surrogate.

The path-scoped check emitted only the unrelated warning-only temporary-directory migration report already present on current main.

@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram size: XS maintainer Maintainer-authored PR labels Jul 11, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for exact head 70513039f3081e1d18d5781ed6d70bc3f06b277f:

  • GitHub Actions run 29134589017 completed successfully for this exact SHA.
  • Blacksmith Testbox tbx_01kx7a49qv2xqp9yt3dbrt1mmh: all 27 focused Telegram model-button tests passed.
  • The same Testbox passed the path-scoped extension production/test type checks, lint, import-cycle checks, and repository guards for both touched files. Its only warning was the unrelated temporary-directory migration report already present on current main.
  • Fresh autoreview completed with no actionable findings (correctness confidence 0.98).
  • Native review artifacts validated with zero findings; OPENCLAW_TESTBOX=1 scripts/pr prepare-run 104037 passed and verified the exact PR head.

The fix reuses the existing public UTF-16-safe SDK primitive, removes the raw suffix slice, and covers both fallback model IDs and configured display names.

@steipete
steipete merged commit 7ac8e2e into main Jul 11, 2026
112 of 115 checks passed
@steipete
steipete deleted the codex/fix-telegram-model-label-utf16 branch July 11, 2026 01:32
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant