Coordinate demand-driven model sleep and wake #12
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/ram-11-serving-coordination"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of RAM-11. This is the coordination core: request leases and the drain, sleep, and wake lifecycle. The optional local inference gateway that would feed it from real traffic is not in this change, so RAM-11 stays open and this pull request deliberately has no closing keyword.
Request leases (
serving/lease.rs)A lease records what is in flight and nothing else: a client label, a request kind, whether the response is streamed, an optional idempotency key, and monotonic timestamps. There is nowhere to put a prompt, a completion, a response body, or a credential, so "the gateway never logs prompts" is checkable by reading the type instead of auditing call sites.
ActivityEvidencethe planner already consumes:Activewhile anything is in flight,Idle { since_ms }from the moment the last lease ended. A workload with a live lease is never released, even when its processes are quiet.Lifecycle (
serving/lifecycle.rs)One state machine per backend: awake, draining, sleeping, waking, unverified, unsupported, failed. It owns no clock and no socket, so it decides what is allowed and the caller performs the provider call, which is what makes the races testable.
failedand the client error names the reason and the attempt count.unsupportedwith a reportable reason, unless the operator explicitly allows it withallow_untracked_unload.Verification
cargo fmt --all -- --checkclean,cargo clippy --workspace --all-targets -- -D warningsclean,cargo test --workspace294 tests pass, including 18 new ones that drive a hand advanced clock through busy rejection, the idle minimum, arrival during a drain, an operator that prefers the client, a long stream, a mid-stream disconnect, queued work, retries, a demand-driven wake, an unhealthy wake, three failed attempts, a timed-out wake, an out-of-order sleep confirmation, unprovable idleness, a restart with and without a provider answer, policy clamping, and the evidence the planner sees.docs/SERVING-COORDINATION.mddocuments the contract, including what is not implemented yet.