Skip to content

fix(discord): keep thread title prompts UTF-16 safe#101551

Merged
steipete merged 1 commit into
mainfrom
codex/utf16-discord-thread-title
Jul 7, 2026
Merged

fix(discord): keep thread title prompts UTF-16 safe#101551
steipete merged 1 commit into
mainfrom
codex/utf16-discord-thread-title

Conversation

@steipete

@steipete steipete commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Related: #101307

What Problem This Solves

Fixes an issue where Discord users generating automatic thread titles could send malformed prompt text when a message, channel name, or channel description hit its character cap in the middle of an emoji.

Why This Change Was Made

All three bounded prompt fields now use OpenClaw's shared UTF-16-safe truncation helper. The formatter remains private, and the regression exercises the actual title-generation completion path rather than adding a test-only production export.

The original contributor branch became ancestry-corrupted and could not be rewritten through GitHub's maintainer-edit path, so this clean maintainer branch preserves the contributor's authorship via Co-authored-by.

User Impact

Discord thread-title generation keeps the same limits and ellipsis behavior while avoiding dangling UTF-16 surrogate halves in model prompts.

Evidence

  • Regression drives generateThreadTitle with split-surrogate boundaries in message text, channel name, and channel description, then inspects the real completion prompt.
  • Fresh Codex autoreview: clean, correctness 0.86.
  • Canonical oxfmt --check for both touched files: passed.
  • git diff --check: passed.
  • Fresh exact-head hosted CI will be required before landing.

@steipete steipete self-assigned this Jul 7, 2026
@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord size: S maintainer Maintainer-authored PR labels Jul 7, 2026
@steipete

steipete commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready review complete at exact head e1c37294a4e17ffc40b6b033ff3cbfbe99291603.

  • Rebuilt the corrupted fix(discord): keep thread title truncation UTF-16 safe #101307 change as a clean two-file PR while preserving @Alix-007's authorship via Co-authored-by.
  • Applied the shared UTF-16-safe truncation helper to message text, channel name, and channel description in the actual Discord thread-title prompt path.
  • Replaced duplicate helper-only coverage with a caller-path regression that inspects the completion payload.
  • Fresh Codex autoreview: clean, correctness 0.86.
  • Canonical oxfmt and git diff --check: pass.
  • Exact-head hosted CI: 63 relevant checks passed, 0 failed/pending.
  • Native scripts/pr review-validate-artifacts and OPENCLAW_TESTBOX=1 scripts/pr prepare-run 101551: pass.

@steipete
steipete merged commit 9fb2403 into main Jul 7, 2026
116 of 118 checks passed
@steipete
steipete deleted the codex/utf16-discord-thread-title branch July 7, 2026 10:17
@steipete

steipete commented Jul 7, 2026

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: discord Channel integration: discord maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant