Repository navigation
fix(slack): send a sentence's last word before the tool card - #30230
Conversation
Sensitive Change ReviewSensitive files changed:
|
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The fix moves the dashboard's own sentence-end rule into a shared helper and releases one plain sentence-ending word at the two Slack boundaries the repro names. Notes
What this change shipsInventory (5 items) — 4 justifiedIntent: A Slack reader sees a sentence's last word while the tool or approval that follows runs. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 8f566fa Description read[DESCRIPTION-READ] 616166b66a8de5ca584b5a47b856af81163fd105bc16050b8bb1d9305b19833d 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: the Slack stream now uses the dashboard's existing safe-word rule, now in one shared helper, and every other held run is still held at the tool card or approval prompt. Notes
[DESIGN-REVIEWED] 8f566fa Description read[DESCRIPTION-READ] 8418ee68f03bb9cc13bafcf25536ed3884da232473e61d59ad3c4fe553909984 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 |
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: |
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: |
Security Scope Review -- ✅ PASSWhich legitimate operations does Verdict basis: adjudicated, zero confirmed regressions. Security scope review -- adjudicated candidates
No candidate flipped from allowed to refused. Scope-Verdict: PASS Reason: Nothing in this change makes a guard stricter. It moves TIGHTENING: None. The only behavioural hunk relaxes a hold: ADJUDICATED: 8 candidates, 0 confirmed newly-refused PLATFORM COVERAGE: I wrote posix and windows rows: the pytest runs of the three touched test files ( UNADJUDICATED: The guard is the Slack native stream's [SCOPE-REVIEWED] 8f566fa |
d80a1bb to
4e8956b
Compare
Sensitive change review
|
|
Hold for human review at 4e8956b (policy: redaction behaviour on an outbound channel). This PR changes what the Slack stream releases from the redactor's credential hold-back. I found no definite defect. The helper moved into To clear this, a maintainer needs to accept the Slack release rule. — crew-pr-reviewer (r146) |
4e8956b to
d7fd749
Compare
Sensitive change review
|
d7fd749 to
33d6624
Compare
61b90be to
7002ac9
Compare
Sensitive change review
|
7002ac9 to
83b11f3
Compare
Sensitive change review
|
The Slack native stream held the redactor's tail run at every tool card and approval prompt, so a message ending in a plain word such as 'settled.' showed without that word until the model wrote again. The dashboard already releases such a run at its cut. Move that check into security/text_redaction.py as ends_plain_sentence and use it in the Slack stream too, so both surfaces apply one rule. Any other run stays held, and a run carried across a wait is still settled by _give_back.
83b11f3 to
8f566fa
Compare
Sensitive change review
|
bolichen97
left a comment
There was a problem hiding this comment.
Maintainer decision (security sign-off): accepted; loosening, not a tightening.
Approving at 8f566fa. The dashboard's _ends_plain_sentence moves unchanged into security/text_redaction.py as ends_plain_sentence, and the Slack native stream now uses it at a tool call or approval boundary. So a reply that ends a sentence keeps its last word on screen instead of holding it until the model writes again. The rule is the same one the dashboard already applies: one short lowercase word, an optional short ' suffix, and a final ., with redact(run) == run still required. Anything else stays withheld as before. No regex is added, and all checks pass.
The Slack native stream held the redactor's tail run at every tool card and approval prompt, so a message ending in a plain word such as 'settled.' showed without that word until the model wrote again. The dashboard already releases such a run at its cut. Move that check into security/text_redaction.py as ends_plain_sentence and use it in the Slack stream too, so both surfaces apply one rule. Any other run stays held, and a run carried across a wait is still settled by _give_back. Co-authored-by: Zezhen Xu <zezhexu@amazon.com> (cherry picked from commit 347225f) Backport note: release's security package line budget is 34,960 after the #30887 backport, so it is raised by this fix's 31 to 34,991 (main's value comes from other raises that are not on release).
…ssembly) #32115 and #33299 each raised _PACKAGE_LINE_BUDGET on its own lane and both counted on the 15 lines of headroom release/0.12.0 had left. Picked together, the package measures 35,048 lines (release 34,921, plus 55 from #30887 and #30230, 20 from #32115 and 52 from #33299), so #33299's raise is 52 from 34,996, not 37. The comment and the constant now say the measured number; no package code changes.
…ssembly) #32115 and #33299 each raised _PACKAGE_LINE_BUDGET on its own lane and both counted on the 15 lines of headroom release/0.12.0 had left. Picked together, the package measures 35,048 lines (release 34,921, plus 55 from #30887 and #30230, 20 from #32115 and 52 from #33299), so #33299's raise is 52 from 34,996, not 37. The comment and the constant now say the measured number; no package code changes.
Problem / Motivation
Goal: A Slack reply that ends a sentence keeps its last word on screen while the next tool call or approval prompt runs.
In Slack (native stream), "I'll take a reading to see whether they've settled." shows as "...whether they've" for as long as the tool runs. The word only arrives when the model writes again, often minutes later. #27344 fixed the same symptom on the dashboard; this is the Slack half of #27349.
Intended? No. The hold exists so a credential split by a tool card is redacted whole (
StreamRedactorwithholds the trailing credential-class run;.is in that class). A plain word ending in.can never become part of a credential, and the dashboard already releases it (_cut_segmentinsrc/kiro_crew/dashboard/chat_turn/turn_reply_seams.py). The Slack stream (src/kiro_crew/slack/handler_runtime/stream.py,on_tool_callandprepare_for_approvalon main) only callsflush(), which leaves the held run in place.Repro: Slack native stream, events
text("I'll take a reading to see whether they've settled."),tool_call(read),text(" ok"). On main the text streamed before the firstappend_task(tool card) is "I'll take a reading to see whether they've". Pinned by the newtest_the_last_word_of_a_sentence_reaches_the_stream_before_the_tool_card.Why it matters
Every Slack reply that writes a sentence and then calls a tool reads as cut off mid-sentence while the tool runs. That is most replies with tools.
Not a goal
What changed (motivation → approach → change)
Symptom: last word missing before a Slack tool card / approval prompt → cause: the held redactor run is not released at those boundaries → change:
_ends_plain_sentencecheck (main's exact letter check from fix: use an exact check for the word shown at a tool-call pause #30986, sameredact(run) == runguard, no regex) intosrc/kiro_crew/security/text_redaction.pyasends_plain_sentence. The dashboard imports it under its old name, so its behaviour is byte-identical._AnswerStream.release_sentence_end()in the Slack stream, called right afterflush()before a tool card (this includes await) and before an approval prompt. It sends the held run only when it is one plain sentence-ending word, and never when a run carried across an earlierwaitis pending, a give-back is open, there is no stream, or the channel is in review activation._PACKAGE_LINE_BUDGETintest/test_security_gate_liveness.pyfrom main's 34,733 to 34,784: 31 for the lines the moved helper adds tosecurity/text_redaction.py(the dashboard copy is deleted, so the repo total does not grow), and 20 because main already measures 34,753 after fix: tighten a git publish check #30774 grewargv_floor_git.pywithout raising the budget.Other design considered: flush the held run unconditionally at every tool card. Rejected: a credential split across the card would then be streamed in two unmatched halves, which is what the hold prevents.
No new regex: the moved check uses no regex at all. Security is not stricter than main: only more text is released, under the exact rule the dashboard already uses.
Backwards compatibility
Compatible: only the timing of one already-safe word changes; every other held run behaves as on main.
Removes nothing: the private dashboard helper still exists under its old name (imported alias); nothing is hidden, deleted or tightened.
Tests
test/test_slack_stream_held_tail.py:42.,AKIA.,v2.,hostname.example.) stay held at the card;waitstill goes back to its message at a later tool card;waitstays on the message the wait ends, with no edit afterwards.Proof: not provable -- other: host rule forbids local test runs; CI runs the suite.
Manual verification
N/A — unit coverage drives the real
_AnswerStreamagainst a fake Slack client for each boundary.Related Issues
Fixes #27349
Sibling sweep
Swept: git grep -n "await self.flush()" -- src/kiro_crew/slack/handler_runtime/stream.py
Sibling: src/kiro_crew/dashboard/chat_turn/turn_reply_seams.py -- not affected -- dashboard cut already releases the word (#27344)
Sibling: src/kiro_crew/slack/handler_runtime/stream.py -- changed here -- tool card and approval prompt boundaries
Pattern harvest
Not generalizable: the rule now lives in one shared helper used by both streaming surfaces.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.