0.2.14 dapi followups: Host Events Long-Poll & ML-Node Capacity Fallback#1443
Open
a-kuprin wants to merge 9 commits into
Open
0.2.14 dapi followups: Host Events Long-Poll & ML-Node Capacity Fallback#1443a-kuprin wants to merge 9 commits into
0.2.14 dapi followups: Host Events Long-Poll & ML-Node Capacity Fallback#1443a-kuprin wants to merge 9 commits into
Conversation
0.2.14 dapi followups: Host Events Long-Poll & ML-Node Capacity Fallback
…and testenv Squash the pixelplex refactoring branch onto upgrade-0.2.14. Prior history replayed already-merged 0.2.13/observability commits on top of upgrade, producing 136 duplicate SHAs; keep only the net tree vs upgrade-0.2.14. Co-authored-by: Cursor <cursoragent@cursor.com>
Fail closed on shared Postgres with boot migration, tighten leases/paths/ gateway FS checks, optional chain gRPC TLS, and share one chain client; also private-by-default edge verify/debug routes and related testenv/proxy wiring.
…lback Cache chain escrow metadata on GetHostEvents without CreateSession so versiond children share Postgres safely; bind lazily on the requested runtime version. Add ListNodeCapacity/escrow_load to bound passive fallback.
f1d6c4d to
16a4ced
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Standalone
devsharddno longer depends on continuous DAPI and inference node reachability for two critical paths: warming escrow sessions and bounding direct-HTTP fallback whenAcquireMLNodefails. DAPI listens for chain escrow and maintenance events (scheduled / canceled), publishes them plus per-escrow acquire load over a long-poll RPC (GetHostEvents);devsharddconsumes them and gates fallback concurrency with observed node capacity.This branch builds on
upgrade-0.2.14follow-ups: the long-poll + capacity feature commits, plus hardening for correctness under outages, high load, and unrelated event churn.Motivation
When inference node or DAPI is slow or unreachable:
miss traffic until something warms them.
doWithFallbackNodescan hammer ML nodes with noawareness of broker locks or how many active escrows share a node.
When the inference node (DAPI path) is not available, there is also no
request-time lazy-init of escrow sessions: the client cannot round-trip through
DAPI to create/warm a session on demand. Instead
devsharddactivelycreates sessions from polled escrow-created host events, so traffic can proceed
on the direct-HTTP fallback path without waiting for a lazy create that cannot
happen.
The design observes capacity and load while DAPI is healthy, then uses that
observation to bound fallback during an outage — without inventing a second
control plane.
Architecture (conceptual)
Host events. DAPI’s event listener appends escrow created/settled and
maintenance scheduled/canceled into a bounded
HostEventRing. Clientslong-poll
GetHostEventswith a subscribe set and cursor — so maintenanceupdates are available the same way as escrow updates (clients that only care
about escrows subscribe to escrow kinds and are not woken by maintenance).
devsharddwarms / tears down sessions from escrow events and refreshes itsload map from every reply (including unchanged timeouts).
Capacity fallback. While DAPI is up,
devsharddpollsListNodeCapacityand consumes
escrow_load. Fallback slots areeffectiveMax − chargedLocks − localInFlight, witheffectiveMax = maxConcurrent / max(activeEscrows, 4). When DAPI is down,last-seen capacity is retained (stale) and the local semaphore still bounds
concurrency.
Behavior changes
escrow_loaddeliveryUnimplemented) stays unboundedPickNodebut never listed in capacity get a synthetic budget (UnknownMaxConcurrent / Divisor()), not an unbounded bypasschain_unavailable); true not-found stays a hard error