Files
openclaw/extensions/slack/src/limits.ts
MatthewSynthia 7df5834511 fix(slack): cap chat.update edit text at the 4000-char limit, not the 8000 send limit (#115027)
* fix(slack): cap chat.update edit text at the 4000-char limit, not the 8000 send limit

updateMessageSlack truncated the edit text to SLACK_TEXT_LIMIT (8000), but Slack chat.update
rejects text longer than 4000 characters with msg_too_long (documented in limits.ts). Every
other edit path (actions.ts, edit-text.ts, message-action-dispatch.ts, preview-finalize.ts)
uses SLACK_EDIT_TEXT_LIMIT (4000); updateMessageSlack was the lone outlier, so a long
question-delivery status edit failed instead of landing. Use the edit limit.

* fix(slack): enforce edit text byte limits

Co-authored-by: MatthewSynthia <matthewsynthia@users.noreply.github.com>

* fix(slack): preserve prepared edit text within limits

Co-authored-by: MatthewSynthia <matthewsynthia@users.noreply.github.com>

---------

Co-authored-by: MatthewSynthia <matthewsynthia@users.noreply.github.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-07-28 12:41:37 -04:00

11 lines
479 B
TypeScript

// Slack plugin module implements limits behavior.
export const SLACK_TEXT_LIMIT = 8000;
// chat.update documents 4,000 characters but rejects text above 4,000 UTF-8 bytes in live use.
// https://docs.slack.dev/reference/methods/chat.update/#errors
export const SLACK_EDIT_TEXT_MAX_BYTES = 4_000;
// Slack truncates chat.postMessage text above 40,000 characters.
// https://api.slack.com/methods/chat.postMessage#truncating
export const SLACK_MESSAGE_TEXT_HARD_LIMIT = 40_000;