Skip to content

Cut a long text message between characters, not inside an emoji - #901

Open
kevin9327 wants to merge 1 commit into
CopilotKit:mainfrom
kevin9327:sms-cut-between-characters
Open

kevin9327 wants to merge 1 commit into
CopilotKit:mainfrom
kevin9327:sms-cut-between-characters

Conversation

@kevin9327

Copy link
Copy Markdown
Contributor

What this changes

The Twilio transport cuts a message longer than 1,500 UTF-16 units to its first 1,400 and adds "…\nOpen OpenBot to read the full message.". The cut was input.text.slice(0, 1400), so when unit 1,400 was the first half of an emoji, the body ended in a lone high surrogate. URLSearchParams encodes that as U+FFFD, so the person received �… at the end of the text.

The cut now uses cutAtCodeUnits from channels/text.ts, which the MCP, Google Drive, Composio, Arcade and routines result cuts already use. It drops the half character, so the body never gets longer than before.

Where it runs

  • New state that outlives a request? None. Pure formatting of the outgoing body.
  • What happens on the second replica? Nothing new.
  • Anything serialised? None new.
  • Anything fanned out to a browser? None.
  • New listener, port, or schedule? None.

Boundary and audit

  • Every acting call still goes through the gateway. Untouched.
  • New refusals and new failures each write a row. None added.
  • Nothing new is trusted from the client.

Changelog

  • A section in CHANGELOG.md under Unreleased; happy to rebase if it conflicts.

Proof

New case in server/tests/delivery-providers.test.ts: 1,399 letters, then an emoji. On unmodified main:

Expected to not contain: "�"
Received: "aaaa…aaaa�…\nOpen OpenBot to read the full message."
(fail) real HTTP provider adapters > Twilio cuts a long SMS between characters, not inside an emoji

With the change, bun test tests/delivery-providers.test.ts passes (8 pass). tsc --noEmit in server/ and biome check on the changed files are clean.

AI assistance: I used an AI coding assistant to find and write this change, and reviewed and tested it myself.

Signed-off-by: kevin9327 <5299031+kevin9327@users.noreply.github.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-30T13:37:16.280312Z
We couldn’t complete this review. Comment @codex review to try again.
4945267 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant