AI 審計證據,第 10 部分:一次掃描,兩種發起者
AI Audit Evidence, Part 10: One Sweep, Two Initiators
KeelBase 的 AI 審計記錄顯示,每小時掃描任務關閉逾時確認時,匯出資料卻把未回應的操作人列作發起者。離線窗口預設為 24 小時且可設定;記錄目前沒有發起者欄位,文中提出新增欄位或沿用另一流程的雙欄做法,但兩者均未實作。
We build a runtime that lets AI agents take real write actions inside enterprise systems: create a record, send a call to another service. Every action carries permissions, approvals, and a record someone can review afterwards.
The last three pieces were about what a record answers: a status is not a receipt, an interval is not coverage, one word can stand for two pasts. This one is about a single column in the export — the one headed "Initiated by". A record can be complete about what happened and still name the wrong person as having done it.
1. A reader fixed the vanishing; the author is still wrong
A reader described their own system:
when an agent gave up waiting for a person's approval, the call simply vanished from the record, so "never asked" and "asked, but no answer" looked the same. Now every attempt gets its own entry, including the ones that never ran.
The fix is right, and it is our shape too: a call whose wait ran out still happened — to the person waiting for it — so it needs a row. Once it has one, "nobody asked" and "asked, no answer" are two facts instead of one blank.
Our answer said: yes, every expiry is written as its own chained row. That settled whether the row exists. It did not settle who the row is signed by — and that is the part we filled in wrong.
2. One sweep, two rows, two authors
When a confirmation request gets no decision inside its offline window (24 hours by default, configurable), an hourly sweep flips it to timeout and writes one audit row per expiry (confirmation.store.ts:507-545 flips each row by its own conditional update and returns the rows it actually flipped; maintenance-tasks.service.ts:123-130 calls it).
The row is written like this (maintenance-tasks.service.ts:141-147):
userId = the operator — the person who made the original call;
username = a snapshot of that person's name;
no agentId (a scheduled task has no request-scoped actor to inherit one from);
authorization, arguments and basis are carried; the authorization cell reads "window expired without a decision".
Another automatic action in the same system is written differently. When a hold is released because the target itself answered, the sweep records userId as system:sweep (write-claim-decision.service.ts:297-300), with the original writer named in detail — "who initiated" and "as whom" are two fields on that path.
The export's "Initiated by" column is derived from three fields only (audit-export-vocabulary.ts:268-281): a row with a name is labelled by whether the action is human-only; a row with no name whose id sits in the system: namespace is labelled "Automated".
One hourly sweep on the left. Row A, a claim_release: userId = system:sweep, no name, no agent — the export prints "Automated". Row B, a tool_confirmation flipped to timeout: userId = alice, username = Alice, no agent — the export prints "Alice (through the AI assistant)". Footer: same cron, same minute; the result column is right on both rows, the initiator column is right on one.
Figure 25 - One sweep, two initiators
So in one sweep, in the same minute, the export shows two rows:
- the release row — initiated by Automated;
- the expiry row — initiated by Alice (through the AI assistant). Alice had not opened the approval centre that day.
3. The result column is right; the initiator column is not
The expiry row's authorization cell is honest: "window expired without a decision" (audit-export-vocabulary.ts:231-233). The author cell is not: it assigns an act performed by the scheduler to the person who never responded.
A concrete case. The process dies inside the in-stream wait; Alice closes her laptop and never opens the pending list again. A day later the sweep closes the request and writes the row. Alice's own trail now contains an action she never took; any view that filters or counts by initiator has it under her name.
A reader who reads the authorization column knows the truth. A reader who reads only the initiator column — or counts by it — does not.
4. Why the column cannot simply be fixed
The direct fix is to write system:sweep into the expiry row, matching the release path. But userId carries a second job on the same table: scope. A non-admin reader sees only rows where userId is their own (audit-reader-scope.ts:93-110). Recording the sweep there would make the row honest about its author and silent to the person it is about — the expiry would leave Alice's own trail.
So the row needs to hold two facts at once: who initiated it, and whose business it is. The release path already does this. The confirmation path was written earlier, when there was one field, and the field was filled with the person.
Neither fix exists yet: add an initiator field to the audit row and have the export prefer it, keeping userId as "who this is about"; or follow the release path's shape, with the subject carried beside the initiator. Which one is secondary is a question for whoever acts on that column alone.
5. The gap
Today the audit row has no initiator field. The export infers authorship from three fields that all describe the person, and the inference rule is not wrong — for an approve or decline row it is right. For an expiry row it signs a non-act to a person.
That is the gap: field, migration, write path, export and console are all still to do. This piece records the current state, not a plan.
The question
When a request nobody answered is closed by a sweep, who should the record sign?
Is "Automated" enough for the initiator column — or should an automatically closed action have no initiator at all, with the person it is about given a column of their own, whose name says exactly that?
The implementation described here comes from the open-source project KeelBase:
https://github.com/rain6fish/KeelBase
Drafted with an AI assistant. The system, the positions and the mistakes are mine.
來源:DEV Community · dev.to
