Skip to content

refactor(slack): split interactions.py and events.py into owner modules - #22079

Merged
bolichen97 merged 1 commit into
mainfrom
refactor/linecap-s24-interactions
Oct 20, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
refactor/linecap-s24-interactions

Conversation

@bolichen97

@bolichen97 bolichen97 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Bring slack/interactions.py (3,892 lines) and slack/events.py (3,718 lines) under the 2,000-line cap without changing what either does, so new Slack interaction and event-routing work lands in modules sized for it.

Both files are past the repository's 2,000-line cap for hand-written files and are listed in .github/file-line-cap-baseline.txt; events.py had already grown 33 lines past its row. Every Block Kit handler (tool approvals, OPTIONS, session controls, the settings modals, review drafts) shares one file, and every slash command, the Home tab, the block-text recovery, the session queue and the message router share the other.

Why it matters

A file over the cap makes every feature PR that touches it grow a baselined file, which the line-cap guard reports and the campaign must later undo. Both files are edited every week (events.py took 6 commits in the 7 days before this branch).

Not a goal

  • No behaviour change: every moved definition keeps its body; the one code edit is listed under Move audit.
  • No change to which names kiro_crew.slack.events and kiro_crew.slack.interactions offer, or to how a test patches them.
  • No decomposition of _route_message or dispatch: each stays one function.
  • No change to the open CodeQL alert in _route_message: the router stays in events.py, so the alert stays where it is.

What changed (motivation → approach → change)

Each file becomes a mirror facade (kiro_crew._facade_mirror, the shape cli_server.py and mcp_shared.py use) over sibling owner modules. The facade keeps every line of its import header, adding only the mirror's glue imports, keeps the code that sits on top (and, in interactions.py, imports the owner names that code reads), imports its owners, and serves every name they define, so kiro_crew.slack.events.<name> and kiro_crew.slack.interactions.<name> resolve as before, and a monkeypatch.setattr or mock.patch through the facade reaches every module that holds the name.

File Keeps Owners (lowest layer first)
interactions.py 3,892 → 874 init, dispatch, _handle_resume_choice (with _resume_locks and _RESUME_TAB_CLOSED_MSG) interactions_context.py 160 (the _orch slot, the view registry, the acknowledge buttons), interactions_modals.py 592, interactions_settings.py 561, interactions_options.py 853, interactions_sessions.py 682, interactions_approvals.py 511
events.py 3,732 → 1,516 init_socket_mode, _route_message events_block_text.py 456, events_queue.py 380, events_slash.py 821, events_home_tab.py 442, events_voice.py 188, events_inbound.py 279

_handle_resume_choice stats the session file inside its async def, a call the sync-io gate's fs baseline records against interactions.py, so it stays there with dispatch, its one caller; the facade imports, in owner order, the 35 owner names those two read. Every interactions owner reads _orch, and a global rebind in init() would reach only the facade's namespace. init stays in the facade and writes it through the facade (setattr(_sys.modules[__name__], "_orch", orchestrator)), so the mirror sets it in the facade and every owner; that is the one edited line of code. The owners log under their facade's name; the slash-command and view-callback registrations run at import beside their handlers, in the original order (the Forward to Agent submission is registered by init(), as before). The slack-gateway spec gains an owner map; registries keyed by path follow the moved code; and the facades get per-file F401 ignores in setup.cfg, backed by import inventories.

Backwards compatibility

Compatible: every name either module bound before the split still resolves on it and is the same object (test/campaign_facade_inventories/kiro_crew.slack.interactions.json, kiro_crew.slack.events.json), and a patch through either facade reaches every owner holding the name (test_interactions_facade.py, test_events_facade.py, test_facade_mirror_guards.py).

The take-away check flags the public defs that moved to owners; each is still served by its facade:

Reader: src/kiro_crew/slack/gateway_runtime/service_boot.py:run -- chat -- its function-local from kiro_crew.slack.events import SeenCache, init_socket_mode and from kiro_crew.slack.interactions import init resolve through the facades (test_slack_gateway_run.py)
Reader: src/kiro_crew/slack/interactions_sessions.py:_handle_stop_confirm -- chat -- its function-local from kiro_crew.slack.events import _entry_owner, slack_stop_in_flight resolves through the events facade, which serves slack_stop_in_flight from events_queue (test_stop_clears_only_its_own_sender_slack.py)
Reader: src/kiro_crew/slack/interactions_sessions.py:_handle_inline_stop -- chat -- the same facade import of slack_stop_in_flight (test_slack_inline_stop.py)
Reader: src/kiro_crew/slack/events_slash.py:register_slash_command -- chat -- the ten sub-command registrations run beside it at import, in the original order (test_events_facade.py)
Reader: src/kiro_crew/slack/interactions.py:init -- chat -- the facade binds register_view_handler from interactions_context for the forward shortcut (test_interactions_facade.py)
Reader: src/kiro_crew/slack/interactions.py:dispatch -- chat -- reads handle_view_submission and handle_view_closed as facade globals bound from interactions_modals, so a facade patch reaches it (test_slack_interactions_coverage.py)
Reader: src/kiro_crew/slack/interactions_sessions.py:_handle_stop_confirm -- chat -- calls ack_button from interactions_context, the object the facade serves (test_slack_interactions_coverage.py)

Move audit

move_audit.py --base <merge-base> --head <this head>:

src/kiro_crew/slack/interactions.py: 3892 -> 874 lines; moved 99.81% (python-ast)
   changed: init [FunctionDef] 7 lines
src/kiro_crew/slack/events.py: 3732 -> 1516 lines; moved 99.58% (python-ast)
   changed: Expr [Expr] 14 lines
  • init (7 lines): global _orch / _orch = orchestrator became setattr(_sys.modules[__name__], "_orch", orchestrator) with a comment. This is the one code edit, granted by the campaign Master.
  • events.py's module docstring (the Expr unit): its sentence about the dedup cache now says the cache lives in events_inbound; prose only.
  • Comment-only edits in moved code (AST unchanged): interactions_modals.py "Used to neutralize" -> "It neutralizes" (comment-history gate).
  • Black reformats moved lines of events.py (a file the black baseline lists) in the new owners, which must be black-clean; the AST is unchanged. events.py itself keeps its unformatted router and stays in the black baseline.

L36 parity (default diff vs --minimal, identical + lines): 52 of the 53 changed files are equal, events.py 100/2316 both; interactions.py is covered by the L41 exception the campaign Master granted for it (below). Diff size: 693,971 bytes.

L41 exception, src/kiro_crew/slack/interactions.py: the default diff adds 129 lines, --minimal 101. The default diff re-shows new-file lines 581-620 (27 non-blank lines: _resume_locks, the _RESUME_TAB_CLOSED_MSG assignment and the first 22 lines of _handle_resume_choice, through if not session_key: return) and the blank line 822. All are byte-identical kept code: the start of the kept run that follows the 1,818-line deletion between dispatch and the resume choice. No added-line gate token is on them, every added-line gate passes on the default diff, and neither fs call of the resume choice is among them. Layout search (default/minimal, difference):

Layout default/minimal diff
owner bindings in the import header 180/111 69
at the foot, after the mirror comment, isort order 128/99 29
at the foot, before the comment 127/99 28
at the foot, one grouped import per owner 138/111 27
before dispatch (one per line / grouped) 127/100, 139/112 27
before _resume_locks (one per line / grouped) 126/99, 138/111 27
import kiro_crew._facade_mirror as vs from kiro_crew import no change -
also keeping _handle_session_resume (three placements) 133/98, 131/98, 139/110 35, 33, 29
keeping only _handle_resume_choice (three placements) 168/101, 166/101, 178/113 67, 65, 65
dispatch left in an owner (not runnable: it would need the facade) 126/100 26
shipped: at the foot, in owner order 129/101 28

Tests

  • test/test_interactions_facade.py, test/test_events_facade.py (new, 65 tests): the test trees' patch targets through each facade reach every module holding the name (with a non-vacuity scan of known seams); the owner list, its layering and that no owner imports its facade; that dispatch and the resume choice stay in the facade; init writes _orch into the facade and every owner, a second init rebinds them all, and a patch of interactions._orch reaches each of them; each runtime-rebound global (_skills_loader, _home_tab_collect_sem) lives with its writer and every reader; a fresh import registers the view callbacks and the ten slash commands in the original order, each as the function the facade serves; every owner imports on its own, before its facade; every BASE public name and every served name type-checks through the facade; the owners log under the facade name; and the import inventory that stands in for F401: an import is accounted for when the module had it before the split, when it is the glue's own or names what its owner defines, or when the family's own code reads it; a planted self-test shows an import nothing reads, and an owner import of a name that owner does not define, both fail, while an import a kept function reads passes. They pin the BASE names, registrations and rebound globals as subsets, never as an exact namespace, so a later addition to either facade does not trip them.
  • test/test_interactions_approvals.py, test/test_interactions_options.py (new, 68 tests): the native tool-approval press, the review-draft handlers' refusals and cleanups, the auth-denied ephemeral, the revise turn; the OPTIONS click and submit paths, stale-control refusal, the action:: payload cap and the thread-to-dashboard import. They bring both owners from 78.9% and 81.2% to 100% line coverage.
  • test/campaign_facade_inventories/kiro_crew.slack.events.json, kiro_crew.slack.interactions.json (new): every public name each module bound at BASE still resolves, and each re-bound import is its home's object (check_inventory.py: 94/94 and 71/71).
  • Re-pointed or joined source pins (assertions unchanged); each was mutated in its new home through a needle unique to the construct and failed (pytest rc 1, never a collection error), then restored: the view-callback and slash-command order; the OPTIONS asker and pin counts and their negative half; the direct read_text scan; the Stop handlers' owner scoping; the run_config_write floor (an interactions and an events owner); config_dir in an async owner; remaining // 60; the person_priority(not count; the restart's SEL and log drains; each NON_EGRESS_REDACTION_MODULES row the change touches or keeps (the facade's included); the log-site census; the init write (reverted to a facade-local global); that the resume choice stays in the facade; and that the facade holds _orch. With the six owner boot-smoke rows removed, test_a_second_boot_touches_only_known_module_globals (KIROCREW_INTEGRATION=1) lists exactly those six keys whenever the second boot reaches init (three of five runs).
  • New tests: 5 runs at -n0 and one at -n 3, all green. test_flake_pattern_ratchet.py and test_wait_discipline_ratchet.py pass.
  • Local gate floor at this head, 403 files at -n 3 (the 399 below plus the skill-usage, restart, exit-path and sync-io gate tests): 22,207 passed, 48 skipped, 0 failed. local-gate --dry-run selects 1,565 backend and 640 frontend files (SD14), so the floor is every test file naming either module or an owner, every test_slack* file, every corpus gate that mentions slack, the mirror, the redaction registries or the patched writers, and every test that reads, by path or name, a file whose comment this PR re-points.
  • mypy src/kiro_crew: no issues in 3,332 files. isort (isort --check-only src/kiro_crew test conftest.py xdist_budget.py), flake8 and black clean. Comment-history, brand, harness-parity, black, subprocess-encoding, agent-sdk, sync-io, memory-store, feature-map and line-cap gates, docs_lint.py and woke 0.19 on added lines: clean. Semgrep 1.78 with the CI configs and --baseline-commit <merge-base> over all 46 changed code and JSON files: 0 findings, 0 errors.
  • Per-file line coverage of the new modules over the floor (CI's metric): events_block_text 99.2%, events_queue 97.6%, events_slash 98.5%, events_home_tab 92.5%, events_voice 100%, events_inbound 97.9%, interactions_context 100%, interactions_modals 98.0%, interactions_settings 97.3%, interactions_options 100%, interactions_approvals 100%; the facade events.py 98.5% (floor 80%). Re-measured at this head over the 26 floor files that name the interactions family: interactions.py 91.6% (it holds dispatch and the resume choice), interactions_sessions 87.8%, interactions_context 100%, interactions_modals 98.0%, interactions_settings 97.3%. The two files fix(slack): spool the pre-ingestion message, not temp paths and file bodies #21829 changed, re-measured at this head over the 16 Slack event, queue and stop test files alone: events_queue 96.9%, events.py 95.8%.
  • Installed-mode smoke from a git-archive wheel: the two facades and all twelve owners import from the wheel under an isolated home.

CI path references

None: no workflow path filter or workflow file list names either file, and AUTOSDE.yaml's src/kiro_crew/slack/**/*.py rule already covers the owners. The .github baselines that list them are covered under Move audit and Re-pointed source pins.

Re-pointed source pins (L30)

Assertions unchanged; each has a mutation that turns it red (listed under Tests). Line numbers are this head's.

  • test/test_stop_clears_only_its_own_sender.py:682-683: ("slack", "interactions.py", ...) -> interactions_sessions.py for _handle_stop_confirm and _handle_inline_stop (the events.py / _route_message row is unchanged: the router stays).
  • test/test_sel_hard_exit_flush.py:432 _PATHS: slack/events.py -> slack/events_slash.py (_handle_restart).
  • Facade joined with every owner (L40(8)):
    • test/test_options_click_validation.py:264,289: inspect.getsource of the facade and every _OWNERS module.
    • test/test_slack_sessions_view.py:1548: the AST of the facade and every owner.
    • test/test_start_priority.py:1068, test/test_sel_hard_exit_flush.py:252, test/test_cli_logging.py:1019: slack/events.py -> every slack/events*.py.
    • test/test_run_config_write.py:37 _SLACK_SOURCES and test/test_safety_override.py:1259: the owner file names beside their facades.
    • test/test_no_config_dir_in_async.py:151-156 _ASYNC_CHECKED_FILES: the six interactions owners.
  • src/kiro_crew/security_posture.py NON_EGRESS_REDACTION_MODULES (:2639-2640, :2646-2649): beside slack/interactions.py, which keeps the calls in dispatch and the resume choice, its four owners that hold redactor calls; slack/events_home_tab.py and slack/events_slash.py beside slack/events.py, which keeps the router's calls.
  • test/test_security_posture.py:295-298 _BASELINE_LOG_SITE_CENSUS: slack/events.py: 2 -> slack/events_home_tab.py: 1, slack/events_slash.py: 1.
  • test/integration/test_boot_smoke.py:460-465 _KNOWN_SECOND_BOOT_CHANGES: beside ("kiro_crew.slack.interactions", "_orch"), which stays, the six owners that hold _orch. With those six rows removed, the second-boot witness lists exactly those six keys as unexplained.

Citation edits (L29)

Only the cited path changes; none of these files is a split target of a live scope.

  • docs/system-specs/modules/slack-gateway.md:171-172 Files rows slack/events.py, slack/interactions.py -> the same rows plus "the import path and patch surface of the events_* / interactions_* owners", and a new "Event and interaction owners" section at :424
  • docs/system-specs/modules/slack-gateway.md:1050 #### Slash Command (events.py) -> (events_slash.py)
  • docs/system-specs/modules/slack-gateway.md:1173 "review-mode draft (interactions.py)" -> "(interactions_approvals.py)"
  • docs/system-specs/modules/slack-gateway.md:1183 "the inline Stop button in interactions.py" -> "in interactions_sessions.py"
  • docs/system-specs/modules/slack-gateway.md:1202 "_handle_sessions in events.py" -> "in events_slash.py"
  • docs/system-specs/modules/slack-gateway.md:1216 interactions.py:_handle_session_resume -> interactions_sessions.py:_handle_session_resume
  • docs/system-specs/modules/slack-gateway.md:1232 interactions.py:_handle_session_end -> interactions_sessions.py:_handle_session_end
  • docs/system-specs/modules/slack-gateway.md:1307 "_resolve_approval_mode(orch) (events.py)" -> "(events_queue.py)"
  • docs/system-specs/modules/slack-gateway.md:1312 events.py:_resolve_approval_mode() -> events_queue.py:_resolve_approval_mode()
  • docs/system-specs/modules/slack-gateway.md:1515 "ack_button() helper in interactions.py" -> "in interactions_context.py"
  • docs/system-specs/modules/config.md:1485 slack/interactions.py -> slack/interactions_modals.py (the voice-config submission)
  • docs/system-specs/modules/session.md:3325 "Slash commands (slack/events.py)" -> "(slack/events_slash.py)"
  • docs/guides/remote-and-mobile.md:656 "ttl = 3600 in slack/events.py" -> "in slack/events_slash.py"
  • docs/architecture/resource-protection.md:40 "session_parts/claims.py plus slack/events.py" -> "plus slack/events.py, slack/events_queue.py and slack/events_inbound.py"
  • src/kiro_crew/config/validation.py:75 (comment) slack/interactions.py -> slack/interactions_modals.py
  • test/test_config_core_owned_sections.py:4 (docstring) slack/interactions.py -> slack/interactions_modals.py
  • test/test_sel_hard_exit_flush.py:214 and :407 (docstrings) slack/events.py -> slack/events_slash.py
  • test/test_cli_logging.py:1003 (docstring) slack/events.py -> slack/events_slash.py
  • docs/system-specs/modules/slack-gateway.md:1175 heading "Message Queue (session_parts/claims.py + events.py)" -> "... + events.py + events_queue.py + events_inbound.py)" (the drain and stop holds, and the message_deleted cancellation), and the :1359 link to it follows the new anchor
  • docs/system-specs/modules/slack-gateway.md:1186 heading "Linked Thread Sync (handler.py + interactions.py)" -> "(handler.py + interactions.py + interactions_sessions.py + interactions_options.py)"
  • src/kiro_crew/pod/runtime_boot.py:638 (comment) "slack/events.py falls through to" -> "slack/events_queue.py" (_resolve_approval_mode)
  • src/kiro_crew/slack/files.py:93-94 (comment) "slack/events.py", "(not in events.py)" -> "slack/events_voice.py", "(not in events_voice.py)"
  • src/kiro_crew/slack/files.py:117 (comment) "slack/events.py consumes both" -> "slack/events_voice.py"
  • src/kiro_crew/messaging/attachments.py:185 (docstring) "(slack/events.py)" -> "(slack/events_voice.py)"
  • src/kiro_crew/slack/gateway_runtime/exit_path.py:552 and src/kiro_crew/platform_compat_runtime.py:304 (comments) "the order slack/events.py uses" -> "slack/events_slash.py" (_handle_restart)
  • test/test_slack_inline_stop.py:6-7 and test/test_session_end_interaction.py:1 (docstrings) interactions.py -> interactions_sessions.py; test/test_interactions_shortcut.py:1 -> interactions_modals.py
  • test/test_stt_reaction.py:1 and test/test_slack_events_coverage_message_helpers.py:275 (docstring, comment) slack/events.py -> slack/events_voice.py; test/test_review_fixes.py:615,627 (docstrings) events.py -> events_slash.py; test/test_slack_log_sanitization.py:4-5 (docstring) names slack/events_slash.py for the slash-command log site beside slack/events.py for the inbound one
  • src/kiro_crew/slack/events.py:12-13 (kept module docstring) "Also contains the bounded dedup cache (_SeenCache)" -> "The bounded dedup cache ... (SeenCache) lives in :mod:kiro_crew.slack.events_inbound"

Baselined growth (L56 addendum 1b)

  • src/kiro_crew/security_posture.py: baseline row 3,181, main 3,481, HEAD 3,487 (+6: one NON_EGRESS_REDACTION_MODULES row per owner that holds a redactor call; interactions.py keeps its row beside four owner rows, and events.py keeps its row beside two).

Notes for reviewers

  • Logger names (L25): every owner binds logging.getLogger("kiro_crew.slack.events") or ("kiro_crew.slack.interactions"), the names at BASE, so caplog.at_level(logger=...) captures and filters see the same logger.
  • The moved classes SeenCache, TrustedBotTurnLedger (events_inbound), _StopHold (events_queue) and _BoundedBlockText (events_block_text) report their owner module. None is an exception or enum, and nothing in the tree reads their __module__ or __qualname__, pickles them or prints their repr (static sweep of src/ and the test trees).
  • CodeQL: the open code-scanning alert 1057 (py/clear-text-logging-sensitive-data, the _safe_log(text[:80]) log line in _route_message) stays in events.py, unchanged; keeping the router there is why the facade sits at 1,516 lines.
  • src/kiro_crew/security_posture.py is in SENSITIVE_GLOBS; the edit is the path rows above only. The Sensitive change review comment is posted on this PR.
  • Owner modules stay top-level siblings rather than events_parts/ / interactions_parts/ packages, as cli_server_* and mcp_shared_* do, so each owner is a specific run_scoped_tests stem.

Manual verification

N/A — a structural move; behaviour is pinned by the existing suites that drive every moved handler and the router, run unmodified through the facades.

Related Issues

Part of #20192

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

Contributions are accepted under the project's Apache-2.0 license.

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/security_posture.py

  • @bolichen97 posted a complete reasoning template for 27859f4.

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 27859f4e5a984d65564975559c8cee928bf765b0 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

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

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 27859f4e5a984d65564975559c8cee928bf765b0 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Check before merge: events_home_tab.py still rebinds _skills_loader and _home_tab_collect_sem with global inside the owner, so facade reads return the install-time value. No reader of those names exists today.

[DESIGN-REVIEWED] 27859f4

Description read

[DESCRIPTION-READ] b0933635410edd38f7893afd26fac546a56cbfb8d85dbc6f6a6ed359141afd80

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 Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 27859f4e5a984d65564975559c8cee928bf765b0 — 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/CONCERNS are advisory.

First-Principles-Verdict: PASS

Check that init()'s setattr(_sys.modules[__name__], "_orch", …) reaches all six interactions owners. It is the split's only code edit.

What this change ships

Inventory (8 items) — 8 justified

Intent: bring two Slack modules under the 2,000-line cap that AGENTS.md mandates, without changing behaviour. This is a FIX (a refactor).

  1. slack/interactions.py is split into a mirror facade plus six interactions_* owner modules — justified
  2. slack/events.py is split into a mirror facade plus six events_* owner modules — justified
  3. init() now writes _orch through the facade module instead of using global — justified
  4. Both baseline rows are removed from file-line-cap-baseline.txt — justified
  5. Per-file F401 ignores are added in setup.cfg for both facades, the same as the existing cli_server.py and mcp_shared.py entries — justified
  6. NON_EGRESS_REDACTION_MODULES adds the six owners whose posted output was covered before — justified
  7. Comment and doc path references now point at the owners (configuration validation, attachments, platform_compat_runtime.py, pod boot, Slack files, the exit path, and the specs) — justified
  8. Facade inventories and the facade, approvals and options test modules are added — justified

[FIRST-PRINCIPLES-REVIEWED] 27859f4

Description read

[DESCRIPTION-READ] f5365a6bbb50c3a803347c234a1694a33570be89f703814e7e008a432ae9aa34

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.

@bolichen97

bolichen97 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Sensitive change review

  • Head commit: 27859f4
  • What rule changed: no rule; only the paths in NON_EGRESS_REDACTION_MODULES follow the redactor calls that moved out of slack/interactions.py and slack/events.py into their owner modules.
  • Before -> after (what was allowed/blocked, now): before, slack/events.py and slack/interactions.py were the registered non-egress Slack sub-surfaces; after, slack/events.py and slack/interactions.py stay (they keep the router's and the dispatch and resume choice's calls) and slack/events_home_tab.py, slack/events_slash.py, slack/interactions_approvals.py, slack/interactions_modals.py, slack/interactions_options.py and slack/interactions_sessions.py are registered the same way; nothing is allowed or blocked differently.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): the posture drift guard would miss a moved redactor call or keep a stale row; no runtime path reads this set, so no command breaks, no secret path changes and no user is locked out.
  • Evidence checked (which sandbox result proves it): test/test_security_posture.py passes on this head, removing any one new row, or the kept interactions.py row, turns it red (mutation proofs M13, M13c, M13d and M13e), and every moved redactor call sits in a unit whose AST is identical to main's (move audit 99.81% and 99.58%).
  • No regression:
    • Tools still work (which tools/commands were run, result): the local floor of 399 Slack, mirror, posture and cite-reading test files passed with 22,455 tests and 0 failures.
    • Backward compatible (old config / old data / old callers still work, how checked): callers keep importing kiro_crew.slack.events and kiro_crew.slack.interactions, and every name either module had still resolves to the same object (campaign inventories 94/94 and 71/71).
    • Existing tests (which suites passed on this head): test_security_posture.py, test_events_facade.py, test_interactions_facade.py, test_facade_mirror_guards.py and the floor above.
  • How to undo: revert this one commit; the owner rows go away together with the owner modules, and the two facade rows stay as they are on main.

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 27859f4e5a984d65564975559c8cee928bf765b0 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 27859f4

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 27859f4e5a984d65564975559c8cee928bf765b0: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 27859f4e5a984d65564975559c8cee928bf765b0 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 27859f4

Verdict parsed from the review's SHA-scoped output markers for commit 27859f4e5a984d65564975559c8cee928bf765b0.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 27859f4e5a984d65564975559c8cee928bf765b0: <one-sentence reason>

@bolichen97
bolichen97 enabled auto-merge (squash) October 19, 2026 05:35
@bolichen97

Copy link
Copy Markdown
Contributor Author

Disposition: rebutted (checked; the allowlist is exact)

  • Redaction allowlist names only owners that call a redactor

The six new NON_EGRESS_REDACTION_MODULES rows are exactly the owners with redactor calls at this head: events_home_tab.py (7), events_slash.py (5), interactions_approvals.py (6), interactions_modals.py (4), interactions_options.py (11) and interactions_sessions.py (8). events.py keeps its row for the router's 2 calls.
The other eight family modules (events_block_text, events_inbound, events_queue, events_voice, interactions_context, interactions_router, interactions_settings, and the interactions.py facade) call none, and none of them is listed.
test_security_posture.py enforces both directions at this head: TestOmissionDetection::test_every_redactor_call_site_is_a_registered_sink_or_allowlisted and ::test_allowlist_has_no_stale_entries. A row with no call would fail the second, and an unlisted owner with a call would fail the first. Deleting any one new row turns the suite red (mutation proofs in the PR's Tests section).

@bolichen97

Copy link
Copy Markdown
Contributor Author

Disposition: rebutted (checked; no stale binding exists)

  • The rebound globals have no reader outside their owner

_skills_loader and _home_tab_collect_sem are bound, read and rebound only in events_home_tab.py. The facade does not hold them: its mirror serves them from the owner on each access, and its only mention of them is the TYPE_CHECKING manifest.
test_events_facade.py::test_each_rebound_global_lives_with_its_writer_and_every_reader pins this for every global in the family: the holders and the readers must both be exactly the writer. ::test_a_facade_write_of_a_rebound_global_lands_with_its_writer shows that a write through kiro_crew.slack.events lands in the owner and is not cached on the facade.
Outside the family, src/ has no reader of either name (git grep): the other _skills_loader hits are unrelated attributes and globals in history_consolidation* and metrics/inventory_gauges.py.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: checking Automated validation is still running labels Oct 19, 2026
@bolichen97
bolichen97 force-pushed the refactor/linecap-s24-interactions branch from cd15878 to 762986d Compare October 19, 2026 06:53
@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: 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 Oct 19, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

Disposition: rebutted (the boot path is exercised; a live Slack click is out of reach here)

  • init's setattr is what gives every owner _orch after boot

The real boot path is covered. test/integration/test_boot_smoke.py::test_a_second_boot_touches_only_known_module_globals (KIROCREW_INTEGRATION=1) runs service_boot.run, which calls interactions.init, twice. With this PR's seven _KNOWN_SECOND_BOOT_CHANGES rows removed, the witness lists exactly the seven kiro_crew.slack.interactions_<owner>._orch keys, so boot writes _orch into all seven owners. With the rows present it passes.
test_interactions_facade.py::test_init_writes_the_orchestrator_into_every_owner_that_reads_it pins that init binds the same object in every owner, that a second init rebinds all seven, and that a patch of interactions._orch reaches each owner. Reverting init to a facade-local global turns it red (mutation proof in the PR).
The approval press itself runs end to end in test_interactions_approvals.py and test_slack_interactions_coverage.py through the facade's _orch. A click in a live Slack workspace needs a real workspace and gateway, which this change's test environment does not reach.

@bolichen97

Copy link
Copy Markdown
Contributor Author

Disposition: rebutted (the description names both files)

  • The description names the two new behavioural test files

The PR description's ## Tests section has a bullet that opens with test/test_interactions_approvals.py, test/test_interactions_options.py (new, 68 tests). It lists what they drive: the native tool-approval press, the review-draft handlers' refusals and cleanups, the auth-denied ephemeral, the revise turn, and the OPTIONS click and submit paths. It also says why they exist: they bring both owners from 78.9% and 81.2% to 100% line coverage, because every new module must clear the 80% per-file floor on its own.
Both files test only code this PR moves into interactions_approvals.py and interactions_options.py. They add no product behaviour.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention labels Oct 19, 2026
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 19, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

Disposition: rebutted (facade reads are live, not install-time)

  • Facade reads of the rebound globals return the current value

kiro_crew.slack.events does not bind _skills_loader or _home_tab_collect_sem. They are served names. The mirror's MirrorIndex.read, called from the facade's __getattr__, looks the owner up in sys.modules and reads the name there on every access. A facade read after events_home_tab rebinds one therefore returns the new object, not the value at install time.
test_events_facade.py::test_each_rebound_global_lives_with_its_writer_and_every_reader pins that every global in the family has exactly one holder and one reader, its writer. ::test_a_facade_write_of_a_rebound_global_lands_with_its_writer pins that a facade write lands in the owner, that the facade read sees it, and that the name never lands in vars(events). Mutation M15 (a second holder) turns the first test red with rc 1.

@bolichen97

Copy link
Copy Markdown
Contributor Author

Disposition: rebutted (checked; the boot path writes all six owners)

  • init's facade write reaches all six owners on a real boot

service_boot.run calls interactions.init on every gateway boot. init runs setattr(_sys.modules[__name__], "_orch", orchestrator) (interactions.py:117), and the facade's MirroredModule.__setattr__ writes the name to the facade's own binding and to every indexed holder: the six owners.
The boot is exercised by test/integration/test_boot_smoke.py::test_a_second_boot_touches_only_known_module_globals (KIROCREW_INTEGRATION=1). With this PR's six owner _orch rows removed, the witness flags exactly those six keys in every run where the second boot reaches init.
test_interactions_facade.py::test_init_writes_the_orchestrator_into_every_owner_that_reads_it asserts that the facade and all six owners hold the same object after each init and after a facade patch. Mutation M1 (a facade-local global _orch) turns it red with rc 1.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 20, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

HOLD at 27859f4.

The code reads as sound and I would approve it, but one Sensitive Change Review run failed on this head (run 39354504086); I re-ran it. Once that clears, a fresh look can approve it.

— crew-pr-reviewer (r114)

@iamwhatever iamwhatever 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.

Approved at 27859f4e5a984d65564975559c8cee928bf765b0.

The r112 blocker (the conflict) is gone. By AST against the merge base, all 81 events.py units and 76 of 77 interactions.py units reappear unchanged in one owner each. The exception is init, which now writes _orch through the mirror facade (interactions.py#L117), so the facade and all five owners that import _orch get the orchestrator. Every owner import resolves to the same source as before. The only global rebinds stay with their readers in events_home_tab.py. The six new NON_EGRESS_REDACTION_MODULES rows (security_posture.py#L2639-L2649) are exactly the owners that call a redactor, and no row is dropped. Both lane punchlines on this head are answered.

One CI note: the newest Sensitive Change Review run on this head failed with "Could not read the PR from the API ... re-run this job". That is an API read error, not a code failure. The same check passed on this head earlier, and PR Readiness passed after it. A rerun should clear it.

I read the code and CI but did not run the tests.

— crew-pr-reviewer (r114)

The Sensitive Change Review re-run passed on this head; auto-merge waits for the required PR Readiness check.

@bolichen97
bolichen97 merged commit e7bd257 into main Oct 20, 2026
109 of 111 checks passed
@bolichen97
bolichen97 deleted the refactor/linecap-s24-interactions branch October 20, 2026 05:54
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 20, 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.

3 participants