Toolnexus.Agents.TurnGate (toolnexus v0.12.0)

Copy Markdown View Source

The global turn gate (SPEC ยง7D backpressure gate 3) โ€” a counting semaphore wrapped around the LLM HTTP call ONLY, never a whole Run (holding it across a Run deadlocks a parent against its children).

The gate MONITORS each acquirer: a Run process killed mid-call (interrupt, forced close, crash) releases its slot automatically โ€” the release never depends on the acquirer's own cleanup path running.

Summary

Functions

Block until a slot is granted to the calling process.

Returns a specification to start this module under a supervisor.

High-water mark of concurrently held slots (conformance probe).

Release the calling process's slot.

Functions

acquire(gate)

@spec acquire(pid()) :: :ok

Block until a slot is granted to the calling process.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

max_observed(gate)

@spec max_observed(pid()) :: non_neg_integer()

High-water mark of concurrently held slots (conformance probe).

release(gate)

@spec release(pid()) :: :ok

Release the calling process's slot.