Human Approval and Control Boundaries › The approval record: what the system must bind
Language AI HandbookAll chapters An approval should answer enough questions for a disconnected worker to check it again later. Here the scope is a tuple of project, destination, and effect. The intent adds a requester, a stable operation key, and the exact artifact bytes. In a real release, a worker can fetch bytes from an immutable store and compare their digest immediately before executing. A path, filename, or editable document URL alone leaves open which version the worker will see.
- Requester. Record the authenticated principal requesting the operation and compare it with the principal reaching the execution boundary.
- Scope. Specify the project, destination, and effect rather than the name of the assistant or the topic of the conversation.
- Artifact. Present the version the person will approve and fingerprint the exact bytes used for execution.
- Decision and approver. Store approval or denial with the authenticated principal authorized for the scope.
- Time. Store issuance, approval expiry, and any earlier scope deadline. Use the earlier upper bound for this operation.
- Operation key. Allocate one key per intended effect; a retry of the same effect reuses the same key.
The digest here is a SHA-256 fingerprint computed over an unambiguous ordered JSON array. It includes a digest of the immutable artifact. The trusted broker stores the resulting approval in its own memory rather than relying on a digest supplied by the assistant. A fingerprint verifies byte relationships between two records when serialization agrees. Actor authentication, authorized issuance, and storage integrity require separate controls. A service that accepts approvals across a trust boundary needs a transport and credential design of its own.
The notebook passes trusted fixture times as integer seconds. Calls always check the current broker state, so supplying an earlier time does not recover a historical state. A deployed worker needs time from a trusted clock at the authorization check. When the stated approval and scope windows differ, the operation is eligible only before their minimum. The exact instant of expiry is excluded. A paused job that resumes before both deadlines may proceed if its approval and ownership are still current. A paused job that wakes after the deadline needs renewed authority.
PythonIn [6]Expand
import json
from dataclasses import dataclass, replace
from hashlib import sha256
@dataclass(frozen=True)
class Scope:
project: str
destination: str
effect: str
@dataclass(frozen=True)
class Intent:
requester: str
request_key: str
scope: Scope
artifact: bytes
def __post_init__(self):
if type(self.scope) is not Scope or type(self.artifact) is not bytes:
raise TypeError("Provide a scope and immutable artifact bytes.")
fields = (
self.requester,
self.request_key,
self.scope.project,
self.scope.destination,
self.scope.effect,
)
if any(type(value) is not str or not value.strip() for value in fields):
raise ValueError(
"Identity, key and scope fields must be nonempty strings."
)
def artifact_digest(self):
return sha256(self.artifact).hexdigest()
def digest(self):
fields = [
self.requester,
self.request_key,
self.scope.project,
self.scope.destination,
self.scope.effect,
self.artifact_digest(),
]
return sha256(
json.dumps(fields, ensure_ascii=True).encode()
).hexdigest()
@dataclass(frozen=True)
class Approval:
intent: Intent
intent_digest: str
approver: str
issued_at: int
expires_at: int
scope_expires_at: int
decision: str
@dataclass(frozen=True)
class Receipt:
intent_digest: str
artifact_digest: str
approval_id: int
approver: str
committed_at: int
@dataclass(frozen=True)
class Result:
status: str
receipt: Receipt | None = None
@dataclass(frozen=True)
class AuditEntry:
time: int
event: str
approval_id: int | None
actor: str
outcome: str
operation_key: tuple[str, str]
intent_digest: strThe receipt records the digest and approver of the committed intent. A stored approval is a decision. A receipt is evidence of the simulated effect. During recovery, a receipt lookup answers what has already happened; passing the authorization check would answer whether a new dispatch is eligible. Those operations have different inputs and should not share a single “authorized” state.
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!