Skip to content

Sprites runner pool with checkpoint reset and warm clones #3765

Done

Description

@integry

Creating a fresh Sprite and re-cloning per task wastes time; Free-plan orgs are limited to 3 Sprites. A pool of long-lived runner Sprites reset from a clean checkpoint between tasks gives fast, isolated starts.

Acceptance:

  • Pool of N runner Sprites (configurable, default 2, respects org limit), leased per run with admission integration (queue when all busy).
  • Base checkpoint after setup script; per-repo warm clone checkpoint optional; restore before each lease so no state leaks between runs.
  • Health check and automatic re-provisioning of a broken runner.
  • Pool status visible in Web UI/propr status and MCP.

Implementation

Add packages/core/src/agents/runtime/spritesPool.ts backed by Redis leases. Use createCheckpoint/restoreCheckpoint from @fly/sprites; record restore timings in run usage.


Update 2026-11-24: start from what is already on the epic branch. #3764 landed as PR #3791 (from the #3789 restart), not #3786. It already includes:

  • packages/core/src/agents/runtime/sprites/spritesProvisioning.ts SpritePool: an in-process idle pool. Each Sprite is provisioned once with a clean checkpoint, restored on every release, destroyed if the restore fails, never adopted by name, and closed at worker shutdown via SpritesRuntime.close().
  • /tmp is bind-mounted from checkpoint-backed scratch, because Sprite checkpoints do NOT cover the real /tmp (a separate disk; verified live).

So this issue is now about what is left: extend SpritePool, don't replace it.

  1. Redis-backed leases so several workers share a bounded pool (PROPR_SPRITES_MAX, default 2, at most the org limit of 3 on the Free plan), with queueing in admission when all are busy.
  2. Orphan reaping. Sprites carry a pool/instance marker, and on startup a worker deletes propr-* Sprites no live lease owns. Today a crashed worker leaks its idle Sprites.
  3. An optional per-repo warm-clone checkpoint.
  4. Pool status in propr status, the Web UI and MCP. Record restore timings in run usage.

Live-verified numbers: first provisioning is about 36 s; each warm run (a CLI --version through the clone transport) is about 40–55 s.

Activity

  1. integry commented on Nov 24, 2026

    @integry
    OwnerAuthor

    Measured Sprite overhead (2026-11-24, @fly/sprites 0.2.5, client on an EU server), for sizing the runner pool:

    Step Time
    create Sprite 3.2 s
    exec round trip (warm, or after 60–180 s idle) ~0.3 s
    shallow clone integry/propr (87 MB) 4.7 s
    git fetch in a warm clone 0.9 s
    write two small credential files 0.8 s
    checkpoint create 0.4 s
    checkpoint restore 14.2 s

    Implications:

    • A warm pooled runner starts a task in ~2–3 s. A fresh Sprite takes ~9 s.
    • Checkpoint restore is the most expensive step. Consider running it after the task completes (off the critical path), or use git clean -fdx && git reset --hard plus a credential wipe for same-repo reuse, with a full restore only between different repos or tenants.
    • Each exec costs a ~0.3 s round trip, so batch setup steps into one exec.
    • Preinstalled CLIs lag the agent image (Claude Code 2.1.319 vs 2.1.328, Codex 0.167.0 vs 0.170.0). The setup script must pin versions.
    • Sprite env: Ubuntu 26.04.1, 8 vCPU, 8 GB RAM visible, 99 GB disk, Node 24, no docker binary.
  2. propr-dev commented on Nov 24, 2026

    @propr-dev
    Contributor

    🤖 AI processing has started for this issue using claude agent with claude-opus-5-5 model.

    I'll analyze the problem and work on a solution. This may take a few minutes.

    Processing Details:

    • Agent: claude
    • Model: claude-opus-5-5
    • Branch: 3765/claude-opus-5-5-sprites-runner-pool-with--20261124-2108-n3l
    • Base Branch: 3758-epic-runtime-abstraction-sc0
    • Worktree: issue-3765-20261124-2108-claude-opus-5-5-n3l

    🔍 Track Task Execution

  3. integry commented on Nov 25, 2026

    @integry
    OwnerAuthor

    Done via #3800 (Sprites runner pool restart), merged into the epic after live verification on real Sprites: orphan cleanup, Redis flush, and the Sprites runtime live test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions