Skip to content

sys_audit_log: mark in-product AI writes (AI on behalf of a person, conversation id, confirmation id) #33694

Closed

Description

@objectstack-fleet

repo:cloud#5 · hotlong · session_01Q4EjjPP1zuWBNq3nBXVei9

Part of objectstack-ai/cloud#3826, phase 2. Ruled on objectstack-ai/cloud#3826 by the account owner in seat session session_01Q4EjjPP1zuWBNq3nBXVei9: 「3826 照建议(征询版)」 (decision request 6890278459 and the revised D1 that follows it). Priority per the owner: 「分拆的任务能否直接标记为高优先级让车队开放」.

维护者速读

  1. 要做的:普通审计日志里,标出哪些修改是 AI 替某人做的、在哪次对话、经哪次确认。
  2. 为什么:现在产品内 AI 改的数据,在审计日志里和人手改的一模一样,回答不了「这条记录是 AI 替张三在哪次对话里改的」。这是对客户说「全程审计」的前提。
  3. 需要你做的:无。

Facts

packages/plugins/plugin-audit/src/audit-writers.ts:2117-2120 and :2270-2275 write performed_by / on_behalf_of only for OAuth-client calls. Measured 🟡 on cloud#4355 G4.

Change

Accept AI-on-behalf, conversation id and confirmation id on the write context, using the existing performed_by / on_behalf_of columns plus contract fields. Do not add a new actor vocabulary. Rows for human edits are unchanged. Add tests.

Activity

  1. added
    enhancement
    priority:p2
    on Nov 15, 2026
  2. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Path: none

    Triage: first touch → domain:server · lease:A2 · p2 · 2026-11-15T06:47Z

    ⛔ Not a claim.

    sys_audit_log marks in-product AI writes (on whose behalf, the conversation id, the confirmation id). cloud#3826 phase 2, p2 (pre-graded). plugin-audit is A2.

  3. added
    domain:server
    pm:queue
    on Nov 15, 2026
  4. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv

    Split · 2026-11-15T10:46Z · area S1, agreed with the seat in its thread

    Blocked-by: #33786

    #33786 carries items a and b: the spec contract fields on ExecutionContext.performedBy / HookContext.provenance, and the ADR-0090 D10 rule 4 reading. The producer is cloud's in-product AI path, not the /mcp OAuth door, so that half needs a ruling. This card keeps the plugin-audit writer half (audit-writers.ts, ~2117 and ~2270). Area S1 claims it once #33786 lands. ⛔ Not a claim.

  5. added
    pm:blocked
    and removed
    pm:queue
    on Nov 15, 2026
  6. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    ContributorAuthor

    director#1 · hotlong · session_688aaa86990a4d2ea95ce91fe5ebba53

    2026-11-16T01:11Z Unblocked: #33786 is closed (PR #34018 merged 2026-11-15T23:21Z). The spec contract fields this card's plugin-audit writer half builds on are on main. pm:blocked → pm:queue; area S1 can claim it as agreed in the split note.

  7. added
    pm:queue
    and removed
    pm:blocked
    on Nov 16, 2026
  8. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-steve · session_01ADHkmSYVw1sqCsaHSJS9JC

    Claim: PM loop area o2-B · large card in its own card thread · 2026-11-16T23:44Z
    Session: session_01ADHkmSYVw1sqCsaHSJS9JC (area o2-B session of seat repo:objectstack#2, which coordinates, sends L1 and lands)
    Thread session: session_01ADHkmSQnLEs6vGofJXcguE
    Account: os-steve
    Branch: claude/project-thread-j2xdku
    Worktree: objectstack-issue-33694
    Domain: domain:server
    Seat: repo:objectstack#2
    File surface: the plugin-audit writer packages/plugins/plugin-audit/src/audit-writers.ts (the performed_by / on_behalf_of stamping, ~2184 and ~2337) and its tests; the describe sentences in packages/spec/src/kernel/execution-context.zod.ts (performedBy) and packages/spec/src/data/hook.zod.ts (provenance.performedBy*) that say the audit writer "does not record them yet", with the generated outputs they feed; root .changeset/ (stop on breach; explain in the report). The provenance chain (objectql buildProvenance, runtime body/script runners, the cli lowered-body enumeration pin) is read, not changed, unless a key does not reach the writer.
    Container & model: M, mode:thread, model: default tier, effort: high
    Clause-②: no
    Metadata-protocol: none
    Responsibility: objectstack (packages/plugins/plugin-audit): the audit writer records performed_by only for the /mcp OAuth client, so an in-product AI write lands in sys_audit_log like a human edit | the contract fields are on main (#33786, PR #34018) and nothing records them | every organization using the in-product AI that asks who changed a record and in which conversation
    Thread-read: 6904574198
    Premise: holds — audit-writers.ts on origin/main reads only provenance.performedByClientId; the spec describes still say the in-product AI keys are not recorded yet.
    Serial constraints cleared: #33786 merged (PR #34018); no open PR touches audit-writers.ts, execution-context.zod.ts or hook.zod.ts at this claim (the dev runs git merge-tree against open PRs before push).
    Pre-claim lane: domain:server (packages/plugins/plugin-audit); the describe edit under packages/spec/src/** stays in this lane per area-lease 留道 and makes this a large card, so it runs in its own card thread.
    Pre-claim deps: Blocked-by: #33786 — closed. Hot files idle.
    Prior rulings read: cloud#3826 owner ruling 「3826 照建议(征询版)」 (decision request 6890278459 and its revised D1: reuse performed_by / on_behalf_of, no new actor vocabulary); split note 6893182618; ADR-0090 D10 rule 4 (dual attribution) and ADR-0118 D1/D5 (actor stays two-valued), as the spec describe cites them; thread: none.
    Lease: lease:o2-B (replaces the stale lease:A2: no Claim: or Release: on this card ever named it; triage set it at first touch 6890578907).
    Review: the spec describe edit owes a contract review (L2) before landing; L1 at L1-a.

  9. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 16, 2026
  10. objectstack-fleet commented on Nov 17, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-steve · session_01ADHkmSQnLEs6vGofJXcguE
    os-dev-report

    {
      "issue": 33694,
      "status": "done",
      "branch": "claude/project-thread-j2xdku",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/34547",
      "session": "session_01ADHkmSQnLEs6vGofJXcguE",
      "premise_still_valid": true,
      "summary": "The record-write audit writer (plugin-audit audit-writers.ts) now reads provenance.performedByAgentId / performedByConversationId / performedByConfirmationId beside performedByClientId. An in-product AI write records metadata { performed_by: agent, on_behalf_of: person, conversation_id, confirmation_id (only when confirmed) }, following the cloud#3826 owner ruling (existing pair, no new actor vocabulary); user_id and actor stay the person. The spec describes of ExecutionContext.performedBy and HookContext.provenance no longer say the keys are not recorded; content/docs/references regenerated. Head 768136c0 (origin/main merged at 0c7869c03).",
      "tests": "pnpm --filter @objectstack/plugin-audit exec vitest run src/agent-dual-attribution.integration.test.ts: 13/13 passed (4 new). pnpm --filter @objectstack/plugin-audit test: 99 files, 1658 tests passed; typecheck exit 0 (test-typecheck 0 errors). spec execution-context.test.ts + hook.test.ts: 146 passed. Ablation via scripts/ablation-replace.mjs (anchor 1 -> 0, blob a7b705e7 -> 716938c1): performedBy = performedByClientId ?? performedByAgentId -> performedByClientId reds 3 AI-row tests (3 failed / 10 passed); restore blob == HEAD, git diff HEAD empty. The writer is imported from src, so no dist leg applies.",
      "gates": "dispatch-gates --commands at 768136c0: 119 derived; all 119 run, every one exit 0; --ran reconcile: 119 run, 0 NOT-MEASURED, 0 UNRUN. Four first exited 3 (prerequisite) and were re-run after the named fix: check-plugin-teardown-shape --self-test (fetched fixture commit 621a4876), spec check:skill-examples (built client + client-react), check:dual-build-cjs-loads and check:i18n (full pnpm build). spec check:generated green after --fix (gen:docs). Record /mnt/project-files/objectstack-seat2/33694-gates-ran.txt. CI at report time: Lint & Repo Gates success, Governed Surface Queue Guard success, Check Changeset success, Build Docs success, Dogfood Regression Gate success; Test Core, Build Core, TypeScript Type Check lanes, UI lanes in_progress.",
      "dogfood_battery": "n/a - no ! in the PR title and Clause-2 has no (narrowing) arm",
      "mcp_calls": "4 - issue_read x3 (33694 get, 33694 get_comments, 34057 get), pull_request_read x1 (get_check_runs 34547); no write tool",
      "api_writes": "2 - fleet-write relay pr_create (PR 34547, assignees os-steve, no labels); this os-dev-report comment via post-stamped",
      "files_changed": [
        "packages/plugins/plugin-audit/src/audit-writers.ts",
        "packages/plugins/plugin-audit/src/agent-dual-attribution.integration.test.ts",
        "packages/spec/src/kernel/execution-context.zod.ts",
        "packages/spec/src/data/hook.zod.ts",
        "content/docs/references/data/data-engine.mdx",
        "content/docs/references/data/hook.mdx",
        "content/docs/references/kernel/execution-context.mdx",
        ".changeset/33694-audit-in-product-ai-performer.md"
      ],
      "line_budget": "n/a - no skills/** or ledger file touched; diff +243 / -33 over 8 files",
      "deviations": [
        "PR body starts with the harness attribution comment and the Requested-by line, then Fixes #33694 (os-dev.md exception for the harness-written attribution comment); no other HTML comment.",
        "The provenance chain (objectql buildProvenance, runtime body/script runners, cli lowered-body pin) was read and not changed: it already carries all four keys on main."
      ],
      "open_questions": [
        {
          "question": "Needs contract review (spec describe text changed) at head 768136c0. Reviewer point: performed_by now holds two id namespaces (an OAuth client id or an in-product agent name), as the cloud#3826 ruling chose; ADR-0151 D5 reason 2 names that risk for a sys_user id. Accept as ruled, or ask for a discriminator?",
          "options": [
            "A: accept as ruled (existing pair, no new vocabulary); a reader tells the in-product row by conversation_id when stamped",
            "B: add a discriminator key later through a needs-user-decision card"
          ],
          "recommendation": "A, because the owner ruling names the existing pair and forbids a new actor vocabulary; the namespace note belongs to the #34057 ADR note"
        },
        {
          "question": "New metadata key names conversation_id and confirmation_id (seat's call).",
          "options": ["A: conversation_id / confirmation_id (shipped)", "B: performed_in_conversation / confirmed_by_pending_id"],
          "recommendation": "A, snake_case beside performed_by / on_behalf_of / impersonated_by, matching the contract fields' names"
        }
      ],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: seat repo:objectstack#2 - action-invocation-audit.ts:159, data-export-audit.ts:317 and dataset-query-audit.ts:205 read performedBy.clientId only, so an in-product AI action run, export or dataset query is recorded as the person's own. Not filed (gap, not a declared-contract break: the describes now say these rows record clientId only). Dedupe words: performedBy agentId action invocation audit, in-product AI export audit performed_by, dataset query audit agent",
        "carrier: seat repo:objectstack#2 - content/docs/automation/hook-bodies.mdx:120 lists ctx.provenance.performedByClientId only, not the in-product AI keys; outside the claimed file surface. Noted, not filed."
      ]
    }

    Stamped 2026-11-17T00:36Z.

  11. objectstack-fleet commented on Nov 17, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-steve · session_01ADHkmSYVw1sqCsaHSJS9JC

    Merged · 2026-11-17T05:11Z
    PR #34547 merged as bb3c1639 (approved and merged by the maintainer after L1 ACCEPT 6937556832 and contract review PASS 6937613475 on 24233e95) and closed this card. Delivered: sys_audit_log rows written by the in-product AI record the agent as performed_by with conversation_id / confirmation_id, only when the agent is the recorded performer; the performedBy describes state how a reader tells the two kinds of value apart and what one row cannot tell. Follow-ups: #34556 (the three other audit rows, this area takes it next). Labels pm:dispatched and lease:o2-B removed.

  12. removed
    pm:dispatched
    on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

domain:serverenhancementpriority:p2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions