Skip to content

feat: name dropped attachments in the slack restart notice - #36477

Merged
bolichen97 merged 1 commit into
mainfrom
fix/8911-slack-attachment-names
Nov 19, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/8911-slack-attachment-names

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A Slack user whose message was refused while the gateway restarted is told which files to resend, not only how many.

A message that arrives while the gateway shuts down is answered on the next start with a restart notice. Discord, Telegram, Teams, WeCom, Weixin and WhatsApp DMs already name the dropped files there. On Slack the notice still said only "Its 2 attachment(s) are not carried over — resend those too.", because Slack takes the file count before ingestion and handed it on as a bare number.

Why it matters

The notice exists so a resend is one step. A count leaves the user guessing which of the files they sent were lost, and a Slack message often carries several. Slack is the last channel the messaging spec still lists as "the count, until its names land (#8911)", so this finishes the per-channel decision the issue asks for.

Not a goal

What changed (motivation → approach → change)

Slack now takes each file's own name at the point it already took the count, in _route_message, before voice transcription and file ingestion rewrite the message. The names ride beside the count, as spool_attachment_names, everywhere the count already goes: the busy-session queue, the native handler (and its compaction replay) and the transport handler. All three Slack refusal routes put them in InboundRoute.attachment_names, so the restart notice lists them. A file Slack sends without a name is passed as an empty name, which the store drops and the notice still counts as "and 1 more".

Where What
slack/events.py captures one name per file beside _spool_attachments and hands it to the queue and both handlers
slack/events_queue.py _dispatch_queued carries the queued names to the handler
slack/handler.py, slack/handler_runtime/turn.py handle_message puts the names on its admission route and keeps them for the compaction replay
slack/transport_dispatch.py handle_message_transport puts them on its admission route and its shutdown-dispatch route
docs/system-specs/modules/messaging.md the per-channel table moves Slack to "the names"

Backwards compatibility

Compatible: spool_attachment_names is a new keyword that defaults to empty, so every existing caller of handle_message and handle_message_transport (button and interaction re-dispatches included) spools exactly what it did before; the spool entry and the notice are unchanged.

Removes nothing: no field, key or behaviour is taken away; the count each Slack route records stays the same.

Tests

  • test/test_slack_events_coverage_route_flow.py::TestRouteMessageAttachments::test_spool_gets_the_pre_ingestion_message (native and transport) — a message with a named and an unnamed file hands ("shot.png", "") and a count of 2 to the handler.
  • test/test_slack_events_coverage_route_flow.py::TestRouteMessageAttachments::test_busy_session_queues_the_pre_ingestion_message — the busy-session queue keeps the names.
  • test/test_slack_events_coverage_route_flow.py::TestDispatchQueued::test_pre_ingestion_message_travels_to_the_handler (native and transport) — a queued message's names reach the handler.
  • test/test_slack_transport_dispatch.py::TestTransportAdmissionSpool::test_spool_records_the_pre_ingestion_message (admission and dispatch) — both transport refusal routes carry the names.
  • test/test_slack_transport_dispatch.py::TestTransportAdmissionSpool::test_native_admission_spools_the_pre_ingestion_message — the native admission route carries the names; an interaction re-dispatch carries none.

Each of these assertions fails on the base (8 failures, all on the new spool_attachment_names / attachment_names checks) and passes with the change. Determinism, on Linux hosts: the 9 changed node ids passed 20 runs at -n0; both files (128 tests) passed 10 runs at -n 4 --dist loadgroup --max-worker-restart=2 on earlier bases and 3 on the current one; shuffled runs of all 128 ids passed with seeds 27558, 15023, 8713 and 12025.

Related backend set (scripts/local-gate.py, all seven batches) on a Linux host: every test passed except five outside the Slack code. Four fail the same way on a clean checkout of the base: test/test_dashboard_server_composition_contract_reach.py::test_the_dashboard_boot_keeps_its_chain_hooks_and_order (a built static/dist in the clone), test/test_host_git_repo_exec_neutralization.py::TestCliUpdate::test_up_to_date_diff_runs_no_textconv_planted_during_the_fetch (host git state), and test/test_live_target_pointer_visibility.py::TestTheSiblingRefusalsAreDefusedToo::test_a_strict_file_stat_failure_is_defused[fstat] and test/test_sandbox_mount_pinned_target.py::test_a_stand_in_whose_identity_cannot_be_read_refuses_with_the_blocked_line (an EIO from the host filesystem). The fifth, test/test_push_guard_diagnostics.py::TestPushGuardChildren::test_a_signal_inside_popen_wait_still_reaps_the_child, failed under parallel load and passes alone on the base and on this branch. mypy, flake8 and isort over the tree, semgrep on the diff and the flake-pattern ratchet pass.

Manual verification

Driven on a Linux host through the real code path, with only the Slack Web API client, the file download and speech-to-text stubbed: _route_message with the text see attached and two files (report.pdf and one with no name), both handler paths, a real SessionManager with admission paused for an update, so admit_inbound_callback spools the message to a temp KIROCREW_HOME; then the boot-time replay_spooled posts the notice to a stub transport.

Before (base), both paths:

> see attached
>
> (Its 2 attachment(s) are not carried over — resend those too.)

After, both paths:

> see attached
>
> (Its 2 attachment(s) are not carried over — resend those too: report.pdf and 1 more.)

A text-only message still gives the quoted text with no attachment line.

Screenshots / video

N/A — no frontend change; the notice is chat text.

Related Issues

Closes #8911

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 (see CONTRIBUTING.md).

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 0f87abe6285195e78e2f10ad2c44304459c973cc 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 13, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: this adds an optional keyword, defaulting to empty, through the paths that already carry the count, and reuses the existing store and notice rendering unchanged.

[DESIGN-REVIEWED] 0f87abe

Description read

[DESCRIPTION-READ] 997a2b9df9ec4ffc3d478f61f24bab125745b63598c95df6ea561d2a6e967aee

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 13, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 0f87abe6285195e78e2f10ad2c44304459c973cc — 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

Nothing blocks: the change finishes Slack's entry in the spec's per-channel table (the decision tracked as #8911), and every item is consumed by the restart notice.

Notes

  • Item 2 — oversized: Slack now passes two values that always agree. spool_attachments is len(files) and _spool_attachment_names = tuple(f.get("name") or "" for f in files) keeps an "" entry for every unnamed file, so its length is always that count. Both are threaded through about 6 sites (queue, both handlers, the turn state).
    Subtraction: delete the spool_attachments parameter from handle_message and handle_message_transport, and set the route's count from len(spool_attachment_names).

What this change ships

Inventory (3 items) — 2 justified

Intent: a Slack user whose message was refused during a restart learns which files to resend. This is an ADDITION.

  1. The Slack restart notice now lists the dropped files by name ("report.pdf and 1 more"), not only how many — justified
  2. File names travel with the count through the busy-session queue, the native and transport handlers and the compaction replay — oversized: the separate count parameter repeats len(names)
  3. The messaging spec moves Slack from "the count" to "the names" — justified

[FIRST-PRINCIPLES-REVIEWED] 0f87abe

Description read

[DESCRIPTION-READ] 3401d62d092ae40958114e6e9cd62b9a275a0737a5969d1febebe5caf3cb1eb8

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 13, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 0f87abe6285195e78e2f10ad2c44304459c973cc — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 0f87abe

Verdict parsed from the review's SHA-scoped output markers for commit 0f87abe6285195e78e2f10ad2c44304459c973cc.

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

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 0f87abe6285195e78e2f10ad2c44304459c973cc and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 0f87abe

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

@bolichen97
bolichen97 enabled auto-merge (squash) November 13, 2026 07:50
@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 13, 2026
@bolichen97
bolichen97 force-pushed the fix/8911-slack-attachment-names branch from f4e7f71 to cc0ad0c Compare November 13, 2026 14:29
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in docs/system-specs/modules/messaging.md, handler.py and handler_runtime/turn.py since this head was checked (2f7e9f2 -> c22557c); CI re-running.

The red Backend Lint & Type Check (3.12) on the previous head was main's: a mypy error in src/kiro_crew/cli_commands_memory.py, a file this PR does not touch, fixed on main by #36457. The rebase was clean and the patch is unchanged (same patch id).

[operator: bolichen97]

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 13, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

Stale-PR cleanup: we did not push here because the linked issue #8911 still carries the needs-human label. @bolichen97, if your Linux smoke test covers that human step, please drop the label (or say so) and rebase; the red Backend Tests (3.12, 3) on this head is test/test_mate_conductor_parity.py::test_every_shared_rule_has_an_ultra_counterpart_or_a_named_gap (goal_plan), which this PR does not touch.

@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in docs/system-specs/modules/messaging.md, events.py, events_queue.py, handler.py, handler_runtime/turn.py, transport_dispatch.py and both changed test files since this head was checked (c22557c -> 26d70ef); CI re-running.

The red Backend Tests (3.12, 3) and Backend Tests (Windows) (3) on the previous head were main's: test/test_mate_conductor_parity.py::test_every_shared_rule_has_an_ultra_counterpart_or_a_named_gap (shared rules with no Ultra Mode counterpart: ['goal_plan']), a test this PR does not touch, fixed on main by #36652 after this PR's base. Coverage Gate and PR Readiness were the cascade. The rebase was clean and the patch is unchanged (same patch id).

[operator: bolichen97]

@bolichen97
bolichen97 force-pushed the fix/8911-slack-attachment-names branch from cc0ad0c to 160899e Compare November 19, 2026 11:40
@bolichen97

Copy link
Copy Markdown
Contributor Author

[operator: bolichen97] @iamwhatever thanks for checking. The step needs-human was waiting on was the design call on what the restart notice carries for a dropped attachment. It was settled and recorded in the messaging spec by #30718 (the file names, through the existing quoting and length cap, with no re-download), and #30718 and #31729 applied it to six channels. The Linux repro and smoke test for this last channel are on #8911. Nothing on the issue waits on a person now except the review of this PR, so I have dropped the label.

This PR is rebased onto a main that carries #36652, which fixes the goal_plan red you named; CI is re-running.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 19, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

[operator: bolichen97] The red Backend Tests (3.12, 7) on this head does not come from this change. test/test_source_link_github_case.py::TestOneChipPerObject::test_case_variants_collapse_to_one_chip[https://github.com/KiroDotDev/KiroCrew/pull/21991] fails with assert 0 == 1 when an earlier test in the same worker leaves the session-card chips switched off (flaky-test report #39460). main fixed that leak in #39470, after this branch's base (26d70ef). Coverage Gate and PR Readiness are red only because of that shard.

Every main commit that carries #39470 is red right now on test/test_process_cache_floor_ratchet.py::test_every_new_module_level_cache_has_a_per_test_reset (#39478). #39479 fixes that. Once #39479 merges, this PR rebases onto main with both fixes and CI runs again.

A Slack message refused at gateway shutdown comes back on the next
start as a restart notice. It said only how many files were lost,
because Slack took the count before ingestion and handed it on as a
bare number.

Slack now takes each file's own name at the same point and carries it
beside the count, through the busy-session queue, to both refusal
routes, so the notice lists which files to resend. A file Slack gives
no name is still counted. The messaging spec's per-channel table moves
Slack to "the names".

Closes #8911
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in docs/system-specs/modules/messaging.md, events.py, events_queue.py, handler.py, handler_runtime/turn.py, transport_dispatch.py and both changed test files since this head was checked (26d70ef -> be1ce64); CI re-running.

The rebase onto current main was clean and the patch is unchanged (same patch id), so no code changed in this round. The red Backend Tests (3.12, 7) on the previous head was not this change: test/test_source_link_github_case.py::TestOneChipPerObject::test_case_variants_collapse_to_one_chip[https://github.com/KiroDotDev/KiroCrew/pull/21991] failed with assert 0 == 1 because an earlier test on the same worker left the session-card chips switched off (recorded in #39503). main fixed that leak in #39470, which the new base carries. Coverage Gate and PR Readiness were red only because of that shard.

[operator: bolichen97]

@bolichen97
bolichen97 force-pushed the fix/8911-slack-attachment-names branch from 160899e to 0f87abe Compare November 19, 2026 20:23
@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 19, 2026
@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider estimates a 6% chance that this change introduces a defect, within the 12% limit for approving on its own, but it is held at tier 2: the title's category is not one of fix, test, chore, refactor.

Slack now records each file's name next to the count before ingestion and passes the names through every place the count already goes: the busy queue, the native handler with its compaction replay, and the transport handler. All three Slack refusal routes put the names in InboundRoute.attachment_names. The existing store and notice code then drop blank names, bound and defang the rest, and count unnamed files as "and N more". The envelope-level admission check passes route=None, so it saves nothing. The new keyword defaults to empty, so re-dispatches behave as before. Tests cover each hop, and CI and all review lanes are green.

Tier: 2, held for a person: the title's category is not one of fix, test, chore, refactor.

An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit 0f87abe628 · 82 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed head 0f87abe. The file names Slack captures before ingestion now travel next to the existing count through the busy-session queue, the native handler and its compaction replay, and the transport handler. All three Slack refusal routes put them on the spool route. The store already drops unnamed entries and the notice still counts them, so a message with both named and unnamed files gets a correct notice. The new keyword defaults to empty, so re-dispatches spool exactly what they did before. The changed Slack test files and the spool tests pass on this head, and I found nothing that blocks.

@bolichen97
bolichen97 merged commit 3248ab5 into main Nov 19, 2026
99 checks passed
@bolichen97
bolichen97 deleted the fix/8911-slack-attachment-names branch November 19, 2026 21:48
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 19, 2026
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.

Inbound shutdown spool carries text only — attachments are not replayed

3 participants