Skip to content

Deploy the FS-free harness on OpenShift with a durable sandbox (P0′) - #51

Merged
pdettori merged 8 commits into
mainfrom
docs/p0prime-ocp-fs-free-deployment
Jul 3, 2026
Merged

pdettori merged 8 commits into
mainfrom
docs/p0prime-ocp-fs-free-deployment

Conversation

@pdettori

@pdettori pdettori commented Jul 2, 2026

Copy link
Copy Markdown
Member

Summary

P0′ of the two-tier FS-free harness epic (#47) — the P1 slice: make the merged FS-free harness deploy and pass its full leaf smoke on the live OpenShift 4.20.8 cluster with a durable RWO sandbox, by reframing the never-applied pre-P1 OCP overlay + setup-ocp.sh onto the agent-sandbox Sandbox-CR world.

Spec: docs/specs/2026-07-02-p0prime-ocp-fs-free-deployment-design.md
Plan: docs/superpowers/plans/2026-07-02-p0prime-ocp-fs-free-deployment.md

What changed

  • sandbox.Dockerfile — bake ripgrep into the pre-baked OCP sandbox image (the agent's find/grep tools shell out to rg inside the sandbox).
  • overlays/ocp/patch-sandbox.yaml — rewritten as a JSON6902 patch onto the Sandbox CR podTemplate: non-root runAsUser/fsGroup 65532, seccomp RuntimeDefault, drop ALL caps, serviceAccountName: serverless-harness-sandbox, command: [sleep infinity], pre-baked internal-registry image. Durable PVC preserved — the patch deliberately does not touch volumeClaimTemplates/volumeMounts, so /workspace stays on the RWO EBS PVC (no emptyDir).
  • overlays/ocp/kustomization.yaml — drop the deleted leaf-pvc.yaml resource, retarget the patch to Sandbox/sandbox-0, remove the dead alpine image transform, refresh header comments.
  • setup-ocp.sh — install the agent-sandbox v0.5.0 controller (before the overlay apply), create + nonroot-v2-grant the sandbox SA, poll the Sandbox .status.selector → pod Ready (after the apply), tolerate a pre-provisioned llm-credentials secret, and retire the post-P1 leaf-work wording.
  • README-ocp.md — replace leaf-work PVC references with the durable Sandbox /workspace PVC, document the controller-install step, and add explicit oc delete pvc to teardown (StatefulSet-style PVCs are not GC'd on CR deletion).
  • leaf-smoke.sh — thread $CURL_OPTS (-k) + the guarded CURL_HDR array through dispatch_item and the claim-5 curl, mirroring lib.sh's existing Route handling (these two call sites were the only ones missing it). This file was outside the original 5-file plan scope; the edit was made after live debugging and with explicit approval.

Verification (live, OpenShift 4.20.8)

  • Stage-1 walking skeleton: confirmed the agent-sandbox v0.5.0 controller propagates podTemplate securityContext/fsGroup/serviceAccountName + volumeClaimTemplates on OCP; pod non-root uid=65532, PVC Bound gp3-csi RWO, /workspace writable.
  • setup-ocp.sh end-to-end: SUCCESS — controller present, in-cluster sandbox build with ripgrep 14.1.0 confirmed in the running pod, overlay applied, Sandbox pod Ready (non-root, durable PVC), ksvc Ready, Route printed.
  • Full leaf-smoke.sh via the Route (SH_MODEL=claude-haiku-4-5): 10 passed / 0 failed — FS-free envelope, workspace isolation on the durable PVC, parallel fan-out (i1→FLAGGED / i2→CLEAR / i3→CLEAR), per-call model routing, malformed→HTTP 400, idempotent re-invoke, crash/resume from Redis (durable-PVC survival), and scale-to-zero.

Notes / follow-ups

  • The full leaf smoke requires an LLM endpoint reachable from the cluster (a direct api.anthropic.com key was used for verification; base-url/auth-token are optional secret keys).
  • Two minor plan-text inaccuracies surfaced during review (code is correct): Task 4's "deleting the Sandbox CR reclaims its PVC" (it does not — hence the explicit oc delete pvc), and Task 2's emptyDir grep expecting 0 (the render legitimately has 1 — the harness's own /tmp mount).
  • Post-merge follow-up (per spec §4): once this merges and CI republishes the GHCR sandbox image with ripgrep, switch the OCP overlay to pull it and drop the in-cluster BuildConfig.

Assisted-By: Claude Code

Paolo Dettori added 8 commits July 2, 2026 16:23
Reframes the pre-P1, never-applied OCP overlay + setup-ocp.sh to the
Sandbox-CR world: fix the stale leaf-pvc.yaml ref, patch the Sandbox CR
(not a Pod) for a non-root/fsGroup nonroot-v2 pod, keep the durable RWO
PVC (drop the emptyDir override), add ripgrep to the sandbox image, and
install the agent-sandbox v0.5.0 controller + Sandbox readiness poll.
Definition of done: full leaf smoke on live OCP 4.20.8 via the Route.

Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>
Signed-off-by: Paolo Dettori <paolo.dettori@example.com>
Six tasks: ripgrep image fix; reframe the OCP overlay onto the Sandbox CR
(JSON6902, durable PVC, non-root 65532/fsGroup/nonroot-v2 SA); wire the
agent-sandbox v0.5.0 controller install + Sandbox readiness poll + sandbox
SA/SCC + llm-credentials tolerance into setup-ocp.sh; README refresh; then a
Stage-1 walking-skeleton propagation gate and the Stage-2 full leaf smoke on
live OCP 4.20.8.

Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>
Signed-off-by: Paolo Dettori <paolo.dettori@example.com>
The agent's find/grep tools shell out to rg inside the sandbox; the OCP
image omitted ripgrep, so the full leaf smoke would crash on the first search.

Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>
Signed-off-by: Paolo Dettori <paolo.dettori@example.com>
P1 deleted leaf-pvc.yaml and moved the sandbox working set to the Sandbox
CR's volumeClaimTemplates. The pre-P1 overlay still referenced leaf-pvc.yaml
(kustomize build failed), patched a non-existent Pod, and overrode /workspace
to emptyDir (defeating durability). Patch the Sandbox CR podTemplate via JSON6902
instead: non-root 65532 + fsGroup + nonroot-v2 SA + pre-baked image, PVC intact.

Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>
Signed-off-by: Paolo Dettori <paolo.dettori@example.com>
…ocp.sh

Adds the missing agent-sandbox v0.5.0 controller install, the sandbox SA +
nonroot-v2 grant, and the Sandbox .status.selector -> pod-Ready poll (mirrors
setup-kind.sh). Tolerates a pre-provisioned llm-credentials secret. Retires the
post-P1 leaf-work PVC wording.

Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>
Signed-off-by: Paolo Dettori <paolo.dettori@example.com>
Replace the removed leaf-work PVC with the durable sandbox /workspace PVC
(Sandbox CR volumeClaimTemplates) and document the agent-sandbox controller step.

Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>
Signed-off-by: Paolo Dettori <paolo.dettori@example.com>
…curls

dispatch_item and the claim-5 malformed-envelope curl targeted $BASE/runs
without $CURL_OPTS, so in Route mode (KSVC_URL set) they hit the OpenShift
Route over HTTPS without -k and failed TLS verification (curl rc=60) against
the router's cert. turn() in lib.sh already threaded $CURL_OPTS; these two
call sites were missed. Mirror lib.sh: add $CURL_OPTS and the guarded
CURL_HDR array so the leaf smoke passes through the OCP Route.

Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>
Signed-off-by: Paolo Dettori <paolo.dettori@example.com>
The sandbox /workspace PVC (workspace-sandbox-0) is provisioned StatefulSet-style
from the Sandbox CR volumeClaimTemplates and is NOT reclaimed when the CR is
deleted, so the prior teardown left an orphaned EBS volume. Add an explicit
'oc delete pvc workspace-sandbox-0' step (final-review finding).

Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>
Signed-off-by: Paolo Dettori <paolo.dettori@example.com>
@pdettori
pdettori merged commit 41bba75 into main Jul 3, 2026
9 checks passed
@pdettori
pdettori deleted the docs/p0prime-ocp-fs-free-deployment branch July 3, 2026 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant