Skip to content

[AI-4360] Limit notices ask Slack to unfurl no media - #2711

Open
kanat wants to merge 4 commits into
mainfrom
kanat/ai-4360-no-link-previews-other-channels
Open

kanat wants to merge 4 commits into
mainfrom
kanat/ai-4360-no-link-previews-other-channels

Conversation

@kanat

@kanat kanat commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

Why

The usage-limit notice asked Slack not to unfurl links but not media, so Slack could still fetch a media link in it. It now sends unfurl_media: false too. I checked the other places the router posts text through a vendor API. Linq, WhatsApp and Telnyx need no code change, and a comment at each send says why. This follows #2613, which did the same for Stream Chat and Slack agent replies.

How it works

router sends text           vendor documents a no-preview setting?        change
---------------------------------------------------------------------------------------
limit notice -> Slack       unfurl_links, unfurl_media (both false)       adds unfurl_media: false
agent reply  -> Linq        none; Linq's pages disagree on text parts     comment only
agent reply  -> WhatsApp    preview_url, preview only when true           comment only (never sent)
agent reply  -> Telnyx SMS  none in the request fields                    comment only
Path What the vendor says Test
Limit notice to Slack unfurl_media: "Pass false to disable unfurling of media content" (chat.postMessage) TestSlackAsksForNoLinkPreviewOfEitherKind: the body is exactly channel, text and both flags
Linq (channels/linq.go, providers/linq.yaml) The message has parts, reply_to, effect and idempotency_key. The guide says iMessage previews a URL inline (rich link previews). The OpenAPI spec says a URL in a text part has no preview card (spec, lines 365, 11667, 12222) none: nothing to set
WhatsApp (channels/whatsapp.go, providers/whatsapp.yaml) preview_url "Optional. Set to true to have the WhatsApp client attempt to render a link preview", and a client "renders a clickable link instead if you omit preview_url" (text messages) already covered: TestAReplyIsTextFromTheBusinessNumberToThePerson pins the whole body, TestAnAnswerIsSentToTheNumberThatWroteAsTheLine the whole text object
Telnyx SMS (providers/telnyx.yaml) The send-a-message request lists no preview field (reference) none: nothing to set

The limit notice is the router's own text to a staff channel, so there is no user message to keep a control for. The test also pins the channel and the text, which are unchanged. The YAML edits are comments only, so no connector revision changes.

Not covered

  • Linq has no field that turns a link preview off. The router puts a URL in a text part and never sends a link part. Linq's guide and its OpenAPI spec disagree on whether a text part is previewed (links in the table above), so this PR does not settle it.
  • The Slack MCP send tool and the Python framework plugin writes are in other packages and are not touched here.
  • Whether WhatsApp accepts an explicit preview_url: false is not documented, so it is not sent.
Mutations and commands

Mutants of internal/limitnotice/slack.go, each killed by TestSlackAsksForNoLinkPreviewOfEitherKind (the first one is the base behaviour):

  • drop unfurl_media
  • unfurl_media set to true
  • drop unfurl_links
  • unfurl_links set to true

mutinv.sh lists no new guard. Run in acceleration/: go test ./internal/limitnotice -run TestSlack, go test -tags integration ./internal/limitnotice ./internal/channels ./internal/connectors/providers, go test ./internal/channels ./internal/connectors/core ./internal/store.

🤖 Generated with Claude Code

The usage-limit notice already asked Slack not to unfurl links, but
unfurl_media was missing, and Slack unfurls the media of a link in an app's
message unless the message says no. The Linq, WhatsApp and Telnyx senders get
only a comment: Linq and Telnyx have no field for it, and WhatsApp previews a
link only when preview_url is true, which the router never sends.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@kanat kanat left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Text review: 2 unclear of 4

Three small text nits. Each comment below partly lies outside the diff hunk, so they are listed here instead of inline.

[Nit] T1.1 acceleration/internal/channels/linq.go:128-135. "iMessage previews a URL, so a login goes in the text" does not follow, and "a login" is not explained. Suggested:

// Send writes the reply as one message of several parts: the text, then each file. A login link is added to the end of the text.
//
// Linq has no setting that turns the link preview off, so a URL in the text part is previewed.
// The router sends no "link" part, since that part asks for a rich card
// (https://docs.linqapp.com/channel/imessage/guides/messaging/rich-link-previews/index.md,
// opened November 29, 2026).

[Nit] T1.2 acceleration/internal/channels/whatsapp.go:135-141. "The button for a login" is not explained, and the first sentence packs four steps. Suggested:

// Send writes the reply as one request per part, since Meta takes one thing per message: the text,
// then each file, then a button for the login link.
//
// The text message has no preview_url on purpose. Meta previews a link only when preview_url is
// true, and a client "renders a clickable link instead if you omit preview_url"
// (https://developers.facebook.com/documentation/business-messaging/whatsapp/messages/text-messages.md,
// opened November 29, 2026).

[Nit] T1.3 PR opening. It has four sentences and names #2613. Suggested:

The usage-limit notice asked Slack not to unfurl links, but not media, so Slack could still fetch media from it. The notice now also sends unfurl_media: false. The other places the router posts text through a vendor (Linq, WhatsApp, Telnyx) need no change, and a comment at each send says why.

The Slack comment in limitnotice/slack.go reads clearly.

@kanat kanat left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

VERDICT: NO-GO

Reviewed 697c1a7 on main d734ca0 (no base change to merge). One Should fix, R1.1 below; everything else checked is sound.

[Should fix] R1.1 The Linq comments (channels/linq.go, providers/linq.yaml) and the "Not covered" bullet in the PR body say a link in a text part is previewed. They cite only the Linq guide ("Text part - iMessage auto-previews the URL inline"). Linq's OpenAPI spec (https://cdn.linqapp.com/openapi/linq-api-v3.yaml, the parts description and the link part's value) says the reverse: "To send a URL without a preview card, include it in a text part instead" and "To send a URL as plain text (no preview), use a text part instead". The router already sends text parts, so the claim is contested by the vendor's own spec. Fix: cite both pages in the two comments, say they disagree and that whether Linq previews a link in a text part is not settled, and word the PR body's "Not covered" line the same way. The ticket about rewriting URLs in agent text should say it too.

Checked and sound:

  • Slack unfurl_media/unfurl_links, WhatsApp preview_url, Telnyx request fields and Linq message fields match the cited pages (fetched today).
  • Router-side sweep: every Stream Chat write of agent text carries skip_enrich_url; Slack chat.postMessage is sent only by the limit notice (changed) and the slack_bot.yaml reply (flags, revision 6); Linq, WhatsApp and Telnyx are the only other senders. The limit notice's digest and sender both go through Slack.Post.
  • The YAML edits are comments only: base and head of linq, whatsapp and telnyx parse to identical manifest JSON, and the revisions are unchanged.
  • TestSlackAsksForNoLinkPreviewOfEitherKind fails on four mutants (drop or flip either flag), including the base behaviour. Touched suites pass on the head.
  • CI: draft, so go and integration are skipped; they run at gh pr ready.

Comment thread acceleration/internal/channels/linq.go Resolved

@kanat kanat left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

[security R1] GO

This PR adds no entry point. Its one behaviour change is a constant in the limit notice's request to Slack, and the new test catches it: removing unfurl_media: false or setting it to true fails TestSlackAsksForNoLinkPreviewOfEitherKind.

I checked every place the router posts an agent's text to a platform that can build link previews:

Path Result
Stream Chat writes of agent text skip_enrich_url is set (#2613). The bridged message from a person is left as it was, on purpose
Slack bot reply, limit notice Both unfurl flags are false
WhatsApp text preview_url is left out, which Meta documents as the no-preview form. Existing tests pin the full body, so adding preview_url: true fails TestWhatsAppSuite
Linq, Telnyx The vendor API has no preview flag
Files, login buttons They carry URLs the router made, not the model

I have no blocking findings. A wording note on the Linq comments goes to the ticket, together with the main reviewer's.

…iews

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@kanat kanat left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

VERDICT: GO

Delta 697c1a7 to 3f63fa8 (comments, YAML comments and the PR body only).

Prior findings

  • R1.1 fixed. linq.go, linq.yaml and the PR body now cite both Linq pages and say they disagree. Checked against the pages: the guide says "Text part - iMessage auto-previews the URL inline", and the OpenAPI spec says "To send a URL without a preview card, include it in a text part instead". No text says a link is or can be previewed.
  • S1.2 fixed. The comments keep to the API fact (no flag, text part only, never a link part).
  • T1.1, T1.2, T1.3 fixed. The Linq and WhatsApp Send comments and the PR body opening match the code and the cited pages (Meta: preview_url asks for a preview, omitting it gives a clickable link; Slack: unfurl_media "Pass false to disable unfurling of media content").
  • Code check: git diff 697c1a7c1 3f63fa838 changes no code line. The linq.yaml manifest parses equal to the earlier head and revision: 3 is unchanged.

Suites: go build ./... and go test -count=1 ./internal/channels ./internal/connectors/providers ./internal/limitnotice pass on the head (equal to the current main merge base d734ca0). CI: draft; labeler and GitGuardian pass, go and integration skip, CodeQL was pending when I looked.

New finding: one Nit, inline. It does not block.

Comment thread acceleration/internal/channels/linq.go Resolved
kanat and others added 2 commits November 29, 2026 12:32
…ll field list

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
@kanat

kanat commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator Author

Fixed in fe9fac8 (comment rewrap in 6db5863): linq.go:132 comment.

@kanat
kanat marked this pull request as ready for review November 29, 2026 17:33

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant