Skip to content

refactor(ui): avoid redundant presence work in avatar lists - #133548

Merged
steipete merged 1 commit into
mainfrom
codex/refactor-session-avatar-presence
Aug 30, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/refactor-session-avatar-presence

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #133519

What Problem This Solves

Prepared participant and online-avatar lists unnecessarily recompute live presence whenever they render. Because presence keeps a single cached payload, these unused computations also evict the projection reused by neighboring sidebar rows.

Why This Change Was Made

Resolve live presence only when the facepile actually needs it. Reuse the existing participant-avatar renderer and read participant data directly from the session, removing duplicate markup and redundant arguments. Tests now use the registered custom-element types rather than mirrored interfaces and casts.

This keeps the deduplication from #133519 at its existing identity and presentation boundaries. Production code is +22/-38 (net -16); tests are +27/-33 (net -6), including two new cache-reuse regressions.

User Impact

Owner and participant faces still appear once in chat and dashboard headers. Prepared avatar lists stop rebuilding and discarding live-presence state. No configuration, persistence, protocol, or visual-design changes.

Evidence

  • Both new regressions failed before the fix: rendering an empty prepared participant or user list replaced the cached live projection. Both pass after it.
  • Focused facepile, owner-chip, sidebar, and presence suites: 357 tests passed.
  • Chromium on Blacksmith Testbox: chat and dashboard deduplication plus presence clearing 2/2 passed. Proof run; the leased runner was stopped after collecting artifacts.
  • Before/after screenshots use synthetic identities and show unchanged header presentation. “Before” is the already-deduplicated state from fix(ui): deduplicate participant and viewer avatars #133519; “after” is this refactor.
  • Authenticated production verification was unavailable through the browser relay. The browser proof exercises the application with a deterministic Gateway fixture; it is not a production deployment claim.

Review follow-ups

Two source-derived, pre-existing edge cases were identified during the broader review and remain outside this cache/rendering cleanup. They are not reproduced regressions of this patch:

  • Archive attribution versus participant projection: an archive row displays archivedBy, while the Gateway participant preview excludes the session owner. Investigate a participant archiving another person's session; repair attribution/count ownership together rather than decrementing a truncated preview in the UI.
  • Channel-avatar fallback versus live viewers: the channel-image component can display an owner-chip fallback before a usable image loads, while the parent row reports no displayed identities for that branch. Investigate loading, missing-auth, 404, decode-error, and successful-image transitions; any repair must track the actual displayed identity through that lifecycle so viewers reappear when the channel image takes over.

Before refactor: deduplicated chat header

After refactor: unchanged deduplicated chat header

After refactor: deduplicated dashboard header

@steipete steipete self-assigned this Aug 30, 2026
@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: S maintainer Maintainer-authored PR labels Aug 30, 2026
@steipete
steipete marked this pull request as ready for review August 30, 2026 21:10
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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. labels Aug 30, 2026
@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 5:17 PM ET / 21:17 UTC.

ClawSweeper review

What this changes

This PR avoids recalculating live presence for prepared avatar lists and reuses the session-owner avatar renderer.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open for explicit maintainer handling: this is a focused, net-negative Control UI repair with no source-level blocker found, while the maintainer label requires human merge handling.

Priority: P3
Reviewed head: 83c56e02329e8fae6395c9df5da246bc380d4692
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A clean, net-negative refactor with targeted regression coverage and no discrete correctness finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored Control UI PR is exempt from the external-contributor proof gate; its supplied deterministic Gateway fixture evidence and focused regression tests are supplemental rather than a production-deployment claim.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored Control UI PR is exempt from the external-contributor proof gate; its supplied deterministic Gateway fixture evidence and focused regression tests are supplemental rather than a production-deployment claim.
Evidence reviewed 8 items Current-main behavior: Current main resolves live viewers before selecting static participants or static users, so an empty prepared list calls the singleton projection with undefined payload and displaces the prior cached payload.
Cache owner and causal path: The presence helper retains one cached payload/projection pair, and live-viewer projection always calls that cache owner; avoiding the call for prepared lists repairs the eviction at the consumer boundary.
Introduced repair: The PR selects static participants or static users before calling the live-viewer projector, preserving live-cache identity when a prepared list is present.
Findings None None.
Security None None.

How this fits together

The Control UI combines Gateway presence data with durable session owners and participants to render chat-header and sidebar avatar lists. Those rendered identities then determine which live viewers remain visible.

flowchart LR
  A[Gateway presence payload] --> B[Presence projection cache]
  C[Session owner and participants] --> D[Avatar list renderer]
  B --> D
  D --> E{Prepared list supplied?}
  E -->|Yes| F[Render prepared avatars]
  E -->|No| G[Filter live session viewers]
  F --> H[Chat header and sidebar]
  G --> H
Loading

Decision needed

Question Recommendation
Should this maintainer-owned Control UI cache repair land once exact-head validation and any latest review follow-ups are complete? Land after validation: Merge the focused cache repair after exact-head checks are green and the latest ClawSweeper follow-ups are confirmed.

Why: The source repair is coherent, but the protected maintainer label requires an explicit human merge decision.

Before merge

  • Resolve merge risk (P1) - The supplied context omits the body of the latest ClawSweeper comment; confirm any exact-head rank-up moves in that review before landing.
  • Complete next step (P2) - The remaining action is protected maintainer review and exact-head validation, not an automated repair.
Agent review details

Security

None.

PR surface

Source -16, Tests -6. Total -22 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 4 22 38 -16
Tests 2 27 33 -6
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 49 71 -22

Review metrics

Metric Value Why it matters
Production versus test delta production +22/-38 (net -16); tests +27/-33 (net -6) The repair removes redundant production work while adding focused cache-regression coverage.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the lazy prepared-list selection, complete exact-head validation, and satisfy any outstanding review follow-up before merging.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the lazy prepared-list selection, complete exact-head validation, and satisfy any outstanding review follow-up before merging.

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

Yes, source-reproducible with high confidence: render a facepile with either prepared empty-list property after caching a real presence payload, then assert the original projection remains cached. The focused regression test encodes both variants, but this read-only review did not execute it.

Is this the best way to solve the issue?

Yes: selecting prepared data before the live-viewer projection prevents unnecessary cache mutation without broadening the cache or adding a second path.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a bounded Control UI cleanup/performance repair with no demonstrated service, data, or security impact.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored Control UI PR is exempt from the external-contributor proof gate; its supplied deterministic Gateway fixture evidence and focused regression tests are supplemental rather than a production-deployment claim.

Label justifications:

  • P3: This is a bounded Control UI cleanup/performance repair with no demonstrated service, data, or security impact.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored Control UI PR is exempt from the external-contributor proof gate; its supplied deterministic Gateway fixture evidence and focused regression tests are supplemental rather than a production-deployment claim.

Evidence

What I checked:

  • Current-main behavior: Current main resolves live viewers before selecting static participants or static users, so an empty prepared list calls the singleton projection with undefined payload and displaces the prior cached payload. (ui/src/components/viewer-facepile.ts:90, 343fe90926c0)
  • Cache owner and causal path: The presence helper retains one cached payload/projection pair, and live-viewer projection always calls that cache owner; avoiding the call for prepared lists repairs the eviction at the consumer boundary. (ui/src/lib/presence-users.ts:79, 83c56e02329e)
  • Introduced repair: The PR selects static participants or static users before calling the live-viewer projector, preserving live-cache identity when a prepared list is present. (ui/src/components/viewer-facepile.ts:90, 83c56e02329e)
  • Focused regression coverage: The added table-driven test covers both empty prepared participant and prepared user lists, asserts no facepile is rendered, and verifies that the prior live projection remains referentially cached. (ui/src/components/viewer-facepile.test.ts:209, 83c56e02329e)
  • Callers and sibling surfaces: The sidebar supplies prepared online users and the chat header supplies prepared session viewers/participants, so both important prepared-list callers use the corrected lazy path. (ui/src/components/app-sidebar-render.ts:257, 83c56e02329e)
  • User-facing contract: The multi-user documentation distinguishes durable owner/participant avatars from transient live viewers and requires already-displayed people not to be repeated as live viewers. Public docs: docs/concepts/multi-user.md. (docs/concepts/multi-user.md:55, 83c56e02329e)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

@steipete

Copy link
Copy Markdown
Contributor Author

Reviewed the cache owner, facepile callers, owner/participant renderer, sidebar display branches, header projection, and sibling presence filtering. The fix avoids live projection entirely for prepared sources; it removes duplicate rendering without adding another cache or exclusion rule. Production delta: +22/-38, net -16. Test delta: +27/-33, net -6.

Validation on 83c56e0:

  • Two cache-reuse regressions failed before the fix and pass after it; focused suites: 357 passed.
  • Chromium chat/dashboard and presence-clearing scenarios: 2 passed. Testbox proof; inspected synthetic screenshots are attached to the PR, and the lease is stopped.
  • All selected changed-check gates passed. The first local type check resolved root pako 1.0.11 because this worktree lacked its UI dependency link; linking the already-installed UI dependencies (pako 3.0.1) and rerunning core-test types, UI types, oxlint, and stylelint passed. No source workaround or dependency change.
  • Fresh independent Codex autoreview reported no actionable findings at its default P0 threshold; broader manual review and native review artifacts are complete.

The PR records the separate archive-attribution and channel-image-fallback investigations explicitly. Authenticated production browser proof was unavailable; this is deterministic application/browser proof, not a production deployment claim.

Read the latest ClawSweeper review: it has no correctness or security findings and recommends this repair. Its remaining requests are explicit maintainer handling, exact-head validation, and checking the latest review follow-ups. Landing is explicitly authorized by the maintainer; this review and its before-merge items have now been read. There are no additional code changes or rank-up moves to apply. Live main rules require openclaw/ci-gate and linear history, with no independent-approval rule.

Exact-head CI run 33335694063 is green for 83c56e0. Proceeding through native scripts/pr prepare-run and merge-run.

@steipete
steipete merged commit 596df18 into main Aug 30, 2026
208 checks passed
@steipete
steipete deleted the codex/refactor-session-avatar-presence branch August 30, 2026 21:27
vincentkoc added a commit that referenced this pull request Aug 30, 2026
* origin/main: (55 commits)
  test: include v2026.8.1 release navigation (#133581)
  fix: stop cloud work before unrelated provider inspection finishes (#133476)
  fix(e2e): keep delete fixture target-compatible (#133526)
  fix(release): detect optional target E2E capability (#133525)
  fix(package): publish readable dist inventory (#133549)
  docs: add complete v2026.8.1 maintainer change index (#133585)
  fix(browser): preserve contextless worker and iframe sessions (#133571)
  fix(voice): discover configured provider candidates (#133507)
  refactor(ui): simplify chat rendering and lifecycle state (#133567)
  test: reduce maturity fixture cleanup time (#133566)
  improve: speed up legacy imports and transcript replacement (#133546)
  docs: add draft v2026.8.1 release notes (#133557)
  test: guard multi-project Vitest cache ownership (#133554)
  fix(memory): clarify default agent scope in command help (#133560)
  fix(clawdock): keep credentials out of diagnostic output (#133547)
  refactor(ui): avoid redundant presence work in avatar lists (#133548)
  fix(agents): recognize internal requester completion replies (#133543)
  fix: prevent duplicate queued user messages in chat clients (#133542)
  chore(ui): refresh control ui locales (#133544)
  fix(beam): restart delivery when the receiver changes (#133533)
  ...
vincentkoc added a commit to shojikumaru/openclaw that referenced this pull request Aug 30, 2026
…cked-delivery

* origin/main: (261 commits)
  fix(clawdock): keep credentials out of diagnostic output (openclaw#133547)
  refactor(ui): avoid redundant presence work in avatar lists (openclaw#133548)
  fix(agents): recognize internal requester completion replies (openclaw#133543)
  fix: prevent duplicate queued user messages in chat clients (openclaw#133542)
  chore(ui): refresh control ui locales (openclaw#133544)
  fix(beam): restart delivery when the receiver changes (openclaw#133533)
  fix(models): recover /models browse from a replaced prepared catalog (openclaw#133221)
  perf(terminal): reuse control scans and remove repeated sanitization work (openclaw#133527)
  perf(agents): prepare only consumed tool and skill diagnostics (openclaw#133512)
  fix(line): offer the card command only on LINE (openclaw#132895)
  fix: keep Android publication independent of core release (openclaw#133471)
  refactor(agents): simplify compaction accounting (openclaw#133521)
  refactor(plugins): simplify registration lifecycle policy (openclaw#133364)
  perf(plugins): avoid eager loader imports for active registry reads (openclaw#133518)
  refactor(ui): consolidate chat rendering ownership (openclaw#133508)
  test(auto-reply): prepare memory flush model capabilities (openclaw#133532)
  fix(ui): replace startup hourglasses with capacity-aware rings (openclaw#133470)
  fix(talk): preserve provider conversation order in browser transcripts (openclaw#133493)
  fix(ui): deduplicate participant and viewer avatars (openclaw#133519)
  feat(ui): add CRT terminal theme (openclaw#133495)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 31, 2026
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 P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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