Skip to content

Demo: one-command laptop showcase — harness on kind, remote worker as a docker container #174

Description

@pdettori

Goal

One command on a laptop that demonstrates the SandboxTransport headline — a sandbox
outside the cluster, with zero inbound rules, executing a leaf's tool calls
— and that
someone can run without a cluster account, a VPN to OpenShift, or any hand-patching.

Today that story is only reachable by someone willing to deploy to a cluster and edit
several manifests by hand. I did exactly that to validate it (see the walkthrough below);
it works, but it took a dozen steps and two traps that are not written down anywhere.

Shape

laptop
├─ kind cluster:  Knative + Redis + harness (ksvc) + sandbox-relay
└─ docker run:    remote-worker  ──dials out──▶  relay

The worker runs as a plain docker run on the host, not as a pod. That is the whole
point: it is outside the cluster, it has no inbound ports, and it reaches the relay by
dialing out. A worker deployed as a pod (which is what worker-example.yaml does)
demonstrates the plumbing but not the driver.

The proof it must show

Verdict text that could only come from the container's own filesystem. The trick that
worked well when I validated this: the in-cluster sandbox-N pods are Alpine and the
worker image is RHEL, so a leaf grepping /etc/os-release gives opposite answers
depending on which backend ran:

Backend pattern Alpine model's stated reason
kubectl sandbox pod FLAGGED "…running Alpine Linux"
remote worker CLEAR "…this system is running Red Hat Enterprise Linux 9.8"

An A/B in one script — same request, opposite verdicts — is far more convincing than a
single green run, because the model names the OS it actually read.

Features worth surfacing (each is already implemented and tested)

  • Inverted connectivitydocker run with no -p, no inbound rules at all.
  • Live streaming — a long bash whose chunks arrive as produced, not batched.
  • Abort mid-stream — kill a runaway; the process group dies (a backgrounded
    grandchild stops too, which is the part that is easy to get wrong).
  • Dual-ended timeouttimeout_s enforced worker-side, timeout:<n> surfaced.
  • Reconnect → dedupdocker stop the worker mid-flight, restart it, watch it
    reattach and not re-run the redelivered exec.
  • Presence mirrorredis-cli HGETALL sh:sandbox:records before/after, showing
    registration is the live stream.
  • Trust modeldocker inspect the worker: a bearer token and nothing else. No LLM
    key, no kubeconfig, no orchestration.
  • Transport swappability — flip SH_REMOTE_SANDBOX and rerun; identical contract,
    different machine.

Two traps the script must handle (both cost me a failed run)

1. Enabling SH_REMOTE_SANDBOX=1 does not route to the worker. select-sandbox
builds candidates = [...pods, ...grpcRecs] and picks least-loaded-first, so with idle
in-cluster sandbox pods present a pod wins and the demo silently proves nothing — my
first remote run returned "Alpine" and looked like a success. This is correct behavior
(the remote worker is a pool peer, not a replacement), so the demo must either point
KAGENTI_SANDBOX_POOL_SELECTOR at a label matching no pods, or stand up a cluster with no
local sandboxes. Worth stating loudly in the README too.

2. deploy/knative/relay-deployment.yaml omits SH_RELAY_TOKEN. Relay auth is
fail-closed, so applying that manifest as-is yields a relay that rejects every Attach.
Either add the env to the manifest or have the script set it. (Small enough to fix
independently of this issue.)

Also note kubectl set env does not work on a Knative Service ("no kind Service is
registered") — the script needs a merge patch, and the patch must preserve the container's
volumeMounts or Knative's webhook rejects it.

Networking

The worker is on the host and the relay is in kind, so the script needs one of:

  • kubectl port-forward svc/sandbox-relay 8443:8443 and run the worker with
    RELAY_ADDR=host.docker.internal:8443 — simplest, works on Docker Desktop and Podman.
  • attach the worker container to kind's docker network and address the node directly.

Port-forward is probably the right default: it is the same mechanism remote-worker/DESIGN.md
already documents for the laptop-worker flow, and it makes the "dials out through a tunnel"
story explicit.

Acceptance

  • make demo-remote-sandbox (or deploy/kind/demo-remote-worker.sh) goes from no
    cluster to a passing A/B in one invocation, and prints what it is proving at each step.
  • Teardown is one command and leaves no kind cluster, container, or loaded image behind.
  • The A/B assertion fails loudly if the exec landed on a pod instead of the worker —
    it must not be possible to get a green demo from the wrong backend (trap 1).
  • README section with the architecture sketch, the one-liner, and the trust-model note.
  • Works with the worker image built locally; no registry push required.

Prerequisites and honest limits

  • Needs an LLM reachable from the cluster for the leaf's model call. In my validation that
    was an internal LiteLLM endpoint; the demo should fail with a clear message when the
    configured model is unreachable rather than timing out mysteriously.
  • Docker/Podman + kind + kubectl + jq.
  • remote-worker/build-image.sh currently targets an OpenShift internal-registry build;
    the demo needs a plain local build plus kind load docker-image (I did this by hand with
    a 6-line Dockerfile over a cross-compiled linux/arm64 binary — worth folding into the
    script, and note the binary arch must match the kind node).

Validated end-to-end already (2026-08-27)

For the avoidance of doubt, the path this issue automates has been run manually and works:
worker pod attached to an in-cluster relay via ClusterIP DNS, presence mirrored into Redis,
harness on SH_REMOTE_SANDBOX=1, and a leaf returning CLEAR for "Alpine" with the reason
"this system is running Red Hat Enterprise Linux 9.8" — i.e. the leaf's file tools ran on
the remote worker, with no kubectl exec anywhere in the path. The gated relay-interop test
(SH_LIVE_RELAY=1) also passes against the real TypeScript relay, and the real
GrpcRelayTransport has been driven against the real relay and real worker.

What this issue adds is not new capability — it is making that reproducible in one command
on a laptop, which is what turns it into a demo.

Part of the SandboxTransport epic #89; complements the live gate in #88 (which covers
Kind → OCP conformance rather than a laptop showcase). Worker follow-ups: #173.

Assisted-By: Claude Code

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