Skip to content

fix(control-ui): harden workspace avatar projection - #103657

Merged
steipete merged 3 commits into
mainfrom
codex/harden-avatar-projection
Jul 10, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/harden-avatar-projection

Conversation

@steipete

@steipete steipete commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The workspace-avatar fix merged in #102892 makes local avatars render in the Control UI, but its first implementation also widens the public agent-runtime result shape and performs file reads after a size check without keeping the read itself bounded. A file that grows after the pinned open can therefore exceed the avatar cap, and usage-only agent enumeration can pay the cost of reading and base64-encoding every configured avatar.

Related: #97602, #102892.

Why This Change Was Made

This follow-up keeps one internal owner for local avatar path resolution, the pinned descriptor, and bounded reads. Gateway bootstrap, agent.identity.get, agent-list projection, and the authenticated avatar route share one selected-avatar projector; usage-only callers use the existing lightweight agent list. Browser projections enforce the encoded size and URI-scheme boundary without changing persisted config validation or the shipped public AgentAvatarResolution shape. The temporary main-only projection export and duplicate URL mapper are removed.

User Impact

Workspace avatars continue to render inline without unauthenticated /avatar retries. Missing, escaped, hardlinked, oversized, or concurrently growing files fall back safely; configured emoji and same-origin avatar-route behavior remain intact. Usage RPCs no longer read avatar files.

Evidence

  • Focused remote tests: Testbox tbx_01kx5v8c769tprxz6v3zwvey2b (lease log 29088350746), command exit 0 with 1,492 tests across shared, agent, Gateway, plugin SDK, and UI surfaces
  • Final test-fixture cleanup: Testbox tbx_01kx5whq48n2djjja0ngzbzy10 (lease log 29089516046), formatting plus 369 agent/Gateway tests exited 0; the temp-creation guard reports no annotations
  • Changed-path gate: Testbox tbx_01kx5v8p7h3jd8rqfbxyptk49e (lease log 29088360259), command exit 0 across typecheck, lint, architecture, and contract guards
  • Remote build: Testbox tbx_01kx5v8rwdjxhv9f46yqtjmd9w (lease log 29088362745), pnpm build exited 0
  • Fresh Codex autoreview: runtime patch clean with no accepted/actionable findings (0.94 confidence); final test-only cleanup clean with no findings (0.99 confidence)
  • Exact-head hosted CI: run 29091616355, all required jobs passed on 80c47662c894065a90ccbde2ea9d10188393f51f
  • Live Gateway + Chromium on final exact head: Testbox tbx_01kx5ze1azssayg7eje36etwka (run 29092138689); token-authenticated /openclaw document and bootstrap returned 200 with the expected CSP/frame/nosniff/referrer headers, the full PNG data URL rendered complete at natural 1x1 dimensions, the UI connected, and 33 captured requests contained zero /avatar/ retries, zero 401s, zero page errors, and zero console errors

No agent transcript is attached.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime scripts Repository scripts agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR extensions: qa-lab labels Jul 10, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for prepared head a12e366b1668bf19d9288353f88b5be657955020:

  • Native exact-head CI: 29089714460, all required jobs passed.
  • Focused Testbox tbx_01kx5v8c769tprxz6v3zwvey2b: 1,492 tests passed.
pnpm test src/shared/avatar-limits.test.ts && pnpm test src/agents/identity-avatar.test.ts src/agents/identity-avatar-file.test.ts && pnpm test src/gateway/assistant-avatar.test.ts src/gateway/assistant-identity.test.ts src/gateway/control-ui.http.test.ts src/gateway/server-methods/agent.test.ts src/gateway/server-methods/usage.test.ts src/gateway/session-utils.test.ts && pnpm test src/plugin-sdk/agent-runtime-avatar-contract.test.ts && pnpm --dir ui test src/lib/agents/display.test.ts src/lib/assistant-identity.test.ts src/pages/config/quick.test.ts
  • Changed-path Testbox tbx_01kx5v8p7h3jd8rqfbxyptk49e: exit 0 across all selected typecheck, lint, architecture, import-cycle, DB/media/sidecar, webhook, and pairing guards.
env OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 OPENCLAW_CHANGED_LANES_RAW_SYNC=1 corepack pnpm check:changed -- CHANGELOG.md scripts/plugin-sdk-surface-report.mjs src/agents/identity-avatar-file.test.ts src/agents/identity-avatar-file.ts src/agents/identity-avatar-projection.ts src/agents/identity-avatar.test.ts src/agents/identity-avatar.ts src/gateway/assistant-avatar.test.ts src/gateway/assistant-avatar.ts src/gateway/assistant-identity.test.ts src/gateway/assistant-identity.ts src/gateway/control-ui.http.test.ts src/gateway/control-ui.ts src/gateway/server-http.ts src/gateway/server-methods/agent.test.ts src/gateway/server-methods/agent.ts src/gateway/server-methods/usage.test.ts src/gateway/server-methods/usage.ts src/gateway/session-utils.ts src/infra/file-descriptor-read.ts src/plugin-sdk/agent-runtime-avatar-contract.test.ts src/shared/avatar-limits.test.ts src/shared/avatar-limits.ts src/shared/avatar-policy.ts ui/src/lib/agents/display.test.ts ui/src/lib/assistant-identity.test.ts ui/src/lib/assistant-identity.ts ui/src/lib/avatar.ts ui/src/pages/config/quick.test.ts ui/src/pages/config/quick.ts
  • Build Testbox tbx_01kx5v8rwdjxhv9f46yqtjmd9w: corepack pnpm build exited 0.
  • Final fixture cleanup Testbox tbx_01kx5whq48n2djjja0ngzbzy10: formatting passed and 369 focused tests passed.
corepack pnpm exec oxfmt --check --threads=1 src/agents/identity-avatar-file.test.ts src/gateway/assistant-avatar.test.ts src/gateway/control-ui.http.test.ts
corepack pnpm test src/agents/identity-avatar-file.test.ts src/gateway/assistant-avatar.test.ts src/gateway/control-ui.http.test.ts
node scripts/report-test-temp-creations.mjs --base origin/main --head HEAD --no-merge-base --json

The four Testbox lease workflows were intentionally stopped after their commands exited 0; their linked Actions records therefore show cancellation at lease shutdown. Fresh Codex autoreview found no accepted/actionable findings in the runtime patch (0.94 confidence) or final test-only cleanup (0.99 confidence).

  • Live Gateway + Chromium on exact head: Testbox tbx_01kx5xap19qrp6wz554hb2a6xy (brisk-barnacle), run 29090219891, wrapper exit 0 after an exact-head build and real browser run. A token-authenticated Gateway served the Control UI at /openclaw; the document and bootstrap returned 200 with the expected CSP, frame, nosniff, and referrer headers. The Pixel workspace avatar arrived as the full 114-character PNG data URL, rendered complete at natural 1x1 dimensions, and the UI reached connected state with the configured avatar visible. Across 33 browser requests there were zero /avatar/ requests, zero 401 responses, and zero page errors.

Known proof gaps: none.

@steipete
steipete requested a review from a team as a code owner July 10, 2026 12:06
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: telegram Channel integration: telegram docker Docker and sandbox tooling extensions: clawrouter Extension: clawrouter labels Jul 10, 2026
@steipete
steipete force-pushed the codex/harden-avatar-projection branch from f94c0ba to 80c4766 Compare July 10, 2026 12:08
@openclaw-barnacle openclaw-barnacle Bot removed docs Improvements or additions to documentation channel: telegram Channel integration: telegram docker Docker and sandbox tooling extensions: qa-lab extensions: clawrouter Extension: clawrouter labels Jul 10, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 80c47662c8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread CHANGELOG.md

- **Agent abort cleanup:** serialize prompt lock reacquisition with terminal cleanup so canceled embedded runs do not self-contend on session locks for up to 60 seconds.
- **Chutes OAuth deadlines:** bound token exchange, profile lookup, and refresh requests, and keep issued tokens when optional userinfo enrichment stalls. (#102026) Thanks @Alix-007.
- **Control UI workspace avatars:** inline validated agent avatar files in bootstrap and identity responses so Personal card images render without unauthenticated avatar-route requests, while preserving configured emoji precedence. (#102892, #97602) Thanks @LZY3538.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove the normal-change changelog entry

This adds a normal fix directly to CHANGELOG.md, but the root AGENTS.md Docs/Changelog rule says CHANGELOG.md is release-only and that normal PRs/direct fixes should put release-note context in the PR or commit while release generation owns the changelog. Keeping this manual entry risks stale or duplicate release notes when the generated release changelog is produced.

Useful? React with 👍 / 👎.

@steipete

Copy link
Copy Markdown
Contributor Author

Final prepared-head addendum for 80c47662c894065a90ccbde2ea9d10188393f51f:

  • Exact-head CI 29091616355: all required jobs passed.
  • Live Testbox run 29092138689, tbx_01kx5ze1azssayg7eje36etwka: build plus real token-authenticated Gateway and Chromium proof passed in 98.8 seconds.
  • The Control UI loaded at /openclaw; document and bootstrap returned 200 with the expected CSP, frame, nosniff, and referrer headers. The full 114-character PNG data URL rendered complete at natural 1x1 dimensions with the configured avatar visible.
  • Across 33 browser requests: zero /avatar/ retries, zero 401 responses, zero page errors, and zero console errors.
  • Remote PR head was rechecked at the same SHA; the proof checkout was clean. Known proof gaps: none.

@steipete
steipete merged commit 505f8ae into main Jul 10, 2026
110 of 112 checks passed
@steipete
steipete deleted the codex/harden-avatar-projection branch July 10, 2026 12:31
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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 maintainer Maintainer-authored PR scripts Repository scripts size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant