Skip to content

refactor: SandboxTransport seam + KubectlTransport rename (ST2, #85) - #92

Merged
pdettori merged 5 commits into
rossoctl:mainfrom
pdettori:feat/sandbox-transport-seam
Jul 10, 2026
Merged

pdettori merged 5 commits into
rossoctl:mainfrom
pdettori:feat/sandbox-transport-seam

Conversation

@pdettori

Copy link
Copy Markdown
Member

Summary

ST2 of the SandboxTransport epic (#89). Introduces the transport-blind SandboxTransport interface (design §3) and reshapes the existing exec paths into it, so the harness call sites never learn how bytes reach the sandbox. Pure, behavior-preserving refactor — zero behavior change. No proto, relay, or worker (those are ST1/ST3/ST4).

Independent of ST1 (#84 / PR #91): this branch uses no protobuf, so it is based on main, not stacked on ST1.

Closes #85.

What changed

  • SandboxTransport interface (packages/k8s-sandbox/src/transport.ts) — { exec: ExecInPod; close(): Promise<void> }, the design §3 surface verbatim. exec is a property holding the existing ExecInPod callable so it stays extractable for Pi's operations.
  • KubectlTransport — rename of kubectlExecInPod, now returning a SandboxTransport (per-call kubectl exec; close() is a no-op). Adds an injectable spawn dep (defaults to node's spawn; real callers are unaffected) so the transport contract is unit-testable.
  • Persistent channel (persistent-exec.ts) now returns a SandboxTransport; its dispose() becomes async close(). Internal single-in-flight / ordered-exec / fallback logic is unchanged.
  • extension.ts holds two transports (fast persistent for read/write/edit/ls/find; per-call kubectl for bash/grep/user-!), passes .exec to Pi ops, and awaits close() on session_shutdown. The two-tier split is preserved (not unified). opts.exec → opts.transport.
  • Harness call sites (converge.ts, run-leaf.ts) are transport-blind — they receive a SandboxTransport and call .exec. run-turn.ts and select-sandbox.ts are untouched (no exec references; select-sandbox returning a transport is ST3).
  • Conformance battery (test/conformance.ts) — a reusable runConformance(label, factory) proving the SandboxTransport contract (stdout/exit, onData streaming, stdin, timeout→timeout:N, abort→aborted, idempotent close), run here against KubectlTransport via a fake spawn. ST5 extends the same battery to GrpcRelayTransport.

Testing

  • pnpm -r test green (harness, k8s-sandbox incl. 7/7 new conformance, experiments, session-backend, work-queue, knative-server); both tsc --noEmit gates clean.
  • deploy/knative/leaf-smoke.sh is byte-unchanged (live inertness gate).
  • No kubectlExecInPod / PersistentExec / dispose references remain.

Notes for ST5

The persistent transport intentionally does not stream onData; the streaming conformance case is the contract for streaming-capable transports specifically (KubectlTransport, and later GrpcRelayTransport).

Assisted-By: Claude Code

pdettori added 5 commits July 9, 2026 20:13
Introduce the transport-blind exec seam (spec §3) and KubectlTransport as
its per-call kubectl implementation, with an injectable spawn dep. Seed the
shared conformance battery (ST5 extends it to GrpcRelayTransport). kubectlExecInPod
kept as a temporary alias.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
persistentExecInPod now returns { exec, close } (dispose->async close);
extension.ts holds two transports and passes .exec to Pi ops, closing the
fast channel on session_shutdown. opts.exec->opts.transport.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
convergeWorkspace/cleanupWorkspace accept a SandboxTransport; run-leaf builds
a KubectlTransport and closes it after converge/cleanup. Call sites are now
transport-blind (spec §3).

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
All consumers now use KubectlTransport. Final public surface: KubectlTransport,
SandboxTransport, ExecInPod, persistentExecInPod. Pure refactor complete —
existing suites green, leaf-smoke.sh unchanged.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
Claim 5 and the intro now name close(); dispose() was removed in this branch's
transport refactor. Doc-only, no code change.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
@pdettori
pdettori merged commit 9c07b4e into rossoctl:main Jul 10, 2026
10 checks passed
@pdettori
pdettori deleted the feat/sandbox-transport-seam branch July 10, 2026 01:06
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.

ST2: backend — SandboxTransport seam + KubectlTransport rename (pure refactor)

1 participant