Repository navigation
Conversation
…nds, and stop failing photos the cache removed. Telegram puts a tiny copy of every photo (its stripped thumbnail, about 40 px) inside the message. chatd now rebuilds it into a JPEG from Telegram's fixed header and keeps it on disk as soon as the message is read, without asking the network. It reaches the shell as the new optional Attachment.preview. The tile draws it stretched over the photo's place while the chat-sized thumbnail downloads, and the thumbnail replaces it in the same place at the same size. Load images and spoilers hide it exactly as they hide the photo. A photo with no usable preview shows the image icon as before. Album tiles use the same code. What came inside a message is kept at once, on the thread that reads the message, so a preview never waits behind the downloads it stands in for. Each write has its own part file, so two writers of the same file never cut each other short. The media cache retried a Telegram file it had evicted at Telegram's internal tg://file/ name, which no host serves, and marked it "Telegram does not serve files from that address." The photo then said it could not load, with a Retry that could not work, until Telegram read the message again. The cache now leaves those files to Telegram and never marks them failed, so the box shows the preview or the icon, and chatd clears the old failures once at start. Signal, Messages and web addresses are unchanged. The e2e scenario telegram-photo-preview holds the thumbnail on the fake wire, checks the screen shows the preview, lets the thumbnail go, and checks it lands in the same place.
abalakh
force-pushed
the
telegram-inline-photo-preview
branch
from
November 15, 2026 11:59
742dc19 to
84a06d4
Compare
itz4blitz
previously approved these changes
Nov 16, 2026
itz4blitz
left a comment
Collaborator
There was a problem hiding this comment.
Checks are green, including pr-gate and the test shards. The preview is an optional attachment field, an evicted Telegram file stays unfailed, and the scenario is in the diff.
Contributor
Author
|
@itz4blitz any next steps to get it merged? Resolved conflicts from main which appeared in the meantime |
6 of 11 tasks
itz4blitz
added a commit
that referenced
this pull request
Nov 21, 2026
…903) * A reaction on an encrypted Tiny conversation is asked of the plaintext route the server refuses, and the test expects it sealed with an echo that lands (red) * Reactions in an encrypted Tiny conversation go out sealed, and fold back onto the message * The lab records a reaction in an encrypted Tiny conversation landing and echoing back * The reaction's authenticated data is described on its own * The audit's findings: a client id inside the server's 64 characters, folds rebuilt in the server's order, owed reactions applied when their message lands, and a reaction that cannot open yet is folded again * Sealed reactions persist: chips live in the stored rows, the fold's cursor and owed pairs are kept sealed beside the cache, a blob that cannot open yet holds the cursor until it opens or its tries run out, and a restart neither refolds history nor loses a count * Show the preview Telegram sends inside a photo until its thumbnail lands, and stop failing photos the cache removed. Telegram puts a tiny copy of every photo (its stripped thumbnail, about 40 px) inside the message. chatd now rebuilds it into a JPEG from Telegram's fixed header and keeps it on disk as soon as the message is read, without asking the network. It reaches the shell as the new optional Attachment.preview. The tile draws it stretched over the photo's place while the chat-sized thumbnail downloads, and the thumbnail replaces it in the same place at the same size. Load images and spoilers hide it exactly as they hide the photo. A photo with no usable preview shows the image icon as before. Album tiles use the same code. What came inside a message is kept at once, on the thread that reads the message, so a preview never waits behind the downloads it stands in for. Each write has its own part file, so two writers of the same file never cut each other short. The media cache retried a Telegram file it had evicted at Telegram's internal tg://file/ name, which no host serves, and marked it "Telegram does not serve files from that address." The photo then said it could not load, with a Retry that could not work, until Telegram read the message again. The cache now leaves those files to Telegram and never marks them failed, so the box shows the preview or the icon, and chatd clears the old failures once at start. Signal, Messages and web addresses are unchanged. The e2e scenario telegram-photo-preview holds the thumbnail on the fake wire, checks the screen shows the preview, lets the thumbnail go, and checks it lands in the same place. * Ignore local proof folders and stray target worktrees `_proof/` and `target-wt/` are ship-it evidence and local build output. They were showing up as untracked work on every checkout. * The remaining review findings: the sealed fold log is rewritten instead of appended whole and keeps only what the cursor can still deliver, a blob that cannot open three folds is skipped for this session and the first fold after a restart steps back below it, the reaction list is paged without the device mutex held and a page applies only while the cursor still stands where it was asked for, rows without an id move the cursor so a page of them is never asked for twice, and a taken-back reaction leaves no empty entry behind * Show a Signal long text as the text it carries, with a continuation note, and tell the composer the 2048 cap * Start tinyclient at sign-in when the setting asks, with the registration each platform already owns * Put the unread count on the Linux launcher entry and flash for attention * Keep the continuation note out of what a Signal quote sends * Name the launcher entry value's lifetime and keep the badge rows off phones * Ring when a Signal call arrives and leave a missed-call line when it is not answered * Keep tinyclient alive in a Windows tray behind an opt-in close-to-tray setting * Keep the attention rows on desktop and off phones * Name Signal view-once media instead of a bare Photo, on send and receive paths alike * Point the view-once test at the AttachmentPointer proto where it actually lives * Withdraw each Signal ring by its own call and let the newest offer take the ring * Draw the mouse pointer into Windows screen shares, with a Wayland off-switch * Offer quick actions on the taskbar, Dock and launcher icon * Say what a Signal payment or gift badge carries instead of a bare word * Give Signal local read-receipt and typing switches that the send paths honour * Fix the tray's windows-rs 0.62 call shapes and rebuild the icon after explorer restarts * Let the tray search closure match find's double reference again * Call the cursor's GDI handles behind unsafe with the safety story written down * Store reminders, wake the notifier for their due time and post them once (stage 1a) * Show who reacted, with the honest Someone fallback where only counts arrive * Keep an edit time and the superseded words on edited messages, off the wire when empty * Mark a whole space read in one go, scoped so other spaces keep their badges * Let notify reach the hub it drives and fix the prove driver's type errors * Fix the reactors patch compile: name the closure's user for the peer, and spell the assertion's count and owners to the reaction's own types * Match the row before by reference and borrow the capped prior in the test * Open the reminder test store as a Path so it compiles * Give the edited tooltip to the finished text block so both branches type the same * Let actions name the reactors: open draw's person and who to the conversation module, take the name resolver as a reborrowed FnMut, and let who read a shared context * Pin the kept edit ahead of the deleted row in the prior test * Drop the redundant .into() on the reactor menu item id so ElementId inference is unambiguous * Clone the reactor's key so the click listener stays Fn. * Tell Discord the share quality that was picked. Opcode 12 names the size, frame rate and bitrate of the share, and is sent again when that quality changes. The picture drive asks for that bitrate. A camera stays one layer. Closes #338 * Block, add and remove a Telegram contact, and read who is blocked. Closes #487 * Keep Signal bold, italic, strike, monospace and spoiler, and leave a spoiler out of the preview. Closes #747 * Show a hidden last seen in words, and list the groups in common. Closes #523 * Send photos, videos and files in a Signal chat. Closes #742 * Keep one copy of each Signal file while it uploads. The row writes the payloads to disk, then the wire takes that same buffer. A failed send removes the files it wrote. * Telegram: use inline bots by typing "@bot query" in any chat A GIF-picker query that starts with @bot asks that bot in the open chat and keeps an article result. A message that came through a bot the account already knows names it. A GIF search is unchanged. No location is sent to a bot. Closes #482 * Read a Teams thread past the first page of replies. Scrolling up follows the cursor Teams sends with each page, and opening an old reply loads the page that ends there. Once the start of the chain is stored, the post counts every reply that was stored. Closes #633 * Answer a Teams team's info and section its roster into owners, members and guests. Closes #668 * Name a failed action, and give it a ref to quote. A request that fails for no specific reason says what was tried and a short ref. The same ref is in the log with the real error, and Copy diagnostics lists recent refs. A call that comes back without an error says it could not be placed. Closes #765 * Look up a Signal username and open a chat with that account. Closes #730 * Settings can change a shortcut, and the quick switcher lists commands after >. Closes #789 * Show Slack custom emoji from the workspace list without opening the picker. Closes #563 * Follow a move to another Discord voice channel. A voice state that puts us in another channel of the same server retargets the call and rejoins with that channel. A direct call, another server, and leaving the channel stay as they were. The dock says the call moved. Closes #333 * Show who replied in a Discord thread and keep the reply count current. A reply updates the starter chip with the count, the newest faces, and unread. A thread update copies Discord's count when it is ahead. Closes #387 * Show both names, custom fields, and roles on a Slack profile. A profile reads labelled custom fields once an hour, keeps the full name beside the display name, and turns a manager into that person's link. Closes #592 * Star a Slack conversation on Slack, and clear it when Slack does. Closes #603 * Color fenced code blocks from their language, including diff and ansi. Closes #358 * Show a Slack meeting as a card with a Join link, and say when an old call happened. A Zoom, Meet, Teams or Webex call block is a card with who is in it, or how long it ran, and a Join link. An old Slack call reads as a call that happened. A call id with nothing filled in stays the placeholder. Closes #555 * Discord highlighter: an escape followed by non-ASCII text no longer panics the coloring task take_sgr bailed after one byte of a multi-byte character, so ansi() sliced the source mid-character. It now leaves a non-ASCII byte for the caller, and a test covers escapes followed by accented, emoji and CJK text. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Cover the window after it has been left, and hide what a notification says. Closes #751 * Count Google Messages unread from the texts, and clear it when the phone has read them. The phone's unread flag is not a count. A chat with no texts stays at zero instead of showing 1, three texts count as three, and a later read flag moves the marker to the newest text and clears the badge. Messages in one batch are applied before the conversation row. Closes #704 * Ask the phone to unpair this computer when Google Messages signs out. Closes #703 * Show a Google Messages video as a video, and a voice note with its waveform. Closes #705 * Sync a Signal delete for me, and stop sending a late delete to everyone. A message or chat deleted on the phone now leaves here. Past one day, Delete tells only this account's other devices. An edit or a delete for everyone older than two days is ignored. Closes #714 * Keep a Signal reaction across a restart so a new emoji replaces the old one. Closes #739 * Telegram: files over 200 MB, and files served from Telegram's CDN, cannot be downloaded. Closes #505 * Show a Signal group rename, and the line that says who changed it. A newer group revision updates the row and writes one system line per change. The snapshot at connect does not invent lines. Leaving the group marks it read-only. Closes #720 * Remember which chat a Telegram message is in, so a delete after reconnect removes it. Closes #515 * Telegram: link previews have no picture, no Instant View, and no control when sending. Closes #506 * Telegram: see someone's live location on a map as it moves A live share stays a normal message with a card: the coordinates, the heading, how long it was shared, and whether it is still going. When the same message moves, the card updates and it does not count as another unread message. Coming into range is a service line. No map tile is fetched. Closes #453 * Keep view-once Telegram media locked instead of downloading it. A photo, video, or voice message with a timer reads as a locked row and queues no file. An ordinary photo is still fetched. Closes #546 * Notify someone who has no username when they are mentioned in Telegram. The composer sends the display name. Someone with no username becomes their first name plus a text mention. Someone with a username becomes that username, which already notifies them. Closes #534 * Offload owe_reactions from socket thread and drop stray __pycache__ .pyc files * Slack: send formatted text as Slack's rich text, including labelled links (#595) A formatted send, edit, scheduled message, or file comment goes to Slack as rich_text blocks, with the plain text kept as the fallback. A labelled link is a link element. A plain send stays text only. Closes #595 * mediad: support TINYCLIENT_MEDIAD_SCREEN=null in headless voice tests * Show a Telegram checklist's items, and mark the one that is done. A checklist message lists its title and each item. A completed item is checked. The list is read-only. Closes #485 * Keep a checklist's open link on the list. Ticking stays in Telegram. The list ends with the same link the old box opened, so the message can still be reached. * Telegram: mark a chat as unread A chat can be marked unread. The badge becomes at least one, Telegram is told with messages.markDialogUnread, and a mark from another device updates the row. Reading the chat clears that mark as well. Closes #508 * Name a Telegram secret chat and say it only works in the phone apps. Closes #530 * File Google Messages archive and spam, and send a block. Closes #674 * Mute a Google Messages chat on this computer. Closes #690 * Read older Google Messages pages so a search of this computer can find them. The published relay has no message search. After connecting, each chat is read backward one page at a time until a short page, at the same pace as the inbox. A search then finds a message that was not on the first page, and photos, files and links come from that store once the chat has been read to its start. Closes #700 * protocol: move code highlighter into shared protocol crate and expand ANSI UTF-8 tests * Show a poll's options and counts on a card, and apply a poll update. Closes #520 * Send up to ten files in one Google Messages message. Closes #689 * Give a Teams chat, channel and message a link that names that place. The info pane copies Microsoft's documented form for a chat and a channel. A message link uses the same form, and a reply names its post. Each link parses back to the place it came from. Closes #641 * Stage Signal file send test fixture in outbox for Windows * Signal: polls cannot be read, voted on, or created A Signal poll keeps its question and its counts. A vote, a retraction, and an end go out on the wire, and a poll cannot carry a file. Closes #737 * Fetch the Telegram pictures on screen first, ahead of a channel left and of what is off screen. Telegram's files come one at a time, 250 ms apart, and every thumbnail a page named waited in one line: a channel opened after an image-heavy one waited behind all of the first one's thumbnails, and behind its own that were not on screen, for 15 to 20 seconds. The file worker now keeps three lines: the original the viewer waits on, then the pictures messages show that the shell asked for because they are on screen (Command::Wanted), the latest asked first, then the rest in the order pages named them. Telegram keeps the place of each picture a message shows, as it kept the originals', so an ask moves it ahead. An ask for a picture no page has named yet is remembered for 30 s and goes ahead when a page does. A file waiting keeps one place, with the newest page's reference, so repeated asks are one download. The line still holds no more than 256: asks are never refused, and the worker lets go of the last-named background file first. Avatars, custom emoji and a picker's tiles keep their turn. What is remembered forgets its oldest half, never all at once. With #262, a thumbnail the cache removed is fetched again as soon as the shell asks for it on screen; its test and the docs now say so. The fake wire gains photo-pages (photo posts in Field Notes and a real JPEG in Trail crew, read only with their pages) and flood-file. The e2e scenario telegram-visible-image-priority opens Field Notes, switches to Trail crew with Ctrl+K while the channel's thumbnails wait, checks from the wire's log that the group's photo went first and from the screen that it is drawn. * Fix bugle::Chat status field in fake.rs after merging #817 and #863 * Fix post-merge Signal integration (capabilities, SendWith poll+files, now_ms, Quote spans, tests) * Fix Windows build and cross-PR Reaction.who compatibility on Lane 1 * Fix cross-lane integration fields and prove block delimiters across 60 merged PRs * Perf: add measured-every-pr pipeline and site perf check * Fix peer-review blockers: restore desktop N10/N11 settings rows and 6 TINYCLIENT_PROVE arms * Slack: expand built-in emoji table and reaction listing * Signal: message delivery and read receipts (#729) * Telegram: typing activity indicators (#543) * App: message edit history stage 2 (#762) --------- Co-authored-by: unRekable <unRekable@protonmail.com> Co-authored-by: Andrii Balakhtar <a.balakhtar@scalr.com> Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Collaborator
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.
A Telegram photo that is not cached yet now shows a soft preview at once, in the place and at the size the photo will have, instead of an image icon. The preview is the tiny picture Telegram puts inside every photo message, so it needs no download. A photo that dropped out of the media cache no longer says "Could not load image"; it shows its preview until Telegram brings the photo back.
What changed and why
chatd rebuilds Telegram's stripped thumbnail into a JPEG, keeps it on disk with the message, and passes it to the shell as
Attachment.preview. The photo tile draws it until the chat-sized thumbnail is decoded, then swaps in the sharp one in the same box. The media cache stops trying to fetch Telegram's own file names itself, which is what turned evicted photos into errors.Changes
Attachment.preview: Option<MediaFile>, the picture a network sent inside the message.Nonefrom every network but Telegram.content.rs):stripped_jpegjoins Telegram's fixed 623-byte JPEG header (as in grammers'photo_sizes.rs), the size and the body. chatd only joins bytes and never decodes. A preview is made only when the row's size did not itself come inside the message, and bytes that are not a version-1 stripped thumbnail, have no size, or pass 16 KiB make none.files.rs): what came inside a message is kept at once on the calling thread instead of queueing behind downloads (the queue is one file at a time, paced 250 ms). The sharedkeepwrites inline bytes and downloads alike, through a part file of its own per write.draw.rs): while the still is loading, the tile draws the preview through the same image cache, stretched over the picture's box (ObjectFit::Cover), for standalone photos and album tiles. Spoilers and Load images return before it, so nothing shows before reveal or when images are off.blobs.rs): a file registered attg://file/that has left the disk is not fetched or failed by the cache. It stays not fetched and Telegram is told it is wanted. At start, chatd clears the cache's own old "does not serve files from that address." failures at those names, and nothing else.media_forgivenow sees the address as well as the reason.photo-previewpost with a real stripped thumbnail and a striped 320×240 thumbnail (fake_ridge_i.bin,fake_ridge_m.jpg), andTINYCLIENT_TELEGRAM_FILE_HOLDwithfile-goto hold that thumbnail's download.docs/architecture.mdnames the preview among an attachment's fields, and says the cache never fails a file Telegram fetched over its own session.Type
Platforms
Proof
Scenario: e2e/scenarios/telegram-photo-preview
Lab run: pending.
The scenario records on Windows and Linux. It reads screen pixels: the held photo must show orange beside blue with no stripes (the preview), and once
file-golets the thumbnail through, dark stripes must appear over the same box with its edges within a few pixels. On the base build the fake wire has nophoto-previewpost, so it fails at "Odalys's chat opens, and Telegram is asked for the photo's thumbnail and holds it"; a base that had the post would draw the image icon and fail the preview check.scenario.jsonsays why macOS (the lab's Mac helper reads window text only) and the phones (their demo build bypasses the scripted wire) are not recorded; they draw the same tile.Not yet run end to end on a lab host. The driver's pixel checks were tried on
--shotrenders of this branch with the fake wire holding the thumbnail (preview found, no stripes) and after letting it go (16 and 19 stripes per half, edges within 3 px).test_drive.py(3 tests) covers a placeholder and an orange avatar that must not count, the preview, the sharp thumbnail, and a 32-bit top-down Retina BMP.Tests:
cargo test -p chatd --lib: 528 passed.--test telegram: 66.--test blobs: 15.--test messages: 8.--test signal: 11.cargo test -p protocol: 122.cargo test -p tinyclient --features gui: 645.cargo check -p tinyclient --features "gui mobile"builds.a_stripped_thumbnail_is_put_back_together_as_the_jpeg_it_was,bytes_that_are_not_a_stripped_thumbnail_make_no_preview,a_photo_with_a_stripped_thumbnail_has_its_preview_on_disk_with_the_page,a_photo_without_a_usable_stripped_thumbnail_has_no_preview,a_photos_stripped_preview_is_on_disk_while_its_thumbnail_is_still_downloading,a_thumbnail_gone_from_disk_is_never_marked_failed_and_telegram_keeps_it_again(fails onmain: the cache marks the photo failed),only_a_file_telegram_kept_is_left_to_telegram, and themedia_forgivestore test.Not in this pull request: previews for video and GIF stills (Telegram sends them too; the shell needs no change, the adapter about ten lines, and they need their own scenario), and fetching an evicted thumbnail again the moment it is on screen, which belongs with prioritising visible Telegram images.
Compatibility
The protocol only grew:
Attachment.previewhas#[serde(default)]and is left off the wire whenNone. An older shell ignores it, and a newer shell with an older chatd draws the image icon as before. No store schema change: a preview is an ordinary row in themediatable. No server change.Risk and rollback
Release note
Telegram photos show a soft preview right away while the sharp picture downloads, and a photo that dropped out of the cache no longer says it could not load.