ZP11Research & insights

Independent Re-Runs Need Separate Mutable State and Authority

Design a ZP11 re-run that can distinguish a fresh build from a cache replay, diagnose mismatches, and make the release gate's decision auditable.

Before accepting a second signature on a release artifact, ask which build actions the second runner actually executed. A remote action cache can hand the runner the finished package. The runner can hash those bytes correctly and sign a truthful record of what it received. The package still has only one observed production path.

ZP-10, the independent re-run zone, asks whether an isolated runner can reproduce the verdict. Apply it to the ZP-2 reproducible-build verdict by recording how each output was produced as well as whether its digest agrees. Keep source, recipe, resolved dependencies, and the toolchain fixed. Give the runs separate writable state and limit each identity to its own output. Then review the inputs and services still common to both runs against the failure the gate is meant to catch.

Put the build boundary after retrieval

Stage the declared inputs before execution. Verify their expected digests, mount them read-only, and launch the build with a fresh workspace and scratch directory. Block network access during execution and restrict filesystem reads to the staged inputs and the runner’s own state. Network isolation closes a retrieval channel. Hermeticity also depends on controlling host files, injected environment variables, and other undeclared inputs. An offline build can still pick up an undeclared header from a host mount.

SLSA Build L3 requires isolation between builds, including protection against influence from other builds and cache poisoning. A network-isolated rebuild is a useful additional control for the re-run. Assess the full build platform separately before claiming a SLSA level.

Give each runner a write identity scoped to its own output slot. Give the comparator read access to both slots and a separate identity that can issue the comparison receipt. That prevents a runner that can publish its own artifact from overwriting the other artifact or signing the decision on both. Verify those permissions from the runner identities, including indirect grants through service roles.

Figure 1 — Illustrative design. Verified inputs feed each workspace, and each workspace writes to its own output slot. The paths join at the comparator, which reads both outputs and signs the receipt.

Distinguish a verified blob from a verified build action

A remote cache can pair an action cache, which maps action keys to result metadata, with a content-addressable store, which holds the referenced blobs. Verifying a blob digest checks the downloaded bytes against that reference. The action record must separately justify why those bytes belong to this invocation. If the action key omits an effective input such as a host-provided compiler flag, two different invocations can alias under the same key without any cryptographic hash collision. A wrong cached result can then pass every blob-integrity check.

Audit the key against the input tree, command, environment, and toolchain or execution platform. In a controlled fixture, change one suspected omitted input and compare the reported keys and cache-disabled results. First establish that each input setting produces a stable output. If the output changes between settings while the key stays fixed, the key cannot distinguish results that the build treats as different.

Under the illustrative re-run profile, disable local and remote action-result reads for both runners across the entire action graph. Disable incremental reuse through workspace state as well. Keep verified input blobs available for staging. Have the control plane reconcile the actions that contribute to the artifact with per-action records of cache status and execution. Record a bypass as a bypass and a lookup as a hit or miss. A packaging event can coexist with an upstream compile served from cache, so require a bypass and an execution event for every contributing action.

Check retrieval separately. For a shared base-image registry, record the selected platform manifest digest and verify the referenced image config and layers against the expected manifest. Have each runner stage the inputs from a pre-staged copy while the registry is unavailable to see whether either path still depends on it. For package mirrors, record the actual serving endpoint and upstream origin where observable. Re-fetch locked inputs with fallback disabled and check both response digests and origin logs. Distinct mirror names can route to the same upstream. If that upstream is opaque, record the dependency as unresolved and use the verified offline snapshot for the rebuild.

Follow a cache hit through the ZP11 gate

Consider a hypothetical package built by a single packaging action from staged inputs. Runner A runs with action-result reads disabled and produces digest D. Runner B starts with reads enabled and reports D from a remote cache hit without executing the action. Under the illustrative re-run profile, the gate excludes that attempt. B retries from a fresh workspace with reads disabled, executes the action, and produces D.

All attempts use the same input-manifest digest M and action key K. These and D are symbolic labels. Record the run and action identifiers, build-image digest, verified staged inputs, effective network and cache policies, workspace isolation, and writer identity. For A and B’s retry, the cache decision is a bypass and the control plane records a completed action. For B’s original attempt, the record includes the hit against K, the cache service and namespace, and the result’s producer run when available.

Figure 2 — Illustrative worked example (hypothetical package). The attempts share manifest M, action key K, and output digest D. The original B attempt hits the cache and lacks an execution event, so only A and B’s retry qualify.

Freeze each selected output at a version the comparator can read by digest so a retry cannot change the bytes behind the same output reference. Collect execution events from the runner control plane and bind them to the output digest. A flag saying the cache was disabled records intent. The execution event and its output binding let the comparator verify what the runner did.

The comparator selects A and B’s retry and signs a re-run receipt naming M, both run IDs, the digests of their execution records, the compared output digests, the comparison method, and the verdict. Use the Proof-Pack receipt binding. The gate authenticates the comparator and checks the recorded isolation and execution against the illustrative re-run profile. Missing action evidence keeps the gate closed even when the digests agree.

Trace differences to the actions that produced them

Preserve both artifacts and execution records. Compare the declared inputs first so an image or recipe difference can be resolved before inspecting output bytes. Use diffoscope to unpack nested artifacts and list the differing components. Use the action graph to trace the earliest-produced differing component to its writer and check its effective inputs. If independent branches diverged, start with the earliest divergence in each branch.

Use the Reproducible Builds project’s SOURCE_DATE_EPOCH convention to supply a declared source-derived timestamp to tools that support it. Fix archive member ordering and permissions, set locale explicitly, and map build paths when debug metadata captures workspace names. If a tool requires post-processing, define the normalization rules and apply them symmetrically. Retain the raw artifacts and record raw digest equality separately from any comparison over normalized bytes.

Triage failed re-run checks under five categories. A staging failure goes to the retrieval path before byte comparison can begin. Once both artifacts exist, follow the earliest supported divergence and keep downstream symptoms in the record. A changed archive digest, for example, can be the last visible effect of a host file read during compilation.

Cause Evidence to inspect Repair
Declared input difference Resolved manifests and build-image digests from both runs Stage the same locked inputs before repeating the comparison
Undeclared input Workspace and process access records for the action that produced the divergence Declare and pin the input or remove the runner's access to it
Nondeterministic behavior Action records and intermediate outputs from fresh executions with fixed inputs Control the source of variability, such as archive member enumeration order
Retrieval failure Registry or mirror logs and the staged-input record Restore staging from a verified copy and repeat digest verification
Verification defect Comparator selection and the expected artifact role in a multi-artifact output Correct the selection rule and recheck the preserved versions

Spend diversity where it changes the evidence

For routine release checks, keep the toolchain fixed and pay for fresh action execution. Pre-staging identical read-only dependencies can save download time without reusing computed outputs. Measure cold execution and input staging separately. Their costs point to different optimizations, and shortening the critical path by restoring the designated action’s result would remove the evidence the gate pays to obtain.

For a suspected compiler compromise, turn to David A. Wheeler’s diverse double-compiling procedure. Build the compiler’s parent from source with a separately trusted compiler, then use that result to build the compiler under test from its source. Under the procedure’s assumptions, a bit-for-bit match between the second-stage binary and the compiler under test supports correspondence between the compiler binary and its claimed source. Run that check where compiler trust changes, such as at toolchain adoption or upgrade. If the experiment instead builds an application with different compilers, compare explicitly defined properties, such as the exported ABI and observed behavior on a declared test corpus. Report the scope of that comparison separately from byte-level reproducibility and from diverse double-compiling.

Approve the re-run when each output has its own verified execution history and the comparison passes under the agreed inputs. Record the shared compiler and input suppliers in the Proof-Pack. If the release decision depends on ruling out a failure in one of those shared dependencies, require evidence that varies that dependency before accepting the verdict.