Repository navigation
fix(messaging): post a redaction notice at every channel delivery surface - #11257
Conversation
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsFINDING -- src/kiro_crew/slack/renderer.py:1418 -- |
Design Review (Fable 5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Verify CI runs the new per-channel notice tests green — the author could not execute the suite locally (Python 3.7 environment). Suggestions
[DESIGN-REVIEWED] 326e915 |
First Principles Review (Fable 5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The author never ran the suite (Python 3.7 environment) — CI green on the new per-surface tests and the posture drift guard is the only proof. What this change shipsInventory (10 items) — 10 justifiedIntent: FIX — a reader who copies redacted text from nine channel surfaces now learns it was rewritten (issue #11206; base
Capped at 10: also a posture-census allowlist row for [FIRST-PRINCIPLES-REVIEWED] 326e915 |
Opus 4.8 Review (fork) — ✅ no blocking findingsReviewed Review detailsThe discovery pass found no candidates. My spot-check of the trickiest new paths — the Slack transport renderer's per-turn tally-then-post at the end of No findings. [OPUS-REVIEWED] 326e915 |
935088b to
7eeaca2
Compare
7eeaca2 to
27df10a
Compare
27df10a to
2a12a79
Compare
be99ccd to
373f33f
Compare
373f33f to
78b93c9
Compare
78b93c9 to
9867136
Compare
9867136 to
7955a7a
Compare
|
Rebased onto main Conflicts resolved (only these files were hand-merged, nothing else changed manually):
Same single commit, same author, same message. The PR’s changes outside the conflict hunk are preserved; upstream main changes are included by the rebase. The original 28-file PR scope and diff size are unchanged (918 insertions, 34 deletions). All 26 changed Python files compile, git diff --check passes, and all 22 WeCom renderer tests pass. Full suite not run. Any prior approval dismissed by the push needs to be re-given after CI re-runs. |
|
Post-rebase status on head The one remaining red, Opus 4.8 Review — "review incomplete", is the repo-wide fork-lane outage tracked in #12099 (the Opus lane's egress allowlist still points at the broken classic Bedrock path; no fork PR has had a successful Opus review since at least 11:45 UTC today). Once #12081 lands, this lane needs a re-run here to clear PR Readiness. |
|
CI dispatch appears stuck for this PR specifically: since the retrigger pushes (and a close/reopen cycle at ~00:47Z), only the fork gates (Fork PR Description ✅, Workflow-Change Guard ✅, Fork PR Label) and PR Readiness have run on the current head — the CI / Fast Gate / Build / test-matrix workflows were never created (they are absent from the head SHA run list and NOT sitting in the action_required approval queue, which is meanwhile processing other fork PRs normally). Three consecutive heads over ~90 minutes show the same pattern, while sibling fork PRs pushed in the same minutes dispatched fully. Could a maintainer kick CI on this head (rerun/manual dispatch)? Happy to push a fresh head instead if that is preferred. |
…face Nine channel delivery surfaces run both body rewriters over the text they ship and post no notice of either kind: Discord, Webex, WhatsApp, WeCom, Telegram, Teams, Feishu, Weixin and the default Slack transport path deliver a credential or suspicious-URL placeholder silently, and the reader copies a command that will not run with no hint the text was altered. Hoist the two-kind tally into a shared count_redaction_tags() beside redaction_notice(), so a surface cannot adopt half the count and post a notice worded for the wrong remedy, and post the notice in-renderer at every surface: each renderer counts the text IT actually delivered, which can differ from the driver's accumulated stream because several renderers re-redact against the form the platform renders. Discord and Telegram tally per landed message across seals, recovery re-posts and the posted reasoning; Slack counts the final display-safe body plus the posted reasoning in one tally; Webex counts the assembled answer; WhatsApp the converted chunks that shipped; WeCom tallies at on_done and posts from close(), consumed once; Teams, Feishu and Weixin count the body their on_done delivers. Every notice send is best-effort: the answer is already out, so a failed send is logged, never raised. Swap the five existing counting sites onto the shared helper. Allowlist whatsapp/turn_renderer.py and feishu/renderer.py in NON_EGRESS_REDACTION_MODULES: the notice pair they now call tallies placeholders and builds the follow-up sentence, rewriting no outbound byte; the passes carrying those channels' guarantees stay the registered whatsapp render pipeline and the TurnDriver's StreamRedactor. Closes kirodotdev#11206 Rebase fallout: main now registers feishu/renderer.py as a redaction sink (its text() override screens the answer body via redact_for_target), so the non-egress allowlist entry this commit had carried for the notice pair there is deleted -- the module is classified by the sink registry.
|
Resolved — the dispatch stall reported above was the PR's mergeability, not the dispatcher: main had moved far enough that the PR became CONFLICTING, so no merge ref existed for Current head |
Problem / Motivation
PR #8291 (dashboard) and PR #11197 (Slack per-turn, Slack review-approve, iMessage) made every surface that already posted a redaction notice cover both body rewriters, worded by kind. Nine channel delivery surfaces still run the same two rewriters over the copyable text they ship and post no notice of either kind: Discord, Webex, WhatsApp, WeCom, Telegram, Teams, Feishu, Weixin and the DEFAULT Slack transport path (
messaging.use_transport, on by default, routes every install throughSlackRenderer) deliver a credential or suspicious-URL placeholder silently.Why it matters
A reader who copies a redacted command gets an opaque downstream failure far from the real cause, with no hint the text was altered — the exact reported failure the notice exists to close. And a surface that hand-rolls half the tally (credentials but not the URL prefix) posts a notice naming a remedy that cannot help.
What changed (motivation → approach → change)
Nine silent surfaces → one shared tally and ONE notice mechanism: every surface posts in-renderer over the text it actually delivered, mirroring the iMessage
on_donereference shape. No new output kind, no newRendererhook — an earlier revision carried a driver-levelNOTICEevent for the pass-through channels, and review (First Principles items 5/6) showed the split was both duplicative and wrong: several renderers re-redact against the form the platform RENDERS (_display_safein the Slack, Telegram, Teams and Discord renderers), so their delivered text can carry placeholders the driver's accumulated stream never had, and driver-side counting undercounts exactly there.count_redaction_tags(text)besideredaction_notice(): exact-match overCREDENTIAL_REDACTION_TAGS, prefix-match for the URL tag (it interpolates the domain), so a surface cannot adopt half the tally.slack/renderer.py): one tally per turn over the final display-safe answer body plus the posted 💭 reasoning, one threaded notice at the end ofon_done— mirroring the nativehandler.pyper-turn count, which stays in place foruse_transport=falseinstalls.on_doneand post the notice after it lands. Telegram tallies per LANDED frame across seals and the posted reasoning, with the notice at everyon_doneexit; Weixin's deliberately-raising_sendis contained at the notice send, since the answer is already out; Feishu covers both failure shapes ofsend_reply(False verdict and raise).on_doneexit; Webex counts the assembled answer after the card block; WhatsApp counts the converted chunks that shipped; WeCom tallies aton_doneand posts fromclose()— the one point its deferred-overflow ladder settles — consumed once so a secondclose()cannot double-post.security_posture.py):NON_EGRESS_REDACTION_MODULESgainswhatsapp/turn_renderer.py. The*redact*(scan matches it because it calls the notice pair (count_redaction_tags+redaction_notice), which tallies placeholders already written by a redaction pass and rewrites no outbound byte; the pass carrying that channel's guarantee stays the registeredwhatsapp/renderer.pypipeline.feishu/renderer.pyneeds no allowlist entry: main registers it as a_REDACTION_SINKSegress row (itstext()screens the answer body viaredact_for_target), so the sink registry already classifies it — a comment in the allowlist says so. The other renderers gaining tallies (Slack, Telegram, Teams, Weixin) are already registeredredaction_pathssinks. No registry rows change, so the posture panel counts are untouched.docs/system-specs/modules/messaging.mdrenderer row and theslack-gateway.mdredaction-notice bullet updated in the same commit.Tests
Per-surface red-before-green + best-effort-failure coverage, mirroring
test_imessage_renderer.py::TestRedactionWarningwith each surface's existing fakes:TestRedactionNoticeclasses intest_discord.py,test_webex_renderer.py,test_whatsapp_turn_renderer.py,test_wecom_renderer.py(incl. a second-close idempotence test),test_telegram.py,test_teams_renderer.py,test_feishu_renderer.py(bothsend_replyfailure shapes) and threetest_weixin_dispatch.pyfunctions;TestTransportRedactionNoticeintest_slack_renderer.pydrives the realTurnDriverend to end so theStreamRedactorwrites the placeholder exactly as production does;TestCountRedactionTagsintest_credential_redaction_notice.pypins the shared tally.Manual verification
Could not run the suite end-to-end in my environment (Python 3.7 only; the repo needs ≥3.12 and several files carry newer syntax — verified the parse failures are pre-existing via stash-compare against the unmodified files). Every touched file passes
ast.parse;./scripts/docs-lint.shpasses; the comment-history gate passes on every file it can parse under 3.7; the unused-import sweep confirms no orphaned tag imports. CI is the authoritative check for the new tests.Screenshots / video
N/A — backend channel delivery paths, no UI surface.
Related Issues
Fixes #11206
Pattern harvest
Rule candidate: review-prompt
Pattern: a delivery surface that runs a redactor over outbound text but never tallies the placeholders afterward ships silent rewrites — when adding a channel egress path, check that the text that actually shipped is counted through
count_redaction_tagsand a notice follows, or that the surface deliberately opts out on a stated ground. Corollary from this PR's review: count at the egress that DELIVERS, not upstream — a renderer that re-redacts against the rendered form makes any upstream tally an undercount.Checklist
messaging.mdrenderer row +slack-gateway.md, same commitContribution License Agreement
Contributed under the project's Apache License 2.0, same as the rest of the codebase.