Repository navigation
fix(slack): keep the text when a truncation's only line break is early - #28677
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks: a two-line floor fixes the two cuts that dropped the text (#28674), and the new tests pin the fix. What this change shipsInventory (3 items) — 3 justifiedIntent: when a long Slack reply is cut to fit one message, the user still sees as much text as fits, not only the first line. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] df98f7b Description read[DESCRIPTION-READ] 567c917c0cecc7dad447836a877ddec8f63f19a5769a4b7cd4e49d20937ec7b2 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: both cuts now use the same quarter-budget floor the shared splitter already uses, and the fallback to cutting at the limit was already the path for text with no line break. Notes
[DESIGN-REVIEWED] df98f7b Description read[DESCRIPTION-READ] 3bc5d1e6f60e8a0cb84c89383b4baaa30beed0f60af263d171acdbd8a6cec647 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: fix (2 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: Slack truncation no longer cuts at a line break near the start of the text, with tests.
Problem / Motivation
Goal: A Slack reply cut to fit one message keeps as much of the text as fits, not just its first line.
Two Slack truncation cuts keep text up to the last line break in reach, even one two characters in.
"Hi\n"plus a long body postsHiand the truncation notice, and the rest of the reply is lost.Why it matters
A Slack user whose long answer starts with a greeting or a heading sees almost nothing of it. The notice says the reply was cut, but the space that fits was thrown away.
Not a goal
split_messageor the stream appends. Those split into several pieces and are fix(slack): skip a break too early in the chunk when splitting #28614.acp/_dispatch_parts/surfaced_text.py. It keeps whole diff rows by design (its docstring), so a half-row never renders.What changed (motivation → approach → change)
A cut too near the start keeps almost nothing. The shared
messaging.splitsplitter only counts a line break at least a quarter into the budget; these two cuts had no floor.to_slack_mrkdwnoverSLACK_MAX_TEXTSLACK_MAX_TEXTSLACK_MAX_TEXT_truncated(one-message overflow)limitlimitBoth still add their truncation notice. A long reply with no line break at all was already cut where the limit falls; a line break near the start now takes that same path.
Backwards compatibility
Compatible: only replies over the limit change, and they keep more of their text; the notice and limits are the same.
Removes nothing: no key, path, record or public function is taken away.
Tests
test/test_slack_handler_rendering.pypins, for both cuts: a short first line before a long body keeps the text up to the limit; a line break a quarter in is still the cut.Proof: PROVEN test/test_slack_handler_rendering.py::TestToSlackMrkdwnTruncation::test_an_early_line_break_does_not_cut_away_the_text, test/test_slack_handler_rendering.py::TestTruncatedOverflowCut::test_an_early_line_break_does_not_cut_away_the_text (head df98f7b)
The new tests are pure functions with no clock, I/O or ordering. The related Slack and ACP suites pass locally (13,709 tests). The full
local-gate.pyrun times out on this busy host, so CI runs the full set.Manual verification
N/A — unit coverage sufficient: both cuts are pure string functions, and the tests call them directly.
Related Issues
Fixes #28674
Sibling sweep
Swept: git grep -nF rfind -- src/kiro_crew
Sibling: src/kiro_crew/slack/format.py:936 -- changed here
Sibling: src/kiro_crew/slack/reply_pieces.py:76 -- tracked in #28614
Sibling: src/kiro_crew/acp/_dispatch_parts/surfaced_text.py:135 -- not affected -- keeps whole diff rows by design, so a half-row never renders
Sibling: src/kiro_crew/imessage/plaintext.py:230 -- not affected -- already carries the floor from #28277
Pattern harvest
Rule candidate: review-prompt
Pattern: a cut that takes the last line break in reach with no floor on how far into the budget it sits
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement