You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(bots): show a paired server bot's uploaded picture once the server comes back - #46204
A bot that lives on a paired server can have its own uploaded picture. If this computer asked for that picture before the server was connected (for example right after launch), the bot kept showing just its first letter until you reopened the view. The same happened to the small faces in a group's Items list. Now the picture is asked for again as soon as the server is back, and a failed attempt never hides a picture that was already showing.
Files
Added
Deleted
Net
Test
3
$\color{#1a7f37}{\Huge{\mathbf{+}}}$672
0
$\color{#1a7f37}{\Huge{\mathbf{+}}}$672
Prod
6
$\color{#1a7f37}{\Huge{\mathbf{+}}}$263
$\color{#cf222e}{\Huge{\mathbf{−}}}$54
$\color{#1a7f37}{\Huge{\mathbf{+}}}$209
What Changed
useBotAvatarLook no longer reads an uploaded picture while the bot's server is away; a picture already loaded still shows.
When the server comes back, the picture is read again (new useBotHostGeneration, bumped by the existing came-back signal).
The come-back is counted before the bot listing shows the server as live, so every view that reads as the server returns shares one read instead of starting a second one.
An upload's version is a hash of its bytes, so a picture that loaded once is kept and never read again, even if a later read for the same version fails. A failed read is dropped. An empty answer (null or an empty file) is read again on the next come-back.
A failed read leaves whatever is showing alone, so it can't replace a picture with the letter.
Every avatar on screen takes a picture as soon as any read loads it into the shared cache, and its own empty or failed answer never hides it, so a header and a group row always agree.
Group Items row faces with no picture read again when their server comes back (as a listing change, or only through its event stream), take a picture as soon as any other view loads it, and ignore late replies from reads that were superseded.
The bot's saved picture was never lost: the server still has it. Only the view on this computer stopped trying.
Why
At launch a paired server's bots show from the last saved list while the server is still connecting. The picture read for each row failed, the row stored "no picture", and nothing re-ran the read while the row stayed mounted. Views opened later (like the bot's Home tab) read it fine, which is why the picture showed in one place and not the other.
A timed retry was rejected because it keeps calling a server that is away. Saving the pictures with the offline list was rejected for now because it adds stored image data to every paired list. Checked against how comparable products handle this.
Linked Issue
N/A (maintainer, reported directly)
Visual Proof
N/A: no new visuals. The fix is about when an existing picture loads after a server reconnects, which a still image can't show. The hook test below drives the away and back sequence and fails on the old code.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
bot-avatar-image.test.ts drives the hook through the real server listing: away then back shows the picture; a failed read is retried on come-back; a loaded picture is kept and not re-read; null and empty-string answers are re-read on come-back; a row mounted while away shows an already loaded picture. bot-group-face-pictures.test.ts drives the real Items panel store next to a header avatar: null and failed faces recover on come-back without Back or reopen; recovery through the event stream alone; a face takes the header's picture; a late reply from before the come-back can't replace the current picture; a row waiting offline and a header share one read; a picture read before a come-back is kept when the read after it fails. Also: a mounted header and row both show the picture whichever of the reads before and after the come-back answers first, with an empty or failed answer from the other; a header whose read failed takes the picture a newly drawn row reads; a row read started as the server comes back is not retired and read again later while the window wrongly says hidden. The recovery tests fail on the old code; the keep-a-loaded-picture ones guard against the retry re-reading or dropping a picture. CI runs both files (local runs could not start on this overloaded machine).
Performance
None worth measuring: each bot picture adds two cheap store subscriptions that only re-render when the server's state changes, and an open group Items panel adds two listeners that fire only when a server comes back or a picture loads. Reads drop while a server is away; on come-back there is at most one read per bot with an uploaded picture that has not loaded yet, and none for pictures that already loaded.
Risk
Level: Low
Renderer only; no saved data, settings or server changes. Worst case, a picture that fails to load while the server is connected stays on the letter until the server reconnects or the view reopens, which is the old behavior. Plain revert backs it out.
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
The avatar cache now tracks host generations and retains successful reads. The avatar hook uses cached pictures while a host is away and retries eligible reads after a generation change. Grouped face pictures respond to cached uploads and host-return events. Tests cover retries, shared reads, and preservation of successful pictures.
Merge Risk: Low · previous review e058c
This PR makes bot avatars recover after a paired server reconnects. In a rare ordering, a header avatar can stay on its initial letter while another view of the same bot shows the uploaded picture. The effect is cosmetic and limited to that case. It is low risk and mergeable, ideally with the small fix applied.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: a paired server bot's uploaded picture now appears once the server comes back. It uses the fix(bots) convention and matches the raw summary, which covers retrying avat…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description follows the repository template and covers the required sections. The ELI5 explains the bug and fix in plain language. What Changed lists the mechanism: the away-state read skip, the g…
Full details: Title check
Explanation
The title names the main change: a paired server bot's uploaded picture now appears once the server comes back. It uses the fix(bots) convention and matches the raw summary, which covers retrying avatar reads after reconnect and keeping loaded pictures.
Full details: Description check
Explanation
The description follows the repository template and covers the required sections. The ELI5 explains the bug and fix in plain language. What Changed lists the mechanism: the away-state read skip, the generation counter, the came-back ordering, hash-keyed caching, and the group Items row recovery. Why explains the rejected alternatives (timed retry, persisting pictures with the offline list). Testing names both test files and the scenarios they cover. Performance and Risk are filled in with a risk level and a revert path. The Linked Issue section says N/A (maintainer, reported directly). The template says outside contributors must link an issue, and the author is a maintainer, so this is acceptable. The author's manual testing box is unchecked, and the text says local runs could not start, so manual verification is not confirmed. The Visual Proof N/A includes a reason. The AI Disclosure section is empty, and the Agent skill upstream boundary checkbox is not ticked. The Checklist is not reflected in the body. The PR-level description is substantive and mostly complete, so the check passes.
Finishing Touches
Fix failing CI checks
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
…r comes back
A picture read while the bot's paired server was away failed and the row kept its initial
until it remounted. The avatar hook now skips reads while the server is away, shows a picture
already loaded from the shared cache, and reads again when the server comes back. A failed read
never replaces a shown picture; an empty answer is read again after a come-back. The shared
cache API used by group faces follows the same rules.
…er come-back
- Count a host's come-back before its listing publishes it live, so a read a view sends while the
listing publishes is one of this return, not a stale one replaced by a second read.
- A picture read for a version stays cached even when a later same-version read took its place.
- An empty-string answer stays retryable on come-back, like null.
- Group Items row faces with no image re-read when their host comes back (listing or event stream),
take a picture any other view loads, and drop replies from superseded reads.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
… keeps reads of this return
- A mounted avatar hook hears each picture that lands in the shared cache for its bot and version,
and its own empty or failed answer never hides one, so a header and a group row converge.
- A group row read started as the listing publishes a returning host is of that return: the
come-back callback no longer retires it and starts a second read later.
…t version answers empty
The picture a mounted avatar shows is bound to its host, bot and version, and an empty answer for
the same version no longer replaces it, whatever the bot's shared cache slot holds by then.
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
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.
ELI5
A bot that lives on a paired server can have its own uploaded picture. If this computer asked for that picture before the server was connected (for example right after launch), the bot kept showing just its first letter until you reopened the view. The same happened to the small faces in a group's Items list. Now the picture is asked for again as soon as the server is back, and a failed attempt never hides a picture that was already showing.
What Changed
useBotAvatarLookno longer reads an uploaded picture while the bot's server is away; a picture already loaded still shows.useBotHostGeneration, bumped by the existing came-back signal).The bot's saved picture was never lost: the server still has it. Only the view on this computer stopped trying.
Why
At launch a paired server's bots show from the last saved list while the server is still connecting. The picture read for each row failed, the row stored "no picture", and nothing re-ran the read while the row stayed mounted. Views opened later (like the bot's Home tab) read it fine, which is why the picture showed in one place and not the other.
A timed retry was rejected because it keeps calling a server that is away. Saving the pictures with the offline list was rejected for now because it adds stored image data to every paired list. Checked against how comparable products handle this.
Linked Issue
N/A (maintainer, reported directly)
Visual Proof
N/A: no new visuals. The fix is about when an existing picture loads after a server reconnects, which a still image can't show. The hook test below drives the away and back sequence and fails on the old code.
Testing
bot-avatar-image.test.tsdrives the hook through the real server listing: away then back shows the picture; a failed read is retried on come-back; a loaded picture is kept and not re-read; null and empty-string answers are re-read on come-back; a row mounted while away shows an already loaded picture.bot-group-face-pictures.test.tsdrives the real Items panel store next to a header avatar: null and failed faces recover on come-back without Back or reopen; recovery through the event stream alone; a face takes the header's picture; a late reply from before the come-back can't replace the current picture; a row waiting offline and a header share one read; a picture read before a come-back is kept when the read after it fails. Also: a mounted header and row both show the picture whichever of the reads before and after the come-back answers first, with an empty or failed answer from the other; a header whose read failed takes the picture a newly drawn row reads; a row read started as the server comes back is not retired and read again later while the window wrongly says hidden. The recovery tests fail on the old code; the keep-a-loaded-picture ones guard against the retry re-reading or dropping a picture. CI runs both files (local runs could not start on this overloaded machine).Performance
None worth measuring: each bot picture adds two cheap store subscriptions that only re-render when the server's state changes, and an open group Items panel adds two listeners that fire only when a server comes back or a picture loads. Reads drop while a server is away; on come-back there is at most one read per bot with an uploaded picture that has not loaded yet, and none for pictures that already loaded.
Risk
Level: Low
Renderer only; no saved data, settings or server changes. Worst case, a picture that fails to load while the server is connected stays on the letter until the server reconnects or the view reopens, which is the old behavior. Plain revert backs it out.
AI Disclosure
Review