Skip to content

feat: send bridged notifications to the feishu owner dm - #36602

Merged
bolichen97 merged 1 commit into
mainfrom
fix/32130-feishu-bridge-sink
Nov 13, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/32130-feishu-bridge-sink

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: An owner who routes a notification channel to Feishu gets its notes, a waiting tool approval included, as a DM on Feishu, the way Discord, Telegram and Webex owners already do.

The notification bridge sends a routed channel's notes to the owner's DM on Discord, Telegram and Webex, and with the "Send pending approvals to chat apps" preview on it also sends one note when a tool approval opens. Feishu is in neither of its transport lists. So Settings never offers Feishu under "Deliver to", a route naming it is refused as an unknown transport, and an owner who is only reachable on Feishu hears nothing while an approval waits and then auto-declines.

Why it matters

A dashboard turn that needs an approval while the owner is away waits out its whole window and is declined, and a Feishu-only owner has no way to know. Feishu can already send the first message to an allow-listed DM (#31283), so the only thing missing is the bridge using it.

Not a goal

  • Answering an approval from Feishu. Feishu stays out of REPLY_TRANSPORTS: that needs an inbound reply reader and is tracked in Feishu: two-way dashboard link and numbered-text tool approval #31448.
  • A separate notice when an approval expires, a new setting, or a change to who may approve.
  • Any change to how the bridge routes, vets, rate-limits or redacts a note, or to the other transports.

What changed (motivation → approach → change)

Feishu becomes one more read-only bridge transport. It needs no code of its own: the generic TransportBridgeSink and the owner-DM leg already serve any connected MessagingTransport that can send first and names exactly one owner DM, and Feishu does both (supports_proactive_send=True, inside CHANNEL_OWNER_DM_NAMESPACES).

Where Change
notifications/bridge.py BRIDGE_TRANSPORTS feishu is a known route target, so deliver_to: ["feishu"] is stored instead of refused
notifications/bridge_transport.py TRANSPORT_SINKS the gateway registers a sink for Feishu, so a routed note reaches the single allow-listed open_id
website/src/pages/settings/NotificationsBridgeRoute.tsx the "Deliver to" row offers Feishu while it is connected, labelled with the existing catalog key
docs/system-specs/modules/app-notifications.md, src/kiro_crew/docs/feishu-integration.md the transport lists name Feishu, and the guide's stale "replies only" limit now says notifications are read-only

Routing, governance, the rate limit, redaction and the one-owner rule are the shared ones, unchanged. A reply in Feishu is still an ordinary message, never an answer to the approval.

Backwards compatibility

Compatible: one more accepted transport id; every route main accepts is stored and delivered as before, and a route that does not name Feishu behaves the same.

Removes nothing: the diff only adds an id to two tuples and one label.

Tests

  • test/test_notification_bridge_transport.py adds a Feishu row (the real FeishuTransport, only its Lark client faked), so every per-transport case runs on Feishu too: a routed critical note lands once as a redacted owner DM, and not connected, two allow-listed people, no proactive send, outside the owner roster and a refused send are each audited as a skip or an error. The roster pins (every sink has a row; every sink can name its owner) cover Feishu.
  • A new case publishes a real pending-approval note routed to Feishu: exactly one message reaches ("open_id", owner), and it carries no "Reply approve or deny" prompt and no call detail.
  • test/test_notification_bridge.py pins the known set with feishu.

Determinism (Ubuntu 24.04 host): every node id in test/test_notification_bridge_transport.py plus test_the_known_transports_are_pinned, passed 20 of 20 runs at -n0, 10 of 10 at -n 4 --dist loadgroup beside test_notification_settings.py and test_notification_bridge_approval_note.py, and a shuffled order (seed 21363).

Red before, green after: prove.py reverted the production hunks and test_the_known_transports_are_pinned and test_every_bridge_transport_but_slack_has_a_test_row failed; both pass on this head.

Manual verification

Run on a Linux host (Ubuntu 24.04, Python 3.12), on a real isolated gateway built from this branch and from its base. The host has no Feishu tenant, so the delivery itself is driven in-process with the real FeishuTransport and only its Lark client faked.

Check Base c22557cd83 This branch
GET /api/notifications/channels bridge_transports no feishu ends in feishu
PUT /api/notifications/channels/settings {"channel": "system.approval", "deliver_to": ["feishu"]} 400 deliver_to names unknown transports ['feishu'] 200, route stored
one pending approval published, approval channel routed to Feishu route refused, 0 Feishu sends 1 send to ("open_id", "ou_owner1"): 🚨 **Approval needed** / execute_bash is waiting for approval in Release notes., no reply prompt, no call detail; audit notification_bridge:feishu completed
same note routed to Webex / Discord — Webex: 1 plain send; Discord: 1 send still carrying the detail and the reply prompt

Gates on the host: black, isort, flake8, mypy, semgrep (0 findings), docs-lint, the flake-pattern ratchet, tsc, the bridge-route vitest files and scripts/local-gate.py (both surfaces) are green, except two backend reds that fail the same way on a clean base checkout of that host (test_find_ui_auto.py::test_the_generated_auto_tier_answers_labels_only_it_carries[continue with github-...] and test_host_git_repo_exec_neutralization.py::TestCliUpdate::test_up_to_date_diff_runs_no_textconv_planted_during_the_fetch).

Screenshots / video

Settings → Notifications → Sources on the isolated gateway. Only /api/status is intercepted, to report Feishu as connected (no tenant on the test host); bridge_transports and the route save are the real gateway's.

Before (base): Feishu connected, yet no row offers it.

Before: no Deliver to control on any row

After: every row offers Feishu under "Deliver to".

After: Deliver to Feishu on each row

Feishu picked on the approval row (the floor picker appears), light and dark

Approval row routed to Feishu, light

Approval row routed to Feishu, dark

Related Issues

Closes #32130

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.

The notification bridge already delivers a routed channel's notes, the
pending tool-approval note included, to the owner's DM on Discord,
Telegram and Webex, but Feishu was in neither of its transport lists, so
an owner reachable only on Feishu heard nothing while an approval waited.

Feishu joins BRIDGE_TRANSPORTS and TRANSPORT_SINKS and the Deliver to
row gets its label. It is served by the same TransportBridgeSink and
owner-DM leg as the other transports, so routing, governance, rate
limit, redaction and the single allow-listed owner rule are unchanged.
It stays out of REPLY_TRANSPORTS: answering from Feishu needs an inbound
reply reader and is tracked separately.

Closes #32130
@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: Feishu already meets both conditions the generic sink and owner-DM leg rely on (supports_proactive_send=True, and it is inside CHANNEL_OWNER_DM_NAMESPACES), and the four screenshots show the new Settings row.

[DESIGN-REVIEWED] 8da6df2

Description read

[DESCRIPTION-READ] 880754c2e3302f1875a5765626b5f4256f5602e9dcba648ee6adc868737e7e33

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 8da6df250d7f73dd5a922f2e72bf7c0a05ec9811 — 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. This adds Feishu as a read-only owner-DM destination that only works when someone picks it, and it reuses the generic TransportBridgeSink path with no new mechanism.

What this change ships

Inventory (5 items) — 5 justified

Intent: An owner who can only be reached on Feishu gets routed notifications, including a waiting approval, as a Feishu DM. This is an ADDITION.

  1. Settings → Notifications "Deliver to" offers Feishu while it is connected, using the existing pages.servicesTab.feishu label — justified
  2. A route naming feishu is now stored instead of refused with a 400 — justified
  3. A routed note, including the pending-approval note, reaches the single allow-listed open_id as a redacted DM, under the shared gates (governance check, rate limit, redaction, one-owner rule) — justified
  4. The Feishu guide's limit "Replies only… not a proactive-notification target" is replaced by "Notifications are read-only" — justified
  5. The pin test test_known_transports_match_the_rfc is renamed test_the_known_transports_are_pinned, and its tuple gains feishu — justified

[FIRST-PRINCIPLES-REVIEWED] 8da6df2

Description read

[DESCRIPTION-READ] 9c6ac1a3890cddd319c00ca3b09ecbc64ab75218440257496d5a2e35de4fd272

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

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 8da6df250d7f73dd5a922f2e72bf7c0a05ec9811 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks. The one UI change is a Feishu label in the existing "Deliver to" pattern, and the screenshots show it unticked, ticked, and in light and dark themes.

Notes

  • The blind reader read "Deliver to Feishu" correctly but was unsure about ticking it: "I don't know what Feishu is… I'd want to know first where my alerts would go." Users who connected Feishu themselves will know it, so this is a note, not a blocker.
  • The approval row says "Always interrupts — cannot be muted or lowered", yet ticking Feishu shows a "Critical only" picker on that row. The reader read that as lowering the approval somewhere else. Consider hiding the floor picker on the protected row, or labelling it "Feishu: critical only". This is an existing pattern, so it's follow-up work.

[UX-REVIEWED] 8da6df2

Description read

[DESCRIPTION-READ] 82d056a3c5818a8c63d30fd20e02fccbdf90e24908ef3fb9ce47adfbcb83970d

That sha256 names everything this verdict read: the PR description, plus the 7 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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 8da6df250d7f73dd5a922f2e72bf7c0a05ec9811 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 8da6df2

Verdict parsed from the review's SHA-scoped output markers for commit 8da6df250d7f73dd5a922f2e72bf7c0a05ec9811.

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

@bolichen97
bolichen97 enabled auto-merge (squash) November 13, 2026 12:21
@github-actions

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 8da6df250d7f73dd5a922f2e72bf7c0a05ec9811 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 8da6df2

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

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

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I reviewed head 8da6df2. I traced the Feishu path through the existing bridge pipeline. It is vetted, audited, rate limited and redacted before any sink runs. The owner DM leg then re-checks the channels/feishu governance gate, the live roster and may_send_to before each part. The owner can only come from the configured allowed_open_ids, so a learned peer is never named owner. Feishu stays out of REPLY_TRANSPORTS, so a pending approval note carries no reply prompt and no call detail. Removing feishu from either backend tuple fails a pinned test.

Done well: Feishu is added as data only, so it runs through the shared governed sink instead of new code. The new test drives the real FeishuTransport with only the Lark client faked, and pins the read-only non-goal as a mutation check.

Optional:

  • Merging closes #32130, but its title still asks for the expiry notice. Consider filing a follow-up issue for expiry, or retitling #32130 to the narrowed scope, so that request is not lost.
  • No test fails if the feishu entry in BRIDGE_TRANSPORT_LABEL_KEY (NotificationsBridgeRoute.tsx:30) is removed. A small vitest case that checks a Feishu checkbox appears, or a parity check against the Python tuple, would cover the UI half.

@bolichen97
bolichen97 merged commit 1438766 into main Nov 13, 2026
98 checks passed
@bolichen97
bolichen97 deleted the fix/32130-feishu-bridge-sink branch November 13, 2026 14:22
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 13, 2026
buluoray pushed a commit that referenced this pull request Nov 15, 2026
The notification bridge already delivers a routed channel's notes, the
pending tool-approval note included, to the owner's DM on Discord,
Telegram and Webex, but Feishu was in neither of its transport lists, so
an owner reachable only on Feishu heard nothing while an approval waited.

Feishu joins BRIDGE_TRANSPORTS and TRANSPORT_SINKS and the Deliver to
row gets its label. It is served by the same TransportBridgeSink and
owner-DM leg as the other transports, so routing, governance, rate
limit, redaction and the single allow-listed owner rule are unchanged.
It stays out of REPLY_TRANSPORTS: answering from Feishu needs an inbound
reply reader and is tracked separately.

Closes #32130

(cherry picked from commit 1438766)
buluoray pushed a commit that referenced this pull request Nov 15, 2026
The notification bridge already delivers a routed channel's notes, the
pending tool-approval note included, to the owner's DM on Discord,
Telegram and Webex, but Feishu was in neither of its transport lists, so
an owner reachable only on Feishu heard nothing while an approval waited.

Feishu joins BRIDGE_TRANSPORTS and TRANSPORT_SINKS and the Deliver to
row gets its label. It is served by the same TransportBridgeSink and
owner-DM leg as the other transports, so routing, governance, rate
limit, redaction and the single allow-listed owner rule are unchanged.
It stays out of REPLY_TRANSPORTS: answering from Feishu needs an inbound
reply reader and is tracked separately.

Closes #32130

(cherry picked from commit 1438766)
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.

Tell the owner on their linked channel when a dashboard approval is waiting (and when it expires)

2 participants