Uh oh!
There was an error while loading. Please reload this page.
Shared chat-channel foundations - #404
Open
alex-clickhouse wants to merge 4 commits into
Open
Conversation
This was referenced Aug 23, 2026
alex-clickhouse
marked this pull request as ready for review
August 24, 2026 06:44
Extract Telegram's ZIP handling into a channel-neutral helper with limits on entry count, expanded size, per-entry size, and compression ratio. This both closes decompression amplification and gives the Slack channel a safe implementation to build on.
MAX_TOTAL_SIZE was above the compressed download cap, so a 703 KB upload of 100 padded PDF entries passed every check and produced 66.7 MB of base64 in one prompt. Set the entry and archive caps from what the prompt can carry once base64 adds its third. The compression ratio check refused small files that repeat for ordinary reasons: a 103 KB generated .py and a 105 KB log of one repeated line both scored above the ratio and were dropped, where Telegram inlined them before. Apply the ratio only above RATIO_FLOOR, where the size caps have not already bounded the entry. Check the text budget before the archive budget so a refusal names the limit the entry reached.
A channel needs to decide whether a sender and a conversation may reach the agent, and the matching rules do not depend on the transport: allow and deny lists of case-insensitive globs, deny winning over allow, and a refusal when an identity could not be resolved well enough to check a deny list against. Aliases are split by who controls them. A deny rule may match any alias. An allow rule may match only the aliases the subject cannot set for itself, because a grant resting on a self-set name lets the subject pick its own access. Each transport decides which of its aliases fall on which side. No transport uses this yet. The Slack channel composes its user, channel, and direct-message rules on top of it.
alex-clickhouseforce-pushed
the
alex/slack-channel-foundations
branch
from
August 26, 2026 11:59
c9119ba to
6ac958dCompare
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 freeto 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.
Part 1 of the Slack channel stack. This PR stands on its own: it adds the
channel-neutral session, notification, access, and attachment pieces that the
Slack adapter in #403 builds on. Nothing here names Slack.
Stack
What changes
case-insensitive globs, deny winning over allow, and a refusal when an
identity could not be resolved well enough to check a deny list against.
Aliases are split by who controls them: a deny rule may match any alias, an
allow rule only the ones the subject cannot set for itself. A grant resting
on a self-set name would let the subject pick its own access. Each transport
decides which of its aliases fall on which side.
text, image, and PDF behavior. The caps come from what a prompt can carry
once base64 adds its third, and the ratio check applies only above a size
floor so ordinary repetitive files still arrive.
ChannelRoutercompleted as the session boundary for stop, star,switch, unregister, and conversation-scoped lookup, so a channel never
reaches through to the engine or the database.
chat:1andchat:12cannotsee each other's rows, and SQL wildcards in a conversation id are escaped
rather than matched.
notification_deliveriesrecords keyed by transport and exacttarget, with existing Telegram delivery references migrated across.
metadata, in broadcasts, and in approval audit records, so one transport
cannot answer another's notification.
Access matching has no caller yet. The Slack channel composes its user,
channel, and direct-message rules on top of it in #403.