Repository navigation
Description
P1 — FS-free harness: move the leaf envelope off the filesystem
Part of the two-tier architecture epic (see epic issue). This is the foundation phase — brainstorm this first.
Problem
The credentialed harness performs filesystem I/O for the leaf envelope, violating the head/hands invariant (only the sandbox should touch a filesystem):
harness/src/run-leaf.ts:116—readItem()readsinputsRefvianode:fs(readFileSync).harness/src/run-leaf.ts:160-161— writes the verdict vianode:fs(mkdirSync+writeFileSync(resultRef, …)).- Async path (
packages/knative-server/src/leaf-job-runner.ts) also writes the verdict + a done-marker to the shared/workPVC — no Redis.
Model tool ops are already fully delegated to the sandbox (all 7 Pi ops: read/write/edit/ls/find/grep/bash — packages/k8s-sandbox/src/extension.ts:39-79). Only the envelope leaks to the harness.
Goal
The harness performs no filesystem access — only network I/O (LLM, Redis, sandbox exec API). Concretely:
- Inputs (
LeafItem={item_id, file, pattern, require_approval?}) arrive inline in the/runsPOST body (drop theinputsReffile read). - Sync verdict returned inline in the
/runsresponse body (todayLeafResultreturns only{status, resultRef}; return the verdict value). - Async verdict + done-marker stored in Redis (already a dependency:
RedisSessionBackend,RedisWorkQueue);/runs/statusreturns the verdict from Redis instead of a PVC file. - Sandbox working set (repo, worktrees) moves from emptyDir → a durable PVC (crash-safe). Single sandbox still fine on RWO at this phase (no RWX yet).
- Remove the
/workPVC mount from the harness Service and the async worker.
Non-goals (this phase)
- Sandbox pool / routing (P2). Single sandbox is fine here.
- RWX / multi-sandbox storage (P2).
- Kata (P3, deferred).
Acceptance
- Harness/worker pods mount no shared writable volume; a red-team
grepfinds no/workmount and nowriteFileSyncin the envelope path. leaf-smoke.shpasses with inputs inline + verdict from response/Redis (repo still only in the sandbox → Claim 0 still holds).- Async path drains via Redis; verdict retrievable via
/runs/status. - Sandbox repo survives a sandbox pod restart (durable PVC).
Touches
harness/src/run-leaf.ts, packages/knative-server/src/server.ts, leaf-job.ts, leaf-job-runner.ts, packages/work-queue, deploy/knative/service.yaml, leaf-scaledjob.yaml, sandbox.yaml/overlays, smoke drivers, and the external-orchestrator client. Updates the MVP leaf-session contract (docs/specs/2026-06-26-mvp-leaf-session-contract-design.md) and async-leaf (2026-06-27-async-leaf-completion-design.md).
Next step
Brainstorm P1 → spec (docs/specs/) → plan (docs/superpowers/plans/).
Activity
pdettori commentedon Jul 2, 2026
Part of epic #49
fix(prompt-leaf): log resolved workloadId to clear CodeQL log-injecti…