Evaluation Governance › Audit Trails and Incident Corrections
Language AI HandbookAll chapters A ledger and a gate are only as good as the ability to reconstruct who decided what, and why. An audit trail records every action on the governance system: release creation, gate evaluations, privacy reviews, lifecycle transitions, and corrections. Because the ledger is append-only and the gate is a pure function of a release, the audit trail is largely derived: for a release, you can replay every gate evaluation and see when it flipped. But some actions are external (a human overrode a block, a reviewer signed off), and those must be appended explicitly.
To reconstruct a past gate result, retain the policy version and the state and evidence used at the time. Record that a decision occurred along with its reasons. The exercise stores detached event records in memory and illustrates only the listed fixture decisions.
The two external actions that matter most:
- Override: a designated reviewer may override a gate block, but only with a written justification and an identity. An override that is later found wrong is itself an incident.
- Incident correction: a new release
supersedesan old one, with an incident record describing what was wrong and what was done.
An organization may define a separate exception policy with required authority, reason, and audit retention. This example has no override. An active flag on the same snapshot remains attached to a metadata-only correction.
Let's build a minimal audit log and an incident record, then show a correction as a new release that supersedes the old one and shows up in history.
PythonIn [24]Expand
@dataclass
class AuditEntry:
action: str
release_id: str
actor: str
detail: dict
at: str = field(default_factory=now_iso)
entry_id: str = field(default_factory=example_id)
class AuditLog:
def __init__(self):
self._entries: list[AuditEntry] = []
@property
def entries(self):
return tuple(deepcopy(self._entries))
def record(self, action, release_id, actor, **detail):
if not actor.strip():
raise LedgerError("record an actor")
entry = AuditEntry(action, release_id, actor, deepcopy(detail))
self._entries.append(entry)
return deepcopy(entry)
def for_release(self, release_id):
return tuple(
entry for entry in self.entries if entry.release_id == release_id
)
def make_correction(
old: Release,
reason: str,
corrected_score_notes: str,
actor: str,
ledger: ReleaseLedger,
audit: AuditLog,
*,
new_benchmark_version=None,
new_score=None,
reviewed_flags=None,
) -> Release:
if not reason.strip() or not actor.strip():
raise LedgerError("record a correction reason and actor")
old = ledger.get(old.release_id)
version = new_benchmark_version or old.benchmark_version
if version != old.benchmark_version and new_score is None:
raise LedgerError("a changed benchmark snapshot requires a new score")
if reviewed_flags is not None and (
version == old.benchmark_version or new_score is None
):
raise LedgerError(
"replacing flags requires an explicitly rescored benchmark snapshot"
)
successor = replace(
old,
release_id=example_id(),
created_at=now_iso(),
benchmark_version=version,
score=old.score if new_score is None else new_score,
gaming_flags=deepcopy(
old.gaming_flags if reviewed_flags is None else reviewed_flags
),
reporting_status="withheld",
supersedes=old.release_id,
superseded_by=None,
notes=corrected_score_notes,
)
ledger.add(successor)
audit.record(
"correction",
successor.release_id,
actor,
reason=reason,
supersedes=old.release_id,
benchmark_version=successor.benchmark_version,
)
return successorThe correction records a successor, actor, and reason. The current view of the original reports its successor and a restricted status, while the original snapshot keeps the original status. This example corrects a description of the scoring rule. The previously recorded flags remain attached.
ConsoleOut [25]Expand
original status: restricted
original superseded_by: demo-0006
chain: ['demo-0001', 'demo-0006']
release_created actor=eval-bot {}
gate_evaluation actor=gate-v0 {'decision': 'withheld', 'reasons': ['exact_overlap_contamination', 'repeat_submission_tuning']}
correction actor=reviewer-alice {'reason': 'clarify how the unchanged score was computed', 'supersedes': 'demo-0001', 'benchmark_version': '1.0.0'}The first ID in the chain is the original. The last is the correction. An auditor can inspect the original snapshot, review the common protocol, and trace the note that motivated the successor.
A retry cannot write another release with the same ID. Run the next block to see the duplicate rejected. In a durable store, enforce uniqueness and update the successor index in the same transaction.
The next call attempts the same insert again to demonstrate the unique-key check.
ConsoleOut [26]Expand
rejected duplicate insert: release_id collision
The duplicate is rejected before the record list changes. The caller can look up the existing ID and inspect its recorded state. The toy ledger uses detached copies for records; a production store needs durable access control and retention policies as well.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!