feat: add defensible durability eval foundation

Merged
KJ
2mo ago
+1465-0

Outcome

Adds a fail-closed, reproducible evidence foundation for Relayflows durability claims:

  • seven durability cases repeated 30 times each;
  • one independent Node black-box case that uses public CLI receipts, kills the resumed daemon and in-flight child process, and verifies replacement of unfinished work without replaying completed work;
  • six real Rust crash/resume cases covering deterministic, llm, agent, channel, concurrency, and memory behavior;
  • pinned source, suite, runtime, host, argv, working directory, allowlisted environment, literal stdout/stderr, and success witnesses;
  • a vendor-neutral protocol naming the participants required for build-vs-buy and best-in-class claims.

This PR does not claim competitive superiority. Relayflows versus DIY requires both adapters under the shared protocol; best-in-class additionally requires Temporal and Inngest.

Independent review repairs

The first review correctly rejected the original head. The current head now:

  • requires explicit output witnesses, so Cargo zero-test exits are invalid;
  • uses ops/cargo.sh instead of ambient Cargo;
  • directly tests clean, dirty, and unavailable provenance paths;
  • confines case working directories to the recorded repository root;
  • distinguishes failed, timed-out, invalid, and inconclusive trials;
  • treats command timeouts as product failures and publication blockers;
  • exits nonzero for every nonpublishable report;
  • requires report output outside the source tree;
  • reports p95 only at 20 or more passing samples;
  • validates nonempty competitive success predicates;
  • records only an explicit non-secret environment allowlist plus case-owned values;
  • forces color-free Cargo output so literal witnesses are stable;
  • cleans up detached daemon and step processes on every failure path;
  • parses the last valid CLI receipt even if diagnostics precede it;
  • uses a fixed, named 16-assertion black-box witness;
  • obtains the run ID from the public CLI receipt rather than journal storage;
  • splits the runner into small CLI, suite, and provenance modules;
  • rejects empty implementation attribution and missing toolchain provenance;
  • classifies executable launch failures as environmental, never product failures;
  • canonicalizes suite and working directories so symlinks cannot escape the recorded root;
  • skips the symlink regression case only when the host denies symlink creation.

The remaining CI-wiring work is deliberately separate because AGENTS.md forbids changing a gate that judges the same work. It is tracked in #569.

Verification at exact head

Exact head: 3f50d89c39dfe67c196138feb401987d0e79cdcd

Command:

node --test scripts/run-evals.test.mjs scripts/benchmark-protocol.test.mjs

Captured output:

1..21
# tests 21
# suites 0
# pass 21
# fail 0
# cancelled 0
# skipped 0
# todo 0
# duration_ms 53.737875

Command:

set -e
for trial in {1..30}; do
  output=$(node benchmarks/durability/black-box-crash.mjs)
  [[ "$output" == *"BLACK_BOX_ASSERTIONS: 16/16"* ]]
  echo "trial $trial: 16/16"
done

Captured output:

trial 1: 16/16
trial 2: 16/16
trial 3: 16/16
trial 4: 16/16
trial 5: 16/16
trial 6: 16/16
trial 7: 16/16
trial 8: 16/16
trial 9: 16/16
trial 10: 16/16
trial 11: 16/16
trial 12: 16/16
trial 13: 16/16
trial 14: 16/16
trial 15: 16/16
trial 16: 16/16
trial 17: 16/16
trial 18: 16/16
trial 19: 16/16
trial 20: 16/16
trial 21: 16/16
trial 22: 16/16
trial 23: 16/16
trial 24: 16/16
trial 25: 16/16
trial 26: 16/16
trial 27: 16/16
trial 28: 16/16
trial 29: 16/16
trial 30: 16/16

Command:

node scripts/run-evals.mjs --suite benchmarks/durability/suite.json --output /tmp/relayflows-durability-3f50d89c.json

Captured output:

relayflows-durability-v1: 210/210 trials passed; publication eligible

Report summary:

{
  "commit": "3f50d89c39dfe67c196138feb401987d0e79cdcd",
  "dirty": false,
  "suiteSha256": "d2972d947660474fba65a1a3f8e6d743379eb37d4025ad3bdadb24d82829918c",
  "passedTrials": 210,
  "failedTrials": 0,
  "timedOutTrials": 0,
  "invalidTrials": 0,
  "inconclusiveTrials": 0,
  "publicationStatus": "eligible",
  "blockers": []
}

Per-case pass counts:

black-box-cli-sigkill-resume       30/30
deterministic-boundary-resume     30/30
llm-result-memoization             30/30
agent-effect-exactly-once          30/30
durable-channel-redelivery         30/30
concurrent-resume-single-lease     30/30
memory-budget-once                 30/30

Negative evidence retained

The allowlist change initially omitted the active Rust toolchain selectors. The clean run failed closed instead of publishing:

Command:

node scripts/run-evals.mjs --suite benchmarks/durability/suite.json --output /tmp/relayflows-durability-7304d1ce.json

Captured output:

relayflows-durability-v1: 0/210 trials passed; publication ineligible

That artifact records 180 failures and 30 inconclusive trials caused by missing Rust toolchain selection. The final head explicitly allows and records CARGO_HOME, CARGO_TARGET_DIR, RUSTUP_HOME, and RUSTUP_TOOLCHAIN, then passed at a new exact commit.

An earlier black-box workload also produced 207/210 and was correctly ineligible. It killed the daemon when a shell effect appeared without proving the step completion was durable, and on three trials observed the expected replay of uncommitted work. The corrected workload first obtains a CLI receipt after one durable completion, resumes, waits for the dependent step to be in flight, then kills the whole execution environment. The README records this boundary explicitly.


[!NOTE]
Low Risk
Adds benchmark harnesses, Node scripts, and JSON fixtures only; no changes to relayflowd runtime or production gates.

Overview
Introduces a fail-closed durability evidence pipeline and separates product conformance from future competitive benchmarking.

Durability eval: scripts/run-evals.mjs drives benchmarks/durability/suite.json (30 repetitions × 7 cases). Reports pin git commit, suite hash, toolchain/host provenance, per-trial argv/cwd/allowlisted env, and full stdout/stderr. Publication is eligible only on a clean tree, sufficient repetitions, Rust/Cargo provenance, all trials passing with required success witnesses (so zero-test Cargo exits count as invalid), and no timeouts/failures/inconclusive environment outcomes. Output must live outside the repo; non-publishable runs exit nonzero.

Black-box case: benchmarks/durability/black-box-crash.mjs exercises public CLI run/resume receipts, SIGKILLs the resumed daemon and in-flight step child, then asserts 16 fixed outcomes (no journal inspection).

Competitive protocol: benchmarks/workflow-reliability/protocol.json defines vendor-neutral scenarios, metrics, and which participants are required for build-vs-buy vs best-in-class claims—without implementing adapters yet. scripts/benchmark-protocol.test.mjs guards protocol shape.

Tests: Extensive scripts/run-evals.test.mjs covers trial classification, symlink/cwd containment, env allowlisting, and black-box helpers.

Reviewed by Cursor Bugbot for commit 3f50d89c39dfe67c196138feb401987d0e79cdcd. Bugbot is set up for automated code reviews on this repo. Configure here.