#11603: feat(gateway): avatar upload + config identity
app: web-ui
gateway
commands
stale
Cluster:
OpenClaw Plugin Enhancements
What
- Add `POST /avatar/<agentId>` (Control UI) to upload an avatar image and store it under the agent workspace (`avatars/avatar.<ext>`), then persist `agents.list[].identity.avatar` to that workspace-relative path.
- Fix `agents.create`/`agents.update` to persist `emoji`/`avatar` into `agents.list[].identity` (config) instead of appending identity fields into `IDENTITY.md` (prevents dumping `data:image/...;base64,...`).
Notes
- Upload endpoint requires gateway auth (Bearer token) via `authorizeGatewayConnect`.
- Allowed content-types: png/jpg/gif/webp/svg.
- Max upload size: 5MB.
Tests
- `pnpm vitest run src/gateway/server-methods/agents.mutate.test.ts src/gateway/control-ui.avatar-upload.test.ts`
- `pnpm check`
- `pnpm build`
AI-assisted
Yes (Codex).
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR adds a Control UI `POST /avatar/<agentId>` endpoint that writes an uploaded image into the agent workspace (`avatars/avatar.<ext>`) and persists the workspace-relative path into `agents.list[].identity.avatar` in config. It also changes `agents.create`/`agents.update` to persist `emoji`/`avatar` in config identity rather than appending identity fields into `IDENTITY.md`, preventing large data URLs from being dumped into markdown.
Routing-wise, the new upload handler is wired into `src/gateway/server-http.ts` before the existing Control UI avatar GET handler, and uses gateway auth (`authorizeGatewayConnect`) plus content-type/size checks.
<h3>Confidence Score: 4/5</h3>
- Generally safe to merge once URL-parse error handling is fixed in the new HTTP upload path.
- The changes are localized and covered by new tests, and the config identity persistence looks consistent. The main concern is the new unauthenticated code path that can throw on malformed URLs and return 500s; fixing that should make the endpoint robust.
- src/gateway/control-ui.ts (new upload handler)
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#16777: feat(gateway): add multimodal image support to /v1/chat/completions
by dzianisv · 2026-02-15
78.1%
#6430: feat(protocol): include agent identity in hello-ok handshake response
by astoreyai · 2026-02-01
78.1%
#10314: fix(webui): read avatar from ui.assistant.avatar config path
by leszekszpunar · 2026-02-06
76.7%
#9726: feat: add identityDir config for separate identity file location
by rickburn · 2026-02-05
76.3%
#10441: webchat: switch file uploads to HTTP /uploads
by supernewbilityxht1 · 2026-02-06
75.2%
#14618: feat(ui): add AgentHQ - agent workspace evolution viewer
by eddie333016 · 2026-02-12
74.6%
#6840: Fix assistant identity default agent for global sessions
by JorgeAlan · 2026-02-02
73.4%
#4534: fix: packaging and OpenAI vision format conversion
by SalimBinYousuf1 · 2026-01-30
72.6%
#16346: feat: support image attachments in OpenAI chat completions endpoint
by sh1nj1 · 2026-02-14
72.4%
#22781: fix(webchat): persist chat attachments after guards and expose medi...
by Kansodata · 2026-02-21
71.7%