A Trace Is Not an Audit Record: Bind Approvals to Spans
A span describes one instrumented operation; a trace groups them. Neither proves an external side effect occurred (OpenTelemetry traces). A trace can show a tool call was attempted without showing who approved it or whic
A span describes one instrumented operation; a trace groups them. Neither proves an external side effect occurred (OpenTelemetry traces). A trace can show a tool call was attempted without showing who approved it or which prompt revision produced it. That gap bites at handoff, when a run leaves its operator for someone else's queue.
W3C PROV-DM has vocabulary for the missing part. An activity uses an input entity and generates an output entity; an association names the agent responsible for the activity (PROV-DM). The association is the accountability relation; PROV records lineage, not correctness. SLSA provenance is narrower: build-artifact production, not runtime behavior (SLSA 1.2). Neither gives you an approval trail; you attach it.
Steps
Fix the boundary first: one agent run, one handoff record, keyed by trace ID. Wider becomes a retention argument; narrower cannot answer "what changed".
Then write three relations per mutating tool span at execution time, not query time: usage of the input entity (prompt revision hash, context IDs), generation of the output entity (diff, path, command result), and an association to an accountable person — an approver ID, or an explicit pending marker when none exists.
Illustrative record shape, not a produced artifact:
{"trace_id":"t-9f2","span":"write_file","input_rev":"p-31c",
"output_digest":"sha256:...","approval":"pending","owner":"u-118"}
approval and owner are separate on purpose. "No approver recorded" and "approver recorded as absent" are different facts, and only the second is a decision.
Test
Take a handoff record whose only mutating span carries approval: pending. A reviewer should state from that record alone that the action is unapproved and who owns the decision. If that needs the trace UI, the record is incomplete — add the association, not the link.
Then probe the blind spot: an agent that shells out or calls a second service may emit spans your writer never sees, and no query over recorded entities finds them. Reconcile from the other side — compare the tool's own side-effect list with your spans, and treat any effect without a matching span as unapproved.
This replaces neither code review nor access control; it makes the handoff decision auditable, nothing more. If runs never leave one operator, the record is overhead.
This article was created with AI assistance.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.