Repository navigation
fix: preserve agent prompt fields in button models - #2000
Merged
mwbrooks merged 1 commit intoOct 28, 2026
Merged
Conversation
samkantor123
marked this pull request as ready for review
October 28, 2026 15:43
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2000 +/- ##
==========================================
- Coverage 84.35% 84.34% -0.02%
==========================================
Files 118 118
Lines 13793 13800 +7
==========================================
+ Hits 11635 11639 +4
- Misses 2158 2161 +3 ☔ View full report in Codecov by Harness. |
mwbrooks
approved these changes
Oct 28, 2026
mwbrooks
left a comment
Member
There was a problem hiding this comment.
✅ Thanks @samkantor123!
📝 We'll follow up with the same fields for the Node and Java SDKs.
| @@ -0,0 +1,51 @@ | |||
| from copy import deepcopy | |||
Member
There was a problem hiding this comment.
thought: The model tests in test_elements.py already cover the round trip, and this one patches the private _sync_send, which our other web tests don't do. Not blocking, so I'd merge as-is and leave it to @WilliamBergamin to keep or move it in a follow-up PR.
This was referenced Oct 28, 2026
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
Buttons built with SDK models currently lose their Slackbot prompt and per-user visibility fields before being sent to Slack, even though the equivalent raw JSON preserves them.
Add explicit
ButtonElementsupport for the documentedagent_prompt,agent_prompt_display, andvisible_to_user_idsfields. Nested actions, section accessories, and Home views then preserve the fields through their existing parsing paths. This also validates the documented 4,000-character prompt limit; omitted fields retain their existing behavior.This is a targeted model update, not a change to how arbitrary unknown fields are handled.
Testing
In an activated Python virtual environment, install the repository's dependencies with
./scripts/install.sh, then run:./scripts/run_tests.sh 'tests/slack_sdk/models tests/slack_sdk/web/test_views_publish_agent_prompt.py'The request regression compares the complete outgoing
views.publishpayload against raw JSON for both actions and section buttons, using explicit button models, raw dictionaries inside block models, and raw blocks inside aView. Only the HTTP transport is mocked; model parsing and WebClient serialization run normally.The model tests also cover each field independently, omission of
None, preserving a 4,000-character prompt, and rejecting 4,001 characters. The new regression checks were run against the original implementation first: the model paths lost fields while the raw-JSON controls retained them.No live Slack workspace, app installation, or Slackbot interaction is claimed by these tests.
Category
tests/integration_tests(Automated tests for this library)Requirements
python3 -m venv .venv && source .venv/bin/activate && ./scripts/run_validation.shafter making the changes.Local full validation completed on Python 3.14. The PR remains a draft for review.
Risks & Revert
⚪️ Low risk: explicitly supplied fields that were previously ignored will now be sent; buttons without these fields are unchanged.
🟢 The SDK change can be reverted. Already-published views would need to be republished to remove these fields.
🤖 Generated with Codex