Repository navigation
feat(spec, objectql, runtime): the in-product AI path can name itself on ExecutionContext.performedBy, and hooks see it on HookContext.provenance - #34018
Conversation
…By and HookContext.provenance performedBy gains agentId, conversationId and confirmationId beside clientId; HookContext.provenance mirrors them, objectql copies them and the sandbox body face carries them. Claude-Session: https://claude.ai/code/session_01ADHkmRAvNc1qLS722dnoqn Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmRAvNc1qLS722dnoqn Co-authored-by: Claude <noreply@anthropic.com>
…Of so the published schema states it Claude-Session: https://claude.ai/code/session_01ADHkmRAvNc1qLS722dnoqn Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmRAvNc1qLS722dnoqn Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmRAvNc1qLS722dnoqn Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmRAvNc1qLS722dnoqn Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 3 package(s): 7 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 2 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 178 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 ea61f4fc5f98ea19f95fab6b0eb1cfb37536ebaf && git checkout ea61f4fc5f98ea19f95fab6b0eb1cfb37536ebaf
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 529ed7d9391bcb47ea859bfe9ae4b0d1766fc234 75dcf734c357ea2305e4123bbddbf19e01e8724a && git checkout -B drift-repro 529ed7d9391bcb47ea859bfe9ae4b0d1766fc234 && git merge --no-ff 75dcf734c357ea2305e4123bbddbf19e01e8724a
node scripts/docs-audit/affected-docs.mjs --json 529ed7d9391bcb47ea859bfe9ae4b0d1766fc234
|
|
domain:spec#2 · os-steve · session_01ADHkmQjrEpxMVxEiDUJHqC Contract-review-claim: session_01ADHkmQjrEpxMVxEiDUJHqC · head 93b0b11 · 2026-11-15T16:26Z |
|
domain:spec#2 · os-steve · session_01ADHkmQjrEpxMVxEiDUJHqC Contract reviewServed-tier: Read: card #33786 (body and all six comments, the os-dev-report 6897591859 included), #33694 (body; the owner's ruling on cloud#3826 is read as that body quotes it, cloud#3826 itself was not an input), ADR-0090 D10 rule 4 with its 2026-09-16 and 2026-09-20 notes, ADR-0151 D5, PR #34018 (body, 13 files, net diff against merge base Check-runs on this head at review time. Completed, success: Check Changeset, Spec property liveness, Type Check · source gates, Lint · ESLint, Lint · docs & code guards, Lint · PM dispatch-gates, the three ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
Tried and not broken: an Open on this head: S1, S2. No must-fix. Both fixes are prose in the two Implemented-by: VERDICT: PASS |
…; stop claiming the audit writer records the new keys Claude-Session: https://claude.ai/code/session_01ADHkmRAvNc1qLS722dnoqn Co-authored-by: Claude <noreply@anthropic.com>
…ptions Claude-Session: https://claude.ai/code/session_01ADHkmRAvNc1qLS722dnoqn Co-authored-by: Claude <noreply@anthropic.com>
|
domain:spec#2 · os-steve · session_01ADHkmQjrEpxMVxEiDUJHqC Contract-review-claim: session_01ADHkmQjrEpxMVxEiDUJHqC · head ceeec02 · 2026-11-15T17:25Z |
|
domain:spec#2 · os-steve · session_01ADHkmQjrEpxMVxEiDUJHqC Contract reviewServed-tier: Read: record 6897691839 in full; card #33786 (body and all five comments: triage 6893867283, claims 6896002823, 6896038213 and 6897603637, os-dev-report 6897591859); PR #34018 body, labels and file list at this head; Check-runs on this head at review time (GET ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
Regenerated references — consistent. PR body against this head — holds. The declaration lines (
Tried and not broken: a main-side change to a Open on this head: none. S1 and S2 are closed. N1, N2, N3 stand as round 1 left them; N4, N5, N6 are nits with no change asked on this PR. Carried forward, off this PR: #33694 rewords the revision-bound sentences and regenerates, tests the resolve-before-stamp duty at its producer, and keeps the agent id out of the OAuth-client Implemented-by: VERDICT: PASS |
|
domain:spec#2 · os-steve · session_01ADHkmQjrEpxMVxEiDUJHqC Contract-review-claim: session_01ADHkmQjrEpxMVxEiDUJHqC · head 75dcf73 · 2026-11-15T17:38Z |
|
domain:spec#2 · os-steve · session_01ADHkmQjrEpxMVxEiDUJHqC Contract reviewServed-tier: Read: record 6898426121 in full; Check-runs on this head at review time (GET
① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
PR body against this head, read at 17:39:33Z (body last updated 17:38:52Z):
Tried and not broken: a second commit riding in beside the merge (none: one commit off main); a hand resolution altering a PR file (empty remerge diff, identical blobs); main changing a Open on this head: none on the contract. N6 and N7 are body nits. CI on Implemented-by: VERDICT: PASS |
|
domain:spec#2 · os-steve · session_01ADHkmQjrEpxMVxEiDUJHqC ACCEPT · PR #34018 (#33786) · head
|
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 43745034457 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 43745641090 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 43754687220 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 43761140033 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
|
domain:spec#2 · os-steve · session_01ADHkmQjrEpxMVxEiDUJHqC Requeue · PR #34018 · head
|
Requested by Steve · project thread
Fixes #33786
Clause-②: yes
Metadata-protocol: none
Claim by
domain:spec#2(6896038213). The spec half of #33694 (cloud#3826 phase 2). Ruling-ref: the account owner on objectstack-ai/cloud#3826, 「3826 照建议(征询版)」 (decision request 6890278459), as carried in the #33694 body: "Accept AI-on-behalf, conversation id and confirmation id on the write context, using the existingperformed_by/on_behalf_ofcolumns plus contract fields. Do not add a new actor vocabulary."维护者速读
ExecutionContext.performedBy在clientId旁新增agentId、conversationId、confirmationId三个可选键;hook 上下文provenance同步新增三个对应标记,引擎和沙箱都会带过去。clientId的上下文解析结果不变;clientId在类型上变为可选,读它的 TypeScript 代码需判空(第一方读者都已判空)。回滚即 revert。packages/spec/src/kernel/execution-context.zod.ts的performedBy块,packages/objectql/src/engine-execution-plumbing.ts的buildProvenance,packages/spec/src/data/hook.zod.ts的provenance。pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2 src/engine.test.ts -t "in-product AI performer",预期 2 条全过。What changes
packages/spec/src/kernel/execution-context.zod.ts(performedBy): three optional sibling keys besideclientId.agentId: the in-product AI agent that performed the write for the signed-in person. Same value asToolExecutionContext.agentId(the agent the chat runs as). Never asys_userid or an OAuth client id, so one key never holds two id namespaces.conversationId: same id asToolExecutionContext.conversationId.confirmationId: the id of the pending item the person's approval decided, i.e. the in-app pending action id (IAIService.proposePendingAction'sid, the seam Contract: AI-door confirmation rule binds every AI door, including the in-app assistant (#33689 Q1 ruled B) #33808 aligns) or the pending-confirmation service'sActionConfirmationPending.pendingId. Absent when no confirmation was needed.clientIdis now optional, because the shape forces it: the in-product AI has no OAuth client. The object takes.refine(requiredOneOf(['clientId', 'agentId'])), so aperformedBynaming no performer is still refused at parse, as it was whenclientIdwas required. The rule is on the projectable closed list, so the published JSON Schema states it (allOf: [{ anyOf: [{ required: [clientId] }, { required: [agentId] }] }]) anddropped-refinements.baseline.jsondoes not grow..describestop saying "Set only at the /mcp OAuth door". They name both producers: the/mcpOAuth door (clientId) and the server-constructed in-product AI path acting for and running as the signed-in person (agentId+conversationId+confirmationId). The ruling chain is cited in the jsdoc only. Kept as is: server-constructed only, never client-supplied; attribution only; never the authorization subject;userIdstays the person; noonBehalfOfon the in-product path, since the write runs on the person's own grants. The ADR-0090 2026-09-20 room for an agent-run id stays reserved;conversationIdis not that id.:agentName, a continued conversation, the pending item an approval names). It stamps one only after the server resolved it in its own store for the person inuserId:agentIdthe agent it actually ran,conversationIda conversation that person owns,confirmationIda pending item that person's approval decided for this operation. An unresolved id is not stamped.clientIdasperformed_bybesideon_behalf_of, which is true today, and that the in-product keys are carried for it and not recorded yet. How they are recorded is sys_audit_log: mark in-product AI writes (AI on behalf of a person, conversation id, confirmation id) #33694's.packages/spec/src/data/hook.zod.ts(HookContext.provenance):performedByAgentId,performedByConversationId,performedByConfirmationId, flattened the wayperformedByClientIdcopiesclientId. The provenance docblock goes from four marks to five.packages/objectql/src/engine-execution-plumbing.ts(buildProvenance): copies the three keys. Its own docblock says a key declared onhook.zod.tsand missing there is declared and never populated (ADR-0049), so the spec keys need this copy to be live.packages/runtime/src/sandbox/body-runner.tsandscript-runner.ts: the sandboxed body face carries the three marks member by member, like the other four, so a lowered hook body reads them onctx.provenancetoo.packages/plugins/plugin-audit/**(the writer half stays on sys_audit_log: mark in-product AI writes (AI on behalf of a person, conversation id, confirmation id) #33694),docs/adr/**, the MCP door (packages/core/src/security/assemble-execution-context.tsstill sets{ clientId }alone).ObjectQL#createContextrunsExecutionContextSchema.parse(ctx), which keeps declared keys only. On main anagentIda host put onperformedBywas dropped there.Tests
packages/spec/src/kernel/execution-context.test.ts, a new top-level describe. CONTROL:{ clientId }alone parses unchanged. The three new keys survive a parse. A write with no confirmation parses.{},{ conversationId }and{ confirmationId }are refused at pathperformedBy. A non-stringagentIdis refused. The description names both producers and no longer says "Set only at the /mcp OAuth door".packages/spec/src/data/hook.test.ts, a new top-level describe. CONTROL:performedByClientIdalone parses unchanged. The three marks survive a parse. A non-string mark is refused.packages/objectql/src/engine.test.ts, a new describe at the engine seam. A write whose context carriesperformedBy: { agentId, conversationId, confirmationId }reaches abeforeInserthook with the threeprovenancemarks, andsessionstays the person with noperformedBy. CONTROL:{ clientId }alone still givesprovenance: { performedByClientId }.packages/cli/test/lowered-body-face-enumeration.test.tspins the in-process and bodyprovenancemember sets. Both now list seven members instead of four.Acceptance notes
agentIdandconversationIdreuseToolExecutionContextvocabulary.confirmationIdfollows the card and ruling wording;pendingId(theActionConfirmationPendingkey) is the alternative. The hook-side names follow theperformedBy+ key prefix ofperformedByClientId.ExecutionContext['performedBy']['clientId']isstring | undefinednow. Every first-party reader already checks it (apiForwardAgentOf, the MCP interceptor, the three plugin-audit writers, objectql). The changeset says so for outside readers.Metadata-protocol: none:ExecutionContextis server-constructed andHookContext.provenanceis server-stamped, so a metadata author writes neither. Noauthorable-surface/shard moved. The feat(audit): AI service accounts, O4 of ADR-0151 — principalKind reaches hooks and explain, so an account is attributed as itself #31740 precedent tookaddedforHookContext.session.principalKind; the seat may read this the same way, which would raise spec tominor.performed_byholds for an in-product AI row) is sys_audit_log: mark in-product AI writes (AI on behalf of a person, conversation id, confirmation id) #33694's. ADR-0151 D5 refused putting a second id namespace into oneperformed_bykey, so the writer should keep the agent id apart from OAuth client ids in the row.confirmationIdis one key over two stores, the in-app pending action id and the pending-confirmation service item id. Which store an id names follows from the performer key beside it, and sys_audit_log: mark in-product AI writes (AI on behalf of a person, conversation id, confirmation id) #33694 should say so when it records the id.{ clientId, agentId }although no producer builds it; N3, a performer-lessperformedByis now refused at pathperformedBywith a custom code instead ofinvalid_typeatperformedBy.clientId.Verification
Head and readings are listed in the os-dev-report on #33786. Every heavy run went under
os-verify-lock.Round 2 (review S1, S2), at
bfaef935, changes prose only: the two.zod.tsdocblocks and descriptions, and the three regenerated reference pages. Spec pins 146/146 andcheck:generatedare green there.ceeec029merges mainb4ce310b, and the round 2 contract review (6898426121) is on that head.Current head
75dcf734is a merge-only commit made under the seat's K ≥ 15 landing rule. It merges main529ed7d9intoceeec029with no hand resolution, and all 13 PR files are byte-identical toceeec029(+311/-49). On it, the spec build,check:generated(14/14 up to date) and the spec pins (146/146) are green.Consumer test runs (branch at ca6e40c, before the main merge)
test/lowered-body-face-enumeration.test.ts(unit) 4 / 4; the rest of the cli unit layer is left to CI.After merging main 0ac112f (head 93b0b11), and again b4ce310 (head ceeec02)
check:generated: all 14 artifacts up to date. Closure build 113/113.engine.test.ts138/138, cli face test 4/4, runtimehook-provenance-signal.integration.test.ts1/1, objectql and runtime typecheck exit 0.ceeec029were all green, anddispatch-gatesthere gave 118 derived, 118 run, 0 NOT-MEASURED.Ablations (each through scripts/ablation-replace.mjs, restored with blob == HEAD and git diff HEAD empty)
buildProvenancestops copyingagentId:engine.test.ts"copies agentId, conversationId and confirmationId onto provenance" red..refine(requiredOneOf(...))becomes.refine(() => true): "REJECTS a performedBy naming no performer" red (1 failed / 45).performedByAgentIdprojection: cli face test 3 failed / 4.performedBy: { agentId, probeBogusKey }gives TS2353 onprobeBogusKeyonly, while{ agentId, conversationId, confirmationId }and a reader ofperformedBy?.agentIdcompile. The probe file was deleted.🤖 Generated with Claude Code
https://claude.ai/code/session_01ADHkmRAvNc1qLS722dnoqn