# `PtcRunner.Kernel.ProviderApplicationGate`
[🔗](https://github.com/andreasronge/ptc_runner/blob/main/lib/ptc_runner/kernel/provider_application_gate.ex#L1)

Admits selected optional provider applications after the active lifecycle
begins.

A host-owned application must already be running. A command-owned VM rejects
an inherited target, disables dotenv loading for both `:req_llm` and
`:llm_db`, configures ReqLLM's default HTTP/1 Finch pool as one shard sized
from the installed `live_provider_tasks` ceiling, and starts the selected
target without stopping it at session close. A manifest-narrowed effective
limit does not resize that VM-lifetime pool. Explicit ReqLLM Finch pools or a
non-HTTP/1 protocol configuration retain their dependency-defined precedence.
The command VM owns
the resulting application processes until VM shutdown. Once selected
applications are admitted, adapter-owned VM-global metadata is warmed before
the run clock begins, so its one-time load does not consume a bounded provider
worker's heap.

OTP application startup is deliberately synchronous here:
`Application.ensure_all_started/1` is not cancellable and offers no timeout.
A stuck application callback can therefore require terminating the command
VM. This gate does not wrap startup in a worker and claim a false bound.

Availability rejections that contact nothing report no provider activity.
Once a command-owned VM attempts OTP application startup, a startup failure
reports activity even when the target application never reaches the running
set.

# `admit`

```elixir
@spec admit(
  PtcRunner.Kernel.PreparedRun.t(),
  PtcRunner.Kernel.InstallationCatalog.t(),
  PtcRunner.Kernel.ProviderRuntimeServices.t()
) :: :ok | {:error, PtcRunner.Kernel.CommandDiagnostic.t()}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
