Skip to main content

Module admission

Module admission 

Source
Expand description

Shared admission control for edge webhook handlers (#795).

Exactly one edge handler used to bound how many turns it dials concurrently (a turn_limit semaphore, acquired before spawning a turn and shed with a 503 when full). Every other edge — Slack, Telegram, A2A — accepted unbounded concurrent load, dialing the agent for every inbound webhook no matter how many were already in flight.

AdmissionGate is that same bounded-concurrency pattern, extracted so every edge can front its agent dial with it. A caller that fails to AdmissionGate::try_admit must shed the request — respond with polyc_proto::admission_shed_text (or the edge’s own transport-level equivalent, e.g. an HTTP 503) — rather than dial the agent.

Structs§

AdmissionGate
Bounds how many turns an edge dials concurrently.
AdmissionPermit
Held for the lifetime of one admitted turn; dropping it frees the slot back to the gate. Never read directly — its whole purpose is the Drop impl inherited from the wrapped OwnedSemaphorePermit.