← Back to PRs

#16037: fix(canvas): resolve A2UI assets from dist + retry resolution

by AlexAnys open 2026-02-14 06:06 View on GitHub →
size: S
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