fix: truncate long text in Slack approval card updates to avoid invalid_blocks - #35495
Closed
Yuki-14544869 wants to merge 1 commit into
Closed
fix: truncate long text in Slack approval card updates to avoid invalid_blocks#35495Yuki-14544869 wants to merge 1 commit into
Yuki-14544869 wants to merge 1 commit into
Conversation
…k API invalid_blocks error Slack's chat.update API rejects section blocks with text longer than 3000 characters (error: invalid_blocks / 'must be less than 3001 characters'). When code execution approval cards contain long code previews, the _handle_approval_action and _handle_slash_confirm_action handlers preserve the original text in updated_blocks, which can exceed this limit and cause the message update to silently fail — leaving the approval buttons visible even after the user has clicked them. Fix: truncate original_text to 2900 characters + ellipsis when rebuilding the updated blocks.
Collaborator
19 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Slack's
chat.updateAPI rejects section blocks with text longer than 3000 characters (invalid_blocks/must be less than 3001 characters).When code execution approval cards contain long code previews, the
_handle_approval_actionand_handle_slash_confirm_actionhandlers preserve the original text inupdated_blocks. This can exceed the 3000-char limit and cause thechat_updateto fail silently — leaving the approval buttons visible even after the user has successfully clicked them.Reproduction
Failed to update approval message: invalid_blocksFix
Truncate
original_textto 2900 characters + ellipsis when rebuilding the updated blocks in both handlers.Changed files:
gateway/platforms/slack.py(2 lines)Logs