fix(discord): keep thread title truncation UTF-16 safe#101307
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 7, 2026, 3:51 AM ET / 07:51 UTC. Summary PR surface: Source +1, Tests +52. Total +53 across 2 files. Reproducibility: yes. from source inspection: current main uses raw 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:
Next step before merge
Security Review detailsBest possible solution: Land this as a bounded Discord plugin fix after ordinary maintainer review, keeping the existing prompt caps and UTF-16 helper rather than broadening thread-title behavior or adding config. Do we have a high-confidence way to reproduce the issue? Yes from source inspection: current main uses raw Is this the best way to solve the issue? Yes; applying the existing AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 48e77b6abf5e. Label changesLabel justifications:
Evidence reviewedPR surface: Source +1, Tests +52. Total +53 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 (5 earlier review cycles)
|
73ba19c to
59adc68
Compare
59adc68 to
b337353
Compare
|
@clawsweeper re-review I refreshed this against latest main and updated the proof section with current-head focused validation. I avoided broadening production exports only for proof. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
b337353 to
b5bd0d0
Compare
|
@clawsweeper re-review Current head/proof body was refreshed after the last rebase; please re-review the latest head. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
b5bd0d0 to
f062226
Compare
|
@clawsweeper re-review I added a direct prompt formatter path, refreshed the tests, and updated the proof with a standalone Node/tsx transcript from the current head. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
Co-authored-by: Alix-007 <[email protected]>
|
Superseded by #101551, landed as The original fork branch had accumulated unrelated repository ancestry and could not be safely rewritten in place. The replacement preserves @Alix-007's contribution with Thank you, @Alix-007. For future PRs, keeping the fork branch narrowly based on current |
|
@steipete is ok ,thx haha |
What Problem This Solves
Discord thread-title prompt fields were truncated with raw UTF-16 slicing. A limit that landed between an emoji's surrogate pair could send malformed text to the title completion model.
Why This Change Was Made
All three bounded fields now use the existing plugin SDK
truncateUtf16Safehelper. Maintainer cleanup keeps the prompt formatter private and tests the realgenerateThreadTitlecompletion path instead of exporting production code only for a test.User Impact
Long Discord message text, channel names, and channel descriptions no longer produce lone UTF-16 surrogates in generated thread-title prompts. Limits and ellipsis behavior are unchanged.
Evidence
corepack pnpm test extensions/discord/src/monitor/thread-title.generate.test.ts— 8/8 passed.corepack pnpm check:changed— passed for the final two-file diff.git diff --check— passed.main.Full Discord/provider delivery was not run: the changed behavior is deterministic prompt construction and is exercised through the production completion entry point with the completion call mocked.