You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(cli): the sandbox LLM gateway's fixed 512m limit OOMs at about 80 agent sessions #5074
The CLI's compose file gives the sandbox LLM gateway a fixed mem_limit: '512m' (tools/cli/src/lib/compose/services/create-sandbox-llm-gateway-service.ts:45), whatever SANDBOX_MAX_SESSIONS and SANDBOX_LLM_GATEWAY_CUSTOM_PROVIDER_CONCURRENCY allow. The gateway holds a virtual key and provider workers for every agent session, so its memory grows with the sessions that run at once.
On a deployment with SANDBOX_MAX_SESSIONS=320, the gateway reached the limit at about 80 concurrent agent sessions:
the kernel OOM-killed it about every 40 seconds (Memory cgroup out of memory: Killed process ... (main));
every agent start in those windows failed with start_failed, either "Provider ... cannot serve this session: its credential could not be pushed to the sandbox LLM gateway (fetch failed)" or "fetch failed";
tasks whose automatic retries also fell into the restarts were left In progress behind a failed run.
The container stays healthy between kills, so nothing in the platform reports the restarts. A compose.override.yml with mem_limit: 4g for sandbox-llm-gateway fixed it.
What done means
The gateway's memory limit follows the deployment's capacity: derived from SANDBOX_MAX_SESSIONS (and the provider concurrency), or set by a documented variable such as SANDBOX_LLM_GATEWAY_MEMORY, with a default that holds the default capacity.
The environment reference (docs/en/self-hosted/configuration/environment-reference.md) and the sizing guidance say how the gateway's memory scales with sessions.
Optional: restarts of the gateway show up where an administrator looks (Sandboxes page or the health endpoint).
Tests
The compose builder emits the derived or configured limit, and the default for an unset capacity.
The variable is validated (sizes such as 4g, 4096m) like the other memory settings.
More on the workaround: tale deploy reads no compose.override.yml. Only tale dev merges it (tools/cli/src/lib/compose/find-compose-override.ts is called from actions/dev.ts alone).
On the self-hosted node, every deploy recreated the gateway at 512 MiB, even with an override in the project root. The node now runs a small systemd unit that watches docker events for the gateway's start and sets docker update --memory 4g each time.
A real fix needs either a configurable limit (an env variable read by create-sandbox-llm-gateway-service.ts) or override support in tale deploy.
Activity
yannickmonney commentedon Oct 29, 2026
More on the workaround:
tale deployreads nocompose.override.yml. Onlytale devmerges it (tools/cli/src/lib/compose/find-compose-override.tsis called fromactions/dev.tsalone).On the self-hosted node, every deploy recreated the gateway at 512 MiB, even with an override in the project root. The node now runs a small systemd unit that watches
docker eventsfor the gateway's start and setsdocker update --memory 4geach time.A real fix needs either a configurable limit (an env variable read by
create-sandbox-llm-gateway-service.ts) or override support intale deploy.