Repository navigation
refactor: SandboxTransport seam + KubectlTransport rename (ST2, #85) - #92
Merged
Merged
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ST2 of the SandboxTransport epic (#89). Introduces the transport-blind
SandboxTransportinterface (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
SandboxTransportinterface (packages/k8s-sandbox/src/transport.ts) —{ exec: ExecInPod; close(): Promise<void> }, the design §3 surface verbatim.execis a property holding the existingExecInPodcallable so it stays extractable for Pi's operations.KubectlTransport— rename ofkubectlExecInPod, now returning aSandboxTransport(per-callkubectl exec;close()is a no-op). Adds an injectablespawndep (defaults to node'sspawn; real callers are unaffected) so the transport contract is unit-testable.persistent-exec.ts) now returns aSandboxTransport; itsdispose()becomes asyncclose(). Internal single-in-flight / ordered-exec / fallback logic is unchanged.extension.tsholds two transports (fast persistent for read/write/edit/ls/find; per-call kubectl for bash/grep/user-!), passes.execto Pi ops, andawaitsclose()onsession_shutdown. The two-tier split is preserved (not unified).opts.exec→opts.transport.converge.ts,run-leaf.ts) are transport-blind — they receive aSandboxTransportand call.exec.run-turn.tsandselect-sandbox.tsare untouched (no exec references;select-sandboxreturning a transport is ST3).test/conformance.ts) — a reusablerunConformance(label, factory)proving theSandboxTransportcontract (stdout/exit,onDatastreaming,stdin,timeout→timeout:N, abort→aborted, idempotentclose), run here againstKubectlTransportvia a fakespawn. ST5 extends the same battery toGrpcRelayTransport.Testing
pnpm -r testgreen (harness, k8s-sandbox incl. 7/7 new conformance, experiments, session-backend, work-queue, knative-server); bothtsc --noEmitgates clean.deploy/knative/leaf-smoke.shis byte-unchanged (live inertness gate).kubectlExecInPod/PersistentExec/disposereferences 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 laterGrpcRelayTransport).Assisted-By: Claude Code