Skip to content

fix(agent): return data URIs for workspace-relative identity card avatars (#97602) - #102892

Merged
steipete merged 3 commits into
openclaw:mainfrom
LZY3538:fix/agent-identity-avatar-data-uri-97602
Jul 10, 2026
Merged

steipete merged 3 commits into
openclaw:mainfrom
LZY3538:fix/agent-identity-avatar-data-uri-97602

Conversation

@LZY3538

@LZY3538 LZY3538 commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

agent.identity.get returned 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 through resolveAssistantAvatarUrl to 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 (readLocalAvatarDataUrl in session-utils.ts) and uses it in both projections — agent.identity.get and 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.ts is gateway-internal; the identity-avatar barrel does not re-export it). The workspace root is canonicalised with realpathSync to 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:

  • UI chat avatar → agent.identity.get (already fixed in the first revision).
  • Config Personal card → appConfig.assistantIdentity.avatar → bootstrap control-ui-config.json → /avatar/<agentId> (auth-gated → <img> 401). This PR fixes this path.

Given a workspace with an avatar file avatar.png:

  • Before: bootstrap assistantAvatar = /avatar/main (route URL → <img> 401)
  • After: bootstrap 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:

  1. readLocalAvatarDataUrl(filePath, workspaceDir) moves from agent.ts into session-utils.ts (exported gateway-internal, off the SDK barrel).
  2. agent.identity.get imports the shared helper (behaviour unchanged).
  3. The bootstrap config handler resolves the avatar via the same resolveAgentAvatar(...) and, when kind === "local", inlines the file with the shared helper before resolveAssistantAvatarUrl (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-internal readLocalAvatarDataUrl (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

node vitest run src/gateway/control-ui.http.test.ts \
  src/gateway/server-methods/agent.test.ts \
  src/agents/identity-avatar.test.ts \
  src/gateway/session-utils.test.ts -t "avatar|identity"

Test Files  10 passed (10)
     Tests  77 passed | 898 skipped (975)

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 handleControlUiHttpRequest bootstrap path

A standalone script (not a committed test) creates a real workspace with a real avatar.png, invokes the production bootstrap-config handler, and prints the assistantAvatar from the actual JSON response body:

========== BEFORE (PR head control-ui.ts) ==========
handled: true
assistantAvatar (first 48 chars): "/avatar/main"
startsWith 'data:image/png;base64,' -> false
contains '/avatar/main' (broken auth-gated route) -> true

========== AFTER (fix) ==========
handled: true
assistantAvatar (first 48 chars): "data:image/png;base64,YXZhdGFyLWJ5dGVzCg=="
startsWith 'data:image/png;base64,' -> true
contains '/avatar/main' (broken auth-gated route) -> false

3. Lint: oxlint on 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]

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling size: S labels Jul 9, 2026
@LZY3538
LZY3538 force-pushed the fix/agent-identity-avatar-data-uri-97602 branch from 44323ad to 5854402 Compare July 9, 2026 14:27
@clawsweeper

clawsweeper Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 10, 2026, 6:01 AM ET / 10:01 UTC.

Summary
The PR centralizes browser-safe assistant-avatar projection and applies it to Control UI bootstrap, agent.identity.get, agent listings, and UI data-URL normalization.

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.

  • Plugin SDK API: 1 function added. The internal avatar fix currently expands the supported plugin compatibility surface.

Stored data model
Persistent data-model change detected: serialized state: src/agents/identity-avatar.test.ts, serialized state: src/gateway/assistant-identity.test.ts, serialized state: src/gateway/server-methods/agent.test.ts, serialized state: src/gateway/session-utils.ts, unknown-data-model-change: src/gateway/session-utils.ts. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🦐 gold shrimp
Result: blocked until stronger real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Internalize resolveAgentAvatarFromSource and restore the Plugin SDK export budgets.
  • [P1] Add fresh redacted final-head gateway or Control UI proof showing the workspace avatar renders without the authenticated-route 401.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The available live output predates the final force-pushed architecture. Add fresh final-head gateway output or a Control UI recording, redacting IP addresses, keys, phone numbers, and private endpoints; updating the PR body should trigger review, or a maintainer can request @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] Merging the new wildcard-exported resolver would create an unnecessary public Plugin SDK compatibility obligation for an internal gateway composition helper.
  • [P1] The submitted before/after transcript describes an earlier session-utils.ts implementation and predates multiple force-pushed rewrites, so it does not prove the final head in a real setup.

Maintainer options:

  1. Internalize and re-prove (recommended)
    Remove the SDK-visible resolver export, restore the public export budgets, and provide fresh final-head runtime or browser proof before merge.
  2. Adopt a public SDK contract
    Retain the resolver only with explicit maintainer API approval, SDK documentation, compatibility tests, and fresh final-head behavior proof.

Next step before merge

  • [P1] The branch needs a focused API-boundary correction plus fresh final-head proof from a real setup; automation cannot provide the contributor's real behavior evidence.

Security
Cleared: The local avatar path preserves the workspace boundary with descriptor-based validation, hardlink rejection, same-descriptor reading, and byte limits.

Review findings

  • [P1] Keep the source resolver out of the Plugin SDK — src/agents/identity-avatar.ts:111
Review details

Best 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:

  • [P1] Keep the source resolver out of the Plugin SDK — src/agents/identity-avatar.ts:111
    src/plugin-sdk/agent-runtime.ts wildcard-exports this module, so this new export makes a core-only composition helper public plugin API and forces the budget bump. Keep it internal or move it to an internal module, then restore the SDK budgets to avoid an unintended compatibility contract.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add merge-risk: 🚨 compatibility: The new source resolver is wildcard-exported through the Plugin SDK and would become a supported public contract.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The available live output predates the final force-pushed architecture. Add fresh final-head gateway output or a Control UI recording, redacting IP addresses, keys, phone numbers, and private endpoints; updating the PR body should trigger review, or a maintainer can request @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Label justifications:

  • P2: This is a bounded user-visible Control UI bug with a focused compatibility repair and proof refresh remaining.
  • merge-risk: 🚨 compatibility: The new source resolver is wildcard-exported through the Plugin SDK and would become a supported public contract.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The available live output predates the final force-pushed architecture. Add fresh final-head gateway output or a Control UI recording, redacting IP addresses, keys, phone numbers, and private endpoints; updating the PR body should trigger review, or a maintainer can request @clawsweeper re-review. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +6, Tests +374, Other 0. Total +380 across 14 files.

View PR surface stats
Area Files Added Removed Net
Source 8 193 187 +6
Tests 5 379 5 +374
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 2 0
Total 14 574 194 +380

What I checked:

Likely related people:

  • steipete: Introduced and centralized the existing Control UI avatar URL behavior, authored the final consolidation commit, and is assigned to the live PR. (role: feature owner and recent contributor; confidence: high; commits: 482fcd2f2c8f, d297e17958f0, b88437330074; files: src/gateway/control-ui-shared.ts, src/gateway/control-ui.ts, src/gateway/assistant-identity.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • 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.
Review history (2 earlier review cycles)
  • reviewed 2026-07-09T14:57:19.805Z sha 5854402aa20a335c1a0cd7ea31c232abc00319a4 :: needs real behavior proof before merge. :: [P1] Keep the avatar reader out of the public SDK | [P2] Canonicalize the workspace root before reading
  • reviewed 2026-07-09T15:43:28.416Z sha 7115b3668896609a38cc0fa3c49b6a895901ae75 :: needs real behavior proof before merge. :: [P1] Cover the bootstrap Personal card path

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 9, 2026
@LZY3538
LZY3538 force-pushed the fix/agent-identity-avatar-data-uri-97602 branch from 5854402 to 7115b36 Compare July 9, 2026 15:20
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui and removed agents Agent runtime and tooling labels Jul 9, 2026
@LZY3538

LZY3538 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Addressed the P1 (bootstrap Personal-card path). The workspace-safe avatar reader is now a single shared gateway-internal helper (readLocalAvatarDataUrl in session-utils.ts), used by both agent.identity.get and the bootstrap config handler, so identity and bootstrap projections emit identical data URIs. Added a bootstrap-config regression test and a standalone before/after transcript driving the real handleControlUiHttpRequest bootstrap path (see updated PR body). Latest commit: 78c3669683.

@clawsweeper

clawsweeper Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@steipete steipete self-assigned this Jul 10, 2026
@clawsweeper

clawsweeper Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

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.

@steipete
steipete force-pushed the fix/agent-identity-avatar-data-uri-97602 branch from 78c3669 to 69936d6 Compare July 10, 2026 09:01
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: L and removed size: S labels Jul 10, 2026
@clawsweeper clawsweeper Bot removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 10, 2026
@clawsweeper

clawsweeper Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

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.

@steipete
steipete force-pushed the fix/agent-identity-avatar-data-uri-97602 branch 2 times, most recently from 2b42a24 to 3616a28 Compare July 10, 2026 09:15
@clawsweeper

clawsweeper Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

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.

LZY3538 and others added 2 commits July 10, 2026 05:26
…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]>
@steipete
steipete force-pushed the fix/agent-identity-avatar-data-uri-97602 branch from 3616a28 to 8438b2e Compare July 10, 2026 09:26
@clawsweeper

clawsweeper Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

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.

@steipete
steipete force-pushed the fix/agent-identity-avatar-data-uri-97602 branch from 8438b2e to 9e89998 Compare July 10, 2026 09:36
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Jul 10, 2026
@steipete
steipete force-pushed the fix/agent-identity-avatar-data-uri-97602 branch from 9e89998 to d31a05f Compare July 10, 2026 09:41
@openclaw-barnacle openclaw-barnacle Bot removed the scripts Repository scripts label Jul 10, 2026
@clawsweeper

clawsweeper Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

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]>
@steipete
steipete force-pushed the fix/agent-identity-avatar-data-uri-97602 branch from d31a05f to b884373 Compare July 10, 2026 09:51
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Jul 10, 2026
@steipete

Copy link
Copy Markdown
Contributor

Land-ready proof for exact head b884373:

  • Reworked the PR to keep workspace-local avatar resolution bounded to the agent workspace while projecting browser-safe data URLs only through an internal Gateway/UI helper, not the public plugin SDK barrel.
  • Preserved same-origin /avatar/<agent> and base-pathed /openclaw/avatar/<agent> routes before filesystem projection, and kept browser normalization free of Node-only avatar-policy imports.
  • Autoreview: clean after moving resolveAgentAvatarUrl out of the public SDK-exported identity-avatar.ts surface.
  • AWS Crabbox run_e21e65d8e65b: corepack pnpm test src/gateway/control-ui.http.test.ts src/gateway/assistant-identity.test.ts src/gateway/server-methods/agent.test.ts src/agents/identity-avatar.test.ts ui/src/lib/assistant-identity.test.ts test/scripts/plugin-sdk-surface-report.test.ts passed all focused shards.
  • Native prepare: OPENCLAW_TESTBOX=1 scripts/pr prepare-run 102892 passed; hosted exact CI run 29084425571 passed for this SHA.
  • Gate mode: hosted_exact_or_recent_rebase; remote PR head matches local prep head.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 10, 2026
@steipete
steipete merged commit 4af1d53 into openclaw:main Jul 10, 2026
126 of 131 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

@steipete

Copy link
Copy Markdown
Contributor

The hardened follow-up is now on main via #103657 at 505f8ae6.

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 /avatar/ retries or 401 responses.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 11, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: L status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Control UI: Personal card avatar 401 due to inconsistent avatar resolution between agents.list and agent.identity.get

2 participants