Repository navigation
Conversation
bolichen97
left a comment
There was a problem hiding this comment.
[operator: bolichen97]
Review of head e4c6304.
Recommendation: close as superseded. Thank you for the fix. Main already fixed #18779 through #18786 (merged 2026-10-10, merge commit 955c2cc). That PR adds the same table case and the same "append the table after the text" step. Issue #18779 is closed as completed.
Counts: 1 blocking, 2 should-fix, 1 nit.
Merge conflict. Both files conflict with main. src/kiro_crew/slack/events.py: main rewrote _extract_blocks_text with a lazy, budgeted renderer (_table_row_fragments, a table branch near line 2391) and added _extract_table_text plus a table-append step in _route_message (near line 2687). This PR edits the same two hunks. test/test_events_forward.py: #18786 added table tests in the same test classes. A rebase would give two table branches (the second unreachable) and two append steps.
Fork PR Description check. It fails because the body uses ## Summary / ### Changes. The template headings are required as written: ## Problem / Motivation, ## Why it matters, ## Not a goal, ## What changed, ## Tests. Edit the body from .github/PULL_REQUEST_TEMPLATE.md; no push is needed. PR Readiness stays red until that passes. This only matters if the PR is kept.
Checked, no finding: cell text is joined as plain text (no markup or command path is added); the table text joins the user's message text, so it keeps the same untrusted channel-message handling as any other Slack text. Empty rows are skipped; None cells become empty strings.
Inline findings below.
| ) | ||
| if inline: | ||
| parts.append(inline) | ||
| elif block_type == "table": |
There was a problem hiding this comment.
blocking - Superseded by #18786 (merged 2026-10-10, 955c2cc). Main already has a table branch in _extract_blocks_text (main events.py ~2391, via _table_row_fragments). After a rebase this elif would sit beside it and never run. Fix: close this PR. If a test case here covers a shape main lacks, port only that test in a new PR on main.
| if not text or text in _SLACK_BLOCK_FALLBACKS: | ||
| fallback = "" if text in _SLACK_BLOCK_FALLBACKS else text | ||
| text = _extract_shared_text(event) or fallback | ||
| elif any(isinstance(b, dict) and b.get("type") == "table" for b in (event.get("blocks") or [])): |
There was a problem hiding this comment.
should-fix - This reads tables only from event["blocks"]. Tables inside attachments (a forwarded or shared message) are missed. Main's _extract_table_text also reads non-link-preview attachments and skips from_url unfurls. Fix (if kept): collect table blocks from the event and from attachments without from_url, as main does.
| elif cell is None: | ||
| cell_texts.append("") | ||
| else: | ||
| cell_texts.append(str(cell)) |
There was a problem hiding this comment.
nit - str(cell) on an unknown cell type (list, bool, dict) puts a Python repr such as ['a'] or True into the agent text. Fix: render only str/int/float, else use an empty string.
| else: | ||
| cell_texts.append(str(cell)) | ||
| if any(cell_texts): | ||
| parts.append(" | ".join(cell_texts)) |
There was a problem hiding this comment.
should-fix - Size cap. The 16000-char cap (return result[:_MAX_RECOVERED_TEXT_CHARS], line 2229) is applied only after the whole string is built, so a very large pasted table (thousands of rows) is fully rendered in memory before the slice. Main fixed this with a budgeted renderer that stops at the cap. Fix (if kept): stop adding rows once the running length reaches _MAX_RECOVERED_TEXT_CHARS, and add a test with a table larger than the cap.
|
Thanks a lot for this fix, @Fire162. Closing because the same problem was fixed on main by #18786 ("fix(slack): keep pasted table blocks in the message text", merged 2026-10-10), which also closed #18779. |
Summary
When users paste spreadsheet tables into Slack, Slack dispatches them as Block Kit
tableblocks. Previously:_extract_blocks_textonly handledrich_text,section, andcontextblocks, silently droppingtableblocks._route_message, block extraction only ran when top-level messagetextwas empty or a generic fallback placeholder. If a user provided text alongside the pasted table (e.g., "read this table"), the table was omitted from the routed message body. If no text was provided, the message could be dropped entirely.Changes
_extract_blocks_text, add support fortype == "table"blocks:|and appends non-empty rows._route_message, detect event-leveltableblocks when message text is present and append extracted table text separated by newlines if not already included.test/test_events_forward.pycovering:Fixes #18779