Skip to content

Container and Kata workspaces on OpenShell v0.1.10 - #173

Closed
sauagarwa wants to merge 5 commits into
validatedpatterns-sandbox:mainfrom
sauagarwa:fix/openclaw-automation-create
Closed

sauagarwa wants to merge 5 commits into
validatedpatterns-sandbox:mainfrom
sauagarwa:fix/openclaw-automation-create

Conversation

@sauagarwa

@sauagarwa sauagarwa commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Container and Kata workspaces on OpenShell v0.1.10: GitOps-deployed, with no cluster-specific configuration. Kata gets two VMs per sandbox. OCSF audit export and the agent trace relay go to a collector the pattern deploys.

What this changes

Commit Area
Workspace runtime for container and Kata workspaces kubernetes-runtime/: controller, plan compiler, tool gate, provider and boundary checks
Container and Kata workspace charts on OpenShell v0.1.10 charts/, overrides/: per-user stack, admission policies, projection, Kata and telemetry charts
Pattern configuration, saw-init and live checks values-prod.yaml, scripts/, Makefile*
Images and CI for OpenShell v0.1.10 .github/, images/, image-builder-charts/, openshell-sandbox-carry/
Docs: install guide, container, Kata and audit README.md, docs/

Container and Kata workspaces

  • Adding a user: an entry in overrides/saw-users.yaml creates a container or Kata workspace through Argo CD. The projector resolves the user, enrollment publishes the boundary, and the runtime reconciles the user's own OpenShell gateway.
  • No cluster-specific configuration:
    • Workspaces reach the Kubernetes API through an AdminNetworkPolicy nodes peer on the control-plane nodes, and DNS through the cluster DNS pods. No IPs are needed.
    • Storage is the cluster's default StorageClass.
    • overrides/container-network.yaml and the per-cluster storage file are gone. make saw-init is the one preparation step.
  • Audit:
    • OCSF events from every gateway and supervisor go to an OpenTelemetry collector that the pattern deploys (Red Hat build of OpenTelemetry).
    • The OpenClaw tool gate keeps a local audit log by default.
    • Signed, fail-closed receipts are optional (auditReceipts). Only then does a workspace get the audit writer, a saw-history-* namespace and RWX storage.
  • Agent trace relay (OpenShell 0.1.10): each supervisor forwards the workload's own OTLP traces to the same collector, tagged with the sandbox ID. OpenClaw's own trace export needs its diagnostics-otel plugin, which OpenClaw 2026.9.6 doesn't bundle; that's a follow-up.
  • Admission policy (saw-runtime-policies): supervisor and workload pods must match the stock OpenShell shape. That means the approved images and commands, and only the configured OCSF and agent-trace collectors and a numeric attach timeout. The gateway and the policy get their images from one value.
  • Provider profiles: a credentialed provider's live profile must match the shipped governed profile exactly. That covers every endpoint's host, ports, path, protocol, access preset and L7 rules, not just host and port.

Kata

  • values-prod.yaml installs the OpenShift sandboxed containers operator.
  • saw-kata creates the KataConfig, selecting plain workers only. It also creates a saw-kata RuntimeClass that's already labelled attachable, so nobody labels the operator's class by hand. It is off by default, because enabling it reboots the workers once.
  • Kata users default to saw-kata. On autoApprove sites the projector binds them to its live UID and placement digest automatically. Reviewed sites keep an explicit binding.
  • Two VMs per sandbox: with OpenShell 0.1.10 (supervisor_runtime_class_name), the supervisor runs in its own Kata VM. It handles the agent's traffic and credentials, so it never shares the workload's guest kernel. This is required, not optional: the admission policy and the controller's boundary check both enforce it.

OpenShell v0.1.10-rhaiv.0

Tooling: make e2e-workspace OPENSHELL_SAW_NAME=<user> DEPLOYMENT_MODE=vm|container|kata checks one user's live workspace:

  • Argo health and sandbox readiness.
  • Kata placement, for Kata users.
  • A real OpenClaw turn that must echo a random token through the user's inference provider.
  • The tool gate's audit entry for that turn.
  • OCSF events at the collector.

Temporary items

  • openshell-sandbox carry. On OpenShift (RHEL 9, kernel 5.14), odh-openshell-sandbox:v0.1.10-rhaiv.0 panics in its network broker on every connect, so the agent has no network and no inference.
    • Cause: the new process-identity code (feat(supervisor): identify the process behind each network event ai-openshell/openshell#5251) calls rustix clock_ticks_per_second(). rustix reads the aux vector with prctl(PR_GET_AUXV), which needs Linux 6.4 or later, or with /proc/self/auxv, which a non-dumpable sandbox running as a non-root UID can't read.
    • openshell-sandbox-carry/ rebuilds only /openshell-sandbox from the same downstream commit with a one-line warm-up at the top of main(), and layers it onto the official image.
    • An issue is being filed with opendatahub-io/openshell. Remove the carry once a fixed image is released.
  • Image pins: the runtime, OpenClaw, interceptor and sandbox-carry images are pinned to ghcr.io/sauagarwa/… CI builds until main CI publishes them.

Verification

  • Unit tests: 2239 chart, runtime, script and portal tests pass, plus the installer suite. The interceptor's SAW extension tests pass against v0.1.10.
  • Live, on an OpenShift 4.x test cluster (RHCOS 9.8): after the final changes, a GitOps-deployed container user and a Kata user, both using custom inference, passed make e2e-workspace with every check green. For the Kata user, the workload and the supervisor each ran in saw-kata. Removing and recreating both users through GitOps also worked.
  • Not retested on v0.1.10: VM mode. It's next, and will also show whether VM sandboxes need the carry.

Follow-ups (separate PRs)

  • Export OpenClaw's own traces (the diagnostics-otel plugin, or a newer OpenClaw).
  • The reconciler should recover when a first sandbox create is rejected after the gateway records its request ID. Today it needs a new generation.
  • A relay app's retrying sync blocks workspace deletion until it's terminated.
  • After the last user is removed, adding one stalls about 3 minutes while the projector's identity is recreated.
  • The self-service portal's Kata path still needs an explicit RuntimeClass binding.
  • Superseded tool-gate trees accumulate on the gate volume.
  • Possibly merge the per-user saw-ctl-* and saw-ui-* namespaces.

🤖 Generated with Claude Code

https://claude.ai/code/session_01B7As13NaHoAbqt5NZ6SRn8

@sauagarwa
sauagarwa force-pushed the fix/openclaw-automation-create branch 2 times, most recently from 5050f76 to d73503e Compare November 19, 2026 04:18

@Hadar301 Hadar301 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Three high-urgency issues block the merge:

  1. Production values enable dev-only auto-approval (overrides/saw-container-defaults.yaml:42-47). values-prod.yaml loads this file for saw-users and the self-service portal. The default enables autoApprove, which lets the portal offer every catalog profile and lets enrollment publish the first observed boundary and BOM without a reviewed reference or profile digest. Please keep this off in production values. Require the reviewed reference and approvedProfiles, and put auto-approval in a demo-only values file.

  2. A per-user false cannot disable default auto-approval (charts/saw-users/templates/_helpers.tpl:520-524). mergeOverwrite skips empty values, so containerSites.<name>.automaticEnrollment.autoApprove: false does not override a shared true. The chart projector then keeps auto-approval enabled, while the portal's Python merge accepts false. Please merge by explicit key presence and test that both paths honor the same per-user override.

  3. Install defaults to a privileged demo NFS stack (scripts/shared-storage.sh:115-124,229-230). saw-init runs this during pattern-install and make saw-create. If no recognized RWX class exists, the unset default creates a single-pod NFS server, grants it privileged SCC access, and adds a cluster-scoped provisioner role without an opt-in prompt. Please fail with guidance by default and require an explicit SAW_SHARED_STORAGE=nfs choice for the demo server.

GitHub also reports this PR as non-mergeable (dirty) and shows no check runs. Please resolve the merge state and run the required checks after these fixes.

@sauagarwa
sauagarwa force-pushed the fix/openclaw-automation-create branch from a440492 to 64770a8 Compare November 23, 2026 14:57

@Hadar301 Hadar301 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One high-urgency issue remains in charts/openshell-saw/files/installer/saw_core.py:1327-1328. The harness tool-rule builder inserts an MCP server name into policy text without validating or escaping it. A name containing newlines can inject an unconditional allow rule for exec, which can bypass the tool gate's default-deny behavior. Please reject names that do not match MCP_SERVER_NAME_RE before building rules, serialize policy fields safely, and add a regression check for invalid names.

Optional:
The PR title and body describe only the OpenClaw command aliases, but the diff spans 94 files and includes container/Kata provisioning, provider credentials, network policy, and shared storage. Please update the PR description or split the unrelated changes. The latest available check snapshot still had the Python 3.12 and 3.14 test jobs in progress; wait for required checks to finish before merge.

Hadar301
Hadar301 previously approved these changes Nov 23, 2026

@Hadar301 Hadar301 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

sauagarwa added a commit to sauagarwa/secure-agent-workspace that referenced this pull request Nov 24, 2026
For testing alice's container workspace on cluster vvkp4siy, which
deploys this branch directly:

- overrides/container-network.yaml: this cluster's API, DNS and Keycloak
  egress, storage classes and ApplicationSet controller labels (make
  container-topology).
- values-prod.yaml: list it, and the demo overlay (enrollment on first
  observation), in saw-users' extraValueFiles.
- custom-inference governance profile: api.enmaas.devshift.net.

Revert this commit, and fac2da8 (alice's entry), before PR validatedpatterns-sandbox#173 merges.
PR tests that expect the shipped values and example host fail until then.

Assisted-By: Claude
Hadar301 added a commit to Hadar301/secure-agent-workspace that referenced this pull request Nov 24, 2026
Validate workload GID, strict groups, and sysctl values against
generated OCI policy. Normalize only explicit host namespace denials.

Narrow PVC policy mounts to their approved read-only mode and recheck
that boundary during enrollment. Reject unsupported subpaths before
generation.

Document the remaining Kata subpath blocker and the distinct storage
scope of PR validatedpatterns-sandbox#173. Keep confidential deployment gates closed.
@sauagarwa
sauagarwa force-pushed the fix/openclaw-automation-create branch 3 times, most recently from ad0fbc4 to 5e71fbd Compare November 25, 2026 04:03
The saw-kubernetes-runtime controller that drives a user's stock OpenShell
gateway: it compiles the workspace plan, enrolls it, and reconciles the
workspace, providers and sandboxes.

- OpenClaw tool gate: automation approvals, retry hints, harness rules and
  model thinking, with a best-effort local audit log by default and signed
  fail-closed receipts as an option. The audit mount stays on log/.
- Superseded tool-gate trees are kept for sandboxes that still mount them.
- Native providers: an already-configured refresh is observed, not resent.
- A credentialed provider's live profile must match the shipped governed
  profile exactly: every endpoint's host, ports, path, protocol, access and
  rules (custom inference: the site's host).
- Kata: the boundary check requires the workload and the supervisor in the
  approved RuntimeClass.

Assisted-By: Claude
Portal and GitOps projection of container and Kata workspaces, and the
platform charts they need.

- saw-portal-container: per-user stack (identity, policy, gateway, audit,
  relay). No cluster-specific addresses: the Kubernetes API through the
  control-plane nodes, DNS by selector, the cluster's default StorageClass.
  Signed audit receipts are optional (auditReceipts); OCSF events and the
  agent trace relay go to the pattern's OpenTelemetry collector. The gateway
  and the admission policy pin the same runtime and supervisor images.
- saw-runtime-policies: supervisors may carry only the configured OCSF and
  agent-trace collectors and a numeric attach timeout; in Kata mode both the
  workload and the supervisor must use the approved class (two VMs).
- saw-users: projection with an IP-free projector; Kata users default to
  saw-kata, bound by its live UID and placement digest on autoApprove sites.
- saw-kata (KataConfig and an attachable saw-kata RuntimeClass) and
  saw-telemetry (OCSF logs and agent traces collector).
- OpenShell v0.1.10-rhaiv.0 for VM and container users; the governance
  interceptor rebuilt from v0.1.10; container sandboxes on a temporary
  openshell-sandbox carry until a fixed image is released.
- openshell-rhdh portal, Keycloak relay registrar, container defaults.

Assisted-By: Claude
- values-prod: OpenShift sandboxed containers and Red Hat build of
  OpenTelemetry operators, saw-kata (off by default), saw-telemetry,
  agent-sandbox, container defaults for saw-users and the portal.
- make saw-init is the one preparation step: storage classes and, only for
  audit receipts, the shared RWX class.
- make e2e-workspace checks one user's live workspace for vm, container or
  kata: Argo, sandbox, Kata placement, a real inference turn, the tool-gate
  audit entry and OCSF export.
- Scripts and tests follow OpenShell v0.1.10.

Assisted-By: Claude
- OpenShift-ready OpenClaw image and the workspace runtime image, published
  from branches on demand.
- Governance interceptor built from OpenShell v0.1.10 (Rust 1.95) with the
  SAW extension; the ai-openshell/openshell#3929 workaround stays.
- TEMPORARY carry: odh-openshell-sandbox v0.1.10-rhaiv.0 rebuilt with one
  fix. Its network broker panicked on every connect on RHEL 9: rustix could
  read the aux vector neither through PR_GET_AUXV (Linux 6.4+) nor through
  /proc/self/auxv once the sandbox is nondumpable. The patch reads it at the
  top of main(). Remove once a fixed image is released.

Assisted-By: Claude
@sauagarwa
sauagarwa force-pushed the fix/openclaw-automation-create branch from 709d5cb to efd4e4c Compare November 25, 2026 07:20
README rewritten as an install guide (VM, container and Kata users, make
e2e-workspace); container installation, Kata (pattern-managed runtime, two
VMs per sandbox), audit events and receipts, deployment and governance docs
updated for OpenShell v0.1.10.

Assisted-By: Claude
@sauagarwa
sauagarwa force-pushed the fix/openclaw-automation-create branch from ba27387 to 848ca3a Compare November 25, 2026 07:44
@sauagarwa sauagarwa changed the title Allow OpenClaw automation create commands Container and Kata workspaces on OpenShell v0.1.10 Nov 25, 2026
@sauagarwa

Copy link
Copy Markdown
Collaborator Author

Thanks for the review. I've rewritten the branch as 5 commits by area. The code is unchanged from what was tested; only the history is new. Response to each finding:

P0: production values install the test cluster. Fixed. The test-cluster configuration was always marked TEMPORARY and is no longer on the branch:

  • values-prod.yaml no longer lists overrides/saw-container-demo.yaml or forces saw-kata on (it's enabled: false by default).
  • overrides/saw-users.yaml is back to users: [].
  • The custom-inference profile names api.inference.example.com again.
  • test_pattern_puts_keycloak_and_each_saw_in_their_own_namespaces, test_the_pattern_installs_the_operator_and_leaves_the_pool_off and test_the_extra_profile_file_is_a_complete_openshell_profile pass.
  • The Kata doc's "keep in draft" note is replaced by the qualification results and what's still not covered.

P1: the charts don't run the sandbox carry. Fixed. Your snapshot predates the pin.

  • driverDefaults.runtimeImage is the published carry.
  • The stack now passes that one resolved value to both the gateway (sandbox_runtime_image) and the admission policy. Before, the gateway used its own chart default while the policy used driverDefaults, and they only matched by coincidence. The carry exposed it: every workload pod was rejected as "not the stock runtime bootstrap".
  • The gateway chart's own default is the carry too, and a test asserts that both charts' defaults agree.
  • I deliberately left the VM BOM's sandbox image alone. VM sandboxes run under Podman inside the VM, and I haven't seen them hit the crash. The VM retest on v0.1.10 decides whether they need the carry.

P2: endpoint equality drops path and protocol. Real, and wider than reported: the access preset and L7 rules were ignored too. A live github profile could have dropped the /graphql scope or turned api.github.com read-write and still matched.

  • The reconciler now compares every endpoint of a shipped governed profile exactly, as a list, so two entries on one host and port don't collapse: host, ports, path, protocol, access and allow/deny rules.
  • The comparison follows the interceptor's YAML-to-NetworkEndpoint conversion and protobuf JSON (enums by name, defaults omitted).
  • Tests cover every shipped profile as served, the dropped and unscoped /graphql entry, access widening, a switch to raw tcp, and an added Gmail rule.
  • Custom inference keeps its host check, because its profile is the site's own file.

On "fixed since the last review": as noted there, keeping superseded tool-gate trees means each policy update leaves another directory on the gate volume. I've listed that as a follow-up.

After all of the above, a GitOps container user and a Kata user passed make e2e-workspace on the test cluster on OpenShell v0.1.10. That covered inference, the tool-gate audit entry and OCSF export. The Kata user's workload and supervisor each ran in their own saw-kata VM.

@mtalvi

mtalvi commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Can be closed. Done in #174 .

@Hadar301 Hadar301 closed this Nov 25, 2026
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.

3 participants