Skip to content

Add fixed idempotent lease-ID support to the Agent Sandbox provider #1742

Description

@jimmybrancaccio

Summary

Add fixed idempotent lease-ID support to the agent-sandbox provider so it can satisfy OpenClaw’s cloud-worker lifecycle contract.

Problem

OpenClaw cloud workers provision Crabbox leases using a caller-supplied fixed cbx_... lease ID. Crabbox 0.48.0’s Agent Sandbox provider rejects this before allocation:

provider=agent-sandbox does not support fixed idempotent lease IDs

The same Agent Sandbox configuration otherwise works. A direct disposable crabbox run successfully created a SandboxClaim, ran Node.js on ARM64, and deleted the claim.

This prevents Agent Sandbox from being used as an OpenClaw cloud-worker backend.

Environment

  • Crabbox: 0.48.0
  • Agent Sandbox controller: v1.0.0
  • Kubernetes: K3s v1.36.3+k3s1
  • Nodes: Linux/ARM64
  • Provider kind: delegated-run
  • Provider capabilities: archive-sync, cleanup, run-session, managed-sandbox

Current Crabbox main at d3d244899f79d5fcecbb5073fa482c9f1e7230df also lacks an Agent Sandbox implementation of the fixed-ID backend contract.

Reproduction

  1. Configure a working Agent Sandbox context, namespace, and SandboxWarmPool.
  2. Confirm an ordinary run succeeds:
crabbox run \
  --provider agent-sandbox \
  --agent-sandbox-context default \
  --agent-sandbox-namespace openclaw-sandboxes-pilot \
  --agent-sandbox-warm-pool openclaw-arm64-cold \
  --no-sync \
  -- node --version
  1. Request a caller-supplied lease ID through OpenClaw cloud-worker dispatch, or directly through the corresponding Crabbox fixed-ID path.
  2. Observe exit code 2:
provider=agent-sandbox does not support fixed idempotent lease IDs

No SandboxClaim, Sandbox, or pod is created.

Requested behavior

Implement Crabbox’s fixed idempotent lease-ID contract for agent-sandbox, including:

  • Deterministic, replay-safe acquisition for a caller-supplied cbx_... ID
  • Durable create intent before Kubernetes mutation
  • Exact binding to context, namespace, warm pool, claim UID, and ownership metadata
  • Safe replay after an ambiguous create result
  • Idempotent stop with confirmed deletion or authoritative absence
  • A terminal receipt or tombstone sufficient for repeated cleanup
  • Provider capability metadata that allows callers to detect fixed-ID support without attempting allocation
  • Tests covering duplicate acquisition, restart recovery, ambiguous create, ownership mismatch, deletion, and already-absent cleanup

The implementation should continue to fail closed when Kubernetes identity or ownership cannot be established.

Related work

Activity

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

    P2Normal priority bug or improvement with limited blast radius.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions