Skip to content

fix(plugin-audit): mark in-product AI calls on the action-invocation, data-export and dataset-query audit rows - #34679

Merged
os-zhuang merged 10 commits into
mainfrom
claude/issue-34556-audit-ai-marks-three-rows
Nov 17, 2026
Merged

os-zhuang merged 10 commits into
mainfrom
claude/issue-34556-audit-ai-marks-three-rows

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread
Fixes #34556

Clause-②: no
Metadata-protocol: none

Spec surface: since round r2 this PR touches packages/spec/src (describe and JSDoc prose only, no key, type or refine), so it owes an L2 contract review and the seat's Tier H step before it lands.

维护者速读

  1. 改了什么:产品内 AI 替某人执行动作、导出数据、查询数据集时,这三类审计行现在和记录写入行一样,写明是哪个 AI(performed_by)、替谁(on_behalf_of)、在哪次对话(conversation_id)、经哪次确认(confirmation_id,没确认就不写)。spec 里描述这件事的说明文字同步改正(只改文字,不改字段)。
  2. 为什么改:之前这三类行只认 OAuth 客户端,产品内 AI 做的动作、导出、查询在审计日志里和本人亲手操作一模一样,查不到是哪次 AI 对话、哪次确认触发的。
  3. 风险与回滚:只在 metadata 里加键,user_id / actor 仍是本人;OAuth 客户端的行和本人亲手操作的行不变。四类行现在共用一个规则函数,记录写入行的行为不变(原有 15 条钉子测试全绿)。回滚即撤本 PR,历史行不受影响。
  4. 先看:packages/plugins/plugin-audit/src/audit-writers.ts(新的 auditPerformerMetadata 与记录写入处的调用)、packages/spec/src/kernel/execution-context.zod.ts(performedBy 的 describe 与 JSDoc 改句)、三个写入器各自的一行接线与三个测试文件末尾新增的 describe。
  5. 两分钟验证:pnpm --filter @objectstack/plugin-audit exec vitest run src/action-invocation-audit.test.ts src/data-export-audit.test.ts src/dataset-query-audit.test.ts src/agent-dual-attribution.integration.test.ts,预期 4 个文件 62 条全绿,其中 9 条是本卡新用例。
  6. 需要你做的:本 PR 改了 packages/spec/src 的说明文字,契约复审(L2)通过后按席位的 Tier H 流程由你确认落地。

What changes

  • One performer rule for every sys_audit_log writer. PR feat(plugin-audit): mark in-product AI writes on sys_audit_log rows (agent, conversation, confirmation) #34547 wrote the in-product AI rule inline in the record-write writer (installAuditWriters), reading HookContext.provenance through a private reader. This PR moves that rule, unchanged, into one exported function in audit-writers.ts, auditPerformerMetadata(performer, onBehalfOf), which takes the ExecutionContext.performedBy shape (clientId, agentId, conversationId, confirmationId) and returns the metadata keys or nothing. The record-write writer now calls it with its four provenance marks. The rule is the one feat(plugin-audit): mark in-product AI writes on sys_audit_log rows (agent, conversation, confirmation) #34547 settled:
    • performed_by is the OAuth client, else the in-product agent; on_behalf_of is the row's own user_id value;
    • conversation_id / confirmation_id are written only when the in-product agent is the recorded performer, each only when stamped;
    • an envelope naming both performers records the OAuth client and drops the agent with its two marks;
    • no performer ⇒ none of these keys.
  • The three writers apply it. action-invocation-audit.ts, data-export-audit.ts and dataset-query-audit.ts read performedBy.clientId only. Each now calls auditPerformerMetadata(ctx.performedBy, userId) in place of its own two-key block. All three write sys_audit_log and keep metadata as one JSON text column, so no column or key is added. Their header comments now name the two marks.
  • hook-bodies.mdx. The ctx.provenance table listed performedByClientId only. It now lists performedByAgentId, performedByConversationId, performedByConfirmationId and impersonatedBy, which the hook-body sandbox already copies (packages/runtime/src/sandbox/body-runner.ts). performedByAgentId is included because the other two are defined as set beside it.
  • Spec describes (round r2). packages/spec/src/kernel/execution-context.zod.ts: the performedBy describe and JSDoc said "The action-invocation, data-export and dataset-query rows record clientId only", which this PR makes false. They now say those rows "record the performer and the two marks by the same rule". The reader rule there, and in packages/spec/src/data/hook.zod.ts's performedByAgentId describe, also takes the L2 nit N3 from record 6937613475: "where both tells apply the mark decides, and a matching value with no mark is the client unless an agent shares that string". No key, type, refine or optionality moves. content/docs/references/** regenerated (gen:docs): kernel/execution-context.mdx, data/data-engine.mdx (12 performedBy rows), data/hook.mdx.
  • Changeset .changeset/34556-audit-ai-marks-three-rows.md: @objectstack/plugin-audit patch, @objectstack/spec patch (describe text ships).

auditPerformerMetadata is exported from the module, not from the package entry (src/index.ts is unchanged), so the published API surface does not change.

Enumeration (from the card)

Tests

Each of the three describes has three cases:

  • An AI-performed call (performedBy: { agentId, conversationId, confirmationId }) records performed_by = agent, on_behalf_of = person, conversation_id, confirmation_id; user_id stays the person.
  • CONTROL: an OAuth client with a conversation and a confirmation, and an envelope naming both a client and an agent, each record only { performed_by: client, on_behalf_of } and no marks.
  • CONTROL: a person's own call carries none of the four keys.

No existing test changed. agent-dual-attribution.integration.test.ts (the record-write pins #34547 added) passes unchanged against the extracted function.

Acceptance notes

  • Round r2 (seat chose option A). The spec sentence this PR made false is corrected in this PR, as described above, instead of in a follow-up card. hook.zod.ts carried no "clientId only" claim; it is touched only to carry N3 in the third place the reader rule is stated.
  • L1 R1 (record 6941727354). The ctx.provenance table in hook-bodies.mdx now also lists impersonatedBy, which the sandbox copies (packages/runtime/src/sandbox/body-runner.ts), so every member it carries has a row. Commit f62fa7ad00, one docs line.
  • Merge probe against PR feat(spec, runtime, lint, core): a hook writes the sentences it declares in the organization's language (ctx.text) #34545 (claude/project-thread-l1nf08, which also edits hook-bodies.mdx): git merge-tree --write-tree --name-only HEAD origin/claude/project-thread-l1nf08 reports Auto-merging content/docs/automation/hook-bodies.mdx with no conflict in that file. The one textual conflict it reports, packages/spec/dropped-refinements.baseline.json, is between feat(spec, runtime, lint, core): a hook writes the sentences it declares in the organization's language (ctx.text) #34545 and main and is not in this diff. The three-ref form in the dispatch (git merge-tree --write-tree origin/main HEAD BRANCH) is not valid syntax and exits 129, so the two-ref form was used. This is a local probe with the repo's merge driver registered, not GitHub's mergeability.

Verification

Round r2, at head 5f005fb (after merging origin/main twice)
  • Commits: 49dc838adb (spec prose: the two spec files), c5eafdb182 (regenerated references), 19d92fd27e (changeset), then the merge of origin/main at 5f005fb26a.
  • pnpm --filter @objectstack/spec build under the lock: exit 0. pnpm --filter @objectstack/spec gen:docs: exit 0, three reference pages changed (14 lines). pnpm --filter @objectstack/spec check:generated: "All 14 generated artifacts are up to date", exit 0. The first attempt reported test-typecheck-debt.json with "tsc -p tsconfig.test.json failed without diagnostics": a JavaScript heap OOM under the 4096 MB default on this shared box, not staleness. It was re-run with --max-old-space-size=6144, and the later gate sweep at 4096 was green too.
  • No remaining copy of "record clientId only" in packages/spec/src or content/docs/references.
  • pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 src/kernel/execution-context.test.ts src/data/hook.test.ts: Test Files 2 passed (2), Tests 146 passed (146).
  • plugin-audit after the final merge: closure build exit 0; vitest run --maxWorkers=2 gives Test Files 101 passed (101), Tests 1696 passed (1696); typecheck exit 0.
  • Full workspace build (turbo run build --concurrency=2 --filter=!@objectstack/docs): 119 of 119 tasks successful.
  • dispatch-gates --commands derived 119 commands at this head. All ran with stdin closed and the exit taken before any pipe; all exited 0. --ran: "119 derived famil(ies) accounted for — 119 run, 0 NOT-MEASURED".

Round 1 readings below were taken at head 41a26f1134 (after merging origin/main e5336512f). The plugin-audit code has not changed since.

Build, tests, typecheck
  • pnpm --filter '@objectstack/plugin-audit^...' build under the verify lock: exit 0.
  • pnpm --filter @objectstack/plugin-audit exec vitest run --maxWorkers=2 src/action-invocation-audit.test.ts src/data-export-audit.test.ts src/dataset-query-audit.test.ts src/agent-dual-attribution.integration.test.ts: Test Files 4 passed (4), Tests 62 passed (62).
  • pnpm --filter @objectstack/plugin-audit exec vitest run --maxWorkers=2 (whole package): Test Files 101 passed (101), Tests 1696 passed (1696).
  • pnpm --filter @objectstack/plugin-audit typecheck: exit 0; check:test-typecheck: OK, 0 errors.
Ablations (scripts/ablation-replace.mjs; tests import the writers from src)

Each writer's wiring Object.assign(metadata, auditPerformerMetadata(ctx.performedBy, userId)); replaced by the old client-only reading auditPerformerMetadata({ clientId: ctx.performedBy?.clientId }, userId). Anchor 1 → 0 each time; restored blob == HEAD and git diff HEAD empty each time.

  • action-invocation-audit.ts → its pin "an AI-performed call records the agent, the person, the conversation and the confirmation" FAILS: Tests 1 failed / 13 passed (14).
  • data-export-audit.ts → "an AI-performed export records …" FAILS: Tests 1 failed / 18 passed (19).
  • dataset-query-audit.ts → "an AI-performed query records …" FAILS: Tests 1 failed / 13 passed (14).

The shared rule in audit-writers.ts: agentIsRecordedPerformer = !performedByClientId && performedByAgentId !== undefined replaced by performedBy !== undefined, run over the four files: Tests 5 failed / 57 passed (62). The three new CONTROL pins (client alone or beside an agent) fail, and so do #34547's two record-write pins ("never ride beside an OAuth client id", "an envelope naming both performers"). Restored blob == HEAD.

Gates
  • node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derived 102 commands for this diff. Each was run with stdin closed and its exit taken before any pipe.
  • Three first exited 3 (prerequisite not met: no built output): check:skill-examples, check:dual-build-cjs-loads, check:i18n. After turbo run build --concurrency=2 --filter=!@objectstack/docs under the lock (exit 0), each re-ran with exit 0.
  • dispatch-gates --ran: "102 derived famil(ies) accounted for — 102 run, 0 NOT-MEASURED". Exit 0.
  • Not run locally, left to CI: the repo-wide scans, test:repo, and the dogfood battery. The title has no ! and the claim has no (narrowing) arm.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ADHkmSYVw1sqCsaHSJS9JC

… data-export and dataset-query rows

The three writers read only performedBy.clientId. They now apply the
record-write writer's performer rule, extracted into one exported helper
(auditPerformerMetadata) that all four writers call.

Claude-Session: https://claude.ai/code/session_01ADHkmSYVw1sqCsaHSJS9JC
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 17, 2026
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/plugin-audit, @objectstack/spec, touching 23 documentable anchor(s).

11 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/ai/actions-as-tools.mdx (via conversationId (symbol, a field of interface AuditPerformerSource))
  • content/docs/ai/index.mdx (via conversationId (symbol, a field of interface AuditPerformerSource))
  • content/docs/api/client-sdk.mdx (via conversationId (symbol, a field of interface AuditPerformerSource))
  • content/docs/automation/connectors.mdx (via clientId (symbol, a field of interface AuditPerformerSource))
  • content/docs/automation/hook-bodies.mdx (via HookContextSchema (symbol, a top-level const), performedByAgentId (literal, a string literal in installAuditWriters; a string literal in provenanceMark))
  • content/docs/frontend/plugins/plugin-chatbot.mdx (via conversationId (symbol, a field of interface AuditPerformerSource))
  • content/docs/kernel/contracts/auth-service.mdx (via clientId (symbol, a field of interface AuditPerformerSource))
  • content/docs/permissions/authentication.mdx (via clientId (symbol, a field of interface AuditPerformerSource))
  • content/docs/permissions/sso.mdx (via clientId (symbol, a field of interface AuditPerformerSource))
  • content/docs/permissions/system-context.mdx (via ExecutionContextSchema (symbol, a top-level const))
  • content/docs/plugins/index.mdx (via clientId (symbol, a field of interface AuditPerformerSource))

⛔ 3 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-0.mdx (via HookContextSchema (symbol, a top-level const))
  • content/docs/releases/v17/17-5.mdx (via on_behalf_of (symbol, a field of interface AuditPerformerMetadata), performed_by (symbol, a field of interface AuditPerformerMetadata))
  • content/docs/releases/v17/17-7.mdx (via agentId (symbol, a field of interface AuditPerformerSource))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 176 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json b1da9f55db0f4028cd6720fae7e80c6574e7dc67 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from fee3637eae384c46a3c5a48284202ba94b12a759 — the merge of head f62fa7ad00016422c95882f00cbe70eb6be421ec into base b1da9f55db0f4028cd6720fae7e80c6574e7dc67, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin fee3637eae384c46a3c5a48284202ba94b12a759 && git checkout fee3637eae384c46a3c5a48284202ba94b12a759
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin b1da9f55db0f4028cd6720fae7e80c6574e7dc67 f62fa7ad00016422c95882f00cbe70eb6be421ec && git checkout -B drift-repro b1da9f55db0f4028cd6720fae7e80c6574e7dc67 && git merge --no-ff f62fa7ad00016422c95882f00cbe70eb6be421ec

node scripts/docs-audit/affected-docs.mjs --json b1da9f55db0f4028cd6720fae7e80c6574e7dc67

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs b1da9f55db0f4028cd6720fae7e80c6574e7dc67 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

…marks by the same rule

Prose only: the ExecutionContext.performedBy describe and JSDoc no longer
say the action-invocation, data-export and dataset-query rows record
clientId only, and the reader rule (here and in the HookContext
performedByAgentId describe) says which tell wins where both apply.
No key, type or refine moves.

Claude-Session: https://claude.ai/code/session_01ADHkmSYVw1sqCsaHSJS9JC
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmSYVw1sqCsaHSJS9JC

Final head for L1 and contract review · 2026-11-17T07:28Z
Final head: 5f005fb26aac627794032316688a28427b8e2822 (card #34556, area o2-B; patch round r2 over 41a26f11). CI at this head: every check completed success or skipped by path filter (Build Core, Test Core 1–8/8 + aggregate, Test UI 1–16/16 + aggregate, Build & E2E UI, Live E2E UI, Type Check UI, TypeScript Type Check, Lint & Repo Gates, Spec property liveness, Build Docs, Check Changeset, Check Documentation Links, PR-body guards, Governed Surface Queue Guard); none red.
Owed: L1 (L1-a, first review) and a contract review. r2 adds a prose-only commit to packages/spec/src/kernel/execution-context.zod.ts and data/hook.zod.ts (the seat's choice A on the dev's open question, recorded on the card as claim amendment 6940394255): the performedBy describe no longer says the three row kinds record clientId only, and it takes N3 from contract review 6937613475. No key or schema behaviour changes. Because this touches packages/spec/src, the PR goes to the seat for the approvers after both reviews sit on this head; it stays a draft and is not armed by the area.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq

Contract-review-claim: session_01ADHkmP44onN8RMzsPMqjRq · head 5f005fb · 2026-11-17T07:29Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmQtnGcx7hYEL11ptVs

席位核对

L1 first review: REWORK (1 item, body only; the code, the pins and the spec prose are accepted) · PR #34679 · card #34556 · area o2-B · L1-a2 · 2026-11-17T07:31Z

Head-sha: 5f005fb26aac627794032316688a28427b8e2822

Final-head comment 6941684507; dev report 6940367044; claim amendment 6940394255.

Checked, no problem

  • Shape. Draft, base main. Fixes #34556 is the only closing keyword in the body. It is right: all four enumeration boxes are delivered, and each row kind is pinned. Clause-②: no and Metadata-protocol: none hold. The spec change is describe and JSDoc text only, and no key, type, refine or optionality moves.
  • Scope (get_files, 14 paths, +280/−77):
    • three writers and their tests, plus audit-writers.ts;
    • two spec files;
    • three regenerated reference pages;
    • hook-bodies.mdx;
    • the changeset.
      Commits: 89ffd4b9, 0c908ab6, 647bb667, 49dc838a, c5eafdb1 and 19d92fd2, plus three main merges (41a26f11, e7e0373e, 5f005fb2). Each merge's git show --remerge-diff is empty.
  • Deviation: extracted, not "export helper". Accepted. feat(plugin-audit): mark in-product AI writes on sys_audit_log rows (agent, conversation, confirmation) #34547 landed the rule inline in installAuditWriters, behind a private provenanceMark(ctx, key) reader, so there was no helper to export. The card's ask is "the helper sys_audit_log: mark in-product AI writes (AI on behalf of a person, conversation id, confirmation id) #33694 lands, not a second copy". Extracting the rule as one function, auditPerformerMetadata, and calling it from all four writers is the only reading that avoids a second copy.
    • I compared the extraction line by line with the removed block. The rule is the same: client else agent, the agent counted as the recorded performer only when there is no client, marks written only beside that agent, each mark only when stamped, on_behalf_of = the row's user_id ?? null, and no performer ⇒ undefined.
    • The record-write call passes the four provenance marks in the same order.
    • attributionMark trims as provenanceMark did.
    • The three writers' old nonEmpty(ctx.performedBy?.clientId) also trimmed, so client-only rows read the same as before.
    • It is exported from the module, not from src/index.ts, so the package surface does not move.
    • The 15 feat(plugin-audit): mark in-product AI writes on sys_audit_log rows (agent, conversation, confirmation) #34547 pins in agent-dual-attribution.integration.test.ts are unchanged and green.
  • Wiring reaches production input. Each writer's event context is a Pick<ExecutionContext, … 'performedBy' …>. The doors hand the envelope through: runtime/src/action-invocation-audit.ts:83 (ExecutionContext | undefined), rest/src/data-action-routes.ts:388 and rest/src/analytics-dataset-query-audit.ts:39. So agentId, conversationId and confirmationId reach auditPerformerMetadata from the same performedBy the record-write path copies into provenance (engine-execution-plumbing.ts:158-174).
  • Pins and ablations. Three cases per row kind:
    • the AI call records performed_by, on_behalf_of and both marks, with user_id staying the person;
    • CONTROL: a client alone, and a client beside an agent, record the client with no marks;
    • CONTROL: a person's own call carries none of the four keys.
      Ablations (dev report): setting each writer's wiring back to client-only turns that writer's AI pin red (1 failed in each of the three files). Setting agentIsRecordedPerformer to performedBy !== undefined turns 5 red (the three new CONTROLs and two feat(plugin-audit): mark in-product AI writes on sys_audit_log rows (agent, conversation, confirmation) #34547 record-write pins). All are restored to blob == HEAD.
  • Spec prose. The performedBy JSDoc (:380-386) and describe (:431) now say the three rows "record the performer and the two marks by the same rule". That is true at this head. No "clientId only" text is left in packages/spec/src, content/docs or skills/ (git grep). The N3 clause ("where both tells apply the mark decides…") appears in the same words in the JSDoc and describe and in HookContext.provenance.performedByAgentId. The three regenerated reference pages match the describes.
  • hook-bodies.mdx. The three added rows match body-runner.ts:1504-1508, which copies the four performedBy* marks, and the HookContext.provenance describes.
  • Changeset (root .changeset/; @objectstack/plugin-audit and @objectstack/spec, both patch). I checked each sentence against the diff, including "an OAuth client stays the recorded performer, also when an envelope names both, and its rows never carry the two marks" and "describe text only". They match.
  • Gates. 119 derived, 119 run, 0 NOT-MEASURED (34556-gates-ran-r2.txt).
  • CI on this head (check-runs, filter=latest, 72 runs): success=60, skipped=12, nothing red or pending.

R1: the impersonatedBy leftover needs a #N or a reason I can check

Acceptance notes: "The ctx.provenance table in hook-bodies.mdx still does not list impersonatedBy, which the sandbox also copies. Left out to keep the edit small; noted, not filed." I confirmed it at this head:

  • body-runner.ts:1508 copies impersonatedBy: provenanceRaw?.impersonatedBy into the body's ctx.provenance.
  • HookContext.provenance.impersonatedBy is described in hook.zod.ts.
  • hook-bodies.mdx has no impersonatedBy line at all.

So a hook-body author reading this table cannot learn that an impersonation write is distinguishable. That is a docs defect, and the PR body names it. The rule for an out-of-scope leftover named in a PR body is a #N or a reason it is not a defect that a reader can check (precedent: L1-b R1 on #34539 and R3 on #34513). "Noted, not filed" is neither.

Fix, either:

  • (a) File it as a finding through filing gate ① (docs, hook-bodies.mdx ctx.provenance table, cite body-runner.ts:1508), and name the card in the Acceptance notes; or
  • (b) Add the one row to the table in this PR. It is the same table and the same kind of row, and it would not move the L2 surface.

Which one is the area's call. If (a), this is a body-only change and I read only the delta. If (b), I read the one new row against hook.zod.ts.

L2 and landing

  • L2 owed at this head: CONTRACT_REVIEW_TIER (published schema describe/JSDoc under packages/spec/src/**). R1 (a) does not move the L2 surface. R1 (b) is docs only and does not move it either. Keep needs:contract-review until a same-shape PASS at the final head is on file.
  • Landing tier. node scripts/pm/check-governed-merges.mjs --pr 34679 reads NOT governed, 357 changed lines ≤ 3000. However, the PR touches packages/spec/src outside tests, so it is spec surface and goes to the seat as Tier H, and the area does not land it. Once L1 ACCEPT and an L2 PASS are both on file at the same head, the final four steps apply: seat record and 速读, pm:awaiting-merge, review request to the approvers, and the round report.

…ce table

The body runner already carries impersonatedBy across the sandbox
boundary; the hook-bodies table named every other member but this one.

Claude-Session: https://claude.ai/code/session_01ADHkmSYVw1sqCsaHSJS9JC
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 5f005fb26aac627794032316688a28427b8e2822
Local-runs: none
Scope: packages/spec/src/data/hook.zod.ts, packages/spec/src/kernel/execution-context.zod.ts + packages/plugins/plugin-audit/src/audit-writers.ts, packages/plugins/plugin-audit/src/action-invocation-audit.ts, packages/plugins/plugin-audit/src/data-export-audit.ts, packages/plugins/plugin-audit/src/dataset-query-audit.ts

① Derived judgments

Inputs read: card #34556 (body and all four comments: triage 6933961648, claim 6939213173, dev report 6940367044, claim amendment 6940394255), PR #34679 (body, file list, the net diff of 14 files against merge-base fecd2e95), the four plugin-audit sources and the two spec files whole at this head, records 6936045381 and 6937613475 on PR #34547, and the 72 check-runs on this head. Code outside the diff was read, not reviewed: packages/objectql/src/engine-execution-plumbing.ts, packages/core/src/security/assemble-execution-context.ts, packages/runtime/src/action-invocation-audit.ts, packages/rest/src/data-action-routes.ts, packages/rest/src/analytics-dataset-query-audit.ts, packages/plugins/plugin-audit/src/objects/sys-audit-log.object.ts, packages/plugins/plugin-audit/package.json.

  • Check-runs: 72, all completed; 60 success, 12 skipped by path filter or opt-in, none failed, none pending. Lint and Repo Gates, TypeScript Type Check, Test Core (aggregate and shards 1 to 8), Build Core, Build Docs, Spec property liveness, Governed Surface Queue Guard and both Check Changeset runs are success.
  • Accept set of ExecutionContextSchema.performedBy and HookContextSchema.provenance: unchanged. execution-context.zod.ts changes one JSDoc paragraph (two sentences) and the performedBy describe string; hook.zod.ts changes the performedByAgentId describe string by one parenthetical. The z.object keys, z.string().optional() on each, the requiredOneOf(['clientId', 'agentId']) refine and its message, and the outer .optional() are byte-identical to the merge-base. Right.
  • Stored shape of sys_audit_log, the change this PR makes: the action_invocation, data-export and dataset_query rows can now carry, inside the metadata JSON text, performed_by holding an in-product agent name (on the merge-base it held an OAuth client_id or was absent), and beside such an agent conversation_id and confirmation_id, each only when stamped. On the merge-base an envelope with performedBy.agentId and no clientId wrote none of these keys on the three rows, so the row read as the person's own call. on_behalf_of, user_id, actor, tenant_id and every other metadata key are unchanged. No column, index or enum value is added. Right, and it is what the card asks for.
  • Rows that do NOT change: an OAuth client row on the three kinds is byte-identical (the writers' nonEmpty and the shared attributionMark are the same test, a trimmed non-blank string; key order performed_by, on_behalf_of is kept); a person's own row still carries none of the four keys; the record-write row is unchanged (see ④). Right.
  • Readers of the old shape: a search of the head tree for performed_by and confirmation_id outside the writers, tests, changelogs and ADR prose finds no code that parses these keys out of metadata: no query, view, index, retention rule or export keys on them. sys-audit-log.object.ts mentions the pair in a comment only. No reader on main is broken by the widening.
  • Public API: auditPerformerMetadata, AuditPerformerSource and AuditPerformerMetadata are exported from the module audit-writers.ts only. src/index.ts is not in the diff and the package's exports map names . alone, so nothing new is importable by a consumer. Right.
  • Generated pages: the new performedBy describe is present once in kernel/execution-context.mdx and in all 12 performedBy rows of data/data-engine.mdx; the new performedByAgentId describe once in data/hook.mdx. The reference diff is 14 changed lines, 13 carrying "by the same rule" and all 14 carrying "the mark decides". A search of the head for "clientId only" and "record clientId" under content/, packages/spec/src and packages/plugins/plugin-audit returns nothing. Right.

② Semver level

Right. Changeset .changeset/34556-audit-ai-marks-three-rows.md: @objectstack/plugin-audit patch, @objectstack/spec patch.

  • @objectstack/plugin-audit patch holds. The package's exported surface does not move. What moves is stored output: additive keys inside an opaque JSON text column, on rows of one producer path, with no reader in the tree keyed on them, repairing rows that mis-stated an AI call as the person's own. PR feat(plugin-audit): mark in-product AI writes on sys_audit_log rows (agent, conversation, confirmation) #34547 shipped the same keys on the record-write row at patch; the same level for the same keys on three more row kinds is consistent.
  • @objectstack/spec patch holds. Describe and JSDoc text only; no key, type, refine or optionality moves, and the generated pages follow the text.
  • Clause-②: Clause-②: no and Metadata-protocol: none are present and identical in the PR body and the changeset, and both are true: no accept set narrows or widens, and nothing a metadata author can write changes.
  • Changeset prose against the head: true. One loose phrase, of no effect: it says metadata carries conversation_id "plus", without the "when stamped" the rule applies to it; the spec describe states the condition.

③ Boundary flags

  • Open question in dev report 6940367044 (the spec sentence "The action-invocation, data-export and dataset-query rows record clientId only" becomes false with this PR): answered. The seat chose option A in claim amendment 6940394255 and the correction rides this PR. That amendment also lifts the claim's own "No packages/spec/** change" line and supersedes the report's "contract_review: not needed", which was written at the earlier head.
  • Deviation, audit-writers.ts: the claim allowed only exporting an existing helper; the dev extracted the inline rule into auditPerformerMetadata because no importable helper existed. Judged in ④ on the tree: the extraction is the same rule with the same outputs, and it gives the card what it asked for ("through the helper, not a second copy"). Accepting the widened file surface is the lane seat's L1 call; nothing in the contract argues against it.
  • Deviation, hook-bodies.mdx gaining performedByAgentId beside the two ids the card names: prose outside this review's scope, the lane seat's. For the record, packages/runtime/src/sandbox/body-runner.ts copies all four keys into the sandbox, so the three new table rows name keys a hook body does receive.
  • Out-of-scope finding with no carrier (dev report: the ctx.provenance table in hook-bodies.mdx omits impersonatedBy, "noted, not filed"): escalated to the seat. It has no card; file one or put it on an existing docs carrier so it is not lost with this PR.
  • Observation for the seat, not a finding on this PR: a search of packages/ at this head finds no non-test producer that sets performedBy.agentId (assemble-execution-context.ts sets clientId only), so in this tree the three rows change only when the in-product AI path named by the cloud#3826 ruling stamps the envelope. The doors hand the writers the request's whole execution context, so the marks arrive once it does. The card's acceptance is the three pin tests, which is what this head delivers.
  • Carried from record 6937613475, still a suggestion to the seat: a decision card asking the owner whether every performed_by row must stay classifiable for good. The unclassifiable set (rows of a since-deleted OAuth application, and in-product rows with neither mark) now spans four row kinds instead of one.
  • The PR is a draft; that is the seat's Tier H step and does not affect this record.
  • SQL push-down: not applicable. The diff adds no query, no id materialisation and no in-app join; the writers build one row from the envelope they are handed.

④ Design judgment

N3: closed

Record 6937613475 asked for one clause saying which reading wins when both tells apply. The clause is on the head in all three places the reader rule is stated (performedBy JSDoc, performedBy describe, performedByAgentId describe): "where both tells apply the mark decides, and a matching value with no mark is the client unless an agent shares that string". Both halves are true of the code. A row carries conversation_id or confirmation_id only when agentIsRecordedPerformer held, so a marked row names the agent whatever its performed_by string equals. A matching value with no mark was written by the client, or by an agent of the same name whose envelope carried neither mark, which is exactly the exception the clause names. The sentence makes no claim for a value matching no existing application; the preceding sentence already covers that case.

packages/spec/src/kernel/execution-context.zod.ts, each changed sentence against the four writers at this head:

  • "The action-invocation, data-export and dataset-query rows record the performer and the two marks by the same rule." True. Each of the three builders now calls auditPerformerMetadata(ctx.performedBy, userId) and assigns the result into metadata; the record-write writer calls the same function with its four provenance marks. Branch by branch, identical on all four:
    • no context, or a context without performedBy: the function answers undefined, the assign is a no-op, and the row carries none of the four keys (on the three rows event.context ?? {} supplies the empty envelope);
    • an OAuth client: performed_by is the clientId, on_behalf_of is the row's own user_id value, and neither mark is written, also when the envelope names a conversation or a confirmation;
    • an in-product agent: performed_by is the agentId, on_behalf_of as above, conversation_id and confirmation_id each only when a non-blank string was stamped;
    • both performers on one envelope: the client is recorded and the agent is dropped with both marks, as the describe's "An envelope carrying both performers is recorded as the client" and the JSDoc's "drops the agent with its two marks" say;
    • a blank or non-string member reads as absent, so a performedBy whose members are all blank writes nothing.
  • "It does not move actor": still true on all four. user_id and actor are computed from ctx.userId as before; no line that sets them is in the diff.
  • The sentences kept from PR feat(plugin-audit): mark in-product AI writes on sys_audit_log rows (agent, conversation, confirmation) #34547 ("only when the agent is the recorded performer", "a client row never carries them", the reader rule) now speak for four row kinds through "by the same rule", and each holds for the three new ones because there is one function.

packages/spec/src/data/hook.zod.ts: the one parenthetical in performedByAgentId is the N3 clause, judged above. The describe keeps "the record-write audit writer", which is right for a hook key: HookContext.provenance exists on record writes only. No "clientId only" sentence stood in this file.

packages/plugins/plugin-audit/src/audit-writers.ts: is the extracted rule the rule PR #34547 shipped? Compared statement by statement against the merge-base:

  • Inputs: the same four values. The old provenanceMark(ctx, key) read provenance?.[key] as a trimmed non-blank string; the new call passes provenance?.performedByClientId and its three siblings into attributionMark, the same test.
  • Precedence: performedByClientId ?? performedByAgentId, and agentIsRecordedPerformer = !performedByClientId && performedByAgentId !== undefined, both moved character for character. The two marks are read behind that gate exactly as before.
  • Outputs: performed_by, on_behalf_of: onBehalfOf ?? null (called with the same userId the row's user_id takes), then conversation_id, then confirmation_id, spread into the metadata object at the position the three old spreads held, so the serialized key order is the same. The outer guard changes from performedBy to performer, which are truthy together: the function answers undefined exactly when no performer string exists, and a performer string is never empty.
  • The JSDoc "Action name produced from a HookContext.event string" still heads actionFor; the new block sits above it under its own comments.

Tried to break it: an envelope with agentId blank and a conversation set (no keys, as before); performedBy null or a non-object (optional chaining answers absent); a client id padded with whitespace on the three rows (trimmed before and after); a system context with no userId and an agent (on_behalf_of: null, the same value the row's user_id holds). None produces a wrong performer or a mark beside a client.

action-invocation-audit.ts, data-export-audit.ts, dataset-query-audit.ts: one wiring line each replaces the two-key client block; the header comments of the first two now name the two marks and the shared function, and agree with the code. The dataset-query header lists no metadata keys, so it had nothing to correct.

Rule-level reading of the audit posture: the rule can record a performer only from the server-built envelope, the client keeps precedence by ruling, and a mark is omitted only when it was not stamped or when the recorded performer is a client. Nothing found that records a wrong performer or loses a stamped mark.

No must-fix, no should-fix.

Implemented-by: claude/issue-34556-audit-ai-marks-three-rows
Reviewed-by: session_01ADHkmP44onN8RMzsPMqjRq

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmSYVw1sqCsaHSJS9JC

Final head for L1 and contract review (delta) · 2026-11-17T08:11Z
Final head: f62fa7ad00016422c95882f00cbe70eb6be421ec (card #34556, area o2-B). Delta over 5f005fb26a is one commit, f62fa7ad00: one added row in content/docs/automation/hook-bodies.mdx, the ctx.provenance.impersonatedBy row the body runner already copies (packages/runtime/src/sandbox/body-runner.ts). This answers L1 R1 (6941727354) and the matching contract-review note (6941799864) in this PR, so nothing is filed for it. The PR body's Acceptance notes, Enumeration and What changes now say so. No code or packages/spec/src change in the delta.
CI at this head: 59 success, 12 skipped by path filter, none red. One PR-body guards run shows cancelled; it was superseded by the run for the body edit, which succeeded.
Owed: L1 delta and contract-review delta on this head. Then the seat for the approvers; the PR stays a draft and is not armed by the area.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmQtnGcx7hYEL11ptVs

席位核对

L1 delta: ACCEPT · PR #34679 · card #34556 · area o2-B · L1-a2 · 2026-11-17T08:13Z

Head-sha: f62fa7ad00016422c95882f00cbe70eb6be421ec

This reads only 5f005fb2..f62fa7ad, answering REWORK 6941727354 (R1). The final-head comment is 6942491342.

What moved (read in git)

  • f62fa7ad: one added row in content/docs/automation/hook-bodies.mdx, the ctx.provenance.impersonatedBy row. There is no other commit, and no code or spec change. The PR is now 14 files, +281/−77.

R1: route (b), the row added in this PR

  • The row says an administrator made the write from an impersonation session, that the value is that administrator's sys_user id, that ctx.session.userId stays the impersonated user the write is authorized as, and that it is attribution only. I checked this against HookContext.provenance.impersonatedBy in hook.zod.ts ("The ADMINISTRATOR (a sys_user id) … while session.userId is the impersonated user the write is authorized as … ATTRIBUTION ONLY") and against body-runner.ts:1508, which copies the member. It matches. Answered.
  • The body was updated in three places to match: What changes, the Enumeration's fourth box, and an Acceptance note that cites this record and the commit. The "noted, not filed" sentence is gone.

Readings

  • CI on this head (check-runs, filter=latest): success=59, skipped=12, cancelled=1. The cancelled run is PR-body guards. The full run list shows a success of the same check on this head after it, so nothing is red or pending.
  • Landing size. 358 changed lines.

L2 and landing

  • L2 owed at this head: CONTRACT_REVIEW_TIER. The spec surface did not move this round, because the commit is docs only. A same-shape PASS still has to be on file at f62fa7ad. If the contract review passed at 5f005fb2, it carries over only if the record says this docs-only delta does not move its surface.
  • Landing tier. check-governed-merges --pr 34679 reads NOT governed, 358 lines ≤ 3000. However, the PR touches packages/spec/src, so it is spec surface and goes to the seat as Tier H, and the area does not land it. Once L1 ACCEPT and an L2 PASS are both on file at this head, the final four steps apply.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq

Contract-review-claim: session_01ADHkmP44onN8RMzsPMqjRq · head f62fa7a · 2026-11-17T08:12Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

l2-review#4 · os-steve · session_01ADHkmP44onN8RMzsPMqjRq

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: f62fa7ad00016422c95882f00cbe70eb6be421ec
Local-runs: none
Scope: packages/spec/src/data/hook.zod.ts, packages/spec/src/kernel/execution-context.zod.ts + packages/plugins/plugin-audit/src/audit-writers.ts, packages/plugins/plugin-audit/src/action-invocation-audit.ts, packages/plugins/plugin-audit/src/data-export-audit.ts, packages/plugins/plugin-audit/src/dataset-query-audit.ts

① Derived judgments

Delta record over 6941799864 (PASS on head 5f005fb26aac627794032316688a28427b8e2822). Inputs read: that record in full and every other comment on PR #34679 (final-head comment 6942491342, L1 records 6941727354 and 6942517746), the PR body at this head, the diff between the two heads, the 72 check-runs on this head, and at this head packages/spec/src/data/hook.zod.ts, packages/spec/src/kernel/execution-context.zod.ts, packages/runtime/src/sandbox/body-runner.ts, packages/runtime/src/sandbox/script-runner.ts, packages/objectql/src/engine-execution-plumbing.ts and content/docs/automation/hook-bodies.mdx.

  • What moved between the heads: one commit, f62fa7ad, whose single parent is 5f005fb2; one file, content/docs/automation/hook-bodies.mdx, one line added, none removed. The same diff restricted to packages/ is empty. The commit is not a merge, and the merge-base with main is fecd2e95 for both heads, so no main content entered. Right.
  • Carry: every Scope file and every file read outside the diff for 6941799864 is byte-identical at this head. Each judgment of that record in ①, ② and ④ (accept sets unchanged, the stored shape of sys_audit_log, no reader of the old shape, no new importable surface, generated pages following the describes, N3 closed, the extracted rule equal to the rule PR feat(plugin-audit): mark in-product AI writes on sys_audit_log rows (agent, conversation, confirmation) #34547 shipped) therefore stands on this head without being re-derived.
  • Check-runs on this head: 72, all completed, none pending. 59 success, 12 skipped by path filter or opt-in, 1 cancelled. The cancelled run is one PR-body guards job (run 44039573990); a second job of the same check on this head (run 44039648642) started after it and is success, so the check's standing conclusion is success. Lint and Repo Gates, TypeScript Type Check, Test Core (aggregate and shards 1 to 8), Test UI (aggregate and shards 1 to 16), Build Core, Build Docs, Check Documentation Links, Spec property liveness, Governed Surface Queue Guard and both Check Changeset runs are success. This agrees with the count in 6942491342, read here off the check-runs and not off that comment.
  • PR size at this head: 14 files, 281 added, 77 removed (one line more than the prior head).

② Semver level

Right, unchanged. The delta adds a hand-written docs line under content/docs/, which belongs to no published package, so it calls for no changeset entry and moves no level. .changeset/34556-audit-ai-marks-three-rows.md is untouched: @objectstack/plugin-audit patch and @objectstack/spec patch, both judged in 6941799864 and both holding for the same reasons. Clause-②: no and Metadata-protocol: none are still on the PR body and still true: no accept set moves and nothing a metadata author can write changes.

③ Boundary flags

  • Escalation of 6941799864 (the ctx.provenance table in hook-bodies.mdx omitted impersonatedBy, with no carrier): closed in this PR by the new row. With it the table has seven rows, one for each of the seven members body-runner.ts projects into the body (flowRunId, attributedUserId, performedByClientId, performedByAgentId, performedByConversationId, performedByConfirmationId, impersonatedBy), and the same seven the ScriptContext.provenance type in script-runner.ts declares. No card is owed for it any more. The row itself is judged in ④.
  • L1 R1 (6941727354) offered two routes; the area took route (b), the row in this PR. The PR body's What changes, Enumeration and Acceptance notes now say so, and the "noted, not filed" sentence is gone. Body prose is the lane seat's; nothing in it contradicts the tree.
  • Carried unchanged from 6941799864, both for the seat and neither a finding on this PR: no non-test producer in packages/ sets performedBy.agentId at this head, so the three rows change only once the in-product AI path stamps the envelope; and the suggested decision card on whether every performed_by row must stay classifiable for good.
  • The PR is still a draft; that is the seat's Tier H step and does not affect this record.
  • SQL push-down: not applicable. The delta is one line of prose; it adds no query, no id materialisation and no in-app join.

④ Design judgment

The Scope files did not move, so the design judgment of 6941799864 on the two spec files and the four plugin-audit files carries whole. What is new is one table row, outside Scope and read here because it restates a published HookContext member:

ctx.provenance.impersonatedBy: "An administrator made the write from an impersonation session; the value is that administrator's sys_user id, while ctx.session.userId stays the impersonated user the write is authorized as. Attribution only: nothing authorizes on it."

  • Name: true. HookContextSchema.provenance declares impersonatedBy, and body-runner.ts copies provenanceRaw?.impersonatedBy under the same key into the body's ctx.provenance.
  • Type: true. The schema member is z.string().optional(); the sandbox projects it through declaredStringMarks, a string or absent, and the whole provenance key is absent when no member survives. That is what the paragraph under the table already says of every member ("a string or absent"), so the new row needs no exception there.
  • Presence and value: true. buildProvenance in engine-execution-plumbing.ts sets the member only when the execution context carries impersonatedBy, which the spec defines as the administrator's sys_user id on an impersonation session and absent on every other request.
  • "ctx.session.userId stays the impersonated user the write is authorized as": true. The describe on HookContextSchema.provenance.impersonatedBy says the same in its own words, ExecutionContext.impersonatedBy states that userId stays the impersonated user, and the body receives session straight from the engine context, built apart from provenance.
  • "Attribution only: nothing authorizes on it": true to the spec, which says no security middleware reads it and it never becomes the subject the write is authorized as. The row is narrower than the describe (it does not mention the audit and activity rows that record the value) and says nothing false by leaving that out; the table's lead-in links the reference page that carries the full text.

The row is consistent in form with the three rows judged in the prior record's ③ and makes no claim the code does not keep.

No must-fix, no should-fix.

Implemented-by: claude/issue-34556-audit-ai-marks-three-rows
Reviewed-by: session_01ADHkmP44onN8RMzsPMqjRq

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmQ2SN4K183oqAvUajA

Seat record · 2026-11-17T08:16Z · Head-sha: f62fa7a

维护者速读

  • 改了什么:产品内 AI 替某人执行动作、导出数据、查询数据集时,这三类审计行现在和记录写入行一样,写明是哪个 AI(performed_by)、替谁(on_behalf_of)、在哪次对话(conversation_id)、经哪次确认(confirmation_id,没确认就不写)。spec 里 performedBy 的说明文字同步改正(只改文字,不改字段)。
  • 为什么改:之前这三类行只认 OAuth 客户端,产品内 AI 做的动作、导出、查询在审计日志里和本人亲手操作一模一样,查不到是哪次 AI 对话、哪次确认触发的。
  • 风险与回滚:只在审计行的 metadata 里加键,user_id/actor 仍是本人;OAuth 客户端的行和本人亲手操作的行不变。四类行现在共用一个规则函数,记录写入行的行为不变(原有 15 条钉子全绿)。回滚即撤回本 PR,历史行不受影响。
  • 先看:packages/plugins/plugin-audit/src/audit-writers.ts(新的 auditPerformerMetadata 与记录写入处的调用)、packages/spec/src/kernel/execution-context.zod.ts(performedBy 的 describe 与 JSDoc)、三个写入器各一行接线与三个测试文件末尾新增的 describe。
  • 两分钟验证:pnpm --filter @objectstack/plugin-audit exec vitest run src/action-invocation-audit.test.ts src/data-export-audit.test.ts src/dataset-query-audit.test.ts src/agent-dual-attribution.integration.test.ts,预期 4 个文件 62 条全绿,其中 9 条是本卡新用例。
  • 需要你做的:用 os-zhuang 审读并批准(本 PR 改了 packages/spec/src 的说明文字)。契约复审 PASS 6942565072,钉在 Head-sha f62fa7ad00016422c95882f00cbe70eb6be421ec。批准在案后由席位翻 ready,经合并队列落地。

席位意见:同意合并。审计里看得出是 AI 代人做的、在哪次对话、经哪次确认,是产品内 AI 的基本问责;本 PR 只加标记、不改本人归属,spec 只改说明文字。

席位核对

  1. 形态:14 个文件,+281/−77,Fixes #34556;Clause-②: no,Metadata-protocol: none(故不欠 Skills-docs: 行)。碰 packages/spec/src(仅 describe/JSDoc)⇒ 按 spec 面交人(席位 06:15Z 定 A)。
  2. 前提实测:9 条新用例覆盖三类行在产品内 AI 调用下带四个标记、无确认时不写 confirmation_id、OAuth 客户端与本人亲手的行不变;原有记录写入的 15 条钉子不变。
  3. 门禁 check-runs:head f62fa7ad 上 72 条,59 绿、12 跳、1 条 PR-body guards 取消(同名一条随后成功,属被替代的旧运行),0 红;mergeable clean。
  4. 接受的偏差:L1-a2 delta ACCEPT 6942517746(前一份 REWORK 6941727354 的一项已在本 head 补上);契约复审 PASS 6942565072(沿用 5f005fb2 的 PASS 6941799864),无 must-fix/should-fix。
  5. 范围外去向:复审沿用的建议(是否要求每条 performed_by 行永远可归类:已删除的 OAuth 应用的行、两种标记都没有的产品内行,现在跨四类行)由席位评估,若立决策卡则另行呈报,不挡本 PR。
  6. 落地条款:os-zhuang 授权批准在案后,席位翻 ready,经合并队列落地;Fixes #34556 合并即关卡,区清 audit: action-invocation, data-export and dataset-query rows record only performedBy.clientId for in-product AI calls #34556 的 pm:dispatched 与 lease:o2-B。

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 17, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 17, 2026 09:16
@os-zhuang
os-zhuang enabled auto-merge November 17, 2026 09:17
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit a1082f3 Nov 17, 2026
77 of 78 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-34556-audit-ai-marks-three-rows branch November 17, 2026 10:09
@objectstack-fleet objectstack-fleet Bot removed the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation protocol:data size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

audit: action-invocation, data-export and dataset-query rows record only performedBy.clientId for in-product AI calls

3 participants