feat(sandbox-kit): port the kit to Docker Sandboxes v3 and inject the token via the egress proxy

E0
10h ago
+272-452

Refs #3836

Why

  • The kit no longer runs. sbx v0.51.0 moved its built-in agents to v3 kits and dropped extends: claude, so
    every current sbx refuses the v2 kit (extends: "claude" is no longer a built-in agent).
  • The token lives in the sandbox. The v2 kit passes the Chainloop token in as an environment variable,
    because the egress proxy could not inject credentials into gRPC. sbx v0.55.0 fixes that
    (docker/sbx-releases#574), which is what #3836 asks for.

How

  • The kit is now a v3 mixin on Docker's built-in claude agent (devel/sandbox-kit/sbx-kit-claude/):
    sbx run --clone claude --kit chainloop/sbx-kit-claude .
  • The token is a host-side sbx secret (sbx secret set chainloop). The sandbox sees a placeholder and the
    egress proxy adds the real value on the control plane and platform hosts, never on the CAS, which uses its own
    token from the control plane.
  • The checks that refused to start an untraced session move from the entrypoint wrapper to an install hook, so
    sbx create fails instead.
  • chainloopToken and chainloopConfig are removed. A chainloop auth login session works through a
    command-backed secret; a self-hosted control plane through sbx secret set-custom and the CHAINLOOP_*_API
    variables.
  • Publishing moves from sbx kit push (v2 only) to docker buildx, signed with sbx kit sign, under the same
    image name. sbxenv.yaml and the README follow.

Why a mixin, not a set or a workload

Mixin (this PR)SetWorkload
Commandsbx run claude --kit …sbx run chainloop/sbx-kit-claudesbx run chainloop/sbx-kit-claude
Claude loginworks as in Docker's kiteach user approves an anthropic bindingsame as set
Docker's Claude updatesat every sandbox createfrozen at each Chainloop publishfrozen, plus a manual re-sync
Code Chainloop maintainsthe kit onlythe kit onlythe kit + ~240 lines of Docker's kit
Checks runat createat createat every launch

The mixin keeps Docker in charge of Claude Code and its login, which is what extends: claude did. The cost is
a second name on the command line and checks at create rather than at launch; in a --clone sandbox the repo and
the credential are fixed at create anyway.

v2 kit vs this kit

v2 (sbx ≤ v0.50)v3 mixin (sbx ≥ v0.55)
Commandsbx run --clone -e CHAINLOOP_TOKEN ./devel/sandbox-kit/claudesbx run --clone claude --kit ./devel/sandbox-kit/sbx-kit-claude .
Chainloop tokenin the sandbox's environmenthost secret store; a placeholder in the sandbox
Token rotationrecreate the sandboxsbx secret set chainloop, applies to running sandboxes
Your login sessionmounted config.toml, copied into the sandboxcommand-backed secret, read on the host per request
Self-hostedmounted config.tomlsbx secret set-custom + CHAINLOOP_*_API
Chainloop trafficbypasses the proxy (NO_PROXY)through the proxy; the CAS is left untouched
Refuses an untraced repo or no credentialsat every launchat sbx create
Claude Codev2 template image, no longer updatedDocker's built-in kit
Claude login approvalan anthropic bindingnone
Publishingsbx kit push --signdocker buildx + sbx kit sign, same image name

Notes for reviewers

  • Needs sbx v0.55.0 stable, which is not released yet; SBX_VERSION in the publish workflow points at it. Tested on v0.55.0-rc5 (macOS and Linux), including a full publish run in a fork; to be re-checked on v0.55.0 once it ships.
  • Publishing already fails on main: chainloop attestation init stops with "creating workflows during the
    attestation process is disabled for this organization", because the sandbox-kit-package workflow does not
    exist in the chainloop org. This PR keeps that step; creating the workflow (or allowing it) is up to the
    maintainers.
  • The first publish moves chainloop/sbx-kit-claude:latest to the v3 kit; :latest moves only after the
    digest is signed.
  • On Chainloop cloud, a token passed with -e is refused when no chainloop secret is stored: sbx drops it at
    the proxy, although the v3 spec says an unbound optional credential is
    skipped.
  • sbx secret set accepts an empty value, and the install check sees only that a secret is bound, not its value, so an empty chainloop secret passes at create (v2 refused an empty token). As with an expired or wrong token, Claude's session-start banner then reports Chainloop Trace cannot upload this session when you push: your authentication token is invalid…, and git push warns and goes through, or is blocked with --require-trace.
  • Published with Buildx and signed with sbx kit sign, per Docker's
    distribution guide; sbx does not
    verify cosign signatures.
  • The docs guide at docs.chainloop.dev needs the same update; its source is not in this repository.

This change was prepared with AI assistance (Claude Code).