Frontend Asset Optimization
Tier 2 easy go · local · real merged PR from grafana/grafana #90939
Ground-truth defects
The GetWebAssets function implements an incomplete double-checked locking pattern for caching web assets. The function first checks if the cache is populated using a read lock (RLock), and if the cache is empty, it acquires a write lock to populate it. However, it fails to re-check whether the cache was populated by another goroutine while waiting to acquire the write lock.
The change under review
diff
@@ -8,6 +8,7 @@ import ( "net/http" "os" "path/filepath" + "sync" "github.com/grafana/grafana/pkg/api/dtos" "github.com/grafana/grafana/pkg/services/licensing" @@ -31,12 +32,21 @@ type EntryPointInfo struct { } `json:"assets,omitempty"` } -var entryPointAssetsCache *dtos.EntryPointAssets = nil +var ( + entryPointAssetsCacheMu sync.RWMutex // guard entryPointAssetsCache + entryPointAssetsCache *dtos.EntryPointAssets // TODO: get rid of global state +) func GetWebAssets(ctx context.Context, cfg *setting.Cfg, license licensing.Licensing) (*dtos.EntryPointAssets, error) { - if cfg.Env != setting.Dev && entryPointAssetsCache != nil { - return entryPointAssetsCache, nil + entryPointAssetsCacheMu.RLock() + ret := entryPointAssetsCache + entryPointAssetsCacheMu.RUnlock() + + if cfg.Env != setting.Dev && ret != nil { + return ret, nil } + entryPointAssetsCacheMu.Lock() + defer entryPointAssetsCacheMu.Unlock() var err error var result *dtos.EntryPointAssets
Leaderboard for this case
easy · 8 of 9 bots fully caught it (89% solve rate) · 89% avg coverage.
| # | Bot | Result | Caught | Coverage | Findings | False alarms |
|---|---|---|---|---|---|---|
| 1 | Claude Code (Opus 5.5) | solved | 1/1 | 100.0% | 1 | 0 |
| 2 | Cubic | solved | 1/1 | 100.0% | 1 | 0 |
| 3 | cursor | solved | 1/1 | 100.0% | 1 | 0 |
| 4 | Drape (Deep Review) | solved | 1/1 | 100.0% | 1 | 0 |
| 5 | Drape (Review) | solved | 1/1 | 100.0% | 1 | 0 |
| 6 | greptile | solved | 1/1 | 100.0% | 1 | 0 |
| 7 | Mjolnir (Sonnet 5.5) | solved | 1/1 | 100.0% | 1 | 0 |
| 8 | qodo | solved | 1/1 | 100.0% | 2 | 0 |
| 9 | Mjolnir (Opus 5.5) | miss | 0/1 | 0.0% | 0 | 0 |
Bot results
Claude Code (Opus 5.5) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | low | ✓ | exact |
raw comments (1)
The cache is not checked again after the write lock is taken. When the cache is empty, several concurrent requests all see nil under the read lock and then queue on the write lock. Each one re-reads and re-parses assets-manifest.json in turn, and every caller is blocked for the whole time, including during a CDN fetch if that path is ever enabled. Add a check like `if cfg.Env != setting.Dev && entryPointAssetsCache != nil { return entryPointAssetsCache, nil }` right after `Lock()` so only the first caller does the work.
Cubic · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | low | ✓ | off by one |
raw comments (2)
<!-- cubic:v=faad4b82-27f2-4907-b91d-3850b7573950 -->
<!-- cubic:review-run=ddede583-cb79-5e6e-bc31-7ce76b092cb7 -->
<!-- metadata:{"confidence":10} -->
P2: When concurrent non-development requests observe an empty cache, each passes the initial check and still reloads the manifest after waiting for this lock. Re-check the cache after acquiring the lock so only the first request loads it and a later failure cannot replace a valid cached result.
<details>
<summary>Prompt for AI agents</summary>
```text
Check if this issue is valid — if so, understand the root cause and fix it. At pkg/api/webassets/webassets.go, line 48:
<comment>When concurrent non-development requests observe an empty cache, each passes the initial check and still reloads the manifest after waiting for this lock. Re-check the cache after acquiring the lock so only the first request loads it and a later failure cannot replace a valid cached result.</comment>
<file context>
@@ -31,12 +32,21 @@ type EntryPointInfo struct {
+ if cfg.Env != setting.Dev && ret != nil {
+ return ret, nil
}
+ entryPointAssetsCacheMu.Lock()
+ defer entryPointAssetsCacheMu.Unlock()
</file context>
```
</details>
```suggestion
entryPointAssetsCacheMu.Lock()
defer entryPointAssetsCacheMu.Unlock()
if cfg.Env != setting.Dev && entryPointAssetsCache != nil {
return entryPointAssetsCache, nil
}
```
<!-- cubic:review-summary:start -->
**1 issue found** across 1 file
<!-- cubic:review-summary:end -->
<details>
<summary>Prompt for AI agents (unresolved issues)</summary>
```text
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="pkg/api/webassets/webassets.go">
<violation number="1" location="pkg/api/webassets/webassets.go:48">
P2: When concurrent non-development requests observe an empty cache, each passes the initial check and still reloads the manifest after waiting for this lock. Re-check the cache after acquiring the lock so only the first request loads it and a later failure cannot replace a valid cached result.</violation>
</file>
```
</details>
<sub>Reply with feedback, questions, or to request a fix.<br /><br />[Re-trigger cubic](https://www.cubic.dev/action/re-review/pr/drape-io/crbench-cubic-2026-09/44/ai_pr_review_github_delivery_eda724503f4b966531319cd2ed35d462ca80fe772ca2b1daf37700fa0275978b?returnTo=https%3A%2F%2Fgithub.com%2Fdrape-io%2Fcrbench-cubic-2026-09%2Fpull%2F44)</sub>
<!-- cubic:review-post:ai_pr_review_github_delivery_eda724503f4b966531319cd2ed35d462ca80fe772ca2b1daf37700fa0275978b:9469bd46a027b01d4d0feb424f6d190fa1f943c8:ddede583-cb79-5e6e-bc31-7ce76b092cb7 -->
cursor · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | low | ✓ | off by one |
raw comments (2)
### Cache not re-checked after lock
**Medium Severity**
<!-- DESCRIPTION START -->
After acquiring the write lock, `GetWebAssets` never re-checks `entryPointAssetsCache`. Concurrent callers that all saw a nil cache then each reload the manifest in turn, so a burst of first requests serializes redundant I/O on the page-render path.
<!-- DESCRIPTION END -->
<!-- BUGBOT_BUG_ID: 2d3c7f06-4dec-45f6-a6ad-3ecabce5e6cc -->
<!-- LOCATIONS START
pkg/api/webassets/webassets.go#L47-L49
LOCATIONS END -->
<div><a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9DVVJTT1IiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmNkNGYzOWIzLTc2Y2MtNDBjZi04ZWEwLTJiZDIyYzBkYjhjYSIsImVuY3J5cHRpb25LZXkiOiJvc3ZNNTJCZHRLWkMzaU1sZlUweWQ3X1h1M1hIQUZYUENEYWZNNnJMRHB3IiwiYnJhbmNoIjoidDItZ3JhZmFuYS05MDkzOSIsInJlcG9Pd25lciI6ImRyYXBlLWlvIiwicmVwb05hbWUiOiJjcmJlbmNoLWN1cnNvci0yMDI2LTA5IiwicHJvdmlkZXIiOiJnaXRodWIifX0" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a> <a href="https://cursor.com/agents?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9JTl9XRUIiLCJkYXRhIjp7InJlZGlzS2V5IjoiYnVnYm90OmNkNGYzOWIzLTc2Y2MtNDBjZi04ZWEwLTJiZDIyYzBkYjhjYSIsImVuY3J5cHRpb25LZXkiOiJvc3ZNNTJCZHRLWkMzaU1sZlUweWQ3X1h1M1hIQUZYUENEYWZNNnJMRHB3IiwiYnJhbmNoIjoidDItZ3JhZmFuYS05MDkzOSIsInJlcG9Pd25lciI6ImRyYXBlLWlvIiwicmVwb05hbWUiOiJjcmJlbmNoLWN1cnNvci0yMDI2LTA5IiwicHJOdW1iZXIiOjQ1LCJjb21taXRTaGEiOiI1NmFlNzg3ZWY3ZmZhMzIzOTMyM2VjYjRhNDFlYzAwN2JlMGQzZjdkIiwicHJvdmlkZXIiOiJnaXRodWIifX0" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-web-light.png"><img alt="Fix in Web" width="99" height="28" src="https://cursor.com/assets/images/fix-in-web-dark.png"></picture></a></div>
<sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 56ae787ef7ffa3239323ecb4a41ec007be0d3f7d. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- BUGBOT_REVIEW -->
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
<!-- BUGBOT_FIX_ALL -->
<a href="https://cursor.com/open?link=eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiQlVHQk9UX0ZJWF9BTExfSU5fQ1VSU09SIiwiZGF0YSI6eyJyZWRpc0tleSI6ImJ1Z2JvdC1tdWx0aTo4ZjU2NzkwNi0zZThmLTQ1MzItOTk0NS00NDY1M2IzMjhmNzYiLCJlbmNyeXB0aW9uS2V5IjoiTmZ3SVJlTTdxRFI0Y1EyTE9XcDRiaDRjNjYxZTFmam9SS1g3MkoxYUdfMCIsImJyYW5jaCI6InQyLWdyYWZhbmEtOTA5MzkiLCJyZXBvT3duZXIiOiJkcmFwZS1pbyIsInJlcG9OYW1lIjoiY3JiZW5jaC1jdXJzb3ItMjAyNi0wOSIsInByb3ZpZGVyIjoiZ2l0aHViIn19" target="_blank" rel="noopener noreferrer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/fix-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/fix-in-cursor-light.png"><img alt="Fix All in Cursor" width="115" height="28" src="https://cursor.com/assets/images/fix-in-cursor-dark.png"></picture></a>
<!-- /BUGBOT_FIX_ALL -->
<!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_BEGIN -->
<sup>❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- BUGBOT_AUTOFIX_REVIEW_FOOTNOTE_END -->
<sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 56ae787ef7ffa3239323ecb4a41ec007be0d3f7d. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup>
Drape (Deep Review) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | low | ✓ | exact |
raw comments (1)
**Concurrent cold requests all reload the manifest**
After taking the write lock, the cache isn't checked again, so every request that found it empty reads and parses the manifest again, one after another, and overwrites the cached value. After taking the write lock, check entryPointAssetsCache again (when not in dev) and return it if it is set.
```
pkg/api/webassets/webassets.go:41 entryPointAssetsCacheMu.RLock()
pkg/api/webassets/webassets.go:42 ret := entryPointAssetsCache
pkg/api/webassets/webassets.go:43 entryPointAssetsCacheMu.RUnlock()
pkg/api/webassets/webassets.go:45 if cfg.Env != setting.Dev && ret != nil {
pkg/api/webassets/webassets.go:48 entryPointAssetsCacheMu.Lock()
pkg/api/webassets/webassets.go:49 defer entryPointAssetsCacheMu.Unlock()
pkg/api/webassets/webassets.go:51 var err error
pkg/api/webassets/webassets.go:52 var result *dtos.EntryPointAssets
pkg/api/webassets/webassets.go:54 cdn := "" // "https://grafana-assets.grafana.net/grafana/10.3.0-64123/"
pkg/api/webassets/webassets.go:55 if cdn != "" {
```
Drape (Review) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | low | ✓ | exact |
raw comments (1)
**Cache not rechecked after taking write lock**
After releasing the read lock, `GetWebAssets` takes the write lock without rechecking the cache. Every caller that saw nil re-reads the manifest in turn, doing file I/O under the exclusive lock. After taking the write lock, recheck entryPointAssetsCache and return it if not Dev and non-nil.
```
pkg/api/webassets/webassets.go:41 entryPointAssetsCacheMu.RLock()
pkg/api/webassets/webassets.go:42 ret := entryPointAssetsCache
pkg/api/webassets/webassets.go:43 entryPointAssetsCacheMu.RUnlock()
pkg/api/webassets/webassets.go:45 if cfg.Env != setting.Dev && ret != nil {
```
greptile · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | low | ✓ | off by one |
raw comments (2)
<a href="#"><img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top"></a> **Redundant serialized cache loads**
Concurrent non-development requests can both read a nil cache before either acquires the write lock. After the first request populates the cache, the second still opens and decodes the manifest while holding the lock, unnecessarily delaying other readers. This is a non-blocking efficiency issue: recheck the cache after acquiring the write lock so queued requests reuse the loaded assets, while preserving development-mode reloads.
```suggestion
entryPointAssetsCacheMu.Lock()
defer entryPointAssetsCacheMu.Unlock()
if cfg.Env != setting.Dev && entryPointAssetsCache != nil {
return entryPointAssetsCache, nil
}
```
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
<h3>Greptile Summary</h3>
Adds an RWMutex around the shared web-assets cache, synchronizing cache reads and holding an exclusive lock through loading and publication.
- Protects the previously unsynchronized cache pointer.
- Preserves cached production responses and development-mode reloads.
- A non-blocking improvement is to recheck the cache after obtaining the write lock, avoiding redundant serialized loads during concurrent initialization.
<h3>Confidence Score: 4/5</h3>
The PR appears safe to merge, with a non-blocking cache-initialization efficiency issue.
The mutex protects cache reads and publication, but callers that observed an empty cache can queue up and unnecessarily reload the manifest after another caller has populated it.
**Files Needing Attention:** pkg/api/webassets/webassets.go
<details><summary><h3>Important Files Changed</h3></summary>
| Filename | Overview |
|----------|----------|
| pkg/api/webassets/webassets.go | Adds cache synchronization; concurrent cold callers can still perform redundant loads sequentially because the exclusive section does not recheck the cache. |
</details>
<!-- greptile_other_comments_section -->
<sub>Reviews (1): Last reviewed commit: ["Update pkg/api/webassets/webassets.go"](https://github.com/drape-io/crbench-greptile-2026-09/commit/3d9ec3ba7715aa1fbb02fb250d4747d8db527ed2) | [Re-trigger Greptile](https://app.greptile.com/api/retrigger?id=64284508)</sub>
Mjolnir (Opus 5.5) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | low | ✗ | — |
Mjolnir (Sonnet 5.5) · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | low | ✓ | exact |
raw comments (1)
[P3] No re-check of the cache after taking the write lock
The cache is read under `RLock`, which is released before `Lock` is taken, and nothing re-checks `entryPointAssetsCache` once the write lock is held. If N requests arrive while the cache is empty (for example at startup, or after a failed load left it nil), each one takes the lock in turn and re-reads and parses `assets-manifest.json`, so the work is done N times instead of once. This is safe but redundant. Re-checking `entryPointAssetsCache != nil && cfg.Env != setting.Dev` after `Lock()` would avoid it
qodo · cross-file engine perris 0.11.1+proven.tiered0.25.call.read.subclass.type
| Defect | Severity | Found | Grade |
|---|---|---|---|
| d1 | low | ✓ | off by one |
The new exclusive lock is taken after a nil snapshot, and the cache is never checked again once it is held. So concurrent cold-start callers queue up and each one re-reads the manifest in turn, when they used to run in parallel. That makes the extra latency a regression introduced by this change. It only happens before the cache is first filled, so the impact is small. [grounded: diff] [consensus 3/3: valid=3]
raw comments (3)
<img src="https://img.shields.io/badge/Medium-634FD1?style=flat-square" height="20px" alt="Remediation recommended">
1\. Startup requests repeat file loading <code>🐞 Bug</code> <code>➹ Performance</code>
<pre>
<b><i>GetWebAssets</i></b> takes the exclusive cache mutex after reading a nil snapshot but never checks the
cache again once the lock is acquired. When multiple production requests arrive before
initialization finishes, every waiter sequentially reloads and parses <b><i>assets-manifest.json</i></b>,
delaying both index and frontend-settings requests despite the first waiter having populated the
cache.
</pre>
<details>
<summary><strong>Agent Prompt</strong></summary>
```
## Issue description
Concurrent production cache misses queue on the exclusive mutex, but each waiter recomputes the assets because the cache is only checked before locking.
## Fix Focus Areas
- pkg/api/webassets/webassets.go[41-60]
## Recommended Fix
After acquiring the exclusive lock, recheck `entryPointAssetsCache` when the environment is not development and return it if populated. Only load and parse the manifest when the second check still finds an empty cache.
```
<code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code>
</details>
<h3>PR Summary by Qodo</h3>
Synchronize web asset cache access
<code>🐞 Bug fix</code> <code>🕐 Less than 10 minutes</code>
<img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider">
<details>
<summary>AI Description</summary>
<dl>
<dd>
<br/>
><pre>
>• Protects global web asset cache reads and writes with an RWMutex.
>• Prevents concurrent requests from racing while loading or returning entry-point assets.
></pre>
</dd>
</dl>
</details>
<details>
<summary>Diagram</summary>
<dl>
<dd>
<br/>
```mermaid
graph TD
A["Asset request"] --> B["Read-lock cache"] --> C{"Reusable cache?"}
C -->|No| E["Write-lock loading"] --> F["Read manifest"] --> G["Store cache"] --> D["Return assets"]
C -->|Yes| D
```
</dd>
</dl>
</details>
<details>
<summary>High-Level Assessment</summary>
<dl>
<dd>
<br/>
>The following are alternative approaches to this PR:
<details>
<summary><b>1. Recheck cache after write lock</b></summary>
<dl>
<dd>
- ➕ Avoids repeated sequential manifest loads during concurrent cold-cache requests
- ➕ Preserves the small scope of the current fix
- ➖ Duplicates the environment and cache condition
- ➖ Must retain development-mode cache bypass behavior
</dd>
</dl>
</details>
<details>
<summary><b>2. Service-owned asset cache</b></summary>
<dl>
<dd>
- ➕ Removes package-level global state
- ➕ Supports explicit lifecycle, configuration scoping, and isolated tests
- ➖ Requires broader dependency injection and caller wiring
- ➖ Disproportionately large for a targeted race fix
</dd>
</dl>
</details>
>**Recommendation:** The RWMutex is an appropriate low-risk fix for unsafe global cache access. Add a second non-development cache check after acquiring the write lock to avoid redundant cold-start loads; consider a service-owned cache only as a separate architectural refactor.
</dd>
</dl>
</details>
<details>
<summary> Files changed (1) <code> +13 / -3 </code> </summary>
<dl>
<dd>
<br/>
<details>
<summary>Bug fix (1) <code> +13 / -3 </code></summary>
<dl>
<dd>
<details>
<summary>webassets.go<code>Synchronize entry-point asset cache access</code> <code>+13/-3</code></summary>
<br/>
>Synchronize entry-point asset cache access
>
><pre>
>• Adds an RWMutex around reads and writes to the global entry-point asset cache. Cache loading is serialized to prevent concurrent requests from racing during cache population.
></pre>
>
><a href='https://github.com/drape-io/crbench-qodo-2026-09/pull/43/files#diff-99a25e95848001248495261d6b4d118606d4970ff7863e14f41d77a37c789e17'>pkg/api/webassets/webassets.go</a>
</details>
</dd>
</dl>
</details>
</dd>
</dl>
</details>
<h3>Code Review by Qodo</h3>
<code>🐞 Bugs (1)</code> <code>📘 Rule violations (0)</code> <code>📜 Skill insights (0)</code>
<img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider">
<br/>
<img src="https://img.shields.io/badge/Medium-634FD1?style=flat-square" height="20px" alt="Remediation recommended">
<details>
<summary> 1. Startup requests repeat file loading <code>🐞 Bug</code> <code>➹ Performance</code></summary>
<br/>
> <details open>
><summary>Description</summary>
><br/>
>
><pre>
><b><i>GetWebAssets</i></b> takes the exclusive cache mutex after reading a nil snapshot but never checks the
>cache again once the lock is acquired. When multiple production requests arrive before
>initialization finishes, every waiter sequentially reloads and parses <b><i>assets-manifest.json</i></b>,
>delaying both index and frontend-settings requests despite the first waiter having populated the
>cache.
></pre>
></details>
> <details>
><summary>Code</summary>
><br/>
>
><code>[pkg/api/webassets/webassets.go[R48-49]](https://github.com/drape-io/crbench-qodo-2026-09/pull/43/files#diff-99a25e95848001248495261d6b4d118606d4970ff7863e14f41d77a37c789e17R48-R49)</code>
>
>```diff
>+ entryPointAssetsCacheMu.Lock()
>+ defer entryPointAssetsCacheMu.Unlock()
>```
></details>
> <details>
><summary>Evidence</summary>
><br/>
>
><pre>
>The initial cache snapshot is taken before the exclusive lock, while the manifest read occurs after
>that lock without another cache check. Both the main index generation and frontend-settings endpoint
>call this function, so concurrent initial requests can enter this serialized reload path.
></pre>
>
> <code>[pkg/api/webassets/webassets.go[40-60]](https://github.com/drape-io/crbench-qodo-2026-09/blob/791e1a04b54f449433cb36b62b9f64c60c659cfd/pkg/api/webassets/webassets.go/#L40-L60)</code>
> <code>[pkg/api/index.go[81-85]](https://github.com/drape-io/crbench-qodo-2026-09/blob/791e1a04b54f449433cb36b62b9f64c60c659cfd/pkg/api/index.go/#L81-L85)</code>
> <code>[pkg/api/frontendsettings.go[60-70]](https://github.com/drape-io/crbench-qodo-2026-09/blob/791e1a04b54f449433cb36b62b9f64c60c659cfd/pkg/api/frontendsettings.go/#L60-L70)</code>
></details>
> <details>
><summary>Agent prompt</summary>
><br/>
>
>```
>The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
>
>## Issue description
>Concurrent production cache misses queue on the exclusive mutex, but each waiter recomputes the assets because the cache is only checked before locking.
>
>## Fix Focus Areas
>- pkg/api/webassets/webassets.go[41-60]
>
>## Recommended Fix
>After acquiring the exclusive lock, recheck `entryPointAssetsCache` when the environment is not development and return it if populated. Only load and parse the manifest when the second check still finds an empty cache.
>```
> <code>ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools</code>
></details>
<hr/>
</details>
<img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider">
<!-- qodo-context:start -->
<details><summary><strong>Context sources</strong></summary>
<div>Review mode: <code>⚖️ Balanced</code>: This changes synchronization and initialization behavior for shared global web-asset state, creating concurrency and locking correctness risks despite the small localized diff.</div>
<!-- qodo-context:end -->
</details>
<img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider">
<!-- qodo-daily-tip:start -->
<details>
<summary><strong>Tip of the day</strong></summary>
<br/>
<pre>💡 Did you know, you can reply 'qodo' on any finding to push back, ask questions, or dig deeper</pre>
<a href="https://docs.qodo.ai/tips-and-tricks">More tips ↗</a> | <a href="https://app.qodo.ai/configurations?tab=display-preferences">Customize Qodo ↗</a> | <a href="https://docs.qodo.ai">Qodo docs ↗</a>
</details>
<img src="https://www.qodo.ai/wp-content/uploads/2025/11/light-grey-line.svg" height="10%" alt="Grey Divider">
<!-- qodo-daily-tip:end -->
<!-- https://github.com/drape-io/crbench-qodo-2026-09/commit/791e1a04b54f449433cb36b62b9f64c60c659cfd -->
<a href="https://www.qodo.ai"><img src="https://www.qodo.ai/wp-content/uploads/2025/03/qodo-logo.svg" width="80" alt="Qodo Logo"></a>