Skip to content

perf(supervisor): host sandbox instances on one shared runtime with task-scoped identity #5957

Backlog

Description

@EmilienM

User Story

From the scale test in #5660: I need one shared supervisor to host hundreds of sandboxes without its thread count and memory growing with every sandbox, busy or idle.

Description

Host all sandbox instances on one shared multi-thread runtime per supervisor (bounded workers, separate from the host control-plane runtime), move sandbox identity from thread-locals to task-scoped context through a scoped spawner that also tracks every per-instance task, and re-express removal, panic handling, and credential revocation so teardown stays fail-closed.

Context

Parent: #5660 (PR 1 of the split; closes its first acceptance criterion). The scoped spawner re-scopes identity at every per-instance spawn, including grpc_client's renewal task; propagation behavior gets verified against the pinned tokio first. Dedicated mode is untouched.

Definition of Done

  • One shared instance runtime per supervisor with bounded workers and an explicit max_blocking_threads
  • Identity on per-crate task-locals via the scoped spawner (tokio-util TaskTracker plus abort-handle registry); every per-instance spawn tracked and identity-bound
  • Removal, panic, and revocation re-expressed: Drop guard inside the instance root task, task-tree join bounded at the current 5s with abort of outstanding tasks when the bound fires, credentials revoked on every exit path (the existing panic test is the bar)
  • Existing sandbox instance host contract tests pass; dedicated mode untouched
  • New tests: interleaved busy/idle cross-attribution, Linux-gated thread-count delta with a concrete bound, task-tree cleanup (one run against a real loopback gateway), revocation after removal
  • After-numbers: census script rerun on this branch at the same pinned N, before/after series posted here
  • Short RFC in rfc/ plus supervisor README and module doc rewrite

Activity

  1. added
    state:triage-needed
    on Nov 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

    state:triage-needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions