Skip to content

refactor(ui): unify user avatar rendering - #114496

Merged
steipete merged 1 commit into
mainfrom
codex/refactor-control-ui-user-avatar-renderer
Jul 27, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/refactor-control-ui-user-avatar-renderer

Conversation

@steipete

@steipete steipete commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where the same person could show different avatar initials or identity colors in the online-user list, profile, and shared chat because each Control UI surface independently rendered user avatars and image fallback events.

Follow-up to #114444.

Why This Change Was Made

Give user avatars one narrow presentation owner: ui/src/components/identity-avatar-view.ts. The shared view resolves the canonical user identity, derives one set of initials and hue, uses the existing origin-pinned authenticated gateway avatar cache, and owns async image rendering, stable DOM updates, blob settlement, and load/error fallback. Keep gateway storage and caching, assistant/agent avatars, and plugin icons unchanged.

User Impact

The same person now looks the same in the sidebar, online roster, Settings profile, and attributed chat. Single-name users have matching initials everywhere. A changed avatar updates the existing image without flicker or stale fallback; a missing image reliably returns to the same initials and color.

Evidence

  • Before/after regression: on current main, the same Riley user renders RI in the roster and R in chat; the new cross-surface test fails before the refactor and passes afterward.
  • Focused UI proof: 9 test files, 404 tests passing, including direct shared-renderer tests, the complete sidebar suite, durable profile identities, hostile-origin/no-credential-forwarding coverage, credential rotation, revision invalidation, cached image lifecycle, fallback, and chat/profile consumers.
  • Real Chromium proof on Blacksmith Testbox: 2 files, 6 tests passing. The actual Gateway CSP scenario proves one authenticated cached image shared by Settings and the sidebar. It then publishes a real Gateway presence revision, deliberately holds the revised HTTP response, verifies visible pending initials and the identical retained sidebar <img>, releases and decodes the revised PNG, and finally waits for an actual HTTP 404 plus settled removed src before proving the initials fallback. The attributed-chat scenario separately verifies matching roster/chat initials.
  • Blacksmith remote provider: blacksmith-testbox, lease tbx_01kyhe6v3tre5r0qrbmvfprm8e; remote Chromium proof completed with exitCode=0.
  • Full changed-code gate on the same Testbox: passing, including UI/core typechecks, type-aware lint, formatter, conflict/security/dependency/i18n guards via corepack pnpm check:changed; Blacksmith returned exitCode=0.
  • Independent structured autoreview and TruffleHog: clean; final verdict patch is correct (0.91).
  • Generated screenshots and recordings remain external to the git diff under the Control UI E2E proof directories.

AI-assisted; implementation, Lit lifecycle, origin and credential boundaries, regression tests, and real-browser behavior independently reviewed.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: L maintainer Maintainer-authored PR labels Jul 27, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Exact-head proof for 78388936c9bffa55a8d5538893fadeac1b4a5be7:

Reproduced on main:

FAIL  ui/src/components/viewer-facepile.test.ts
      uses the same user initials and identity hue in the roster and attributed chat
AssertionError: expected 'RI' to be 'R'

Real browser, remote Blacksmith Testbox tbx_01kyhe6v3tre5r0qrbmvfprm8e:

OPENCLAW_CAPTURE_UI_PROOF=1 OPENCLAW_CONTROL_UI_E2E_ARTIFACT_DIR=.artifacts/control-ui-e2e/shared-user-avatar pnpm exec vitest run   --config test/vitest/vitest.ui-e2e.config.ts   --configLoader runner --reporter verbose   ui/src/e2e/profile-page.e2e.test.ts   ui/src/e2e/chat-attributed-identity.e2e.test.ts

✓ Control UI profile page mocked Gateway E2E
  > shares one authenticated avatar between the sidebar and profile preview
✓ Control UI attributed chat identity
  > uses one avatar placement and keeps shared-thread authors readable

Test Files  2 passed (2)
     Tests  6 passed (6)
Blacksmith remote exitCode=0

The profile browser assertion directly proves the production image CSP, the one-request authenticated blob, a Gateway-driven v3 revision held while initials are visible, continued identity of the original sidebar image element, successful decoding after the revision resolves, and an actual awaited v4 HTTP 404 with the image src removed before checking fallback. Inspect the complete Chromium network and DOM assertions and the actual roster/chat initials assertions.

Shared security/lifecycle contract: central avatar view and image renderer, hostile-origin rejection, authenticated fetch, error/load state, and retained image.

focused UI:       9 files, 404 passed
remote check:     corepack pnpm check:changed, exitCode=0
focused oxlint:   0 warnings, 0 errors
autoreview:       no accepted/actionable findings
                  patch is correct (0.91)
TruffleHog:       clean

The Playwright screenshots and recordings remain non-committed as required by the Control UI E2E policy; the complete real network, security, decoding, revision, fallback, and DOM assertions are checked in and linked above.

@clawsweeper

clawsweeper Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 27, 2026, 6:04 AM ET / 10:04 UTC.

ClawSweeper review

What this changes

This PR centralizes Control UI user-avatar identity, authenticated image rendering, and fallback behavior so the roster, profile, and attributed chat show the same initials and color for the same person.

Merge readiness

✅ Ready for maintainer review

This PR remains necessary: the merged avatar-cache work established secure image retrieval, while this follow-up removes the remaining divergent Control UI rendering and fallback implementations. The supplied regression and Chromium evidence support the shared renderer; the protected maintainer label keeps final landing in the normal human merge path.

Likely related people: steipete is the recent area contributor for both the merged avatar-cache baseline and this presentation follow-up (medium confidence).

Priority: P2
Reviewed head: 78388936c9bffa55a8d5538893fadeac1b4a5be7

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong browser proof and focused regression coverage support a bounded refactor with no concrete patch defect found in the supplied review evidence.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body and follow-up comment provide successful real Chromium evidence for the changed authenticated-avatar lifecycle, including revision, DOM reuse, decode, and HTTP 404 fallback; no additional contributor proof is needed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body and follow-up comment provide successful real Chromium evidence for the changed authenticated-avatar lifecycle, including revision, DOM reuse, decode, and HTTP 404 fallback; no additional contributor proof is needed.
Evidence reviewed 5 items Shared presentation boundary: The PR head adds the shared view that resolves canonical fallback identity and the existing image URL contract before rendering a common image/fallback lifecycle.
Cross-surface adoption: The supplied PR diff replaces separate roster and chat avatar renderers with imports from the shared view, directly addressing the inconsistent initials and hue paths.
Merged foundation: The related merged PR #114444 established the authenticated, origin-pinned, revision-aware avatar cache that this refactor deliberately reuses rather than reimplementing.
Findings None None.
Security None None.

How this fits together

The Control UI receives presence and sender identities from Gateway-backed state, then renders those identities in the sidebar, profile, and chat. This change places the common user-avatar presentation lifecycle between the existing identity/image cache and those UI surfaces.

flowchart LR
  A[Presence and chat identities] --> B[Avatar identity and gateway image cache]
  B --> C[Shared user-avatar view]
  C --> D[Image load and fallback lifecycle]
  D --> E[Sidebar and roster]
  D --> F[Settings profile]
  D --> G[Attributed chat]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -36, Tests +313. Total +277 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 4 134 170 -36
Tests 4 316 3 +313
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 450 173 +277

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: ui/src/e2e/profile-page.e2e.test.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Land one shared user-avatar presentation owner over the existing authenticated Gateway cache, retaining the current origin and credential boundary while keeping assistant, agent, and plugin icon rendering separate.

Do we have a high-confidence way to reproduce the issue?

Yes in source, with medium confidence: the supplied exact-head report records the current-main roster/chat initials mismatch and adds a focused cross-surface regression assertion; this read-only review could not independently execute it.

Is this the best way to solve the issue?

Yes: sharing the presentation lifecycle is narrower and more maintainable than keeping separate initials, hue, authenticated-image, and fallback implementations in each Control UI surface.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against b7cc6811b7c5.

Labels

Label changes:

  • add P2: This is a bounded Control UI consistency repair with visible but limited blast radius and strong focused proof.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body and follow-up comment provide successful real Chromium evidence for the changed authenticated-avatar lifecycle, including revision, DOM reuse, decode, and HTTP 404 fallback; no additional contributor proof is needed.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body and follow-up comment provide successful real Chromium evidence for the changed authenticated-avatar lifecycle, including revision, DOM reuse, decode, and HTTP 404 fallback; no additional contributor proof is needed.

Label justifications:

  • P2: This is a bounded Control UI consistency repair with visible but limited blast radius and strong focused proof.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body and follow-up comment provide successful real Chromium evidence for the changed authenticated-avatar lifecycle, including revision, DOM reuse, decode, and HTTP 404 fallback; no additional contributor proof is needed.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body and follow-up comment provide successful real Chromium evidence for the changed authenticated-avatar lifecycle, including revision, DOM reuse, decode, and HTTP 404 fallback; no additional contributor proof is needed.

Evidence

What I checked:

Likely related people:

  • steipete: Authored the current shared-avatar presentation refactor and the immediately preceding merged avatar-cache implementation that supplies its identity and image contract. (role: recent area contributor; confidence: medium; commits: 78388936c9bf, a2ff6cb52bc2; files: ui/src/components/identity-avatar-view.ts, ui/src/lib/identity-avatar.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-07-27T09:58:57.975Z sha 7838893 :: needs maintainer review before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

Maintainer disposition before landing:

  • The repository owner explicitly requested this exact follow-up: one shared user-avatar renderer, test it, open the PR, and land it. This is the owner decision for the protected maintainer item, not an unattended automation action.
  • Confirmed the installed Lit live/until implementations and the actual sidebar image-identity contract. The shared view preserves the original <img> while resetting pending/error fallback; it does not replace the node.
  • Real Chromium on Blacksmith proves the production-CSP authenticated image, cross-surface cache reuse, a deliberately delayed revision with unchanged DOM identity, decoded replacement, and a fully completed HTTP 404 with settled removed src.
  • The existing exact-origin credential boundary and bounded gateway image cache are untouched; direct hostile-origin tests remain green.
  • Independent maintainer review: zero findings and zero security concerns; structured autoreview: patch is correct (0.91).
  • Final landing remains gated on green exact-head GitHub CI and scripts/pr prepare-run / scripts/pr merge-run.

No ClawSweeper rank-up item is being skipped silently: explicit owner approval and direct Lit/browser proof address the presentation-boundary and protected-maintainer concerns.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels Jul 27, 2026
@steipete
steipete merged commit 8479063 into main Jul 27, 2026
108 of 114 checks passed
@steipete
steipete deleted the codex/refactor-control-ui-user-avatar-renderer branch July 27, 2026 10:11
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant