﻿# Historical OPA replay needs the state that the decision actually observed

A saved policy revision cannot reproduce changing time or external inputs. Check decision-log replay coverage before explaining an enterprise AI access decision.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/enterprise-ai-opa-historical-decision-replay-input-coverage/
Language: en

## Ask a historical question explicitly

An enterprise assistant was permitted to export a report. During review, the same policy revision now denies a seemingly identical request because a temporary entitlement or time window has changed. The later result does not prove that the original evaluator was wrong. Decide whether the investigation asks what should be allowed now or what the original decision observed. Those questions require different state and must remain separate in the incident record.

## Identify the recorded evaluation and its dependencies

The [decision-log reference](https://www.openpolicyagent.org/docs/management-decision-logs) describes query input, result, decision identity and bundle metadata. Preserve that association with the relevant external operation. Inventory the policy’s data dependencies as well: supplied input is not necessarily the whole evaluated world. A current directory lookup cannot stand in for the historical entitlement state. Record whether that state is retained as an approved snapshot, a versioned dependency or an unresolved gap, without assuming bundle revision covers every external fact.

## Account for time and nondeterministic observations

The [time built-ins documentation](https://www.openpolicyagent.org/docs/policy-reference/builtins/time) says time.now_ns returns the same value within a single evaluation. That does not freeze its value for a later investigation. The [configuration reference](https://www.openpolicyagent.org/docs/configuration) makes nd_builtin_cache opt-in, capturing nondeterministic builtin observations for decision logs. Verify the evaluator’s effective configuration and the recorded input/output mappings before describing a replay as equivalent. A setting planned in a deployment file is weaker evidence than the actual event retained by the receiver.

## Check coverage after the log leaves the evaluator

OPA documents a size-bounding path that drops nd_builtin_cache when its inclusion cannot fit the upload bound. A received decision event can therefore retain its result while lacking the observations required for faithful replay. Masking and retention may remove other required evidence deliberately. Mark coverage explicitly and keep the original outcome authoritative as a historical observation; do not invent missing builtin responses or call a present-day reevaluation a recovered original execution.

## Design a replay-coverage fixture

Use a controlled policy whose decision depends on a temporary time window and an external fixture value. Retain an evaluation record, then change the clock and fixture. Compare a historical reconstruction with a clearly labelled current-state evaluation, and repeat with replay observations intentionally absent. Acceptance requires the system to distinguish the outcomes and report insufficient coverage honestly. No policy evaluation, network call or forensic replay was executed here; this is a proposed verification procedure.

## Keep investigation from creating new authority

[Per-invocation tool policy](/journal/practically-secure-agent-tools-static-effects-per-invocation-policy/) concerns enforcement at the effect boundary. [Reproducible stacks](/journal/software-stack-reproducibility/) preserve the evaluator environment. A replay can explain a historical decision under retained evidence; it does not authorize a fresh export under old permissions. Isolate reconstructed dependencies from live tool execution, protect sensitive inputs and state the missing evidence. The useful result is a bounded explanation, including when exact reconstruction is impossible, rather than a newly manufactured approval.
