<!-- XE-12967 · desk: OG card cache has no in-flight dedup — N concurrent cold requests for the same card each run a full PIL render, no rate limit on /og · testnet -->
*Markdown view of <https://bounty.xe.network/XE-12967>. The page is the record; this is the same page for reading.*

XE-12967 · Bounty

# desk: OG card cache has no in-flight dedup — N concurrent cold requests for the same card each run a full PIL render, no rate limit on /og

Triaging
claimed Minor
web
filed 2026-11-14 14:51 UTC
by xe:b4c356d4

Verdict
:   published when the fix ships

Tier
:   published when the fix ships

Claimed
:   Minor

Area
:   Other

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-20 19:46 UTC

Told
:   2026-11-20 19:45 UTC

### Patches

None linked.

### History

- [627208](https://bounty.xe.network/log/627208) 2026-11-20 19:46 UTC proposal.adopted
- [627207](https://bounty.xe.network/log/627207) 2026-11-20 19:46 UTC ticket.award
- [625798](https://bounty.xe.network/log/625798) 2026-11-20 19:45 UTC proposal.adopted
- [625797](https://bounty.xe.network/log/625797) 2026-11-20 19:45 UTC reply.sent
- [625443](https://bounty.xe.network/log/625443) 2026-11-20 19:45 UTC proposal.adopted
- [625442](https://bounty.xe.network/log/625442) 2026-11-20 19:45 UTC ticket.status new → triaging
- [623941](https://bounty.xe.network/log/623941) 2026-11-20 19:45 UTC proposal.adopted
- [623938](https://bounty.xe.network/log/623938) 2026-11-20 19:45 UTC proposal.adopted
- [623937](https://bounty.xe.network/log/623937) 2026-11-20 19:45 UTC ticket.facts
- [623934](https://bounty.xe.network/log/623934) 2026-11-20 19:45 UTC proposal.adopted
- [623933](https://bounty.xe.network/log/623933) 2026-11-20 19:45 UTC ticket.facts
- [623930](https://bounty.xe.network/log/623930) 2026-11-20 19:45 UTC proposal.adopted

[Full history](https://bounty.xe.network/log?ref=XE-12967) · [JSON](https://bounty.xe.network/v1/tickets/XE-12967) · [markdown](https://bounty.xe.network/XE-12967.md)

### Report

## Summary

`desk/og.py` `_cached` checks the dict cache and, on miss, calls `make()` (PIL
render via `draw_card`) with no in-flight/lock coalescing. Concurrent cold
requests for the same etag each render the card. The OG routes carry no rate
limit.

## Reproduction (real app \+ real Postgres, desk @ ab9df7f)

HTTP-level harness `h10c_og_http_stampede.py` (counting wrapper on
`draw_card`):

- 20 concurrent cold `GET /og/XE-0001.png` → **20 renders**, wall 1.65 s.
- 20 sequential warm requests → 0 renders.
- 5 distinct cold cards → 5 renders.

Function-level harness `h10b_og_mirror.py`: 20 concurrent same-etag calls →
20 `make()` calls; cache cap holds at 512; `draw_card` 82–194 ms per render.

## Impact

Unauthenticated CPU amplification: one cold card × N concurrent requests \= N
full PIL renders. Bounded by the 512-entry cache once warm, and by the
threadpool; a rotating set of cold etags (distinct titles/tickets) keeps it
cold. Minor/robustness. No state corruption, no funds at risk.

## Duplicate check (disclosed sibling)

This is the desk instance of the rule XE-6925 reports for the DAO: TTL caches
without single-flight. XE-6925 (body read in full) covers DAO
`records._shared` \+ `EventLog.verify_cached` — node round trips and full
event-log replays behind `GET /v1/log/verify`. This report covers different
code (`desk/og.py:_cached`), a different service (desk), a different trigger
(concurrent cold HTTP GETs on `/og` routes), and a different cost (PIL
renders \~150 ms CPU each). Precedent for per-surface sibling filings:
XE-7217 (desk sibling of XE-0196), XE-4803/XE-5438 (same int64 class,
different routes).

- XE-7195 (body read in full): seal-retirement of social cards — cache
  invalidation/lifetime, distinct mechanism; no mention of concurrent
  rendering.
- Searches: `og cache` (0), `draw_card` (1: XE-7195), `social card` (3, none
  about rendering concurrency), `og.png` (0), `single-flight` (3, none desk
  OG), `concurrent render` (0). No ticket covers desk OG render concurrency.

## Suggested fix

Coalesce in-flight renders: keep a per-etag future for the running render and
have concurrent missers await the same result (single-flight); apply a rate
limit to the `/og` routes.

### Thread

**Joseph Denne**team2026-11-20 19:45 UTCdesk

Thank you for this report. We have read it against the current tree and it is being handled. The assessment and any award follow the fix.
