#16037: fix(canvas): resolve A2UI assets from dist + retry resolution
size: S
Cluster:
UI Improvements and Fixes
Fixes #10497.
## Problem
Some packaged/bundled entrypoint layouts can serve Canvas but A2UI requests return **503** with `A2UI assets not found` even though the bundle exists.
Additionally, if A2UI resolution fails once during startup (transient fs/race), the current implementation can cache `null` for the lifetime of the process (no retry).
## Changes
- Improve A2UI asset root candidate resolution to handle bundled dist entrypoints (e.g. `dist/canvas-host/a2ui`).
- Avoid permanently caching a `null` A2UI root so the next request can recover after transient failures.
- Add unit tests for candidate selection + retry behavior.
## Verification
- `npx pnpm install --frozen-lockfile`
- `env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy npx vitest run --config vitest.unit.config.ts`
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Refactors A2UI asset resolution to fix 503 errors in bundled/packaged layouts by adding `dist/canvas-host/a2ui` candidates and prevents permanently caching null results so transient filesystem failures can recover on retry. Extracts resolution logic into testable pure functions (`getA2uiRootCandidates`, `resolveA2uiRootFromCandidates`, `createA2uiRootRealResolver`) and adds unit tests validating candidate selection, null-retry behavior, and inflight deduplication.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The refactoring extracts resolution logic into well-tested pure functions, adds comprehensive unit tests covering the key scenarios (bundled dist paths, null retry, inflight deduplication), and maintains backward compatibility with all existing candidate paths while fixing the reported 503 errors
- No files require special attention
<sub>Last reviewed commit: 14829d5</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#8644: Fix Control UI asset resolution for global installs
by codvik · 2026-02-04
78.6%
#20843: docs: add troubleshooting for A2UI bundling and missing node_modules
by yahiag04 · 2026-02-19
75.5%
#22361: fix(macos/canvas): prevent A2UI reload loop and add A2UI MIME mapping
by AIflow-Labs · 2026-02-21
74.8%
#9628: fix: resolve tsconfig rootDir errors by separating UI config (AI-as...
by KGBos · 2026-02-05
72.1%
#10292: Build: migrate A2UI packaging script from bash to TypeScript
by JAVA-LW · 2026-02-06
71.6%
#7852: fix(gateway): use port from Host header for canvasHostUrl (reverse ...
by tonimelisma · 2026-02-03
71.1%
#16480: fix(build): replace bash A2UI bundle script with cross-platform Typ...
by colddonkey · 2026-02-14
70.5%
#13321: android/gateway: harden manual connect identity and A2UI UX
by m888m · 2026-02-10
69.8%
#2544: fix(security): XSS vulnerability in Canvas Host + Windows CI stability
by Kiwitwitter · 2026-01-27
68.8%
#8988: fix: resolve security vulnerabilities in dependencies
by fotorpics · 2026-02-04
68.7%