← Back to PRs

#11603: feat(gateway): avatar upload + config identity

by advaitpaliwal open 2026-02-08 02:00 View on GitHub →
app: web-ui gateway commands stale
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