|
| 1 | +--- |
| 2 | +'@objectstack/spec': minor |
| 3 | +'@objectstack/core': minor |
| 4 | +'@objectstack/objectql': minor |
| 5 | +'@objectstack/plugin-audit': minor |
| 6 | +--- |
| 7 | + |
| 8 | +Record the acting agent on the audit row — ADR-0090 D10 rule 4 dual attribution |
| 9 | + |
| 10 | +A `sys_audit_log` row written by an MCP OAuth client acting for a human used to |
| 11 | +be byte-identical to a row that human wrote in the Console. The envelope carried |
| 12 | +the delegation (`principalKind: 'agent'` + `onBehalfOf`), the row did not, and |
| 13 | +nothing in between copied it: `assembleExecutionContext` consumed the OAuth |
| 14 | +`azp` as a boolean and dropped the value, so the acting client did not exist |
| 15 | +downstream of the door at all. |
| 16 | + |
| 17 | +The delegation now travels the whole way and lands on the row: |
| 18 | + |
| 19 | +- `ExecutionContext.performedBy` (`{ clientId }`) — decided at the `/mcp` OAuth |
| 20 | + door, on the same branch that already decides `principalKind: 'agent'` and |
| 21 | + `onBehalfOf`; a member of the closed entry field set like every other. |
| 22 | +- `HookContext.provenance.performedByClientId` — the hook-layer carrier, beside |
| 23 | + `flowRunId` and `attributedUserId`. Provenance, not `session`: no |
| 24 | + caller-gating hook may read the client as the caller. |
| 25 | +- `sys_audit_log.metadata` gains `{ performed_by, on_behalf_of }` on a delegated |
| 26 | + write, and nothing at all on a personal one — the two shapes are told apart by |
| 27 | + absence rather than by guesswork. |
| 28 | + |
| 29 | +Additive, and attribution only. `user_id` stays the human, so owner-stamping, |
| 30 | +`current_user.*` RLS and the `sys_user` join are untouched (ADR-0073 D3 — |
| 31 | +attribution is not ownership). `actor` is untouched too: ADR-0118 D1/D5 keeps |
| 32 | +that column two-valued — a user id, or `null` for the system — and answers |
| 33 | +"which non-user acted" with an added attribution field rather than a second |
| 34 | +actor vocabulary. No existing row changes meaning, and no historical row is |
| 35 | +rewritten. |
| 36 | + |
| 37 | +Rule 4's third element, the run id, is NOT delivered here and is not declared |
| 38 | +either: nothing on the request path mints one today (`ExecutionContext.traceId` |
| 39 | +is declared but resolved by no transport entry point), and declaring a carrier |
| 40 | +nothing populates is the defect this change exists to close. |
0 commit comments