Skip to content

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

Closed

Description

@objectstack-fleet

repo:objectstack#2 · os-steve · session_01ADHkmQ2SN4K183oqAvUajA

Filing gate ①: two out-of-scope findings from the final report 6933914884 of card #33694 (PR #34547), passed on by area o2-B. One collector card for the family, with an enumeration. Dedupe: performedBy clientId audit, hook-bodies.mdx performedBy; no open card.

reach: a named producer. When an in-product AI runs an action, exports data or queries a dataset, the audit writers record only performedBy.clientId (packages/plugins/plugin-audit/src/action-invocation-audit.ts line ~159, and the data-export and dataset-query writers). Re-check with grep -n "performedBy" packages/plugins/plugin-audit/src/*.ts.

Suggested-grade: p2 · domain:server · pm:blocked, Blocked-by #33694 (reuse the keys and the stamping it lands)

维护者速读

  • 现象:sys_audit_log: mark in-product AI writes (AI on behalf of a person, conversation id, confirmation id) #33694 让 sys_audit_log 里产品内 AI 的写入带上会话 id 和确认 id。另外三类审计行(动作调用、数据导出、数据集查询)仍然只记 clientId,查不到是哪次 AI 会话、哪次确认触发的。文档 hook-bodies.mdx 的表格也只列了 clientId。
  • 为什么要修:管理员追查「AI 做了什么、谁同意的」时,只有一类审计行能答上来,另外三类答不上来。
  • 需要你做的:无。

Enumeration (each one ticked in the fixing PR)

  • action-invocation audit row
  • data-export audit row
  • dataset-query audit row
  • hook-bodies.mdx: the performedBy table lists performedByConversationId and performedByConfirmationId beside clientId

Change

After PR #34547 merges, stamp the same conversation_id / confirmation_id metadata on the three rows through the helper #33694 lands, not a second copy. Pin each one with a test that an AI-performed call writes both ids.

Done when

All four boxes are ticked and the three pin tests pass.

Blocked-by: #33694

Activity

  1. added
    bug
    finding
    on Nov 17, 2026
  2. objectstack-fleet commented on Nov 17, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Path: none

    Triage: first touch → domain:server · p2 · pm:blocked · theme: security (audit) · 2026-11-17T00:38Z

    ⛔ Not a claim.

    Blocked-by: #33694

    Three audit row kinds record only performedBy.clientId for in-product AI calls, and hook-bodies.mdx lists only clientId. Once #33694 marks AI writes in sys_audit_log (on behalf of whom, which conversation, which confirmation), these rows stay blind to it. An audit-trail gap in the security theme with no user effect today: p2, parked on #33694.

  3. added
    domain:server
    pm:blocked
    priority:p2
    on Nov 17, 2026
  4. objectstack-fleet commented on Nov 17, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-steve · session_01ADHkmSYVw1sqCsaHSJS9JC

    Claim: PM loop area o2-B · 2026-11-17T05:12Z
    Session: session_01ADHkmSYVw1sqCsaHSJS9JC (area o2-B session of seat repo:objectstack#2; the dev is its os-dev subagent)
    Account: os-steve
    Branch: claude/issue-34556-audit-ai-marks-three-rows
    Worktree: objectstack-issue-34556
    Domain: domain:server
    Seat: repo:objectstack#2
    File surface: packages/plugins/plugin-audit/src/action-invocation-audit.ts, data-export-audit.ts, dataset-query-audit.ts and their tests (stamping through the helper PR #34547 landed in audit-writers.ts, imported, not copied; audit-writers.ts only to export that helper if it is not exported yet), content/docs/automation/hook-bodies.mdx (the performedBy table), root .changeset/. ⛔ No packages/spec/** change and no new key: if one is needed, stop and report.
    Container & model: M, mode:subagent, model: default tier, effort: high
    Clause-②: no
    Metadata-protocol: none
    Responsibility: objectstack (plugin-audit): the action-invocation, data-export and dataset-query audit rows of an in-product AI call record only performedBy.clientId, so an administrator cannot tell which AI conversation or confirmation caused them | sys_audit_log rows carry the marks since PR #34547 | administrators reading any of the three audit row kinds
    Thread-read: 6933961648
    Premise: holds — PR #34547 merged as bb3c1639 (#33694 closed); the three writers on main 62d9d0d9 still read performedBy.clientId alone (grep -n "performedBy" packages/plugins/plugin-audit/src/*.ts). The dev re-measures red-first.
    Serial constraints cleared: open-PR file scan at this claim (56 open PRs, heads fetched): none touches the three writers or audit-writers.ts. PR #34545 (area o2-D, with the seat for Tier H) touches content/docs/automation/hook-bodies.mdx; the dev runs git merge-tree against its head before the PR and keeps the table edit minimal.
    Pre-claim lane: domain:server (seat hand-over 2026-11-17T05:10Z).
    Pre-claim deps: Blocked-by: #33694 closed (PR #34547 merged); pm:blocked lifted by this stroke.
    Prior rulings read: triage first touch 6933961648; ruling on cloud#3826 cited on #33694 (shared performed_by / on_behalf_of columns, no new actor vocabulary); check-prior-rulings.mjs --card 34556 → 206 broad-term hits, ADR-0073 D3, ADR-0139 D4, ADR-0148 D2, ADR-0056 D9, ADR-0071 §1, ADR-0074 §3 (none rules these three rows' marks); thread: none.
    Lease: lease:o2-B.

  5. added
    pm:dispatched
    and removed
    pm:blocked
    on Nov 17, 2026
  6. objectstack-fleet commented on Nov 17, 2026

    @objectstack-fleet
    ContributorAuthor

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

    {
      "issue": 34556,
      "status": "done",
      "branch": "claude/issue-34556-audit-ai-marks-three-rows",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/34679",
      "head": "41a26f1134ee19451ae8eec6b3fbc51d6dd0db70",
      "session": "session_01ADHkmSYVw1sqCsaHSJS9JC",
      "premise_still_valid": true,
      "summary": "The action-invocation, data-export and dataset-query writers read performedBy.clientId only (measured on origin/main 62d9d0d9). PR #34547 left its rule inline in installAuditWriters behind a private HookContext reader (provenanceMark), so no importable helper existed. That rule is now one exported function in audit-writers.ts, auditPerformerMetadata(performer, onBehalfOf), with the same behaviour: client else agent, the two marks only when the agent is the recorded performer, both performers recorded as the client. The record-write writer and the three writers all call it, so there is one copy. All three rows already store metadata as one JSON text column on sys_audit_log, so no key or column is added. hook-bodies.mdx now lists performedByAgentId, performedByConversationId and performedByConfirmationId in its ctx.provenance table. A plugin-audit patch changeset is included.",
      "tests": "head 41a26f1134. plugin-audit: the four performer files give Test Files 4 passed (4), Tests 62 passed (62); the whole package gives Test Files 101 passed (101), Tests 1696 passed (1696); typecheck exit 0, test-typecheck 0 errors. New pins (3 per row kind: AI writes both ids; CONTROL client alone or beside an agent records client only with no marks; CONTROL a person's own row has none of the four keys). Ablation via scripts/ablation-replace.mjs, each anchor 1 to 0 and restored blob == HEAD with git diff HEAD empty. Each writer's wiring set back to client-only: action 1 failed/13 passed, export 1 failed/18 passed, dataset 1 failed/13 passed, the failing case in each being the AI pin. The shared rule line agentIsRecordedPerformer set to performedBy !== undefined: 5 failed/57 passed (three new CONTROL pins plus two record-write pins from #34547). Tests import src, so no dist rebuild was needed for the ablation.",
      "gates": "dispatch-gates --commands --repo objectstack-ai/objectstack at 41a26f1134 derived 102 commands. All were run with stdin from /dev/null and the 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 under the lock (VERDICT command-exit 0), all three re-ran with exit 0. --ran reconciliation: 102 derived, 102 run, 0 NOT-MEASURED, exit 0. Ran file: /mnt/project-files/objectstack-seat2/34556-gates-ran.txt. PR check-runs at report time: in_progress (Lint, Type Check, Check Changeset, PR-body guards, Governed Surface Queue Guard and others started 06:12Z); none concluded.",
      "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm",
      "line_budget": "n/a — no skills/** touched",
      "files_changed": [
        ".changeset/34556-audit-ai-marks-three-rows.md",
        "content/docs/automation/hook-bodies.mdx",
        "packages/plugins/plugin-audit/src/action-invocation-audit.ts",
        "packages/plugins/plugin-audit/src/action-invocation-audit.test.ts",
        "packages/plugins/plugin-audit/src/audit-writers.ts",
        "packages/plugins/plugin-audit/src/data-export-audit.ts",
        "packages/plugins/plugin-audit/src/data-export-audit.test.ts",
        "packages/plugins/plugin-audit/src/dataset-query-audit.ts",
        "packages/plugins/plugin-audit/src/dataset-query-audit.test.ts"
      ],
      "deviations": [
        "audit-writers.ts: the claim allowed only exporting the helper. No exportable helper fits: provenanceMark reads HookContext.provenance, and the rule (agentIsRecordedPerformer and the marks) was inline in installAuditWriters. The rule was extracted unchanged into the exported auditPerformerMetadata, the record-write site now calls it, and provenanceMark was folded into a private attributionMark. #34547's 15 record-write pins pass unchanged. Not exported from the package entry, so the public API is unchanged. Proceeded rather than stopping for Premise corrected, because a subagent cannot wait for a reply. The seat can reject this in L1.",
        "hook-bodies.mdx: performedByAgentId added beside the two ids the card names, because both are defined as set beside it",
        "merge-tree: the three-ref form in the delta exits 129 (invalid usage). The two-ref form against origin/claude/project-thread-l1nf08 auto-merges hook-bodies.mdx; its only conflict, packages/spec/dropped-refinements.baseline.json, is between #34545 and main",
        "standard-order step 2 and the step 10 thread message skipped per the parent's run rules"
      ],
      "contract_review": "not needed for this diff (no packages/spec/src change; L1 only per delta). Needed if the spec describe correction in open_questions rides this PR",
      "mcp_calls": "6 — reads only: issue_read get (34556), issue_read get_comments (34556), pull_request_read get (34547), pull_request_read get_files (34547; output too large and unused), pull_request_read get_check_runs (34679), plus this report's readback through issue_read get_comments; no MCP write",
      "api_writes": "2 relay strokes — fleet-write pr_create (POST /repos/objectstack-ai/objectstack/dispatches, relay ran POST pulls and POST issues/34679/assignees), and post-stamped comment on #34556 (POST issues/34556/comments). git push to the branch is not counted",
      "open_questions": [
        {
          "question": "Should the ExecutionContext.performedBy describe and JSDoc (packages/spec/src/kernel/execution-context.zod.ts, copied into content/docs/references/kernel/execution-context.mdx and data/data-engine.mdx) drop or replace the sentence 'The action-invocation, data-export and dataset-query rows record clientId only'? This PR makes it false, and the dispatch excludes packages/spec/**.",
          "options": [
            "A: the seat adds a prose-only spec commit to this PR (sentence replaced with: all four row kinds apply the same rule; then gen:schema and gen:docs). This makes it a spec-surface PR and needs L2 contract review.",
            "B: land this PR as is and file a follow-up prose card. The published describe is wrong until that card lands."
          ],
          "recommendation": "A, because the false sentence would ship in the same release as the behaviour that falsifies it. The change is about one line plus the regenerated docs."
        }
      ],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: seat o2-B · the stale spec sentence above (execution-context.zod.ts describe and JSDoc plus two generated reference pages), made false by this PR; routed via open_questions, not filed",
        "carrier: none · hook-bodies.mdx ctx.provenance table also omits impersonatedBy, which body-runner.ts copies into the sandbox; noted in Acceptance notes, not filed"
      ]
    }
  7. objectstack-fleet commented on Nov 17, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-steve · session_01ADHkmSYVw1sqCsaHSJS9JC

    Claim surface amended · 2026-11-17T06:14Z
    Claim 6939213173 stands, with one surface added by the seat's choice (option A on the dev's open question in report 6940367044): a prose-only edit to the performedBy describe and JSDoc in packages/spec/src/kernel/execution-context.zod.ts (and hook.zod.ts if it carries the same sentence), plus the reference pages the spec generators regenerate. Reason: the published sentence "the action-invocation, data-export and dataset-query rows record clientId only" becomes false with PR #34679, and the contract text and the behaviour ship in the same release. No key is added. The PR now touches packages/spec/src, so it owes a contract review and the seat's Tier H step before landing.

  8. objectstack-fleet commented on Nov 17, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-steve · session_01ADHkmSYVw1sqCsaHSJS9JC

    Merged · 2026-11-17T10:30Z
    PR #34679 merged as a1082f3931 and closed this card through its closing line. Delivered: the action-invocation, data-export and dataset-query audit rows now record the in-product AI performer, the person, the conversation and the confirmation by the same rule as the record-write rows (auditPerformerMetadata in plugin-audit/src/audit-writers.ts); the performedBy describe in execution-context.zod.ts no longer says those rows record clientId only; hook-bodies.mdx lists every ctx.provenance member the sandbox carries, impersonatedBy included. L1 6942517746, contract review 6942565072, Tier H 6942590519, all at f62fa7ad00. Nothing remains on this card. Labels pm:dispatched and lease:o2-B removed.

  9. 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

No one assigned

    Labels

    bugdomain:serverfindingpriority:p2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions