[WIP] [POC] [History Server] [Beta] Scalable v2 architecture: Lazy loading with blocking enter_cluster + snapshot LRU #4765
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #4765"
general
weight: 0.35
JiangJiaWei1103
Why are these changes needed?
Alpha Problems
EventHandlerre-read and re-process all raw events periodically (each tick bound toO(all sessions ever))Beta Strategy
/enter_clusterendpoint); no ticker, no active scanningSessionSnapshotinto the LRU for later calls, falling back to on-demand processing on a cache missOverview
System Architecture
Request Data Flow
Takeaways:
singleflightkey ={name}_{ns}/{session}(matches LRU key shape)serverCtx, not the winner's request ctx- Winner disconnects cannot cancel followers' shared work
Primeplants the freshly-built snapshot pointer into the LRU so the immediate follow-up calls (e.g./tasks) is zero-IOComponents
| Component | File | Purpose |
| ------------------ | ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| Pipeline |
pkg/processor/session.go| Convert dead-session events → SessionSnapshot JSON; stateless across sessions. || SnapshotLoader |
pkg/server/cache.go| LRU-fronted snapshot reads; falls through to on-demand processing on miss. || Supervisor |
pkg/server/enter_cluster.go| Block/enter_clusteruntil a snapshot is ready; coalesce concurrent callers. || HTTP handlers |
pkg/server/handlers.go+formatters.go+router.go| Read-side API: tasks / actors / jobs / nodes / events / logs / cluster_status. || Live reverse proxy |
pkg/server/server.go| Whensession_name=="live", proxy to the head-pod Ray Dashboard (8265). || Metrics |
pkg/metrics/metrics.go| Centralized Prometheus declarations. |Unit Test Coverage
Limitations & Follow-ups
Test Coverage
Functional gaps
/api/v0/logs/file:task_id/actor_idresolution returns 400 (caller mustpass node_id + filename)./api/v0/logs/streamfor dead clusters returns 501 — no historical tail.formatTaskForResponsedoes not emitprofiling_datauntilTASK_PROFILE_EVENTis supported upstream.cluster_status?format=1reportsPending: (unavailable in history server)— autoscaler events are not exported.Operational gaps
singleflight: Per-replicasingleflight.Group; multi-replica races are safe viaskip-if-existsbut Pipeline can run on more than one replica simultaneously. Acceptable at current scale.runCtxwith a grace timer.Related issue number
N/A
Checks
For setting up a local dev env for testing, see historyserver/beta-v2/README.md.
- [x] Unit tests
- [x] Manual tests
- [ ] This PR is not tested :(