Repository navigation
feat(plugin-audit): mark in-product AI writes on sys_audit_log rows (agent, conversation, confirmation) - #34547
Conversation
…and confirmation on sys_audit_log rows Claude-Session: https://claude.ai/code/session_01ADHkmSQnLEs6vGofJXcguE Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmSQnLEs6vGofJXcguE Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmSQnLEs6vGofJXcguE Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 2 package(s): 2 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 1 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 176 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 8b13c4f046c6854a5bc3ca41e5fb59f6783a386f && git checkout 8b13c4f046c6854a5bc3ca41e5fb59f6783a386f
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 066177b80fd6a444e3fc44a23cb6b818d2407399 24233e955c33ee77052d41ad1e7acdadc37f2368 && git checkout -B drift-repro 066177b80fd6a444e3fc44a23cb6b818d2407399 && git merge --no-ff 24233e955c33ee77052d41ad1e7acdadc37f2368
node scripts/docs-audit/affected-docs.mjs --json 066177b80fd6a444e3fc44a23cb6b818d2407399
|
|
repo:objectstack#2 · os-steve · session_01ADHkmSYVw1sqCsaHSJS9JC Final head for L1 and contract review · 2026-11-17T01:07Z |
|
l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq Contract-review-claim: session_01ADHkmP44onN8RMzsPMqjRq · head 768136c · 2026-11-17T01:08Z |
|
repo:objectstack#2 · os-steve · session_01ADHkmSmxJiAWk7fuq3Q1Sf 席位核对L1 verdict: ACCEPT · card #33694 · area o2-B · first review · read at 2026-11-17T01:09Z Checklist, read against GitHub and the head tree, not against the report:
L2 owed: yes, at Landing tier. |
|
l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq Contract reviewServed-tier: ① Derived judgmentsInputs read: card #33694 (body and all 5 comments), PR #34547 (body, 8-file list, net diff against merge-base 0c7869c, comments), and the 72 check-runs on this head: every one is completed, success or skipped by path filter, none red and none pending.
② Semver levelChangeset ③ Boundary flags
④ Design judgment
S1 (should-fix) — the contract does not tell a reader of
N1 (nit) — when one envelope carries both No must-fix. One should-fix (S1) is open on this head; landing waits on its fix and the delta record. Implemented-by: VERDICT: PASS |
…e the in-product agent, and state how a reader tells the two performed_by kinds apart Claude-Session: https://claude.ai/code/session_01ADHkmSQnLEs6vGofJXcguE Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmSQnLEs6vGofJXcguE Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#2 · os-steve · session_01ADHkmSYVw1sqCsaHSJS9JC Final head for L1 and contract review, patch round 2 · 2026-11-17T02:17Z |
|
l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq Contract-review-claim: session_01ADHkmP44onN8RMzsPMqjRq · head 8cc2192 · 2026-11-17T02:18Z |
|
repo:objectstack#2 · os-steve · session_01ADHkmQtnGcx7hYEL11ptVs 席位核对L1 delta (patch round 2): ACCEPT · PR #34547 · card #33694 · area o2-B · L1-a2 · 2026-11-17T02:19Z Head-sha: Previous L1: ACCEPT 6934586781 at What moved (read in git, not from the report)
Delta checklist
Nit, not blocking (for the L2 delta to weigh)The L2 and landing
|
|
l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq Contract reviewServed-tier: ① Derived judgmentsDelta review (record 6934640918: PASS, should-fix S1, nit N1) of the change from head 768136c to this head. Inputs read: that record in full, PR #34547 (body, comments, final-head comment 6935915356), the lane's delta note (as an account, not as evidence), the two-head diff restricted to the PR's own files, the net diff against merge-base 7b3e955,
② Semver levelUnchanged and still right. Changeset ③ Boundary flags
④ Design judgment
What S1 asked for is on the head. The N1: closed. The two marks are keyed on the agent being the recorded performer. The precedence is stated in the contract in three places ( S2 (should-fix) — the stated rule misclassifies a row once its OAuth application is deleted.
The two new pins ( N2 (nit) — in No must-fix. S2 is open on this head; landing waits on its fix and a delta record. Implemented-by: VERDICT: PASS |
…nt_id for the OAuth client Claude-Session: https://claude.ai/code/session_01ADHkmSQnLEs6vGofJXcguE Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmSQnLEs6vGofJXcguE Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#2 · os-steve · session_01ADHkmSYVw1sqCsaHSJS9JC Final head for L1 and contract review, patch round 3 · 2026-11-17T03:42Z |
|
l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq Contract-review-claim: session_01ADHkmP44onN8RMzsPMqjRq · head 24233e9 · 2026-11-17T03:43Z |
|
repo:objectstack#2 · os-steve · session_01ADHkmQtnGcx7hYEL11ptVs 席位核对L1 delta (patch round 3): ACCEPT · PR #34547 · card #33694 · area o2-B · L1-a2 · 2026-11-17T03:43Z Head-sha: Previous L1: delta ACCEPT 6935956323 at What moved (read in git; no main merge this round)
Checklist
Nit for the L2 delta to weigh (not blocking, not filed)The new text says "a value matching the L2 and landing
|
|
repo:objectstack#2 · os-steve · session_01ADHkmQtnGcx7hYEL11ptVs 席位核对 · correction to 6937556832Head-sha: Retracted: the Landing section of 6937556832, which said "the area lands it, no human approval is needed". Corrected: this PR touches The L1 verdict itself (ACCEPT) is unchanged. |
|
l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq Contract reviewServed-tier: ① Derived judgmentsDelta review (record 6936045381: PASS on head 8cc2192, S1 and N1 closed, S2 and N2 open) of the change from head 8cc2192 to this head. Inputs read: that record and the first record 6934640918 in full, every PR #34547 comment (including final-head comment 6937522222 and the L1 delta record 6937556832), the area's round-3 note (as an account, not as evidence), the two-head diff restricted to the PR's own files, the two spec files, the three generated pages and
② Semver levelUnchanged and still right. The changeset is byte-identical: ③ Boundary flags
④ Design judgmentS2: closed The sentence that was false is gone from every place it stood ("any other value is an in-product agent name", and "their absence does not mark a client row" with it). Read against the tree at this head, the replacement sentences:
N2: closed The JSDoc "Action name produced from a HookContext.event string" heads N3 (nit) — the text does not say which reading wins when both tells apply. Raised by the L1 delta record 6937556832 and judged here on the tree. If an agent name equals the No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#2 · os-steve · session_01ADHkmQ2SN4K183oqAvUajA Seat record · 2026-11-17T03:49Z · Head-sha: 24233e9 The PR body's 速读 says "需要你做的:无,席位落地". This record replaces that line. The PR changes 维护者速读
席位意见:同意合并。契约说明写得如实:它点名了单看一行分不清来源的几种行(已删除的 OAuth 应用写的行,以及产品内既无对话号也无确认号的行),没有夸大写入器的保证。契约审核建议问一句「是否要求每一行永久可分」,席位这次不立决策卡:目前没有实测的拉动,契约已经如实写明残余。真有管理员要追查已删除应用写的行时再提。 席位核对
|
|
repo:objectstack#2 · os-steve · session_01ADHkmQ2SN4K183oqAvUajA Tier H hand-off, written at 2026-11-17T03:50Z. This is a spec face (describe text), so it goes to a human approver. The seat record is pinned to head |
Requested by Steve · project thread
Fixes #33694
Clause-②: no
Metadata-protocol: none
维护者速读
performed_by)、替谁(on_behalf_of)、在哪次对话(conversation_id)、经哪次确认(confirmation_id,没确认就不写)。user_id/actor仍是本人,人手改的行不变;回滚即撤本 PR,历史行不受影响。packages/plugins/plugin-audit/src/audit-writers.ts(performedBy取值与 metadata 拼装两处)、agent-dual-attribution.integration.test.ts末尾新增的 describe、packages/spec/src/kernel/execution-context.zod.ts的 describe 改句。pnpm --filter @objectstack/plugin-audit exec vitest run src/agent-dual-attribution.integration.test.ts,预期 15 条全绿,其中 6 条是本卡新用例。What changes
audit-writers.tsread onlyprovenance.performedByClientId(the /mcp OAuth client). It now also readsprovenance.performedByAgentId,performedByConversationIdandperformedByConfirmationId, whichbuildProvenancealready copies fromExecutionContext.performedBy(spec(kernel/data): let a server-constructed in-product AI path set ExecutionContext.performedBy / HookContext.provenance (AI on behalf of a person, conversation id, confirmation id), and amend the ADR-0090 D10 rule 4 "/mcp OAuth door only" reading #33786, PR feat(spec, objectql, runtime): the in-product AI path can name itself on ExecutionContext.performedBy, and hooks see it on HookContext.provenance #34018). On a row the in-product AI wrote for a person,sys_audit_log.metadatacarries:performed_by: the agent, besideon_behalf_of: the person (the existing pair, per the owner ruling on objectstack-ai/cloud#3826 「3826 照建议(征询版)」: reuseperformed_by/on_behalf_of, no new actor vocabulary);conversation_id: the AI conversation;confirmation_id: the pending item the person's approval decided, only when there was one.user_idandactorstay the person (ADR-0073 D3, ADR-0118 D1/D5). A personal write still carries no metadata.conversation_id/confirmation_idare written only when the in-product agent is the recorded performer, never beside an OAuth client id. If an envelope ever carried bothclientIdandagentId(each producer sets only its own), the row records the OAuth client and drops the agent with its two marks.ExecutionContext.performedByandHookContext.provenance.performedByAgentId/performedByConversationId/performedByConfirmationIddescribes and JSDoc no longer say the audit writer "does not record them yet". They name the metadata keys; say thatperformed_byholds either an OAuth client id or an in-product agent name, and state only what a reader can tell from a row: a value matching theclient_idof an existingsys_oauth_applicationrow is an OAuth client; a row carryingconversation_idorconfirmation_idnames an in-product agent; a row meeting neither may name an agent or the client of a since-deleted application, which the row alone cannot tell apart; and the contract does not keep an agent name and aclient_idfrom being the same string; state the both-performers precedence; and say the action-invocation, data-export and dataset-query rows still recordclientIdonly. TheperformedByJSDoc's "no key holds two id namespaces" sentence now names the audit key as the ruled exception. No schema shape change;content/docs/references/**regenerated (gen:docs)..changeset/33694-audit-in-product-ai-performer.md:@objectstack/plugin-auditpatch,@objectstack/specpatch (describe text ships).Why
The in-product AI writes as the signed-in person, so its rows were byte-identical to that person's own edits on every attribution column. The contract fields that tell them apart landed in #33786; nothing recorded them.
Tests
New top-level describe in
packages/plugins/plugin-audit/src/agent-dual-attribution.integration.test.ts(the existing rule 4 harness: real kernel,assembleExecutionContext, objectqlbuildProvenance, the shippedsys_audit_logobject and writer on sqlite-wasm). The person's envelope is built at the real door;performedByis added as the in-product AI path stamps it (that producer lives outside this repository).humanprincipal with noperformedBy, anduser_id/actorare the person on all four rows.{ performed_by, on_behalf_of, conversation_id, confirmation_id }.confirmation_id.{ performed_by: client, on_behalf_of }.The last two envelopes have no producer in the tree; they pin what the spec tells a reader.
No existing test changed.
Acceptance notes
performed_by.performed_bynow holds an OAuth client id or an in-product agent name, as the ruling chose (accepted in contract review 6934640918). Round 2 answered its S1: the writer keysconversation_id/confirmation_idon the agent being the recorded performer (which also closes N1). Round 3 answers S2 (6936045381): the describes no longer claim every value is classifiable, since an OAuth application row can be deleted while audit rows keep itsclient_id; a permanent per-row discriminator would need a kind mark on the row, which is a ruling, not this PR. ADR-0151 D5 reason 2 and ADR-0090 D10 rule 4 wording stay with carrier docs/adr: ADR-0090 D10 rule 4, ADR-0151 "Leaves unchanged" and the 2026-09-20 one-key note still describe ExecutionContext.performedBy as the OAuth client only; #33786 adds the in-product AI performer #34057.action-invocation-audit.ts,data-export-audit.ts,dataset-query-audit.ts) readperformedBy.clientIdonly, so an in-product AI action run or export is still recorded as the person's own. The describes now say so.clientId/performedByClientIddescribes now name the OAuth client by theclient_idof itssys_oauth_applicationrow (they said the row's id; the two columns differ).content/docs/automation/hook-bodies.mdxlistsctx.provenance.performedByClientIdonly; outside this card's file surface. Filed audit: action-invocation, data-export and dataset-query rows record only performedBy.clientId for in-product AI calls #34556.Verification
Local runs (head and gate list in the report comment on #33694)
pnpm --filter '@objectstack/plugin-audit^...' buildunder the verify lock: exit 0.pnpm --filter @objectstack/plugin-audit exec vitest run src/agent-dual-attribution.integration.test.ts: Test Files 1 passed, Tests 15 passed.pnpm --filter @objectstack/plugin-audit test(after merging main): Test Files 101 passed, Tests 1676 passed.pnpm --filter @objectstack/plugin-audit typecheck: exit 0, test-typecheck 0 errors.pnpm --filter @objectstack/spec exec vitest run src/kernel/execution-context.test.ts src/data/hook.test.ts: Tests 146 passed.pnpm --filter @objectstack/spec build && check:generated:content/docs/references/**stale, regenerated with--fix, re-check green.scripts/ablation-replace.mjs, anchor hit 1 → 0):performedBy = performedByClientId ?? performedByAgentId→performedByClientIdreds the three AI-row tests (3 failed / 10 passed); restore blob == HEAD,git diff HEADempty.agentIsRecordedPerformer = !performedByClientId && performedByAgentId !== undefined→performedBy !== undefinedreds the two new pins (2 failed / 13 passed); restore blob == HEAD,git diff HEADempty.Human Minimum
packages/specholds no runtime logic.pnpm lintpasses (CI).main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code