Repository navigation
fix: truncate HITL card body to prevent silent Slack rejection - #8072
Merged
Merged
Conversation
Slack Block Kit rejects section text >200 chars with invalid_blocks error, causing HITL approval cards to never render. Uses existing truncate() helper. Fixes issue discovered in agno-agi/coda#23 where comment_on_issue with 250+ char body caused approval UI to fail silently.
Verifies that body text >200 chars is truncated in both _build_confirmation_card and build_confirmation_toggle_card.
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.
Summary
Slack Block Kit rejects Card block body text longer than 200 characters with
invalid_blockserror, causing HITL approval cards to silently fail to render. When this happens, agents pause indefinitely waiting for approval that can never come.This fix truncates the card body text using the existing
truncate()helper (already intypes.py) before building the card.Changes
truncatefromagno.os.interfaces.slack.typestruncate(body_text, 200)in_build_confirmation_card()truncate(body_text, 200)inbuild_confirmation_toggle_card()Root cause
Tool calls like
comment_on_issuewith 250+ character arguments cause the body text to exceed Slack's Card block body limit of 200 chars. The card post request returnsok: falsewithinvalid_blockserror, but this was not being detected — the agent just hangs waiting for approval.Note: Section blocks have a 3000 char limit, but agno's HITL cards use the newer Card block type (2024) which has stricter limits.
How it was discovered
agno-agi/coda#23 implemented a monkey-patch workaround (
coda/slack_patches.py) to fix this. This PR moves the fix upstream where it belongs.Test plan
pytest libs/agno/tests/unit/os/routers/test_slack_blocks.py)test_long_tool_args_truncated_to_200_charsfor_build_confirmation_cardtest_long_body_truncated_to_200_charsforbuild_confirmation_toggle_card