Repository navigation
Description
Problem
Spec §8 states the total-output-per-exec cap as a seam-level guarantee: every SandboxTransport enforces it, so Pi cannot tell which backend served a flood. Two of the three implementations do. The third does not.
persistentExecInPod (packages/k8s-sandbox/src/persistent-exec.ts) returns a SandboxTransport with no cap, and it is the transport wired to the file-reading tools — Read, Write, Edit, Ls, Find (packages/k8s-sandbox/src/extension.ts:53-59). Only bash and grep go through the capped KubectlTransport (extension.ts:62-64). The shared conformance battery runs against the two per-call transports only (transport-conformance.test.ts, grpc-relay-transport.test.ts).
Consequence today: cat a 20 MiB file and the persistent channel returns 20 MiB, while the same read through either per-call transport returns 8 MiB plus \n[output truncated] with exitCode: null. Pi can distinguish the backends, which is precisely what the guarantee exists to prevent.
Found by the whole-branch review of the epic-closing work (#89). The spec, ADR-0024, and transport.ts's comment have been corrected to name this exception rather than claim a guarantee that does not hold — this issue is about whether to close the gap in code.
Why it is not simply "add the cap"
persistentExecInPod serves whole-file reads. Capping it means a >8 MiB read fails rather than silently truncating — because createPodReadOps.readFile now rejects any read it cannot vouch for (packages/k8s-sandbox/src/operations.ts:22-38, added in the same review's fix wave, after we found a truncated read could be written back into the file through Edit).
That is the safe behavior, but it is a behavior change on the Read path: files above the cap become unreadable through the sandbox tools rather than partially readable.
The decision
- Cap it and add it to
runConformance. The honest close: the seam guarantee becomes true, all three implementations are held to one contract, and the battery covers what it claims. Cost: >8 MiB files become unreadable through Read/Edit. - Leave it uncapped by design, on the grounds that the file-reading path wants whole files and the poisoned-output threat is about streamed command output. Cost: the seam guarantee stays qualified, and the docs keep carrying the exception.
Option 1 also wants a decision on what the cap should be for reads specifically — 8 MiB is tuned to the streaming case and is pinned to the Go worker's BufferCap (now enforced by packages/k8s-sandbox/test/output-cap-coupling.test.ts).
Refs
Epic #89 · found in the whole-branch review of the epic-closing branch · related: the truncated-read guard in operations.ts:22-38.
Activity
test(k8s-sandbox): seed the live-smoke fixtures in a beforeAll
fix(k8s-sandbox): make a broken output-cap stage loud instead of silent
docs(specs): ST6 — seam-wide output cap + explicit truncation contract
feat(k8s-sandbox): represent truncation explicitly on the SandboxTran…
feat(k8s-sandbox): cap the persistent channel, in the pod
test(k8s-sandbox): hold all three transports to the battery, with dec…
fix(k8s-sandbox): name truncation precisely in readFile and glob
fix: report truncation as truncation at the grep and diff-capture sites
docs: the output cap is now a seam-wide guarantee
test(k8s-sandbox): live gate for the capped read path
fix: address final whole-branch review findings
docs(spec): close #182's accepted divergence in §8 and ADR-0024
fix(transport): derive the gRPC message ceiling from the output cap (#…