Repository navigation
fix(slack): spool the pre-ingestion message, not temp paths and file bodies - #21829
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Check one thing: a Slack message that is only a voice memo now spools empty text with What this change shipsInventory (6 items) — 6 justifiedIntent: a Slack sender whose message was refused at shutdown gets their own words back after restart, plus how many files to resend. This is a FIX for the
[FIRST-PRINCIPLES-REVIEWED] f47d32f Description read[DESCRIPTION-READ] 0ed213473147ad30192959f969dedc97a1a0d399179cc295b237fce859f50251 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Check that a refused Slack message with a pasted table, or with only a voice memo, still spools useful text, since [DESIGN-REVIEWED] f47d32f Description read[DESCRIPTION-READ] bcae53553cae87114c0f46890ebe2f7891c84196fb8c330e6cb74e1dd3561ea3 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: |
|
|
f214b98 to
407a4cd
Compare
407a4cd to
7646a0a
Compare
|
|
7646a0a to
d5bf760
Compare
|
|
|
Review-ready at d5bf760: PR Readiness passed with 103 checks and no failures, the branch is mergeable, and every Design and First Principles item on this head has an answer above. The one code change from review (span=552dbfa89c81, reuse |
d5bf760 to
f47d32f
Compare
|
Rebased onto #21040 (merged), which moved |
|
|
|
Review-ready at f47d32f: PR Readiness passed with 106 checks and no failures, the branch is mergeable, and both whole-design items on this head have an answer above. This head is rebased onto #21040 (merged); the spool plumbing runs through |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Every review lane on the head is clean (only runner notices and PR Scope size warnings); held by the triage cron on a path, category, checklist or P0-area rule, not a finding. Approved on the watch holder's request.
Problem / Motivation
Goal: A Slack message refused at shutdown comes back after restart as what the user typed, plus how many files it had, never as dead temp paths and pasted file contents.
When a Slack message with files is refused by the shutdown gate, the restart notice quotes the turn's ingested prompt. That prompt holds the temp paths of the downloaded files (gone after the restart) and the extracted text of each file. It also says nothing about the files being dropped.
Why it matters
The restart notice is meant to show the sender their own message so they can resend it. On Slack it shows them a wall of temp paths and file bodies instead, and it never tells them to resend the files. Telegram, Discord, Teams and Webex already record the file count, and Weixin, WeCom and WhatsApp spool the pre-ingestion text. Slack does neither, which breaks the
InboundRoute.textcontract insrc/kiro_crew/messaging/inbound_spool.py.Not a goal
What changed (motivation → approach → change)
The Slack restart notice quoted the ingested prompt because both Slack refusal paths built their
InboundRoutefrom the sametextthe turn runs on, and_route_messageinslack/events.pyrewrites that string in place with temp paths and file contents before the handler sees it._route_messagenow captures the user's message (mention stripped, before voice transcription and file ingestion) and the file count, and hands both on asspool_text/spool_attachmentson every dispatch path: direct native, direct transport, and the busy-session queue (_dispatch_queuedreads them back). This is the same capture Weixin, WeCom and WhatsApp already do.handle_messageinslack/handler.pyandhandle_message_transportinslack/transport_dispatch.pyuse those two values only for the spool route: the admission gate refusal, and the transport'sSessionClosingErrorrefusal. They setattachments_dropped, so the notice says how many files to resend._SlackTurninslack/handler_runtime/turn.pycarries both values, so a compaction-failure replay of the same message spools them too. Whenspool_textisNone(button and interaction re-dispatches, which never ingest files), the text is spooled as before. The durable inbound spool section ofdocs/system-specs/modules/messaging.mdnames Slack's capture beside Weixin's and WhatsApp's.Backwards compatibility
Compatible: both new parameters are optional keywords that default to today's behavior, and the turn's own prompt is unchanged.
Removes nothing: the spool keeps every field it had; only the Slack route's
textchanges from the ingested form to the pre-ingestion form, andattachments_droppedgoes from always 0 to the real count.Tests
TestRouteMessageAttachments::test_spool_gets_the_pre_ingestion_message(native + transport)spool_text="look"(mention stripped) withspool_attachments=2for the spoolTestRouteMessageAttachments::test_busy_session_queues_the_pre_ingestion_messageTestDispatchQueued::test_pre_ingestion_message_travels_to_the_handler(native + transport)TestTransportAdmissionSpool::test_spool_records_the_pre_ingestion_message(admission + dispatch)TestTransportAdmissionSpool::test_native_admission_spools_the_pre_ingestion_messageTestPastedTableBlocksintest/test_events_forward.pyspool_textrepeats the message for the spoolWith the three production files reverted to
origin/main, 8 of the 9 new cases fail by name; the one that passes is the no-capture case, which pins unchanged behavior.Determinism: the 9 new node ids and the 7
TestPastedTableBlocksids each ran 20 times at-n0(all green). The three changed test files ran 10 times at-n 4 --dist loadgroup --max-worker-restart=2(10/10 green). All 222 node ids in those files passed in a shuffled order, seed 4995.Manual verification
N/A — unit coverage sufficient: the change is argument plumbing between
_route_messageand the two spool routes, and the tests drive each refusal point with the real handler.Related Issues
Part of #8911
Built on top of #21040 (merged), which moved
handle_message's body intoslack/handler_runtime/.Pattern harvest
Rule candidate: review-prompt
Pattern: a channel builds its shutdown-spool
InboundRoute.textfrom the turn's ingested prompt instead of the pre-ingestion message.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)