Repository navigation
feat(ui): channel conversation avatars in the sidebar (Discord + Slack) - #125668
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 18, 2026, 8:14 AM ET / 12:14 UTC. ClawSweeper reviewWhat this changesAdds Discord and Slack conversation-avatar thumbnails to Control UI sidebar sessions through authenticated Gateway image delivery. Merge readinessKeep open: the latest head still does not persist an avatar downloaded after the first inbound message, so a one-message Discord or Slack conversation never receives the advertised sidebar thumbnail. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherDiscord and Slack plugins attach local avatar media references to inbound conversations. Session metadata persists those references, the Gateway serves them to authorized owners, and the Control UI renders the sidebar thumbnail. flowchart LR
A[Discord or Slack message] --> B[Avatar download]
B --> C[Session origin metadata]
C --> D[Authenticated Gateway route]
D --> E[Session row avatar URL]
E --> F[Control UI sidebar]
F --> G[Conversation thumbnail]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +835, Tests +568, Other +4. Total +1407 across 47 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Use one guarded completion-time session update that records the downloaded local reference only while the original channel identity still owns that session, with one-message regressions for both producers. Do we have a high-confidence way to reproduce the issue? Yes, at source level: allow the first avatar download to finish without sending another message; the sole recorded inbound context has no avatar reference and no completion path writes one. Is this the best way to solve the issue? No. Background acquisition is appropriate for the reply path, but cache-only completion is too narrow; the session owner needs a guarded completion-time update. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f1453c7c778c. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (6 earlier review cycles)
|
82ff4f5 to
4c1c09f
Compare
703a47f to
56edd22
Compare
…tion (#125766) * refactor(ui): extract chat pane rail state chat-pane-render.ts sits at 702/700 effective max-lines on main, latently failing the lint lane for any change that pulls it into scope. Extract the rail/sidebar-slot model building into chat-pane-rails.ts (behavior-neutral) to heal it without a suppression. * test(ui): isolate markdown-tables from shared module graph The shared UI runner reuses its module graph across jsdom registries; when another worker file evaluates markdown-tables.ts unmocked first, this file's clipboard vi.mock can bind to a stale instance and the copy spy records zero calls (checks-ui failures on PR #125668). The test belongs on the canonical singleton-sensitive list, which exists for exactly this class.
56edd22 to
225c698
Compare
|
Status: all feature work, both ClawSweeper P2 fixes (route revision cache-busting; owner-chip fallback), and the startup-budget accounting are complete on this branch, and every check is green except |
A stable per-session URL let AuthenticatedAvatarRouteLoader's blob and sticky-404 caches pin a mounted row to a stale or blank avatar after the backing media changed. Append an opaque digest of the media reference so replacement and 404-recovery change the route identity.
A session with a channelAvatarUrl suppressed its owner chip even while the blob was loading, auth was not ready, or the route 404ed, leaving an empty lead slot. The chip now rides as fallback content inside the avatar element and yields only to a usable image. Covers 404 and auth-pending states; avatar rows keep renderedOwnerId unset so an owner-viewer stays visible in the facepile.
The avatar element and its authenticated blob loader rode the startup bundle through session-leading-indicator, pushing startup JS 51 B over the CI gzip budget. Channel avatars are not startup-critical: register the element on the first avatar row; the owner-chip fallback covers the one-time upgrade window. Startup JS returns ~1 KiB under the ceiling.
CI-measured startup JS is 344379 B against a 343289 B baseline (+1090 B). The avatar element and blob loader are code-split out of startup (previous commit); the residual is the sidebar lead-slot render branch and row plumbing, which cannot be deferred. Baseline updated via check-control-ui-performance --update-baseline with CI bytes per the script's contract; well inside the 4096 B ratchet step and 358400 B ceiling.
850d76a to
19d7bf4
Compare
|
Merged via squash.
|
…tion (openclaw#125766) * refactor(ui): extract chat pane rail state chat-pane-render.ts sits at 702/700 effective max-lines on main, latently failing the lint lane for any change that pulls it into scope. Extract the rail/sidebar-slot model building into chat-pane-rails.ts (behavior-neutral) to heal it without a suppression. * test(ui): isolate markdown-tables from shared module graph The shared UI runner reuses its module graph across jsdom registries; when another worker file evaluates markdown-tables.ts unmocked first, this file's clipboard vi.mock can bind to a stale instance and the copy spy records zero calls (checks-ui failures on PR openclaw#125668). The test belongs on the canonical singleton-sensitive list, which exists for exactly this class.
…k) (openclaw#125668) * feat(gateway): proxy channel conversation avatars * feat(discord): capture conversation avatars * feat(slack): capture DM sender avatars * test(discord): bind guild avatar mock * feat(ui): render channel conversation avatars * fix(ui): align sidebar owner fixtures * fix(gateway): version channel-avatar routes by media revision A stable per-session URL let AuthenticatedAvatarRouteLoader's blob and sticky-404 caches pin a mounted row to a stale or blank avatar after the backing media changed. Append an opaque digest of the media reference so replacement and 404-recovery change the route identity. * test(ui): align sidebar owner facet * fix(ui): keep owner chip until channel avatar loads A session with a channelAvatarUrl suppressed its owner chip even while the blob was loading, auth was not ready, or the route 404ed, leaving an empty lead slot. The chip now rides as fallback content inside the avatar element and yields only to a usable image. Covers 404 and auth-pending states; avatar rows keep renderedOwnerId unset so an owner-viewer stays visible in the facepile. * perf(ui): keep channel avatar fallback within budget * perf(ui): lazy-load the channel avatar element The avatar element and its authenticated blob loader rode the startup bundle through session-leading-indicator, pushing startup JS 51 B over the CI gzip budget. Channel avatars are not startup-critical: register the element on the first avatar row; the owner-chip fallback covers the one-time upgrade window. Startup JS returns ~1 KiB under the ceiling. * build(ui): raise startup baseline for channel avatars CI-measured startup JS is 344379 B against a 343289 B baseline (+1090 B). The avatar element and blob loader are code-split out of startup (previous commit); the residual is the sidebar lead-slot render branch and row plumbing, which cannot be deferred. Baseline updated via check-control-ui-performance --update-baseline with CI bytes per the script's contract; well inside the 4096 B ratchet step and 358400 B ceiling.
What Problem This Solves
Sessions that originate from a chat channel render with generic initials or an empty slot in the Control UI sidebar. Operators running Discord/Slack-connected agents cannot tell conversations apart at a glance, even though the channels know exactly what the conversation looks like (sender avatar, guild icon).
Why This Change Was Made
Builds one generic cross-channel seam ("session channel avatar") plus two channel producers, designed so Telegram-class channels (token-bearing, expiring file URLs) fit the same contract later:
MsgContext.ConversationAvatarfield. Core persists it onentry.delivery.origin.avatar(single producer:deriveSessionOrigin; invalidated on channel switch inmergeSessionOrigin). Remote CDN URLs and local paths never reach the wire.channelAvatarUrlonSessionRowSchema(a gateway route URL; Swift protocol regenerated). The row projection stripsorigin.avatarfrom the exposed origin object./__openclaw__/channel-avatar/<sessionKey>cloned from the workspace-icon auth model (bearer →sessions.listscope → owner gate), with the shared image policy (sniffed raster allowlist, SVG safety gate, sha256 ETag/304, CSP sandbox headers) extracted intosrc/gateway/http-image-response.tsand reused by the workspace-icon route (net dedup there).<openclaw-channel-avatar>element (blob-loaded viaAuthenticatedAvatarRouteLoader), slotted into the sidebar leading indicator between the session icon and the owner chip.media-ssrf-policy.ts), keyed by conversation+hash so repeat messages never re-download.users.infoalready returnedprofile.image_*and discarded it; now cached and downloaded token-free from the public*.slack-edge.comCDN. GovSlack is skipped (its API plane does not expose these hosts); detection extracted toslack-client-kind.ts.Two latent main defects discovered en route (the
chat-pane-render.tsmax-lines violation and themarkdown-tables.test.tsisolate:false clipboard-mock leak that failed this PR'schecks-uitwice) were split out and landed separately as #125766, so this PR carries only the feature.ClawSweeper's P2 (stable avatar route URL pinning client blob/404 caches to stale images) is addressed: the route URL carries an opaque sha256 revision of the media reference, with regression coverage for mounted-row replacement and initial-404 recovery.
Accepted tradeoff: when a session has
channelAvatarUrlbut the image cannot load (avatar media pruned, auth not yet ready), the leading slot shows an empty circle rather than falling back to the owner chip; the slot decision is synchronous and the miss is transient/rare.Non-goals (named follow-ups): Telegram (
getChatchat photos + TTL cache), WhatsApp (profilePictureUrl), Slack workspace icon (needsteam:readmanifest scope),conversations.listavatar plumb-through (closed schema), directory-entry avatars.User Impact
Discord and Slack sessions in the Control UI sidebar show the real conversation image (round thumbnail): sender avatar for DMs, guild icon for Discord guild channels. Sessions without an image render exactly as before. No config surface; on by default; no SQLite schema changes (origin persists in existing delivery state).
Evidence
Live proof on an isolated dev gateway (
OPENCLAW_STATE_DIR, port 19877): sessions seeded through the real ingress path (recordInboundSessionMetawithConversationAvatar), avatars served by the new route and rendered in the sidebar; the "Plain session" row shows the unchanged before-rendering in the same frame:node scripts/check-changed.mjs: every format/lint/typecheck lane green; the local "macOS app CI tests" lane was killed by its timeout (SIGTERM after 31 min) — deferred to this PR's exact-head CI, which runs that lane authoritatively.pnpm buildgreen (7m34s, no ineffective-dynamic-import), Swift protocol regen committed.