Skip to content

OpenShellSpawner: sandbox image compatibility — remove catatonit, use exec-managed startup #172

Closed
jameswnl/lightspeed-agentic-sandbox
#8

Description

@jameswnl

Problem

The production sandbox image (lightspeed-agentic-sandbox) crashes with exit code 1 when launched via OpenShell gateway. Two issues:

  1. catatonit ENTRYPOINT conflicts with OpenShell supervisor — OpenShell manages container lifecycle and PID 1. Having catatonit as the entrypoint creates a conflict that crashes the container immediately.

  2. CMD auto-starts uvicorn — The spawner separately starts uvicorn via start_server() (exec_stream). If the image CMD also starts uvicorn, they'd conflict on port 8080.

Root cause

Production Containerfile has:

ENTRYPOINT ["/usr/bin/catatonit", "--"]
CMD ["python3.12", "-m", "uvicorn", "lightspeed_agentic.app:app", "--host", "0.0.0.0", "--port", "8080"]

Fix (sandbox image)

Remove catatonit ENTRYPOINT, change CMD to a keep-alive process:

CMD ["sleep", "infinity"]

The spawner's start_server() already handles starting uvicorn via exec. The image just needs to stay alive.

For standalone use (without OpenShell), pass the uvicorn command explicitly:

podman run image python3.12 -m uvicorn lightspeed_agentic.app:app --host 0.0.0.0 --port 8080

Evidence

  • Containerfile.dev (no catatonit, plain CMD) works with OpenShell
  • spawn:none and spawn:local work fine
  • spawn:ephemeral via PodmanSpawner works (no catatonit conflict)
  • spawn:ephemeral via OpenShellSpawner crashes immediately

Fix location

Sandbox image fix: jameswnl/lightspeed-agentic-sandbox branch lcs-main

Related

Activity

  1. beesarmy commented on Aug 24, 2026

    @beesarmy
    Collaborator

    Triage

    Summary: Production sandbox image crashes under OpenShell due to catatonit ENTRYPOINT conflict and CMD auto-starting uvicorn (which the spawner already manages via exec_stream).

    Affected components:

    • src/cloud_agents/spawner/openshell_spawner.py — L417: start_server() already handles uvicorn startup via exec_stream; L827: start_server() definition
    • Fix is in the sandbox image repo (jameswnl/lightspeed-agentic-sandbox), not this repo

    Verified:

    • ✅ start_server() at L827 starts uvicorn via exec_stream — confirmed the image CMD should NOT also start uvicorn
    • ✅ _DEFAULT_SERVER_COMMAND at L39 includes "uvicorn" — the spawner owns server lifecycle
    • ✅ The fix (CMD ["sleep", "infinity"]) is correct for OpenShell-managed containers

    Assessment: This is a sandbox image issue, not a cloud-agents code issue. The spawner code is correct — it expects to manage the server lifecycle via exec_stream. The fix belongs in jameswnl/lightspeed-agentic-sandbox.

    No code changes needed in this repo. Consider closing after the sandbox image fix lands, or keep open as a tracking issue with a cross-repo reference.

    Related:

    Suggested labels: area/spawner, external-fix


    🤖 Triaged by beesarmy via Claude Code

  2. jameswnl commented on Aug 24, 2026

    @jameswnl
    CollaboratorAuthor

    E2E test results — sandbox image fix VERIFIED

    What was done

    1. Sandbox image fix (PR Make sandbox image compatible with OpenShell supervisor jameswnl/lightspeed-agentic-sandbox#8):

      • Removed catatonit ENTRYPOINT
      • Changed CMD to sleep infinity — spawner starts uvicorn via exec_stream
      • Added Containerfile.dev with same fix for fast local builds
    2. Gateway JWT setup was also needed:

      • Supervisor needs a JWT to connect back to the gateway
      • Gateway config requires gateway_jwt section with signing keys

    Test flow (all passed)

    [1] Creating SandboxClient -> localhost:17670
    [2] Creating OpenShellSpawner (driver=podman, workspace=default)
    [3] Spawning sandbox (image=localhost/sandbox-openshell:dev)...
    [4] Sandbox spawned! Endpoint: http://localhost:17670
    [5] Health response: 200 {"status":"ok"}
    [6] Sandbox destroyed successfully
    

    Gateway dev setup

    Generate JWT signing keys:

    podman run --rm --user 0 --security-opt label=disable \
      localhost/openshell-gateway:latest \
      sh -c 'openshell-gateway generate-certs --output-dir /tmp/certs 2>/dev/null && \
        cat /tmp/certs/jwt/signing.pem && echo "---" && \
        cat /tmp/certs/jwt/public.pem && echo "---" && \
        cat /tmp/certs/jwt/kid'

    Gateway config (gateway.toml):

    [openshell.gateway.gateway_jwt]
    signing_key_path = "/jwt/signing.pem"
    public_key_path = "/jwt/public.pem"
    kid_path = "/jwt/kid"
    
    [openshell.gateway.auth]
    allow_unauthenticated_users = true

    Run gateway:

    podman run -d --name openshell-gw \
      --security-opt label=disable \
      -p 17670:17670 \
      -v /run/user/501/podman/podman.sock:/run/podman/podman.sock \
      -v /path/to/jwt:/jwt:ro \
      -v /path/to/gateway.toml:/etc/openshell/gateway.toml:ro \
      -e OPENSHELL_PODMAN_SOCKET=/run/podman/podman.sock \
      localhost/openshell-gateway:latest \
      openshell-gateway --disable-tls --drivers podman --bind-address 0.0.0.0 \
      --config /etc/openshell/gateway.toml

    Root causes found

    1. catatonit ENTRYPOINT — OpenShell overrides the image entrypoint with its own supervisor (/opt/openshell/bin/openshell-sandbox). Having catatonit as well caused a conflict.

    2. Missing sandbox JWT — Supervisor needs a JWT to authenticate back to the gateway for policy fetch. Without gateway_jwt config, supervisor exits with "no sandbox token source available".

    3. Image CMD used correctly — OpenShell reads the image CMD and passes it to the supervisor as OPENSHELL_SANDBOX_COMMAND. With sleep infinity, the sandbox stays alive for exec commands.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions