Repository navigation
fix(agent): return data URIs for workspace-relative identity card avatars (#97602) - #102892
Conversation
44323ad to
5854402
Compare
|
Codex review: needs real behavior proof before merge. Reviewed July 10, 2026, 6:01 AM ET / 10:01 UTC. Summary PR surface: Source +6, Tests +374, Other 0. Total +380 across 14 files. Reproducibility: yes. at source level: current main maps a workspace avatar path to an authenticated route consumed by an image element, and the linked issue provides concrete setup and UI steps. This read-only review did not independently run the UI scenario. Review metrics: 1 noteworthy metric.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Keep the unified descriptor-safe avatar projection, internalize the source-specific resolver so Plugin SDK exports do not grow, and attach fresh redacted final-head gateway or Control UI proof showing a workspace avatar rendering as a data URL without a 401. Do we have a high-confidence way to reproduce the issue? Yes at source level: current main maps a workspace avatar path to an authenticated route consumed by an image element, and the linked issue provides concrete setup and UI steps. This read-only review did not independently run the UI scenario. Is this the best way to solve the issue? No in its current form: the shared projection is the narrowest maintainable behavior fix, but the source-specific helper should remain internal and the final rewritten head needs fresh real behavior proof. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1bac1022e65b. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +6, Tests +374, Other 0. Total +380 across 14 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
Review history (2 earlier review cycles)
|
5854402 to
7115b36
Compare
|
@clawsweeper re-review Addressed the P1 (bootstrap Personal-card path). The workspace-safe avatar reader is now a single shared gateway-internal helper ( |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(agent): return data URIs for workspace-relative identity card avatars (#97602) This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
78c3669 to
69936d6
Compare
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(agent): return data URIs for workspace-relative identity card avatars (#97602) This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
2b42a24 to
3616a28
Compare
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(agent): return data URIs for workspace-relative identity card avatars (#97602) This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
…tars (openclaw#97602) agent.identity.get resolved workspace-relative agent avatars via resolveAssistantAvatarUrl to /avatar/<agentId> route URLs. <img> tags in the Control UI Personal card cannot load these URLs because they lack Bearer auth headers, showing broken images (401). Read the validated local avatar file into a data URI inline before constructing the identity response. The file-reading helper lives in agent.ts as a private (non-exported) function so it does not leak onto the public Plugin SDK surface. The workspace root is canonicalised with realpathSync to match the already-resolved filePath from resolveAgentAvatar, fixing containment checks for symlinked workspaces. Fixes openclaw#97602 Co-Authored-By: Claude <[email protected]>
…ard (openclaw#97602) agent.identity.get already returns inline data URIs for workspace-local avatars, but the Control UI Personal card is initialized from the bootstrap config (control-ui-config.json), which still mapped workspace avatars to the auth-gated /avatar/<agentId> route. An <img> cannot carry Bearer auth, so the linked Personal card 401/broken-image symptom persisted despite the RPC fix. Consolidate the workspace-safe avatar reader into a single gateway-internal helper (readLocalAvatarDataUrl in session-utils) and use it in both agent.identity.get and the bootstrap config handler, so the identity and bootstrap projections produce identical data URIs. Not re-exported on the Plugin SDK surface. Adds a bootstrap-config regression test. Co-Authored-By: Claude <[email protected]>
3616a28 to
8438b2e
Compare
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(agent): return data URIs for workspace-relative identity card avatars (#97602) This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
8438b2e to
9e89998
Compare
9e89998 to
d31a05f
Compare
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(agent): return data URIs for workspace-relative identity card avatars (#97602) This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
Project workspace-local assistant avatars into browser-safe data URLs across bootstrap and agent identity RPCs while preserving same-origin avatar routes and shared size limits. Co-authored-by: LZY3538 <[email protected]>
d31a05f to
b884373
Compare
|
Land-ready proof for exact head b884373:
|
|
Merged via squash.
|
|
The hardened follow-up is now on It preserves this PR's workspace-avatar rendering fix while consolidating one Gateway projection, bounding reads on the pinned descriptor, rejecting escaped/hardlinked/oversized or concurrently growing files, and keeping usage-only agent enumeration free of avatar-file reads. Exact-head CI and the token-authenticated Gateway + Chromium proof both passed; the browser observed the inline image and made zero |
…tars (openclaw#97602) (openclaw#102892) * fix(agent): return data URIs for workspace-relative identity card avatars (openclaw#97602) agent.identity.get resolved workspace-relative agent avatars via resolveAssistantAvatarUrl to /avatar/<agentId> route URLs. <img> tags in the Control UI Personal card cannot load these URLs because they lack Bearer auth headers, showing broken images (401). Read the validated local avatar file into a data URI inline before constructing the identity response. The file-reading helper lives in agent.ts as a private (non-exported) function so it does not leak onto the public Plugin SDK surface. The workspace root is canonicalised with realpathSync to match the already-resolved filePath from resolveAgentAvatar, fixing containment checks for symlinked workspaces. Fixes openclaw#97602 Co-Authored-By: Claude <[email protected]> * fix(gateway): inline workspace avatars in bootstrap config Personal card (openclaw#97602) agent.identity.get already returns inline data URIs for workspace-local avatars, but the Control UI Personal card is initialized from the bootstrap config (control-ui-config.json), which still mapped workspace avatars to the auth-gated /avatar/<agentId> route. An <img> cannot carry Bearer auth, so the linked Personal card 401/broken-image symptom persisted despite the RPC fix. Consolidate the workspace-safe avatar reader into a single gateway-internal helper (readLocalAvatarDataUrl in session-utils) and use it in both agent.identity.get and the bootstrap config handler, so the identity and bootstrap projections produce identical data URIs. Not re-exported on the Plugin SDK surface. Adds a bootstrap-config regression test. Co-Authored-By: Claude <[email protected]> * fix(control-ui): inline workspace assistant avatars Project workspace-local assistant avatars into browser-safe data URLs across bootstrap and agent identity RPCs while preserving same-origin avatar routes and shared size limits. Co-authored-by: LZY3538 <[email protected]> --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Peter Steinberger <[email protected]> Co-authored-by: LZY3538 <[email protected]>
Summary
agent.identity.getreturned inline data URIs for workspace-relative avatars, but the Control UI Personal card is initialized from the bootstrap config (control-ui-config.json), which still mapped workspace avatars throughresolveAssistantAvatarUrlto the auth-gated/avatar/<agentId>route. An<img>tag cannot carry a Bearer header, so the linked Personal-card 401/broken-image symptom persisted despite the RPC fix.This PR consolidates the workspace-safe avatar reader into one shared, gateway-internal helper (
readLocalAvatarDataUrlinsession-utils.ts) and uses it in both projections —agent.identity.getand the bootstrap config handler — so identity and bootstrap produce identical inline data URIs. Remote HTTP URLs, existing data URLs, text fallbacks, and the/avatar/<agentId>HTTP endpoint are unchanged.The helper is not re-exported on the Plugin SDK surface (
session-utils.tsis gateway-internal; theidentity-avatarbarrel does not re-export it). The workspace root is canonicalised withrealpathSyncto keep the containment check correct for symlinked workspaces.Fixes #97602.
What Problem This Solves
The Personal card in Control UI showed a broken avatar image because its avatar comes from the bootstrap config, not from
agent.identity.get:agent.identity.get(already fixed in the first revision).appConfig.assistantIdentity.avatar→ bootstrapcontrol-ui-config.json→/avatar/<agentId>(auth-gated →<img>401). This PR fixes this path.Given a workspace with an avatar file
avatar.png:assistantAvatar=/avatar/main(route URL →<img>401)assistantAvatar=data:image/png;base64,...(inline → renders)Why This Change Was Made
ClawSweeper's P1: the earlier fix covered only
agent.identity.get, leaving the bootstrap Personal-card path emitting the protected route. Rather than duplicate a third avatar reader, this revision lands one canonical projection:readLocalAvatarDataUrl(filePath, workspaceDir)moves fromagent.tsintosession-utils.ts(exported gateway-internal, off the SDK barrel).agent.identity.getimports the shared helper (behaviour unchanged).resolveAgentAvatar(...)and, whenkind === "local", inlines the file with the shared helper beforeresolveAssistantAvatarUrl(which passes data URIs through untouched). On any failure it falls back to the route URL.Changes
src/gateway/session-utils.ts: add exported gateway-internalreadLocalAvatarDataUrl(shared reader).src/gateway/server-methods/agent.ts: import the shared helper; remove the now-duplicated private copy and its now-unused imports.src/gateway/control-ui.ts: inline workspace-local avatars as data URIs in the bootstrap config response.src/gateway/control-ui.http.test.ts: bootstrap-config regression test asserting a workspace-local avatar is returned as a data URI (not/avatar/main).Evidence
1. Bootstrap regression test (new) + identity/list regressions — all green
The new test
inlines a workspace-local assistant avatar as a data URI in bootstrap config (#97602)fails on the pre-fix bootstrap handler and passes after.2. Real behavior proof — standalone harness driving the real
handleControlUiHttpRequestbootstrap pathA standalone script (not a committed test) creates a real workspace with a real
avatar.png, invokes the production bootstrap-config handler, and prints theassistantAvatarfrom the actual JSON response body:3. Lint:
oxlinton the three changed source files — clean (exit 0).AI-assisted
This PR was AI-assisted (Claude Code).
🤖 Generated with Claude Code
Co-Authored-By: Claude [email protected]