Repository navigation
PLAT-39403 connector: bridge Reddit avatars from the chat web API - #17
Conversation
Reddit's chat Matrix server returns no avatar in profiles, member events or the user directory, so every ghost was marked as having none. Reddit's own chat UI reads them from the ChatRedditors GraphQL operation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
2 potential issues found:
↑ Select any checkbox above to have Indent auto-fix the issue 1 issue already resolved
All CI checks passed on
Select any unchecked box below to run or rerun that agent. Full resultsIndent Review Agent
|
| } `json:"icon"` | ||
| } `json:"redditorsInfoByIds"` | ||
| } | ||
| err := s.chatGraphQL(ctx, "ChatRedditors", map[string]any{"ids": redditorIDs, "includeRedditorAttributes": true}, &data) |
There was a problem hiding this comment.
⚪️ Nit · Missing redditorsInfoByIds caches every requested user as having no avatar
If the response has data but no redditorsInfoByIds list (schema change, null field, different shape), this returns an empty map with no error. redditorAvatars then caches "" for every ID in the batch for the client's lifetime, so those ghosts get no avatar until restart. GetBlockedUsers in blocking.go treats an absent list as an error for this reason; do the same here.
Found by Indent Review Agent
…fter failures Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| defer r.avatarMu.Unlock() | ||
| if time.Now().Before(r.avatarRetryAt) { | ||
| return nil | ||
| } |
There was a problem hiding this comment.
⚪️ Nit · Only the first 50 uncached members get avatars per chat sync
claimUncachedRedditors stops after redditorBatchSize (50) IDs and redditorAvatars makes one fetch per call. In a group with more than 50 members, one sync fetches avatars for 50 members, chosen by Go's random map order. The rest only fill in 50 at a time as later room updates trigger resyncs, so quiet large groups can stay partly avatar-less for a long time. The previous commit chunked through every missing ID.
Claim all uncached IDs and fetch them in chunks outside the lock, releasing the claims for unfetched batches on error. Or loop until nothing is left to claim.
Found by Indent Review Agent
|
Live-tested at this head (a52376d, build 7990356): all Reddit ghosts that had no avatar on main got one after room activity (custom snoovatar and default avatars both), member events carry |
Reddit's chat Matrix server has no avatars (
/profile, member events and the user directory all return none), so ghosts were marked as having none. Chat info andGetUserInfonow take avatars from theChatRedditorsGraphQL operation that reddit.com/chat itself uses, batched per room and cached per client. Existing ghosts get their avatar the next time a room they're in syncs.🤖 Generated with Claude Code