Skip to content

fix: render Slack-formatted send_message bodies legibly in the bell - #29906

Merged
bolichen97 merged 1 commit into
kirodotdev:mainfrom
brandonjsmith:fix/bell-renders-slack-mrkdwn
Nov 9, 2026
Merged

bolichen97 merged 1 commit into
kirodotdev:mainfrom
brandonjsmith:fix/bell-renders-slack-mrkdwn

Conversation

@brandonjsmith

@brandonjsmith brandonjsmith commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A send_message call formatted for Slack renders legibly on both of its surfaces — Slack-formatted in the channel, clickable and correctly emphasized in the dashboard notification center.

When an agent delivers a message to Slack via send_message, the gateway also creates a notification-center (bell) entry for the owner. The bell stores the Slack-mrkdwn text verbatim, but the notification center renders bodies as Markdown (NotificationDetailPanel renders through MarkdownRenderer; the companion send_notification documents its body as markdown). The grammars disagree on links, so every Slack-style link renders broken in the bell: Review ready: <https://example.com/reviews/123|REVIEW-123> renders a correct link in Slack and raw unclickable text — https://example.com/reviews/123|REVIEW-123 — in the bell. Messages with several links per line become unreadable. Emphasis rides along: *bold* renders italic, ~strike~/_italic_ differ.

Why it matters

Any agent that formats for Slack — the channel's own format — gets a degraded bell feed, and there is no workaround that avoids double-notifying: a separate send_notification call would create a second bell entry alongside the mirrored one. Scheduled crons reporting links (reviews, tickets, dashboards) are the common case: their owner-DM sends always mirror to the bell.

Not a goal

  • Converting in the other direction, or on any delivery leg: Slack and every non-Slack channel still receive the caller's own bytes untouched.
  • A full mrkdwn parser. The converter is deliberately conservative (Slack's own word-edge emphasis boundaries, only <scheme:...> angle forms, code spans verbatim); constructs outside that stay literal rather than risk corrupting a body.
  • Storing a format hint on the notification and converting at render time. That would put mrkdwn knowledge in the frontend and migrate the stored shape; converting once at the single ingestion point needs neither.

What changed (motivation → approach → change)

Symptom: Slack links and emphasis arrive broken in the bell. Root cause: one send_message call reaches two renderers with two grammars — _deliver_send_message_fallback mirrors the Slack-bound text into the bell verbatim, and the bell renders Markdown.

Approach: convert the BELL's copy only, at the one place Slack-bound caller text enters the bell, gated on send_to_slack — that predicate is true precisely when the caller formatted for Slack (the cron owner-DM default included) and false when a channel_target/channel_type send carries another channel's format, which must reach the bell verbatim.

Change:

  • New src/kiro_crew/slack/mrkdwn_markdown.py (slack/format.py is over the file-line cap): mrkdwn_to_markdown converts <url|label> → [label](url), bare <url> → [url](url) (self-labelled, so a non-web scheme like vscode:// that Markdown would not autolink stays clickable), *bold* → **bold**, _italic_ → *italic*, ~strike~ → ~~strike~~. Emphasis converts only at Slack's own word-edge boundaries, so snake_case and already-Markdown bodies pass through; mentions (<@U…>, <#C…|…>, <!here>) stay literal; inline and fenced code spans are kept verbatim; HTML entities pass through (a Markdown renderer decodes them, which is their mrkdwn reading). Every URL-shaped span is an atom the emphasis pass never reaches: existing Markdown links/images and bare URLs pass through verbatim, so a _ or * inside any destination is path, never markup.
  • _deliver_send_message_fallback passes the converted copy to state.notify when send_to_slack; the import is function-local because the facade rebinds owner functions onto handlers.messaging's globals (same pattern as redact there).
  • Specs updated in the same commit: a fifth load-bearing property in messaging.md's delivery-ladder section, and a module row in slack-gateway.md.

Backwards compatibility

Compatible: no API, schema, or delivery-leg behavior changes — only the bell's stored body text for Slack-bound sends, which was previously illegible. delivered_to, outcome codes, and every egress leg are untouched.

Removes nothing: the change adds a conversion on one stored copy; every existing reader of notification bodies keeps working (the body remains a plain string).

Tests

test/test_mrkdwn_to_markdown.py (19 tests):

  • Links: labelled → Markdown link, several per line, bare <url> drops brackets, parenthesized destinations get Markdown <...> bracketing, [/] in labels escaped, mentions/broadcasts stay literal, emphasis characters inside a destination are not emphasis.
  • Emphasis: bold/italic/strike mapping; snake_case, already-Markdown **bold**, existing Markdown links, and HTML entities all pass through.
  • Code spans: inline and fenced kept verbatim; an unterminated fence runs to the end.
  • Bare links: a web URL and a vscode:// editor link both come out as self-labelled clickable links.
  • URL atoms: a Markdown link/image destination carrying _/~/* round-trips unharmed (including a balanced-parens destination), a bare URL with delimiters is not emphasis, and Slack + Markdown links coexist on one line.
  • Integration (facade-level, egress legs stubbed): a send_to_slack send reaches the bell as Markdown; a channel_type send reaches the bell verbatim.

Proof: not provable -- other: prove.py reports INCONCLUSIVE because reverting the production hunks removes the new module the test file imports, erroring at collection. Proven manually instead: with only proactive_send.py reverted to origin/main, test_a_slack_bound_send_reaches_the_bell_as_markdown fails with the raw-mrkdwn body (AssertionError: assert 'Ready: <http...-1> is *done*' == 'Ready: [R-1]...'); all 18 other tests pass.

Manual verification

N/A — unit coverage sufficient: the conversion and its send_to_slack gating are asserted at the same facade seam the route drives, and the frontend rendering path (MarkdownRenderer) is unchanged.

Related Issues

None filed; symptom observed on 0.9.x–0.11.2.x installs.

Sibling sweep

Swept: git grep -n "state\.notify(\|\.notify(" -- src/kiro_crew
Sibling: src/kiro_crew/dashboard/messaging_api/agent_push.py -- app/agent send_notification push -- not affected -- its body is documented and produced as markdown, never Slack mrkdwn
Sibling: remaining state.notify( sites (update_notify, chat_api, chat_turn, chat_voice, apps) -- not affected -- each composes its own plain/Markdown body; none ingests a caller's Slack-formatted send_message text, which enters the bell only through _deliver_send_message_fallback

Pattern harvest

Rule candidate: review-prompt
Pattern: a body authored in one markup grammar stored onto a surface that renders another (mrkdwn vs Markdown) without a conversion or a format hint at the ingestion seam

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; see the Licensing section of CONTRIBUTING.md.

@brandonjsmith
brandonjsmith requested review from a team and KiroCrewCaptain as code owners November 4, 2026 19:51
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention fork Pull request from a fork (external contributor) labels Nov 4, 2026
bolichen97
bolichen97 previously approved these changes Nov 6, 2026

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

Reviewed at 7b1c03d15a (T1: the bell shows a Slack-bound send_message body as broken Markdown, so links are unclickable; no linked issue, so I tiered it from the description).

The fix only converts the bell's copy, gated on send_to_slack, so every delivery leg still sends the caller's own bytes. mrkdwn_to_markdown is conservative where it has to be: code spans and fences stay verbatim (an unterminated fence too), only a URI angle form becomes a link (mentions and <!here> stay literal), emphasis converts only at Slack's word boundaries so **bold** and snake_case pass through, and label brackets and destinations with spaces or parens are escaped. The tests cover each of these, and both module specs move with the code. One commit, no merge commits.

Approved on this head. It merges once fork CI runs and is green.

AI-assisted, sent by CommunityCrew

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

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ⏭️ skipped

Revision ed27d2d8c46c29e2f848832e862701c3c03e1f39 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 6, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of ed27d2d8c46c29e2f848832e862701c3c03e1f39 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

No design-level concerns. The bell's copy is converted at the one point where Slack-bound text enters it, every delivery leg still sends the caller's own bytes, and the result is re-scanned for secrets before it is stored.

Notes

  • The gate fires for cron owner-DM sends even on installs with no Slack client. There, an agent writes Markdown (the send_message text schema says "markdown"), so a Markdown *italic* is shown bold in the bell. Checking send_to_slack and state.slack_client would limit the conversion to sends that actually reach Slack, and it costs one more condition.

[DESIGN-REVIEWED] ed27d2d

Description read

[DESCRIPTION-READ] 37d1992c21f742a166aa02d81797b89bdf7aabcd04303a93806f228dc8c51aca

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of ed27d2d8c46c29e2f848832e862701c3c03e1f39 via the fork AI-review pipeline — 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 fix converts only the bell's copy, at the one point where Slack-bound text enters it. It adds a regression test that fails on base, and no converter in the opposite direction exists in-tree.

Notes

  • Item 4 — rides along: the description says "The cron owner-DM default keeps it true even on an install with no Slack client, where the body may already be Markdown — accepted". On such an install no Slack leg runs, so the only reader is the bell, and converting restyles Markdown *x* into bold for nobody's benefit. Subtraction: narrow the gate from if send_to_slack: to if send_to_slack and state.slack_client:, the predicate the Slack leg itself uses (proactive_send.py:1029).

What this change ships

Inventory (6 items) — 5 justified

Intent: make a Slack-formatted send_message readable and clickable in the dashboard bell. This is a FIX.

  1. Slack <url|label> links in a bell entry now render as clickable links — justified
  2. A bare <url>, including non-web schemes, becomes a clickable self-labelled link — justified
  3. Slack *bold*, _italic_ and ~strike~ now render at their Slack weight in the bell — justified
  4. On an install with no Slack client, cron owner-DM bell bodies are still converted — rides along, see note
  5. The converted bell copy is redacted a second time before it is stored — undeclared
  6. The messaging and slack-gateway specs gain a property row and a module row — justified

[FIRST-PRINCIPLES-REVIEWED] ed27d2d

Description read

[DESCRIPTION-READ] 4abee28d51ec99fd62a7e2764d57ab41887f176ce70f29c8c7b76e79f2d5f1a9

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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed ed27d2d8c46c29e2f848832e862701c3c03e1f39 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] ed27d2d

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed ed27d2d8c46c29e2f848832e862701c3c03e1f39 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] ed27d2d

@brandonjsmith

Copy link
Copy Markdown
Contributor Author

Pushed 1000c5a3db addressing the review round:

GPT 6.1 blocking finding (emphasis conversion corrupts Markdown link destinations) — fixed. The finding names a class: the emphasis pass reaching inside URL-shaped spans. All sites of the class are now atoms in _convert_non_code: existing Markdown links and images (destination grammar shared with the repo's md_link_destination, balanced parens included) and bare URLs pass through verbatim; emphasis runs only on the text between atoms. Tests cover the exact repro ([report](https://example.com/_reports_/123) round-trips unharmed), an image destination, a balanced-parens destination, a bare URL with delimiters, and Slack + Markdown links on one line.

Design Review / Opus note (send_to_slack is also true for crons on Slack-less installs) — acknowledged; comment and spec corrected. The gate comment and the messaging spec no longer claim the predicate is "true precisely when the caller formatted for Slack"; they now state the cron owner-DM default keeps it true with no Slack client configured, and why that residual is accepted: with URL spans and Markdown constructs passing through, the only divergence left for an already-Markdown body is single-delimiter emphasis (*x*, mrkdwn bold) changing weight. Gating instead on "Slack actually configured" would make the bell's rendering of the same cron text change when an operator connects Slack, which is a worse surprise than a stable, documented reading.

One note for maintainers: the branch sits on its previous base rather than current main — the latest upstream commits touch .github/workflows/ci.yml, which my fork token cannot push until I grant the workflow scope. I'll rebase onto fresh main in the next push; happy to do it sooner if you prefer.

@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 6, 2026

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

Re-reviewed at 1000c5a3db. The new push makes every URL-shaped span an atom for the emphasis pass: Slack angle links still convert, while existing Markdown links and images (via md_link_destination, so balanced parens stay one atom) and bare URLs pass through verbatim. So a _ or * inside a destination is never read as emphasis. The new tests cover each of these, and the spec and comment now say plainly that a Markdown body on a no-Slack install only changes single-delimiter weight. Still one commit.

Approved on this head. It merges once fork CI runs and is green.

AI-assisted, sent by CommunityCrew

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

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

Thanks @brandonjsmith. I'm changing my approval on 1000c5a3db to a change request. The fork GPT 6.1 review found one real problem, and its adjudication upheld it.

Blocker: a bare non-web Slack link stops being clickable. _markdown_link turns <url> (no label) into a bare url. That is fine for https://, but the bell's Markdown renderer only autolinks bare http/www (MarkdownRenderer.tsx, the GFM plugin). So <vscode://file/project/app.py:42>, which reached the bell as a clickable autolink before this PR, now arrives as plain text. Fix: when there is no label, emit an explicit link, [url](url), using the same (<url>) form your labelled branch already uses when the destination holds a space or parens. Please add one test for a vscode: (or mailto:) bare link.

The other finding (bold around a Slack link reads as italic) was downgraded as low-impact, so it doesn't block. Fix it only if it's easy.

Everything else in my earlier reviews still stands. I'll re-review once you push.

AI-assisted, sent by CommunityCrew

@brandonjsmith
brandonjsmith force-pushed the fix/bell-renders-slack-mrkdwn branch from 1000c5a to d3515df Compare November 6, 2026 18:12
@brandonjsmith

Copy link
Copy Markdown
Contributor Author

Pushed d3515df271 for the second review round:

Upheld finding (bare <vscode://...> link goes dead in the bell) — fixed as suggested. A label-less angle link now converts to a self-labelled [url](url) instead of a plain URL, so non-web schemes Markdown would not autolink (editor deep links, slack://) stay clickable; web URLs get the same shape, which renders identically to an autolink. Test added with the exact vscode://file/project/app.py:42 repro; the bare-web-URL test updated to the new shape.

Finding not upheld (emphasis pairing across a link: *Review <url|R-123>* renders italic rather than bold) — deferring, in agreement with adjudication. The delimiters survive verbatim and the span still renders emphasized, so the loss is weight, not meaning or clickability. Pairing delimiters across protected spans needs a real inline parser — matching openers and closers around atoms with Slack's boundary rules — which is a different altitude of machinery than this fix's conservative regex passes, and misparsing it would risk exactly the destination-corruption class the previous round fixed. Happy to file a follow-up issue if maintainers want bold-across-links fidelity tracked.

@brandonjsmith
brandonjsmith force-pushed the fix/bell-renders-slack-mrkdwn branch from d3515df to 9fad516 Compare November 6, 2026 18:16
@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 6, 2026

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

Re-reviewed at 9fad5167a0. This fixes my change request: a label-less <url> now becomes a self-labelled link, [url](url), so a vscode:// or slack:// link stays clickable in the bell. Destinations with a space or parens still take the (<url>) form. The new vscode: test covers it, and the old bare-URL test now checks the self-labelled form. Still one commit.

Approved on this head. It merges once fork CI runs and is green.

AI-assisted, sent by CommunityCrew

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

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

Requesting changes on c006f70. GPT 6.1's adjudication stage failed to run on this head (a GitHub rate limit, fix in #33613), so I checked its three blocking findings by calling mrkdwn_to_markdown at this head. All three reproduce:

  1. src/kiro_crew/slack/mrkdwn_markdown.py:103: emphasis is converted per segment between protected atoms, so bold that encloses a link never converts. *Review <https://example.com/reviews/123|REVIEW-123> now* becomes *Review [REVIEW-123](https://example.com/reviews/123) now*, which the bell shows as italic, not bold.
  2. src/kiro_crew/slack/mrkdwn_markdown.py:125: inline-code splitting runs before link matching, so a link label containing backticks is left as raw angle-form text. <https://example.com/file|View `main.py` file> comes back unchanged.
  3. src/kiro_crew/slack/mrkdwn_markdown.py:57: _INLINE_CODE matches single backticks only, so text inside a double-backtick span is rewritten. ``echo `pwd` && curl <https://example.com/api>`` gets its link converted inside the code span. proactive_send.py:943 runs this path whenever send_to_slack is true.

Each needs a small test with the trigger above.

The other reds on this head are not from your change: Backend Tests (3.12, 7) is a facade-guard timeout seen on three other branches today, and Real Adapter now passes.

AI-assisted, sent by CommunityCrew

@brandonjsmith
brandonjsmith force-pushed the fix/bell-renders-slack-mrkdwn branch from c006f70 to 04102a0 Compare November 9, 2026 14:44
@brandonjsmith

Copy link
Copy Markdown
Contributor Author

Pushed 04102a054e (rebased onto current main) addressing all three verified findings in one restructure — thank you for reproducing them by hand while the adjudication lane was down:

The converter now runs ONE left-to-right token scan per fence-free region, where inline code spans (any backtick-run length) and URL-shaped spans compete by start position, earliest wins. That single rule settles both nestings the way Slack reads them, and emphasis then converts over the whole region with tokens reduced to inert sentinels:

  1. Bold enclosing a link (or code span) now pairs: *Review <url|REVIEW-123> now* → **Review [REVIEW-123](url) now**. Tokens are lifted behind control-character sentinels (stripped from input first, so unforgeable; they carry no emphasis sigil, word char, or whitespace, so boundary guards behave), emphasis runs across the region as one string, tokens land back untouched.
  2. A backtick inside a label belongs to the link: the < opens first, so the whole angle form wins the scan; the label's backticks come out escaped ([View \main.py` file](...)`).
  3. A link inside a double-backtick span stays code: _INLINE_CODE now matches any equal-length backtick run, and the backticks open first, so the span is one verbatim token.

Each trigger from your review is a test verbatim, plus bold-spanning-inline-code; specs updated in the same commit. 33 converter tests green, mypy/flake8/black/flake-ratchet clean.

@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 9, 2026

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

Thanks for 04102a0. I re-ran the three triggers from my last review against mrkdwn_to_markdown at this head, and all three are fixed:

  • bold around a link now gives **Review [REVIEW-123](https://example.com/reviews/123) now**
  • a link label with backticks now converts to [View \main.py` file](https://example.com/file)`
  • the double-backtick span is left unchanged

One blocker is left. It is GPT 6.1's upheld finding, and it reproduces:

src/kiro_crew/slack/mrkdwn_markdown.py:152 escapes the bang whenever out.endswith("!"), even when that bang is already escaped. The input \!<https://example.com/review/123|Review> becomes \\![Review](https://example.com/review/123). Markdown reads \\ as a literal backslash and then ![...] as an image, so the bell shows an image chip instead of the link.

Fix: count the backslashes directly before the !, and add the escape only when that count is even. Please add a test with this input. Then I can approve once CI is green.

AI-assisted, sent by CommunityCrew

@brandonjsmith
brandonjsmith force-pushed the fix/bell-renders-slack-mrkdwn branch from 04102a0 to d8913b9 Compare November 9, 2026 16:36
@brandonjsmith

Copy link
Copy Markdown
Contributor Author

Pushed d8913b9384 (rebased onto current main) for the upheld finding:

Already-escaped bang before a converted link — fixed with backslash parity. The bang-escape now counts the trailing backslash run first: an odd run means the ! is already Markdown-escaped and is left alone (\!<url|Review> → \![Review](url)), while an even run (including zero) still gets the escape — so \\!<url|x>, a literal backslash plus an unescaped bang, becomes \\\![x](url). Both parities are tests, the upheld trigger verbatim.

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

Approving d8913b9. The bang escape now checks backslash parity:

  • \!<https://example.com/review/123|Review> gives \![Review](https://example.com/review/123)
  • \\!<https://x.y|L> still gets the escape
  • the three cases from my earlier review stay fixed

test/test_mrkdwn_to_markdown.py passes locally: 35 passed.

The fork CI runs on this head are approved and running. I'll merge once CI and the AI review lanes are green on this head.

AI-assisted, sent by CommunityCrew

@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 9, 2026

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

Changing my approval to request changes on d8913b9. GPT 6.1 found a security-class issue on this head, and I reproduced it:

  • redact_for_display("key AKIA\x00*IOSFODNN7EXAMPLE* end", _redact_all) returns the text unchanged, because the U+0000 splits the key.
  • mrkdwn_to_markdown then strips the U+0000 and returns key AKIA*IOSFODNN7EXAMPLE* end.
  • proactive_send.py:943 passes that to state.notify with no further redaction. In the bell, the Markdown renderer drops the asterisks and shows the whole key.

The fix works too: redact_for_display(mrkdwn_to_markdown(...), _redact_all) returns key [REDACTED: credential] end.

Fix: run bell_text, _ = redact_for_display(bell_text, _redact_all) after the conversion and before state.notify. Add one test with the split-key input above, asserting the bell body holds [REDACTED: credential].

Everything else on this head is still fine. I'll approve again once this lands.

AI-assisted, sent by CommunityCrew

One send_message call reaches two renderers with two grammars: Slack
renders mrkdwn, while the notification center renders Markdown. A
Slack-style link (<url|label>) therefore rendered as raw unclickable
text in the bell, and the emphasis sigils mapped to the wrong weights
(*bold* read as italic), so any agent formatting for Slack — the
documented channel format — got a degraded bell feed, with no
workaround that avoids double-notifying.

Convert the BELL's copy only, in _deliver_send_message_fallback, gated
on send_to_slack: that predicate is true precisely when the caller
formatted for Slack (the cron owner-DM default included), and false
when a channel_target/channel_type send carries another channel's
format. Every delivery leg still sends the caller's own bytes.

The converter (slack/mrkdwn_markdown.py) is deliberately conservative:
emphasis converts only at Slack's own word-edge boundaries so an
already-Markdown body and snake_case identifiers pass through, only
<scheme:...> angle forms convert so mentions and <!here> stay literal,
and code spans are kept verbatim.
@brandonjsmith
brandonjsmith force-pushed the fix/bell-renders-slack-mrkdwn branch from d8913b9 to ed27d2d Compare November 9, 2026 18:38
@brandonjsmith

Copy link
Copy Markdown
Contributor Author

Pushed ed27d2d8c4 (rebased onto current main) for the security-class finding — a good catch, and the suggested fix was exactly right:

Converted bell copy is re-scanned before storage. Conversion is a rendering step after the route's display scan: the sentinel strip and emphasis collapse can reassemble a secret a scan saw as split. _deliver_send_message_fallback now applies redact_for_display(bell_text, _redact_all) — the same settled scan this route already runs on the inbound text — to the CONVERTED copy before state.notify; the delivery legs still send the already-scanned original bytes. Test added with the finding's trigger shape (a NUL-and-emphasis-split AWS key id): the real redactor catches the reassembled key and the bell body carries no fragment of it. Spec updated in the same commit.

Note also: this head already contains the escaped-bang parity fix from the previous round (your review of 04102a054e and my push crossed).

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

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

Approving ed27d2d. The bell copy is now re-scanned with redact_for_display(bell_text, _redact_all) after the conversion, and only on the Slack-bound path. test_a_slack_bound_send_rescans_the_converted_copy_for_secrets covers the split key. test/test_mrkdwn_to_markdown.py passes locally (36 passed). All six fork AI lanes pass on this head: GPT 6.1, Opus 5.5, Design, First Principles, Security Scope and UX.

I'll merge once the backend shards finish green.

AI-assisted, sent by CommunityCrew

@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 Nov 9, 2026
@bolichen97
bolichen97 merged commit 398d49b into kirodotdev:main Nov 9, 2026
94 checks passed
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 9, 2026
bolichen97 pushed a commit that referenced this pull request Nov 10, 2026
…29906)

One send_message call reaches two renderers with two grammars: Slack
renders mrkdwn, while the notification center renders Markdown. A
Slack-style link (<url|label>) therefore rendered as raw unclickable
text in the bell, and the emphasis sigils mapped to the wrong weights
(*bold* read as italic), so any agent formatting for Slack — the
documented channel format — got a degraded bell feed, with no
workaround that avoids double-notifying.

Convert the BELL's copy only, in _deliver_send_message_fallback, gated
on send_to_slack: that predicate is true precisely when the caller
formatted for Slack (the cron owner-DM default included), and false
when a channel_target/channel_type send carries another channel's
format. Every delivery leg still sends the caller's own bytes.

The converter (slack/mrkdwn_markdown.py) is deliberately conservative:
emphasis converts only at Slack's own word-edge boundaries so an
already-Markdown body and snake_case identifiers pass through, only
<scheme:...> angle forms convert so mentions and <!here> stay literal,
and code spans are kept verbatim.

(cherry picked from commit 398d49b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants