Skip to content

phase2-convert-translator: ship real azureclaw convert translator (S9.2) - #63

Merged
Pal Lakatos-Toth (pallakatos) merged 1 commit into
devfrom
phase2-convert-translator
Apr 28, 2026
Merged

Pal Lakatos-Toth (pallakatos) merged 1 commit into
devfrom
phase2-convert-translator

Conversation

@pallakatos

Copy link
Copy Markdown
Collaborator

Slice S9.2 — phase2-convert-translator

Replaces the Phase 0 exit-3 skeleton of azureclaw convert with a real YAML-in / YAML-out translator between AzureClaw ClawSandbox and upstream agents.x-k8s.io/v1alpha1 Sandbox (kubernetes-sigs/agent-sandbox @ c8c85f5).

What's in

  • Three target modes:
    • --to clawsandbox — upstream Sandbox → ClawSandbox (lossy inverse)
    • --to upstream-sandbox — ClawSandbox → upstream Sandbox (lossy forward)
    • --to overlay --sandbox-ref=<name|ns/name> — upstream Sandbox → fresh ClawSandbox skeleton with spec.upstreamCompatibility.sigsAgentSandbox=overlay
  • Hard-fail on lossy translation by default — --allow-lossy waives. Applies to --dry-run too (rationale: silently dropping a TokenBudget on conversion is a governance regression).
  • Seccomp + runtimeClass mirrors the controller — confidential → kata-vm-isolation + RuntimeDefault; enhanced + <name> → Localhost(profiles/<name>.json). Verified directly against controller/src/reconciler/mod.rs:34-78.
  • Order-aware env projection — valueFrom drops any prior literal for the same name (no stale-data resurrection), warns. Literal overriding a prior valueFrom double-warns.
  • Overlay namespace pin — --sandbox-ref ns/name validates against input metadata.namespace (LocalObjectRef is same-namespace only).
  • Upstream verification — API shape pulled directly from kubernetes-sigs/agent-sandbox @ c8c85f5/api/v1alpha1/sandbox_types.go via GitHub MCP. No v1alpha2 yet — api/ directory contains only v1alpha1/.

Tests

  • 48 new vitest cases in cli/src/commands/convert.test.ts
  • CLI workspace: 337 → 382 tests
  • Manual end-to-end smoke green: node dist/index.js convert -f sandbox.yaml --to clawsandbox exits 0 on confidential input, emits valid ClawSandbox.
  • tsc --noEmit + oxlint clean.

CI scripts

ci/no-stubs.sh, ci/no-custom-crypto.sh, ci/check-loc.sh all clean against origin/dev.

Audit doc

docs/security-audits/2026-04-28-phase2-convert-translator.md — full 12-section template. STRIDE, reuse map (10 existing seams enumerated), failure-mode table (12 modes × exit codes), seccomp canonicalisation matrix, ops surface for the three day-1 use cases (adoption / de-adoption / partial-overlay-bootstrap).

Rubber-duck pre-implementation pass

10 findings adopted: hard-fail-on-lossy default, overlay input gating, valueFrom handling, profiles/<name>.json path convention, dry-run lossy preservation, ns-mismatch rejection, multi-doc reject, status strip, missing-podSpec invalid-input handling, deterministic env ordering. 0 deferred.

Phase 2 progress

S1 #51 ✓ · S2 #52 ✓ · S3 #53 ✓ · S4 #54 ✓ · S5 #55 ✓ · S6 #56 ✓ · S8 #57 ✓ · S11 #59 ✓ · S11.1 #61 ✓ · S9.1 #62 ✓ · S9.2 (this PR)

11 of ~14 slices.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

Replace Phase 0 exit-3 skeleton with real YAML translator between
ClawSandbox and upstream agents.x-k8s.io/v1alpha1 Sandbox
(kubernetes-sigs/agent-sandbox @ c8c85f5).

- Three target modes: clawsandbox (inverse), upstream-sandbox (forward),
  overlay (skeleton emit).
- Hard-fail on lossy translation by default; --allow-lossy waives.
  Applies to --dry-run too.
- Seccomp + runtimeClass mapping mirrors controller exactly:
  confidential -> kata-vm-isolation + RuntimeDefault; enhanced + name
  -> Localhost(profiles/<name>.json); RuntimeDefault/empty -> RuntimeDefault.
- Order-aware env projection: valueFrom drops prior literals (no stale
  data resurrection), warns per name; literal-overrides-valueFrom
  double-warns.
- Multi-doc YAML rejected; server-managed metadata stripped.
- Overlay --sandbox-ref ns/name validates against input metadata.namespace
  (LocalObjectRef is same-namespace).
- 48 new vitest cases; CLI 337 -> 382. Manual smoke green.
- Upstream API shape verified directly against
  kubernetes-sigs/agent-sandbox @ c8c85f5/api/v1alpha1/sandbox_types.go
  (no v1alpha2 yet).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pallakatos
Pal Lakatos-Toth (pallakatos) merged commit b838415 into dev Apr 28, 2026
14 of 15 checks passed
@pallakatos
Pal Lakatos-Toth (pallakatos) deleted the phase2-convert-translator branch April 28, 2026 08:46
Pal Lakatos-Toth (pallakatos) added a commit that referenced this pull request May 12, 2026
Replace Phase 0 exit-3 skeleton with real YAML translator between
ClawSandbox and upstream agents.x-k8s.io/v1alpha1 Sandbox
(kubernetes-sigs/agent-sandbox @ c8c85f5).

- Three target modes: clawsandbox (inverse), upstream-sandbox (forward),
  overlay (skeleton emit).
- Hard-fail on lossy translation by default; --allow-lossy waives.
  Applies to --dry-run too.
- Seccomp + runtimeClass mapping mirrors controller exactly:
  confidential -> kata-vm-isolation + RuntimeDefault; enhanced + name
  -> Localhost(profiles/<name>.json); RuntimeDefault/empty -> RuntimeDefault.
- Order-aware env projection: valueFrom drops prior literals (no stale
  data resurrection), warns per name; literal-overrides-valueFrom
  double-warns.
- Multi-doc YAML rejected; server-managed metadata stripped.
- Overlay --sandbox-ref ns/name validates against input metadata.namespace
  (LocalObjectRef is same-namespace).
- 48 new vitest cases; CLI 337 -> 382. Manual smoke green.
- Upstream API shape verified directly against
  kubernetes-sigs/agent-sandbox @ c8c85f5/api/v1alpha1/sandbox_types.go
  (no v1alpha2 yet).

Co-authored-by: Pal Lakatos-Toth <pallakatos@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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