Repository navigation
MCP answers to 8,000 characters, Discord's long replies as one message, a press's toast, and a link previews setting - #52
Merged
Merged
Conversation
maxAnswer (a direct command's answer, a feed item, an addon's post and a buttons op's text) goes from 4,000 to 8,000, the most any network sends as one reply (maxReply), so a long answer such as finbot's /holdings goes whole, split into messages where the network needs it (Telegram 2, Discord about 5), instead of losing its end. The outbox merges posts while their texts together stay within it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
robdevops
pushed a commit
to robdevops/finbot
that referenced
this pull request
Dec 2, 2026
Signalbot's cap on an MCP answer is 8,000 characters (robdevops/signalbot#52), as every network's on one reply, so finbot's cut and the Markdown dialect's limit follow it, and a cut answer ends with "✂️ Cut short: the rest is too long for one answer." rather than a bare ellipsis. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
…0 ms On a loaded CI machine the read could come after the first post was said sent, so "two" went out alone and the test failed (CI on 63ad4ce). It now waits for the addon's log to show a read of two or more ops first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
…efore counting log lines The Signal adapter logs its groups once the bot has started, at its own pace; on a loaded CI machine the line came after the test counted the log, and was taken for logged chatter (CI on ecfa2bc). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
A reply past one message's 2,000 characters goes on in embeds below its text (each up to 4,096, 5,800 together, 10 at most), so an 8,000-character answer is one message; mentions notify from its text alone. An edit sends the embeds too, none when the text fits alone; a quoted bot message reads its embeds. Discord's Caps.Text rises to half what one message holds. A plain server's press result with no content may carry _meta io.github.robdevops.signalbot/toast, shown to the presser, the post left as it was. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
The review found that halving the limits didn't keep a reply to one message: parts cut early and escapes left 3,850 characters going out as two, so buttons went under a post never kept and an edit dropped its end. A reply is now cut from the text itself (mdstyle.Cut), the message's text first, then each embed to the room left, a cut shortened until its Markdown fits; Caps.Fits packs a text the same way and says whether it is one message, which oneMessage uses before Caps.Text. An embed's @NAMEs stay as written (no mention to notify), an edit too long for one message warns, and only the bot's own quoted message has its embeds read: a user's link preview is never part of their message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
…ntions The verification found take() could cut to nothing or below: text whose Markdown is twice as long as it or more (a run of escaped | or *, a list of links, known names' mentions) made pack loop without end or panic in mdstyle.Cut. A cut now shrinks in proportion to how much too long it is, never under one character, so each take holds something. Fits packed without the chat's names, which Send turns into longer mentions, so it could say one message where Send made two; it now counts every @word as the longest mention. Tests for each case, with a time limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
…room The second verification found Fits' guess at mentions could still say one message where Send made two (a long or underscored @word written out escaped, @al. with its dot, a name starting with an emoji), and a link whose URL outgrew an embed's room went out whole, past Discord's 6,000. Caps.Fits now takes the names to send with, and a feature asks Net.Fits, which Bot.Net binds to the chat's names as Send gets them: exact, not a guess. A piece that can't be cut to fit, a link with an outsized URL, keeps its text without the link. Tests for each case found. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
Link previews off: Telegram's sendMessage and editMessageText carry link_preview_options is_disabled; on Discord every link is written <url> or [text](<url>), as its suppress-embeds flag would hide a long reply's embeds too, and a message read has each <url> as the URL. Slack's were off already, and Signal sends none. The third verification found a link too long for the room left shredded into one- and two-character pieces, and Fits packing without the leading echo of the bot's name that Send strips. A cut now never goes through a link: it ends before it, or after a link that starts the piece; an embed's room too small for a link leaves it to the next message; a link longer than a message's text holds keeps its text without the link. Fits checks both ways a text is packed, a post's and an edit's. A seeded fuzz test of 300 replies checks Fits against what is sent, every limit, every word, and links whole. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
Previews of the links in the bot's messages follow one setting, off unless LINK_PREVIEWS is true, yes, on or 1: Telegram's link_preview_options on sends and edits, Discord's <url> wrapping (off) or links as written (on), and Slack's unfurl_links and unfurl_media. Documented, a core setting kept from addons, and tested off and on for each network. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
The fourth verification found the <url> wrapping took in trailing punctuation and closing brackets or quotes (see <https://x.io/a.>), put a style's closing marker inside the brackets (**<https://x.io/a**>), and wrapped a URL already written <url> again. A bare URL now ends at white space, a change of style, a link or a mention, less trailing punctuation, quotes and closing brackets but a ) that closes a ( in it, and one written <url> is left as it is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
…es or <> The fifth verification found, with previews off: a masked link written [text](<url>) wrapped twice; a bare URL running on through a < (an HTML <br>); a bare URL cut between a message and its embed though it fit whole in the embed; a known @name inside a URL (youtube.com/@name) made a mention, pinging that person and breaking the link; a masked URL with parentheses (Wikipedia's) ending at its first ); an IPv6 host losing its ]; and a press's answer still previewing its links. mdstyle's link parsing balances a URL's own parentheses and takes [text](<url>) as the URL; a bare URL ends at a <, keeps a ] that closes a [, is never cut through where it fits whole (urlRuns), and holds no mentions; a press's answer has flag 4 unless LINK_PREVIEWS is on. Tests for each. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
… link's The sixth verification found a bare URL that starts a piece still cut at the end of the room an embed had left, though the next message's text held it whole, and a URL written in a masked link's text taken for a bare URL, which split the link at a cut and was wrapped in <> inside the link's text. Such a URL now moves to the next message (take's ok=false, as a link's does) and is cut through only where no message holds it; a URL in a link's text is the link's (bareRuns), never wrapped. Tests for both, which fail on the previous commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
The seventh verification found that since a URL in a link's text is no longer wrapped, it stayed a bare URL past the link's end, so text right after the link was neither escaped (a~~b~~c struck through) nor had its own URL wrapped. A link's start and end now end any bare URL. Tests for both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
The eighth verification found, mostly from before this PR: text after a URL written <url> left unescaped; a URL in a link's text left unescaped, though Discord never links there; a URL straight after CJK text, a link or inline code not taken for one (so previewed, escaped and its @name a mention); and a known name with a space cut at that space, its mention lost. A URL now starts where Discord's autolinker starts one (not after an ASCII letter, digit or _; after a link or code), never in a link's text; one written <url> ends at its >; and a cut never goes through a mention. Tests for each. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
The ninth verification found a URL after a < with no > (an unclosed <url>, or one with a space before its >) taken as written <url> already, so not wrapped and still previewed, and a link preview of type rich (an X post's) read into a quote of the bot's message as the bot's words. A URL is taken as written <url> only where its > closes it, and a quote reads only embeds with no url, the bot's own. Tests for both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
…ckets The tenth verification found that links side by side ([1](u)[2](u)), whose shortest cut holds both, made take give up at its floor with a piece far over its room: a message's embeds past Discord's 6,000, or its text past 2,000, which Discord refuses, losing the whole reply though Fits said one message. At the floor, take now cuts after the first link (or mention or URL) that fits, else after one character. A URL written <url> is kept with its brackets at a cut. A test of each case, which fails on the previous commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
The eleventh verification found no reply over Discord's limits in some 200,000 random ones, and Fits always agreeing with what was sent; it found two cuts in poor places. A link too long for what is before it shrank the cut by its own size, so the cut fell mid-word and a sentence went into tiny embeds (Sources | :); the cut now goes before that link, at a line break or space. A known name with a space at a URL's end (youtube.com/@john Smith) was kept whole by cutting through the URL; a name in a URL is the URL's, as markdown already writes it. Tests for both, which fail on the previous commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
robdevops
pushed a commit
to robdevops/finbot
that referenced
this pull request
Dec 2, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four changes: MCP answers capped at 8,000 characters, Discord's long replies as one message, a toast for a plain server's press, and no link previews.
MCP answers to 8,000 characters
maxAnswer(a direct command's answer, a feed item, an addon's post and a buttons op's text) goes from 4,000 to 8,000, so a long answer such as finbot's/holdingsgoes whole instead of losing its end: the most every network already sends as one reply (maxReply), split where the network needs it. An 8,000-character answer is 2 messages on Telegram, one or two on Discord (below), one message of 3 sections on Slack, and one on Signal (folded behind Read more).Discord: a long reply as one message
mdstyle.Cut), shortened until its Markdown fits, and never through a masked link, a bare URL or a mention where it fits whole (a link too long for any message's text keeps its text without the URL; one too long for an embed's room left goes to the next message, with the cut before it). That is about 7,700 characters a message; past it, a second message the same way. Buttons stay under the last message, pictures with the first.@Namestays as written.embeds: []when the text now fits alone), as does a slash command's@originalanswer.Caps.Fits(text, known)says exactly whether a text goes out as one message; Discord's packs it as a post and an edit are packed. A feature asks the chat'sNet.Fits, whichBot.Netbinds to the chat's names asSendgets them, andoneMessageuses it, so buttons go under longer answers and presses edit them in place. The prompt no longer says a message holds 2,000 characters.A plain server's press can answer with a toast
_metaio.github.robdevops.signalbot/toastshows that text to the presser for a moment (at most 200 characters), the post left as it was, such as why the press can't be done ("8 tickers at most").addon.ResultMeta.Toastandschema.jsondeclare it.Link previews: one setting, off by default
LINK_PREVIEWS(falseby default;true,yes,on,1) turns previews of the links in the bot's messages on for every network that makes them. Documented indocs/CONFIGURATION.md, and kept from addons as a core setting.link_preview_options: {is_disabled: …}onsendMessageandeditMessageText.<url>or[text](<url>)(the suppress-embeds flag would also hide a long reply's embeds), a bare URL found and ended as Discord's autolinker does (trailing punctuation outside, balanced brackets in, after CJK text, a link or code; never in a link's text; one written<url>left as it is); a press's answer carries flag 4; a message read has each<url>back as the URL.[text](<url>)is read as the URL; a known@nameinside a URL (youtube.com/@name) stays the URL's, never a mention.unfurl_linksandunfurl_mediafollow it (were always off). Signal makes none for a bot's messages.Tests
Fitsagrees with what is sent for heavily escaped text, long lines and short ones; an embed's name stays as written; a long edit carries an embed and a short one clears them; a slash command's long answer has its embed in the@originalPATCH; a quote of the bot reads its embeds, and a user's link preview is never read in; text whose Markdown is twice as long or more (escaped runs, long links, mentions) packs within limits with a time limit; a seeded fuzz of 300 replies checksFitsagainst what is sent, every limit, every word, and links whole;Bot.Netbinds the chat's names. Each network's previews followLINK_PREVIEWS, off and on.TestOutboxandTestScenarioGroupChatterIsContextwaited for log lines by time; on a loaded CI machine they failed (on 63ad4ce and ecfa2bc). Each now waits for the line itself.Twelve rounds of adversarial review (three reviewers each, with random fuzzing of up to some 200,000 replies a round) found and fixed hangs, panics, over-limit messages,
Fitsdisagreeing with what was sent, cut links and URLs, and URL wrapping errors; each fix has a test that fails without it. The twelfth round found nothing.go vet,go test -race ./...and the toolchain'sgofmtare clean. Docs:TECHNICAL.md,docs/FILES_LINKS_TOOLS_MCP.md,README.md.https://claude.ai/code/session_01RsqJny87LfkxT9UwQbuAsH
Generated by Claude Code