Skip to content

bug(sandbox): one session building at its CPU quota holds every start and lease on an idle host #5146

Closed

Description

@yannickmonney

What happens

On a Docker sandbox host every agent session runs under --cpus=$SANDBOX_AGENT_CPUS (default 2, services/sandbox/src/session/docker-session-args.ts). A session that builds at that cap is throttled, and a throttled task counts as stalled in every cgroup above it up to the root. So /proc/pressure/cpu some reads about 70 % for one throttled session and about 90 % for two, while most of the host's CPUs are idle.

Host admission judges exactly that reading (services/sandbox/src/host-pressure-assessment.ts):

  • under the default preset, session starts are held at SANDBOX_CPU_PRESSURE_PERCENT (60);
  • heavy-phase leases are always judged conservatively, at 20 % CPU pressure and released only below 10 %. tightenThresholds keeps the conservative 20 whatever the deployment sets.

One session building at its own quota therefore holds every new start, and every other session's lease for an install, a build or a test suite, on a host that has room for them.

Observed

agents.tale.dev on 2026-10-30, v0.5.94, 12 threads, 13 sessions at cpu.max 200000 100000:

  • Host CPU some avg10 was 86–89 %, while mpstat showed 40 % idle and a load of 6.
  • The two Reviewer sessions that were building read 70–71 % some avg10 in their own cgroups.
  • For about ten minutes dispatch stopped with host_pressure, and a standing role's run started no build.
  • A Reviewer's build lease was refused from 15:28 to 15:35 UTC, which cost it a landing.

After every session's quota was raised to the host's CPU count (docker update --cpus 12, SANDBOX_AGENT_CPUS=12), host CPU some avg10 fell to 4.6 % at 51 % CPU use.

Expected

The CPU pressure that admission reads measures contention for the host's CPUs, not a session's own quota. A host with idle CPUs admits a start and grants a lease, and a host whose CPUs are contended holds them, as it does now.

Done means

  • A host-pressure assessment test: sessions throttled by their quota on a host with idle CPUs are admitted.
  • The same test with the host's CPUs contended stays pressed, for both starts and leases.
  • The environment reference and services/sandbox/README.md ("Host admission") say what the CPU signal measures.

The design is open. For example, the CPU signal could be judged from something quota throttling cannot inflate (the host's busy share, or the stall with the sessions' throttled time taken out). Or the default session quota could follow the host's CPUs, with the low CPU weight that config.ts already gives sessions sharing them under contention.

Activity

  1. added
    priority: high
    bug
    agent-ready
    on Oct 30, 2026
  2. added a commit that references this issue on Oct 30, 2026
    7abaf93
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

    agent-readybugpriority: high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions