Repository navigation
Prevent duplicate and blocked background session warming #1498
Description
Important
Problem — Background session warming can leave data cold or make later work wait unnecessarily: listed sessions are not all remembered before network scheduling, a slow origin delays scheduling for other origins, overlapping passes can accumulate duplicate work, and a lineage failure suppresses otherwise available message prefetch.
Approach — Keep session-list hydration separate from background I/O, schedule every server before awaiting completion, and make each origin's queued warming bounded and identity-aware. Treat lineage and message prefetch as independent best-effort operations.
Scope — in: session-list hydration and bulk warming scheduling · out: foreground loading policy, server API changes, and session-mirror retention
Assumptions — Background warming remains best-effort; foreground loads retain their existing capacity and semantics.
Acceptance Criteria
- Every valid session returned by a list response is normalized and remembered before any background lineage or message work is selected.
- A slow or stalled warm batch for one server does not delay scheduling a batch for another server.
- Overlapping timed warm passes cannot grow an unbounded queue of duplicate work for the same session and origin while preserving the configured concurrency limit.
- A failed lineage lookup does not prevent an eligible message prefetch for the same session.
- Existing error isolation remains intact: malformed list data and failed background requests do not break the prewarmer.
Testing Decisions
Extend the existing session-warm and prewarmer unit coverage. Add deterministic tests for whole-list hydration, cross-origin scheduling, overlapping-pass de-duplication, concurrency, and lineage-failure-prefetch independence.
Key Decisions
- Queue work by stable session identity within an origin rather than treating each periodic pass as a wholly new batch.
- Preserve the existing low-priority concurrency budget.
- Record known session information synchronously from the list response; network warming remains asynchronous and best-effort.
Constraints & Invariants
- Do not increase foreground request contention.
- Do not make warm failures user-visible or abort other origins.
- Keep the change independently reviewable from landing-page and mirror-retention work.
Prior Art
The existing session warming scheduler, prewarmer, session information normalization boundary, and scheduler tests.
Source
Follow-up to the six CodeRabbit findings attached to #1473; the behavior originated in the current-main reliability recovery delivered by #1472.
Activity