Skip to content

Host lacks global admission control across work sources #1393

Closed as duplicate
Closed as duplicate

Description

@amadad

Summary

BB can admit more concurrent work than one execution host can support. Interactive turns, child threads, automations, retained provider sessions, and tool subprocesses have no shared admission gate.

A prompt-level worker limit does not control these work sources. On a co-located host, their aggregate memory can reach the service cgroup limit and interrupt unrelated work.

This report extends the resource-containment problem in #1334. It focuses on admission before resource exhaustion.

Environment

  • bb-app 0.37.0 (fe432e3b1475406bc0e6f21decefc29ef978e639)
  • Ubuntu 24.04, systemd, cgroup v2
  • BB server and execution processes in one user service
  • MemoryMax=4G
  • MemorySwapMax=512M

What I did

I ran scheduled automations and interactive work on the same BB host. A Chief thread also created child threads. The Chief prompt specified a maximum of two workers.

The host had work from these independent sources:

  • interactive Chief turns;
  • Chief child threads;
  • scheduled automations;
  • provider sessions retained after turns completed;
  • shell, test, lint, and build subprocesses.

Expected behavior

BB should apply one host-level admission policy to every source of execution work.

Before BB starts or resumes work, it should account for active turns, retained providers, subprocesses, and current memory pressure. If the host lacks capacity, BB should queue or reject the work with an actionable status.

Observed behavior

The prompt-level two-worker limit governed only Chief delegation. It did not govern automations, interactive turns, retained provider sessions, or tool subprocesses.

The shared bb.service cgroup reached its 4 GiB memory limit three times on 2026-08-12:

2026-08-12 00:44:17 bb.service: A process of this unit has been killed by the OOM killer.
2026-08-12 03:03:44 bb.service: A process of this unit has been killed by the OOM killer.
2026-08-12 08:35:20 bb.service: A process of this unit has been killed by the OOM killer.

Systemd reported these peaks:

4.0G memory peak, 512.0M memory swap peak
4.0G memory peak, 136.8M memory swap peak
4.0G memory peak, 0B memory swap peak

At 03:03, completed child turns still had resident provider processes while new work ran. At 08:35, a scheduled automation started while an interactive repair was active.

After daemon loss, BB recorded this error on affected threads:

Thread interrupted because the host daemon disconnected

BB did not resume those objectives from a durable checkpoint. Some automation transport states also disagreed with the objective's terminal result.

Why worker count is insufficient

One provider can create many subprocesses and consume substantial memory. A read-only diagnostic turn issued more than 100 tool invocations, repeatedly queried a 1.64 GiB event database, and increased cgroup memory to about 2.3 GiB without creating a child thread.

Admission therefore must govern host resources and all execution sources. It cannot rely only on child-thread count or prompt instructions.

Proposed direction

Please add a host-level admission owner with these properties:

  1. Apply one policy to interactive turns, child threads, automations, and resumed work.
  2. Account for active provider sessions and their descendant processes.
  3. Check current cgroup memory and pressure before admitting work.
  4. Queue work when the host lacks capacity.
  5. Reap or suspend idle providers under pressure before admitting new work.
  6. Expose why work is queued or rejected.
  7. Persist enough objective state to resume or produce a terminal recovery record after daemon loss.
  8. Treat the objective terminal token as completion truth, not transport completion alone.

The admission API can remain separate from the containment work proposed in #1334. Containment protects the control plane after pressure occurs. Admission prevents BB from creating that pressure through concurrent work.

Acceptance criteria

  • A host-wide configured limit applies to every BB work source.
  • An automation cannot bypass capacity already used by interactive work.
  • A child thread cannot bypass capacity used by an automation.
  • Retained provider sessions count against admission or are reclaimed first.
  • BB queues or rejects excess work before the cgroup reaches MemoryMax.
  • The UI and API expose the queue reason and current host capacity.
  • A daemon restart leaves each admitted objective resumable or terminal with a specific recovery reason.

Activity

  1. added
    host
    on Aug 18, 2026
  2. SawyerHood commented on Aug 25, 2026

    @SawyerHood
    Collaborator

    Duplicate of #2433

  3. added
    duplicate
    on Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicatehost

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions