Address PR #6 review comments#8
Open
Aaron Wang (tabletenniser) wants to merge 2 commits into
Open
Conversation
- Make _extract_block_text recursive to handle nested rich_text containers (rich_text_list, rich_text_quote, etc.) so compact mode no longer drops message content for those Block Kit payloads - Simplify _compact_attachment, _compact_message, and _compact_user using tuple-driven loops / comprehensions per reviewer nits - Add unit test coverage for all compact helpers and the recursive rich_text extraction Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is ON, but it could not run because the service account is not on the team's cloud agent allowlist. To enable Bugbot Autofix, have a team admin update the allowlist in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2dc8fa9. Configure here.
user.get("profile", {}) returns None when the key is present with a null
value (the default only applies when missing). The earlier refactor lost
the implicit falsy guard, which would raise AttributeError on those
payloads. Use `or {}` instead and pin the behavior with a regression test.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sarah Deitke (sarahdeitke)
approved these changes
May 29, 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.

Follow-up to #6 that resolves the unresolved review comments.
Summary
_extract_block_textis now recursive, so nested rich-text containers (rich_text_list,rich_text_quote, etc.) no longer silently drop content when the top-leveltextis empty._compact_attachmentcollapsed to a single dict comprehension._compact_messageoptional-field copying collapsed to a tuple-driven loop._compact_userprofile-field copying collapsed to a tuple-driven loop with the walrus operator.tests/test_compact_responses.pycovering all five compact helpers plus the recursive Block Kit walker (36 new tests; existing 27 still pass).Test plan
uv run pytest tests/— 63 passedNote
Low Risk
Localized changes to response-shaping helpers plus new tests; the main functional change improves text fallback for nested Block Kit, with low blast radius outside compact MCP tool output.
Overview
Fixes Block Kit text extraction when messages have empty top-level
text:_extract_block_textnow walks nested rich-text containers (rich_text_list,rich_text_quote, etc.) via a recursive_walk_rich_texthelper, so list/quote content is no longer dropped in compact channel/search responses.Several compact helpers are refactored without intended behavior changes—
_compact_attachmentuses a dict comprehension;_compact_messagecopies optional keys in a loop;_compact_userloops profile fields and treats"profile": nullsafely withuser.get("profile") or {}.Adds
tests/test_compact_responses.pywith broad coverage of the compact helpers and the recursive Block Kit walker (per PR #6 review follow-up).Reviewed by Cursor Bugbot for commit dc245e3. Bugbot is set up for automated code reviews on this repo. Configure here.