fix(slack): guard against empty text in chat.postMessage (#52663) - #52672
Closed
liuhao1024 wants to merge 1 commit into
Closed
fix(slack): guard against empty text in chat.postMessage (#52663)#52672liuhao1024 wants to merge 1 commit into
liuhao1024 wants to merge 1 commit into
Conversation
Slack API returns `no_text` error when `chat.postMessage` is called with empty or whitespace-only text. This happens when cron delivery posts a response before the agent produces content (e.g. malformed turn before [SILENT]). Add early-return guards in both code paths: - `_standalone_send()`: out-of-process cron delivery via Web API - `send()`: in-process gateway adapter Both paths now skip the API call and return success when the formatted message is empty or whitespace-only. Fixes NousResearch#52663
Contributor
|
Thanks for addressing the verified Slack cron-delivery failure. The proposed guards cover the normal Problems
Suggested changes
Automated hermes-sweeper review. |
Contributor
|
Merged via #69317 — your commit was cherry-picked onto current main with your authorship preserved in git history: your empty-text postMessage guard was cherry-picked directly. Thanks for the contribution! |
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.
What does this PR do?
Guards against Slack
no_textAPI errors whenchat.postMessageis called with empty or whitespace-only text. This occurs when cron delivery posts an agent response before the agent produces content (e.g. a malformed turn before[SILENT]).Related Issue
Fixes #52663
Type of Change
Changes Made
plugins/platforms/slack/adapter.py: Add early-return empty-text guard in_standalone_send()(out-of-process cron delivery) andsend()(in-process gateway adapter). Both paths now skip the API call and return success when formatted text is empty/whitespace.tests/gateway/test_slack.py: AddTestEmptyTextGuardclass with 4 tests covering both empty string and whitespace-only inputs for both send paths.How to Test
pytest tests/gateway/test_slack.py::TestEmptyTextGuard -xvs— all 4 tests should pass.pytest tests/gateway/test_slack.py -q— all 213 tests should pass (no regressions).pytest tests/tools/test_send_message_tool.py -q— all 146 tests should pass (standalone sender integration).Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/ACode Intelligence
plugins/platforms/slack/adapter.py(_standalone_send,send)