feat(evals): add attested local and E2B Harbor runners#191
Conversation
Greptile SummaryThis PR routes Harbor ground-truth evaluation through a new
Confidence Score: 4/5Safe to merge; all findings are P2 quality/consistency observations with no correctness or data-integrity impact on the happy path. The PR is a substantial, well-engineered addition with atomic lease ledgers, attested lifecycle policies, budget hard caps, and schema-versioned attestation. Two P2 issues were found: a missing capacity-error retry in _BudgetedProjectSandboxFactory (inconsistent with E2BOneShotRunnerFactory) and a five-branch combinatorial if/elif in default_sandbox_factory. Neither causes incorrect behavior today. Score is 4 rather than 5 because the retry gap is a meaningful consistency gap that could surface under E2B load. wmh/agents/project.py (_BudgetedProjectSandboxFactory.call) and wmh/harness/e2b_sandbox.py (default_sandbox_factory) warrant a second look before the E2B path goes into high-volume use. Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Eval as HarborEvaluator
participant Cfg as PiRunnerBackendSpec
participant Fac as build_pi_runner_factory()
participant LRF as LocalContainerRunnerFactory
participant ERF as E2BOneShotRunnerFactory
participant Ledger as RunnerLeaseLedger
participant SB as E2B Sandbox
participant Attest as PiRunnerAttestation
Eval->>Cfg: "coerce_runner_spec(runner_image | spec)"
Eval->>Fac: build_pi_runner_factory(spec, lease_ledger_dir)
alt "backend == local"
Fac->>LRF: LocalContainerRunnerFactory(spec)
else "backend == e2b"
Fac->>ERF: E2BOneShotRunnerFactory(spec, ledger)
end
Eval->>ERF: __enter__() / open()
ERF->>Ledger: begin(lease_id, provider_expiry_horizon_s)
ERF->>SB: create_sandbox(factory) with retries
SB-->>ERF: sandbox handle
ERF->>Ledger: activate(sandbox_id)
ERF->>Attest: _attest(sandbox, get_info())
Attest-->>ERF: "attestation schema_version=3"
Eval->>ERF: run_pi_turn(runner_factory)
ERF->>SB: commands.run(pi_node_cmd)
SB-->>ERF: turn output
ERF->>ERF: __exit__() / close()
ERF->>SB: kill_sandbox() with retries
alt kill success
ERF->>Ledger: retire(lease_id)
else kill failed
ERF->>Ledger: cleanup_failed(lease_id)
ERF->>ERF: reap_e2b_runner_lease(lease_id)
end
ERF-->>Eval: "lease_receipt state=retired or cleanup_failed"
Eval->>Eval: write attestation + receipt to task metadata
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Eval as HarborEvaluator
participant Cfg as PiRunnerBackendSpec
participant Fac as build_pi_runner_factory()
participant LRF as LocalContainerRunnerFactory
participant ERF as E2BOneShotRunnerFactory
participant Ledger as RunnerLeaseLedger
participant SB as E2B Sandbox
participant Attest as PiRunnerAttestation
Eval->>Cfg: "coerce_runner_spec(runner_image | spec)"
Eval->>Fac: build_pi_runner_factory(spec, lease_ledger_dir)
alt "backend == local"
Fac->>LRF: LocalContainerRunnerFactory(spec)
else "backend == e2b"
Fac->>ERF: E2BOneShotRunnerFactory(spec, ledger)
end
Eval->>ERF: __enter__() / open()
ERF->>Ledger: begin(lease_id, provider_expiry_horizon_s)
ERF->>SB: create_sandbox(factory) with retries
SB-->>ERF: sandbox handle
ERF->>Ledger: activate(sandbox_id)
ERF->>Attest: _attest(sandbox, get_info())
Attest-->>ERF: "attestation schema_version=3"
Eval->>ERF: run_pi_turn(runner_factory)
ERF->>SB: commands.run(pi_node_cmd)
SB-->>ERF: turn output
ERF->>ERF: __exit__() / close()
ERF->>SB: kill_sandbox() with retries
alt kill success
ERF->>Ledger: retire(lease_id)
else kill failed
ERF->>Ledger: cleanup_failed(lease_id)
ERF->>ERF: reap_e2b_runner_lease(lease_id)
end
ERF-->>Eval: "lease_receipt state=retired or cleanup_failed"
Eval->>Eval: write attestation + receipt to task metadata
Reviews (3): Last reviewed commit: "fix(e2b): honor persisted orphan expiry" | Re-trigger Greptile |
|
Addressed the fresh Greptile review at da8fc4b. Runner lease records now persist their own conservative provider expiry before create. Reconciliation prefers the prior sandbox observed end time plus clock skew, then that persisted bound, and uses the current spec horizon only for legacy records lacking both. This prevents shorter replacement specs from skipping cleanup and larger replacement specs from reaping a resource already guaranteed dead. The regression suite covers creating, active, cleanup-failed, retired, legacy, shrink, growth, and skew cases; 204 focused tests plus whole-project Ruff, format, and ty pass. The storage-unit question is also verified: E2B documents diskTotal as bytes, matching the pinned Python SDK model and the existing byte-to-MiB conversion: https://e2b.dev/docs/sandbox/metrics |
|
Closing because this branch is superseded and is not intended for merge. Exact head preserved: da8fc4b. No branch was deleted. |
Scope
This branch explored interchangeable Pi runner backends for Harbor evaluation, with local execution as the default and E2B as an explicit option.
Disposition
The implementation includes broader lifecycle machinery than the reusable backend seam requires. It is closed without merge, and the backend selection will be rebuilt against current main.