Skip to content

FE-1928: Pool atlas requests to handle network pressure better - #10020

Open
alex-e-leon wants to merge 3 commits into
mainfrom
FE-1928-atlas-request-pool
Open

alex-e-leon wants to merge 3 commits into
mainfrom
FE-1928-atlas-request-pool

Conversation

@alex-e-leon

Copy link
Copy Markdown
Contributor

🌟 Purpose

The current implementation of atlas fetches/prefetches all tiles naively, and doesn't handle network issues or network pressure well. If the server is overloaded, or the user is rate-limited the errors get forwarded to the client and a 429 message is shown. This PR introduces a network pool that slows down the network requests, especially pre-fetching if network errors are triggered.

In addition this PR also improves auth token refresh handling. In the original implementation if an auth token expires during network transit, only the first tile fetch reply renews the token and retries and any other tile fetches fail. We fix this by having all in flight tile fetches re-use and retry their requests with a new token during token renewal.

🚫 Blocked by

There is a seperate ticket to update the rate limits on atlas to better match a tiling workload:
https://linear.app/hash/issue/SRE-1170/adjust-atlas-rate-limits-for-tiling-workloads

I'd like for this to be finished first so that I can properly test the new logic against the updated rate limits.

@alex-e-leon
alex-e-leon requested a review from a team as a code owner October 13, 2026 07:28
@vercel

vercel Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hash Ready Ready Preview Oct 13, 2026 3:49pm UTC
3 Skipped Deployments
Project Deployment Actions Updated
hashdotdesign-tokens Ignored Ignored Preview Oct 13, 2026 3:49pm UTC
petrinaut Skipped Skipped Oct 13, 2026 3:49pm UTC
petrinaut-docs Skipped Skipped Oct 13, 2026 3:49pm UTC

Request Review

@cursor

cursor Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches core atlas transport (retries, session replacement, concurrency) and tile caching behavior under load and auth renewal; mis-coordination could cause failed tiles or stale sessions, but changes are heavily tested.

Overview
Adds atlas request shaping so tile bursts do not overwhelm rate limits: a shared concurrency pool (cap of six) for data routes with required traffic ahead of low-priority prefetches, while manifest/current stay unpooled to avoid renewal deadlocks.

On 429 responses the transport now parses Retry-After, floors retry backoff on shorter waits, treats very long waits as non-retryable, and records speculation backpressure so prefetch pauses (and can cancel in-flight prefetches) until the budget clears.

Session recovery is reworked: withAtlasSession replaces the old replace-or-bail check so when a session ends, one caller replaces and concurrent siblings retry under the recorded successor instead of failing for acting second.

Tile cache / prefetch changes: auxiliary detail is retained with tiles (labels count toward budget), prefetches run at the viewport’s detail mode, and getViewportNodes skips speculation while backpressure is active.

Reviewed by Cursor Bugbot for commit 9aafd93. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot added area/apps > hash* Affects HASH (a `hash-*` app) area/apps > hash-api Affects the HASH API (app) type/eng > frontend Owned by the @frontend team type/eng > backend Owned by the @backend team area/apps labels Oct 13, 2026

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs October 13, 2026 15:35 Inactive
@vercel
vercel Bot temporarily deployed to Preview – petrinaut October 13, 2026 15:35 Inactive

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b1b1569. Configure here.

@alex-e-leon
alex-e-leon force-pushed the FE-1928-atlas-request-pool branch from b1b1569 to 9aafd93 Compare October 13, 2026 15:39
@vercel
vercel Bot temporarily deployed to Preview – petrinaut October 13, 2026 15:39 Inactive
@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs October 13, 2026 15:39 Inactive
@github-actions github-actions Bot removed area/apps > hash-api Affects the HASH API (app) type/eng > backend Owned by the @backend team labels Oct 13, 2026

This branch was successfully deployed

1 active and 2 inactive deployments
Preview – hash — 9aafd93f Deployed Oct 13, 2026 by vercel[bot]
Preview – petrinaut — 9aafd93f Deployed Oct 13, 2026 by vercel[bot]
Preview – petrinaut-docs — 9aafd93f Deployed Oct 13, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps > hash* Affects HASH (a `hash-*` app) area/apps type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

1 participant