Repository navigation
Merged
Conversation
…and the log keeps no text of the others A Telegram bot is public: anyone who finds it can DM it, and a DM wakes a bot that has full access to its computer. Any channel entry in bot.json can now have wakeFrom, the addresses (as the log gives them) of the people, places and threads whose events may wake the bot there. * Without wakeFrom nothing changes; with [] nobody on that channel wakes the bot. A listed place lets everyone in it wake the bot; a listed person wakes it anywhere. The terminal has no entry, so it is never limited. * The log decides as it writes an event, as for the bot's own events and deletes: an event whose person, place and thread are all not on the list is logged with wake 'unlisted' and never reaches the waker (no wake, judge, steer, typing, outage line or download). * Such an event keeps only who, where, when and its kind: no text, mentions, files or raw data, no gw_messages row, no thread name or place description, and its gw_inbox row loses its raw data in the same transaction. The text of a join or a leave stays, as it only names who added or removed whom (such as who added the bot to a group). A change to a message the log keeps follows the message. The same message again from a backfill is logged once. * bot.json refuses an entry that is not an address of its channel. A change to wakeFrom applies to the next event without connecting the channel again. * No limit on where the bot sends: that stays its judgment. * The prompt names wakeFrom in the bot.json line and 'unlisted' in the log's wake values. The Telegram skill connects with "wakeFrom": [], has the person DM the bot once so it takes their address from the log, warns that a @username never matches, and has krau's /setjoingroups step. * spec/Inbox.tla: events the log decides as it writes them are decided and never woken, and an unlisted one leaves no text on disk once decided (Inbox.unlisted.cfg). Co-authored-by: krau <71133316+krau@users.noreply.github.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
* A changed channel gets its new list before its adapter starts, so the events it brings at once (Telegram's waiting updates, a backfill) are decided by it. * On a channel with a list, an inbox event that brought no happening (what a person types into a menu's search) keeps no raw data either. * A message logged as unlisted that a backfill brings again after its person was put on the list stays as it was decided. * A backfill's newest message and the threads it reads count unlisted messages, so it does not read them again; a reaction that names no thread takes the thread of the unlisted message it is on. * A change that names no one to the bot's own kept message, such as a link preview, is the bot's own, also on a channel with an empty list. * A failure after an inbox event was applied does not reopen it: its raw data may be gone, and its events come back through the undecided ones.
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.
Closes #130: a Telegram bot is public, anyone who finds it can DM it, and a DM wakes a bot that has full access to its computer.
Thanks to @krau for the issue and for #135, whose Telegram allowlist this generalises. His
/setjoingroupsstep, his point that a@usernamemust not be used, and his test cases are in here; the commit has him as co-author.What it does
Any channel entry in
bot.jsoncan havewakeFrom: the addresses, as the log gives them, of the people, places and threads whose events may wake the bot there.{ "id": "telegram", "type": "telegram", "secrets": "~/.pots/secrets/telegram-ada.env", "wakeFrom": ["telegram:@7712345678", "telegram:#-1001234567890"] }wakeFrom: nothing changes.[]: nobody on that channel wakes the bot.bot.json, so it is never limited.unlistedand never reaches the waker: no wake, no judge, no steer, no typing, no outage line, no file download.gw_messagesrow, no thread name or place description, and itsgw_inboxrow loses its raw data in the same transaction that decides it. Bots read their log, and that text comes from people they do not know. The text of a join or a leave stays: the adapter writes it from names and addresses, such as "added by eve (telegram:@333)", so the bot can see who added it to a group and leave.bot.jsonrefuses an entry that is not an address of its channel ("@eve",123). A change towakeFromapplies to the next event without connecting the channel again.The bot learns of strangers by reading its log (
wake = 'unlisted'), as the system prompt says in one sentence. The Telegram skill connects with"wakeFrom": [], asks the person to DM the bot once, and has the bot take their address from the log.What is not taken from #135
The adapter-level gate, the outbound guard,
leaveUnauthorizedGroups,groupAllowUsers, the policy modes and the in-memory supergroup allowance. The gateway's list covers the same cases for every channel; the bot can leave a group itself withcall; and a group that becomes a supergroup already gives its new address in the log.Checks
npm run check,npm test(818 passed, 4 skipped),npm run tlawithspec/Inbox.tlain step: events the log decides as it writes them are never woken, and an unlisted one leaves no text on disk once decided (Inbox.unlisted.cfg).bot.jsonend to end with the test channel (a stranger's DM logs no text and makes no model request; a longer list applies without a reconnect; the two errors), and Telegram updates from feat: telegram allowlist #135 (DM, mention, channel post, a stranger adding the bot to a group, a button press, a reaction) through the log.Known limits
gw_inbox.rawin free pages or the WAL until they are written over; SQL does not read them.gw_inboxwith stateerror, as today: nothing was decided.Review
One Codex (gpt-6.2-astra, xhigh) round. Fixed in the second commit: a new channel's list is in force before its adapter starts; no raw data kept of an event that brought nothing on a channel with a list (menu search text); a message logged unlisted stays so when a backfill brings it after its person is listed; backfill start and thread lists count unlisted messages; a reaction takes the thread of the unlisted message it is on; an authorless link preview on the bot's own message is its own; a failure after an event was applied does not reopen it with its raw data gone. Not taken: redacting a listed person's quote of an unlisted message, an actor field for membership events, and adapter state (see Known limits).