Skip to content

fix(slack): send a sentence's last word before the tool card - #30230

Merged
bolichen97 merged 1 commit into
mainfrom
crew/bug-resolve/27349
Nov 7, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
crew/bug-resolve/27349

Conversation

@CrysisDeu

@CrysisDeu CrysisDeu commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

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 (StreamRedactor withholds 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_segment in src/kiro_crew/dashboard/chat_turn/turn_reply_seams.py). The Slack stream (src/kiro_crew/slack/handler_runtime/stream.py, on_tool_call and prepare_for_approval on main) only calls flush(), 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 first append_task (tool card) is "I'll take a reading to see whether they've". Pinned by the new test_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:

  • Moved the dashboard's _ends_plain_sentence check (main's exact letter check from fix: use an exact check for the word shown at a tool-call pause #30986, same redact(run) == run guard, no regex) into src/kiro_crew/security/text_redaction.py as ends_plain_sentence. The dashboard imports it under its old name, so its behaviour is byte-identical.
  • Added _AnswerStream.release_sentence_end() in the Slack stream, called right after flush() before a tool card (this includes a wait) 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 earlier wait is pending, a give-back is open, there is no stream, or the channel is in review activation.
  • Updated the Slack and security specs.
  • Raised _PACKAGE_LINE_BUDGET in test/test_security_gate_liveness.py from main's 34,733 to 34,784: 31 for the lines the moved helper adds to security/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 grew argv_floor_git.py without 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:

  • the last word of a sentence reaches the stream before the tool card (two sentences);
  • runs that are not one plain sentence word (42., AKIA., v2., hostname.example.) stay held at the card;
  • a Bearer value split around a tool card after a sentence is still redacted as one;
  • a word carried across a wait still goes back to its message at a later tool card;
  • the last word is sent before an approval prompt;
  • a sentence ending before a wait stays 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 _AnswerStream against 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

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributed under the project's Apache-2.0 license.

@CrysisDeu
CrysisDeu requested review from a team and KiroCrewCaptain as code owners November 5, 2026 07:43
@CrysisDeu
CrysisDeu requested a review from iamwhatever November 5, 2026 07:43
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/security/text_redaction.py

  • @CrysisDeu posted a complete reasoning template for 8f566fa.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 8f566fa7270f08229849921bb8c77dff97ed6a70 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 8f566fa7270f08229849921bb8c77dff97ed6a70 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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

  • Item 2 — symptom-level sibling: the sweep only grepped stream.py, but messaging/driver.py:963 also holds stream_redactor.held at a tool call (segment_tail = stream_redactor.held) and never calls ends_plain_sentence. That leaves 1 unfixed sibling (grepped ends_plain_sentence|StreamRedactor\( across src/). The sweep doesn't show whether a channel renderer displays that held tail before the tool runs.

What this change ships

Inventory (5 items) — 4 justified

Intent: A Slack reader sees a sentence's last word while the tool or approval that follows runs. This is a FIX.

  1. In Slack's native stream, the last word of a sentence now shows before the tool card — justified
  2. The last word now also shows before an approval prompt — symptom-level (sibling left in messaging/driver.py)
  3. The dashboard's sentence-end check moved into security/text_redaction.py as ends_plain_sentence, with 2 consumers — justified
  4. The package line budget was raised by 31 for the moved helper — justified
  5. The Slack and security specs now describe the release — justified

[FIRST-PRINCIPLES-REVIEWED] 8f566fa

Description read

[DESCRIPTION-READ] 616166b66a8de5ca584b5a47b856af81163fd105bc16050b8bb1d9305b19833d

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 8f566fa7270f08229849921bb8c77dff97ed6a70 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

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

  • The _PACKAGE_LINE_BUDGET bump also absorbs 20 lines that fix: tighten a git publish check #30774 added without raising the budget. That is unrelated to this fix and would sit better in its own commit or PR, so this PR's budget change covers only its own lines.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 8f566fa7270f08229849921bb8c77dff97ed6a70 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 8f566fa

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 8f566fa7270f08229849921bb8c77dff97ed6a70 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 8f566fa7270f08229849921bb8c77dff97ed6a70 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 8f566fa

Verdict parsed from the review's SHA-scoped output markers for commit 8f566fa7270f08229849921bb8c77dff97ed6a70.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 8f566fa7270f08229849921bb8c77dff97ed6a70 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Security Scope Review -- ✅ PASS

Which legitimate operations does 8f566fa7270f08229849921bb8c77dff97ed6a70 newly refuse? Updated in place on each push. A script-confirmed regression blocks; the model proposes candidates and never decides a refusal.

Verdict basis: adjudicated, zero confirmed regressions.

Security scope review -- adjudicated candidates

  • macos-latest (platform posix): 4 classified, 0 newly refused, 4 still allowed.
  • ubuntu-latest (platform posix): 4 classified, 0 newly refused, 4 still allowed.
  • windows-latest (platform windows): 4 classified, 0 newly refused, 4 still allowed.

No candidate flipped from allowed to refused.

Scope-Verdict: PASS

Reason: Nothing in this change makes a guard stricter. It moves ends_plain_sentence unchanged from the dashboard into security/text_redaction.py and adds release_sentence_end, which lets the Slack native stream send a held plain sentence-ending word earlier (before a tool card or approval prompt). No shell-deny tier is touched, so the 8 shell candidates are controls with nothing to flip. The one guard the change does affect, the Slack stream's held-run handling, is a loosening that the classifier cannot measure (see UNADJUDICATED).

TIGHTENING: None. The only behavioural hunk relaxes a hold: + await self.release_sentence_end() before the tool card and the approval pause, which sends self.redactor.flush() when ends_plain_sentence(held) is true. That is a release, not a refusal. Whether the release is safe is the other lanes' question, not this one.

ADJUDICATED: 8 candidates, 0 confirmed newly-refused

PLATFORM COVERAGE: I wrote posix and windows rows: the pytest runs of the three touched test files (.venv/bin/python against .venv\Scripts\python.exe with \ separators) and a caller search (grep -rn against findstr /s /n). The diff assumes nothing about paths, separators, interpreters, executables or environment variables. Its only platform-neutral assumption is the ASCII lowercase-letter character set inside ends_plain_sentence, which is a text rule and not host-specific. No assumed platform went without a candidate.

UNADJUDICATED: The guard is the Slack native stream's StreamRedactor holdback. Text reaches it this way: _AnswerStream.append → redactor.held → (new) release_sentence_end, called from the tool-call path after self.flush() and from prepare_for_approval → ends_plain_sentence(held) → redactor.flush() → _deliver. The only way this change can newly refuse anything is by holding a word that used to be released, and it never does. Every path either returns early (no held run, a run carried across a wait, move_back set, no stream_ts, a review-mode channel, or a word that is not a plain sentence end) or releases sooner than before. So nothing is newly refused. If this guard could be classified, I would have submitted these inputs: "whether they've settled.", "that it is Done.", "I need to write the file now." before an approval prompt, and a word carried across a wait before a tool card. The PR's own tests already cover all of these.

[SCOPE-REVIEWED] 8f566fa

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 5, 2026
@CrysisDeu
CrysisDeu force-pushed the crew/bug-resolve/27349 branch from d80a1bb to 4e8956b Compare November 5, 2026 08:40
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 5, 2026
@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 4e8956b
  • What rule changed: no redaction rule changed. The dashboard's existing sentence-end check (_PLAIN_SENTENCE_END_RE + redact(run) == run) moved unchanged from dashboard/chat_turn/turn_reply_seams.py into security/text_redaction.py as ends_plain_sentence, and the Slack native stream now also calls it before a tool card or approval prompt.
  • Before -> after (what was allowed/blocked, now): before, the Slack stream held the redactor's tail run at every tool card and approval prompt, so a message ending "...they've settled." showed "...they've" until the model wrote again. After, only a run that is one plain lowercase-tail word ending in . (and that redact() leaves unchanged) is sent before the card; every other run stays held exactly as on main. The dashboard behaves byte-identically (same function, imported under its old name).
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a credential fragment shaped like a plain word plus . is sent before the card. The pattern excludes digits, mixed case after the first letter, _, -, / and lengths over 19, which rules out every credential prefix the redactor knows; it is the same rule the dashboard has shipped since fix(chat): show a row's last word while its tool call runs #27344.
  • Evidence checked (which sandbox result proves it): test/test_slack_stream_held_tail.py pins that 42., AKIA., v2. and hostname.example. stay held at the card, and that a Bearer value split around a tool card after a sentence is still redacted whole ([REDACTED: credential], raw value absent). Existing test/test_chat_runner_redact_across_tool_boundary.py still pins the dashboard rule through the moved helper.
  • No regression:
    • Tools still work (which tools/commands were run, result): no tool, command gate or sandbox code changed; only stream text timing.
    • Backward compatible (old config / old data / old callers still work, how checked): no config or stored data involved; the dashboard caller keeps its _ends_plain_sentence name via an import alias, grep shows no other caller.
    • Existing tests (which suites passed on this head): all Backend Tests shards (3.12 x8, Windows x8), E2E stub, Coverage Gate, Source Gates, Security Scope Review, GPT 6.1 Review and Opus 5.5 Review passed on 4e8956b.
  • How to undo: revert this commit; the dashboard copy returns to turn_reply_seams.py and the Slack stream goes back to holding the run.

@iamwhatever

Copy link
Copy Markdown
Contributor

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. release_sentence_end flushes the held run before a tool card or an approval prompt (stream.py). Changes to what is withheld from an egress surface are kept for a human reviewer, even when the code looks right.

I found no definite defect. The helper moved into security/text_redaction.py unchanged (code). held is empty while a value is being dropped, and flush() redacts before it returns. The release is skipped for carried runs, an open give-back, review activation, and anything that is not one plain sentence word. One point for the reviewer: ends_plain_sentence judges the held run without the text emitted before it. The dashboard has used the same rule since #27344. All CI checks and AI lanes are green.

To clear this, a maintainer needs to accept the Slack release rule.

— crew-pr-reviewer (r146)

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 5, 2026
@CrysisDeu
CrysisDeu force-pushed the crew/bug-resolve/27349 branch from 4e8956b to d7fd749 Compare November 5, 2026 21:20
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision labels Nov 5, 2026
@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: d7fd749
  • What rule changed: no redaction rule changed. This head is a rebase of 4e8956b onto current main. The dashboard's existing sentence-end check (_PLAIN_SENTENCE_END_RE + redact(run) == run) moved unchanged from dashboard/chat_turn/turn_reply_seams.py into security/text_redaction.py as ends_plain_sentence, and the Slack native stream now also calls it before a tool card or approval prompt. The only line that differs from 4e8956b is the package line budget in test/test_security_gate_liveness.py: main raised it to 34,524 for the Railway consent host, so this PR's +15 now lands at 34,539.
  • Before -> after (what was allowed/blocked, now): before, the Slack stream held the redactor's tail run at every tool card and approval prompt, so a message ending "...they've settled." showed "...they've" until the model wrote again. After, only a run that is one plain lowercase-tail word ending in . (and that redact() leaves unchanged) is sent before the card; every other run stays held exactly as on main. The dashboard behaves byte-identically (same function, imported under its old name).
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a credential fragment shaped like a plain word plus . is sent before the card. The pattern excludes digits, mixed case after the first letter, _, -, / and lengths over 19, which rules out every credential prefix the redactor knows; it is the same rule the dashboard has shipped since fix(chat): show a row's last word while its tool call runs #27344.
  • Evidence checked (which sandbox result proves it): test/test_slack_stream_held_tail.py pins that 42., AKIA., v2. and hostname.example. stay held at the card, and that a Bearer value split around a tool card after a sentence is still redacted whole ([REDACTED: credential], raw value absent). Existing test/test_chat_runner_redact_across_tool_boundary.py still pins the dashboard rule through the moved helper.
  • No regression:
    • Tools still work (which tools/commands were run, result): no tool, command gate or sandbox code changed; only stream text timing.
    • Backward compatible (old config / old data / old callers still work, how checked): no config or stored data involved; the dashboard caller keeps its _ends_plain_sentence name via an import alias, grep shows no other caller.
    • Existing tests (which suites passed on this head): CI is running on d7fd749; the rebase changed no product line, and the previous head 4e8956b passed every Backend Tests shard, E2E stub, Coverage Gate, Source Gates, Security Scope Review, GPT 6.1 Review and Opus 5.5 Review.
  • How to undo: revert this commit; the dashboard copy returns to turn_reply_seams.py and the Slack stream goes back to holding the run.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Nov 5, 2026
@CrysisDeu
CrysisDeu force-pushed the crew/bug-resolve/27349 branch from d7fd749 to 33d6624 Compare November 5, 2026 21:53
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Nov 5, 2026
@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 6, 2026
@CrysisDeu
CrysisDeu force-pushed the crew/bug-resolve/27349 branch from 61b90be to 7002ac9 Compare November 6, 2026 18:01
@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 7002ac9
  • What rule changed: no redaction rule changed. This head is a rebase of 61b90be onto current main 8095bc3. The dashboard's sentence-end check moved from dashboard/chat_turn/turn_reply_seams.py into security/text_redaction.py as ends_plain_sentence, and the Slack native stream now also calls it before a tool card or approval prompt. Main's fix: use an exact check for the word shown at a tool-call pause #30986 replaced that check's regex with an exact letter check (_ASCII_LETTERS / _ASCII_LOWERCASE + redact(run) == run), so the moved copy is now main's new body, unchanged; the PR adds no regex.
  • Before -> after (what was allowed/blocked, now): before, the Slack stream held the redactor's tail run at every tool card and approval prompt, so a message ending "...they've settled." showed "...they've" until the model wrote again. After, only a run that is one plain lowercase-tail word ending in . (and that redact() leaves unchanged) is sent before the card; every other run stays held exactly as on main. The dashboard behaves byte-identically (same function body, imported under its old name).
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a credential fragment shaped like a plain word plus . is sent before the card. The check excludes digits, mixed case after the first letter, _, -, / and lengths over 19, which rules out every credential prefix the redactor knows; it is the rule the dashboard ships on main.
  • Evidence checked (which sandbox result proves it): test/test_slack_stream_held_tail.py pins that 42., AKIA., v2. and hostname.example. stay held at the card, and that a Bearer value split around a tool card after a sentence is still redacted whole. Main's test/test_chat_runner_redact_across_tool_boundary.py cases for fix: use an exact check for the word shown at a tool-call pause #30986 still call turn_reply_seams._ends_plain_sentence, which is the moved function.
  • No regression:
    • Tools still work (which tools/commands were run, result): no tool, command gate or sandbox code changed; only stream text timing.
    • Backward compatible (old config / old data / old callers still work, how checked): no config or stored data involved; the dashboard keeps its _ends_plain_sentence name via an import alias; grep shows the Slack stream and that alias are the only callers.
    • Existing tests (which suites passed on this head): CI is running on 7002ac9. Static gates on the touched files: flake8, isort, black, comment-history, brand.
  • How to undo: revert this commit; the dashboard copy returns to turn_reply_seams.py and the Slack stream goes back to holding the run.
  • Since 61b90be: rebased onto main 8095bc3. Conflict in turn_reply_seams.py: main (fix: use an exact check for the word shown at a tool-call pause #30986) rewrote the helper this PR moves. Resolved by deleting it there as before and moving main's new body into text_redaction.py (docstring keeps this PR's shared-by line). _PACKAGE_LINE_BUDGET: main's package already measures 34,753 against its 34,733 budget (fix: tighten a git publish check #30774 grew argv_floor_git.py by 20), and this PR adds 31, so the budget is 34,784, the measured size of this head. Every other changed line is byte-identical to 61b90be.

@github-actions github-actions Bot added readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: passed Eligible automated validation passed for the current revision and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Nov 6, 2026
@CrysisDeu
CrysisDeu force-pushed the crew/bug-resolve/27349 branch from 7002ac9 to 83b11f3 Compare November 7, 2026 17:08
@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 83b11f3
  • What rule changed: no redaction rule changed. This head is a rebase of 7002ac9 onto current main 759bb96. The dashboard's sentence-end check moved from dashboard/chat_turn/turn_reply_seams.py into security/text_redaction.py as ends_plain_sentence, and the Slack native stream now also calls it before a tool card or approval prompt. Main's fix: use an exact check for the word shown at a tool-call pause #30986 replaced that check's regex with an exact letter check (_ASCII_LETTERS / _ASCII_LOWERCASE + redact(run) == run), so the moved copy is now main's new body, unchanged; the PR adds no regex.
  • Before -> after (what was allowed/blocked, now): before, the Slack stream held the redactor's tail run at every tool card and approval prompt, so a message ending "...they've settled." showed "...they've" until the model wrote again. After, only a run that is one plain lowercase-tail word ending in . (and that redact() leaves unchanged) is sent before the card; every other run stays held exactly as on main. The dashboard behaves byte-identically (same function body, imported under its old name).
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a credential fragment shaped like a plain word plus . is sent before the card. The check excludes digits, mixed case after the first letter, _, -, / and lengths over 19, which rules out every credential prefix the redactor knows; it is the rule the dashboard ships on main.
  • Evidence checked (which sandbox result proves it): test/test_slack_stream_held_tail.py pins that 42., AKIA., v2. and hostname.example. stay held at the card, and that a Bearer value split around a tool card after a sentence is still redacted whole. Main's test/test_chat_runner_redact_across_tool_boundary.py cases for fix: use an exact check for the word shown at a tool-call pause #30986 still call turn_reply_seams._ends_plain_sentence, which is the moved function.
  • No regression:
    • Tools still work (which tools/commands were run, result): no tool, command gate or sandbox code changed; only stream text timing.
    • Backward compatible (old config / old data / old callers still work, how checked): no config or stored data involved; the dashboard keeps its _ends_plain_sentence name via an import alias; grep shows the Slack stream and that alias are the only callers.
    • Existing tests (which suites passed on this head): CI is running on 83b11f3. Static gates on the touched files: flake8, isort, black, comment-history, brand.
  • How to undo: revert this commit; the dashboard copy returns to turn_reply_seams.py and the Slack stream goes back to holding the run.
  • Since 7002ac9: rebased onto main 759bb96. Only conflict: _PACKAGE_LINE_BUDGET in test/test_security_gate_liveness.py. Main's package now measures 35,001 against its own 35,001 budget, and this PR adds 31, so the budget is 35,032, the measured size of this head. Main's budget comments are kept; this PR's line is restated from 35,001. Every other changed line is byte-identical to 7002ac9.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision labels Nov 7, 2026
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.
@CrysisDeu
CrysisDeu force-pushed the crew/bug-resolve/27349 branch from 83b11f3 to 8f566fa Compare November 7, 2026 17:41
@CrysisDeu

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 8f566fa
  • What rule changed: no redaction rule changed. This head is a rebase of 83b11f3 onto current main 6f786d9. The dashboard's sentence-end check moved from dashboard/chat_turn/turn_reply_seams.py into security/text_redaction.py as ends_plain_sentence, and the Slack native stream now also calls it before a tool card or approval prompt. Main's fix: use an exact check for the word shown at a tool-call pause #30986 replaced that check's regex with an exact letter check (_ASCII_LETTERS / _ASCII_LOWERCASE + redact(run) == run), so the moved copy is now main's new body, unchanged; the PR adds no regex.
  • Before -> after (what was allowed/blocked, now): before, the Slack stream held the redactor's tail run at every tool card and approval prompt, so a message ending "...they've settled." showed "...they've" until the model wrote again. After, only a run that is one plain lowercase-tail word ending in . (and that redact() leaves unchanged) is sent before the card; every other run stays held exactly as on main. The dashboard behaves byte-identically (same function body, imported under its old name).
  • Worst case if wrong (breaks commands / leaks secret / locks user out): a credential fragment shaped like a plain word plus . is sent before the card. The check excludes digits, mixed case after the first letter, _, -, / and lengths over 19, which rules out every credential prefix the redactor knows; it is the rule the dashboard ships on main.
  • Evidence checked (which sandbox result proves it): test/test_slack_stream_held_tail.py pins that 42., AKIA., v2. and hostname.example. stay held at the card, and that a Bearer value split around a tool card after a sentence is still redacted whole. Main's test/test_chat_runner_redact_across_tool_boundary.py cases for fix: use an exact check for the word shown at a tool-call pause #30986 still call turn_reply_seams._ends_plain_sentence, which is the moved function.
  • No regression:
    • Tools still work (which tools/commands were run, result): no tool, command gate or sandbox code changed; only stream text timing.
    • Backward compatible (old config / old data / old callers still work, how checked): no config or stored data involved; the dashboard keeps its _ends_plain_sentence name via an import alias; grep shows the Slack stream and that alias are the only callers.
    • Existing tests (which suites passed on this head): CI is running on 8f566fa. Static gates on the touched files: flake8, isort, black, comment-history, brand.
  • How to undo: revert this commit; the dashboard copy returns to turn_reply_seams.py and the Slack stream goes back to holding the run.
  • Since 7002ac9: rebased onto main 759bb96. Only conflict: _PACKAGE_LINE_BUDGET in test/test_security_gate_liveness.py. Main's package now measures 35,001 against its own 35,001 budget, and this PR adds 31, so the budget is 35,032, the measured size of this head. Main's budget comments are kept; this PR's line is restated from 35,001. Every other changed line is byte-identical to 7002ac9.
  • Since 83b11f3: rebased onto main 6f786d9 (main moved and conflicted again within the hour). Same conflict: main's package now measures 35,005 against its 35,005 budget, and this PR adds 31, so the budget is 35,036, the measured size of this head. Every other changed line is byte-identical to 83b11f3.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Nov 7, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@bolichen97
bolichen97 merged commit 347225f into main Nov 7, 2026
102 of 104 checks passed
@bolichen97
bolichen97 deleted the crew/bug-resolve/27349 branch November 7, 2026 19:09
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 7, 2026
bolichen97 pushed a commit that referenced this pull request Nov 9, 2026
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).
bolichen97 added a commit that referenced this pull request Nov 9, 2026
…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.
bolichen97 added a commit that referenced this pull request Nov 9, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: chat row loses its last word while the following tool call runs

3 participants