chore(channels): remove confirmed dead code in the messaging channels - #6876
Conversation
Five symbols with zero references anywhere in the repository, each confirmed
superseded or orphaned rather than merely un-called by a static scan.
- slack/blocks.py `config_panel` — emits inline `mc_config_{key}` toggles. The
router has no `== "mc_config_*"` branch and no `startswith("mc_config")`
branch; the live config path is the modal view handler
`register_view_handler("mc_config_panel", ...)` reading
`values["channels_block"]["mc_config_channels"]`. Unroutable.
- slack/blocks.py `agent_buttons` — emits `mc_agent_select_{name}` /
`mc_agent_select_off`, but the router matches `action_id == "mc_agent_select"`
by exact equality (interactions.py:859) and the live producer is the
static_select at events.py:334. Unroutable.
- discord/transport_dispatch.py `_receipt_finish_cancelled_locked` — orphaned
member of a live family: the sibling `_receipt_flip_locked` IS called
(transport_dispatch.py:808), while teams/webex call
`self._queue.finish_cancelled_locked(...)` directly rather than wrapping it.
- discord/session_resume.py `_history_dashboard_key` — superseded by the shared
`messaging/session_resume.py::history_dashboard_key`, which is used at
session_resume.py:236 and tested in test/test_teams_sessions.py.
- discord/renderer.py `_options` — orphaned by #5716, which gave the
`[OPTIONS:]` trailer parse one owner. `_extract_options` remains used at
renderer.py:675, 831, 833.
No test companions to delete: all five have zero references under test/ too.
No behaviour change — none of the deleted code was reachable.
Held back deliberately (reported in the PR body): prompt_allowlist,
confirmation_dialog, build_subagent_ack_block, send_message_draft,
MessageContext, CallableReactionSink.
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 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: |
Design Review (Fable 5) — ✅ PASSDesign-level review of All verified: the four deleted names have zero references repo-wide, Design-Verdict: PASS Verified pure dead-code removal — every zero-reference claim checks out against the repo, and the held-back unwired features are correctly left for a product decision. [DESIGN-REVIEWED] 3c9bb91 |
Opus 4.8 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: |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of All verification complete — every claimed zero-reference deletion checked out under my own greps, deleted symbols' callees retain live callers, and the shared replacement for the deleted duplicate exists and is tested. Final review: First-Principles-Verdict: PASS Pure subtraction: five symbols with independently verified zero references removed, nothing added, no capability a user or component could reach is lost. What this change shipsIntent: shrink the messaging-channels code surface by deleting confirmed-dead symbols — a FIX (of accumulated dead surface), 122 lines deleted, 0 added.
All counts above are greps I ran, not the author's. The description's held-back list (unwired features like [FIRST-PRINCIPLES-REVIEWED] 3c9bb91 |
chenmingwei23
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: chore/refactor (4 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, SAST annotations clean (Semgrep+CodeQL success, 0 annotations, 0 open alerts), security checklist all-NO, AI reviewers green. Category: removes confirmed dead helper functions (_options, _history_dashboard_key, _receipt_finish_cancelled_locked, config_panel, agent_buttons) in the messaging channels, pure deletion with no behavior change.
bolichen97
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: refactor (4 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, SAST annotations clean, security checklist all-NO, AI reviewers green. Category: dead-code removal only (pure deletions, -122 lines); all four deleted symbols (config_panel, agent_buttons, _history_dashboard_key, _receipt_finish_cancelled_locked) verified unreferenced on current main — remaining config_panel search hits are the unrelated mc_config_panel callback-id string.
NicholasRBowers
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: chore (4 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, SAST annotations clean, security checklist all-NO, AI reviewers green. Category: deletion-only dead-code removal (unused Discord renderer/_options helper, unused history-key and cancelled-receipt helpers, unused Slack config_panel/agent_buttons block builders); no remaining references verified by full-tree grep (mc_config_panel string matches are an unrelated callback id), no runtime impact; already human-APPROVED.
What
Removes five symbols from the messaging-channels group that have zero references anywhere in the repository. 122 deleted lines, 0 added, no behaviour change.
Scope was
src/kiro_crew/{slack,discord,telegram,teams,webex,wecom,weixin,whatsapp,imessage,feishu,messaging}/pluschannel.py,channels.py,channel_history.py,channel_transcript_migration.py. Nothing outside that group is touched.How the candidates were found
Three independent passes, because one scanner is not enough here:
vulture --min-confidence 60tokenizereal NAME tokens repo-wide, def sites subtracted (docstrings/comments cannot register as references)Intersection: 18. Each survivor then went through a five-step confirmation: repo-wide word-boundary sweep across
.py .ts .tsx .js .md .json .yml .yaml .toml .sh .ps1includingtest/,docs/,system-specs/,builtin_skills/,error-code-baseline.json,config-baseline.json,.github/andwebsite/src; dynamic-reference sweep (getattr/setattr/globals()/importlib/__all__/ string-form names); action-id routing-table check againstslack/interactions.py; public-surface check; and a 30-day introduction gate.The cross-channel copy-paste risk was real and it caught things. Vulture's largest block —
fetch_history/configured_targets/may_send_toacross ninetransport.pyfiles — is Protocol implementation dispatched throughmessaging.transport.MessageTransport, not duplicated dead code. Rejected wholesale. The six WhatsApp_on_qr/_on_pair/_on_connected/_on_disconnected/_on_logged_out/_on_banfunctions are@client.event(QREv)-registered whatsmeow handlers — the exact event-dispatch trap. Also rejected.Deleted
config_panelslack/blocks.py:94action_id=mc_config_{key}toggles. The router has no== "mc_config_*"branch and nostartswith("mc_config")branch. The live config path is the modal view handlerregister_view_handler("mc_config_panel", ...)readingvalues["channels_block"]["mc_config_channels"](interactions.py:220,262) — a different mechanism entirely. First-add 2026-07-16.agent_buttonsslack/blocks.py:203mc_agent_select_{name}/mc_agent_select_off, but the router matchesaction_id == "mc_agent_select"by exact equality (interactions.py:859) and the live producer is the static_select atevents.py:334. Superseded pre-select-menu implementation. First-add 2026-07-16._receipt_finish_cancelled_lockeddiscord/transport_dispatch.py:881_receipt_flip_lockedis called (transport_dispatch.py:808), and teams/webex callself._queue.finish_cancelled_locked(...)directly instead of wrapping it. No dispatch pairing. First-add 2026-07-21._history_dashboard_keydiscord/session_resume.py:123messaging/session_resume.py::history_dashboard_key, which is used (session_resume.py:236) and tested (test/test_teams_sessions.py:858-862). Private copy left behind when the helper was hoisted tomessaging/. First-add 2026-07-30._optionsdiscord/renderer.py:1306[OPTIONS:]trailer parse one owner". The 6 grep hits for the name are unrelated_optionsparameters inwebsite/vite.config.ts,website/electron/test/windows-port.test.jsandtest/test_platform_compat_coverage.py._extract_optionsitself stays — still used atrenderer.py:675,831,833. First-add 2026-07-21.No test companions were deleted — all five have zero references under
test/as well, so nothing had to be rewritten.Deliberately NOT deleted
Six symbols the scanners flagged and I am holding. Four of them are not cleanup questions at all — they are unwired features whose deadness is itself the defect, and the right fix is wiring, not deletion.
prompt_allowlistslack/allowlist.py:95docs/system-specs/modules/slack-gateway.md:12,28,231documents it as live behaviour: "When a user joins a monitored channel,prompt_allowlist()sends Allow/Deny to the owner". Its siblingprompt_track_channelis wired (events.py:62,1429). This is an authorization gate that never fires. Needs a maintainer decision.confirmation_dialogslack/blocks.py:153mc_stop_confirm/mc_stop_cancel, both of which have live handlers (interactions.py:724,727). Zero callers ⇒ that confirm flow is currently unreachable. Deleting the builder is behaviour-neutral today but removes the only path to a shipped handler. Wire-or-remove is a product call.build_subagent_ack_blockslack/format.py:315build_cron_ack_block, which is called (gateway.py:4633), with the prefix swapped. Sole producer ofSUBAGENT_ACK_ACTION_PREFIX, whose handler_handle_subagent_ackis live (interactions.py:687,2077) but therefore unreachable — subagent notifications lost their Acknowledge button. Same wire-or-remove call.send_message_drafttelegram/client.py:876test/test_telegram.py:125, so removal is a refactor (rewrite the test double), not a deletion — and dropping a shipped streaming feature is a product decision.MessageContextslack/handler.py:1351handler.py:2607actively advertises it ("New callers can useMessageContextto group the service parameters"). Deleting it would also mean editing a docstring inslack/handler.py, a hot conflict file.CallableReactionSinkmessaging/status_reactions.py:186docs/system-specs/modules/messaging.md:397, and first-add 2026-08-23 — inside the 30-day new-code gate.Also held under the 30-day gate:
_display(discord/session_resume.py:226, first-add 2026-08-18), andResumeSurface/post_picker/settle_picker(messaging/session_resume.py, first-add 2026-08-23) which are aProtocoldeclaration and its method stubs, implemented structurally per channel.Verification
pytest -k "discord or slack or blocks or receipt or session_resume").test_discord*.py,test_queue_receipt.py,test_slack_interactions_coverage.py,test_slack_events_coverage.py,test_action_interactions.py,test_slack_renderer.py,test_telegram.py,test_slash_task_tracking.py,test_teams_sessions.py,test_security_posture.py— all green.flake80 ·isort --check-only0 ·mypy src/kiro_crew/clean across 1167 files · black gate 0 (baseline-aware; the pre-existing unformatted spans inslack/blocks.pyare untouched, and this diff removes one of them).confirmation_dialog,deprecation_warning_block,voice_config_modal,session_task_card,command_hint_block,dashboard_link_block,_receipt_flip_locked,_receipt_surface,_picker_components) is intact.discord/transport_dispatch.py(feat: AgentCore login attach and consent #6600, feat: AgentCore principal propagation (default-off) #6595, fix: verify name-grant program identity on all auto-approve surfaces (#6361) #6504, feat: add staged acp adapter admission #6307, feat: expose session monitors to agents #5184, refactor: account for completed monitor turns #5182), all additive and none within the deleted hunk — verified by diffing feat: expose session monitors to agents #5184 (the largest, +188/-97) against the receipt-wrapper region.No linked issue: this is a self-directed cleanup pass over one file group; the
#NNNNreferences above are provenance citations for when a symbol was orphaned, not issues this PR closes.