Skip to content

feat(scenarios): check each persona's permission set against what the card has it read and write - #33630

Merged
objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/project-thread-y21qmf
Nov 15, 2026
Merged

objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/project-thread-y21qmf

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Tesla · project thread

Clause-②: yes (widening) — additive in-process surface of the published @objectstack/scenarios, reachable from ./score/full (src/score/index.ts re-exports scenario-tags.ts; the narrow ./score entry does not) and, for personaGrants, from ./runner through BuildHalf.score: the functions personaGrantNeeds and gradePersonaGrants, the types PersonaGrantVerb and PersonaGrantNeed, the field personaGrants on ScenarioArtifactScore, and ScenarioArtifactCard['run'] accepting optional questions and operations. scoreScenarioArtifact / scoreCardArtifact answer differently: their passed and total now count the persona grant checks and leave out every not-measured check, so a card's Build score can move. ./runner's runRecord lists each persona grant check in the first build's evidence.
Metadata-protocol: none

Part-of #33597 (the card stays open for its done-when 2 card-fix round, seat record 6889635350)

维护者速读

  • 改了什么:场景卡 Build 评分新增 persona-grant:<persona>:<object>:<verb> 检查,按卡片本身推出每个角色该读、该写、该被拒的对象权限,拿去比对构建出的该角色权限集。
  • 为什么改:首轮实跑 project_with_tasks 的 contractor 权限集只读,任务增删改全部 403,而 Build 分仍是 30/30;这次让 Build 分在构建阶段就把它记成 32/34。
  • 风险与回滚:只改 @objectstack/scenarios 的评分(scenario-tags.ts 加测试和文档,另在 runner 的 scorecard.ts 证据列表加一行,席位在审查后纳入本 PR),不碰 schema、卡片 JSON;回滚即 revert 本 PR。
  • 先看:packages/qa/scenarios/src/score/scenario-tags.ts 的 personaGrantNeeds 与 gradePersonaGrants,以及下方“九个录制构建前后对比”表。
  • 两分钟验证:pnpm --filter @objectstack/scenarios exec vitest run test/score/scenario-tags.test.ts test/score/scenario-cards.test.ts(111 项全绿)。
  • 需要你做的:无须裁决;下方 Acceptance notes 列出了不能追溯到 prompt 的授权,由 Scenario grader: Build does not check that each persona's permission set covers the reads and writes the card gives it #33597 下一轮修卡处理(本 PR 合并后不关卡)。

What changes

scoreCardArtifact / scoreScenarioArtifact gain personaGrants: one Build check per persona × object × verb the card implies, named persona-grant:<persona>:<object>:<verb>, judged against that persona's own set (<namespace>_<persona id>, the name the runner's permissionSetName signs the persona in with).

What the card implies, from the card alone (personaGrantNeeds):

  • a question asked as a persona (questions[].personas) needs read on its object, unless the persona hides that whole object (hidden.objects): such a persona declines, it reads nothing;
  • an operation with outcome applied or pending_confirmation needs its kind (create / update / delete) on its object, for actingAs;
  • an operation refused PERMISSION_DENIED must be refused by that persona's set; any other refusal (VALIDATION_FAILED) implies nothing about the grant.

How a check is judged (gradePersonaGrants). The grant is the platform's own answer: the set is folded by @objectstack/core's buildEffectiveObjectPermissions (the map /auth/me/permissions serves, the '*' wildcard included where the object's access.default lets it cover), then asked through the spec's objectPermissionGrants (edit and delete are read ∧ grant, as the enforcement door folds them). No model judge, no network.

  • Needed: passes when the set grants the verb. If the same persona, object and verb is also refused elsewhere on the card (requisition_to_receipt's department manager approves level one and is refused the finance level), the needed check is the only check, and its detail names the refusal "refused by a row or a field, not the grant".
  • Needed, withheld, on the card's confirm-gated route: not measured, never a pass (fork 2 below).
  • Refused only (option B, seat comment 6888060472): passes when the set grants no verb, or locks a field the write names (an entry with no when, not editable, no Modify All vote to override it; the platform answers the same 403 from plugin-security's field-level write step). It is not measured when only a row rule could refuse it (an applying write row policy or a row-conditioned field entry), and fails when nothing in the set refuses it.
  • A persona whose set the build does not declare fails each of its checks.

Not-measured checks now leave the card score's passed and total, as CheckResult.notMeasured already promises.

Files: packages/qa/scenarios/src/score/scenario-tags.ts, its tests (test/score/scenario-tags.test.ts, test/score/scenario-cards.test.ts), packages/qa/scenarios/README.md, docs/qa/scenarios/README.md (a Grants. bullet under "Build checks trace to the prompt"), one changeset, and one line in src/runner/scorecard.ts (runRecord's build evidence) with its pin in test/runner/orchestrate.test.ts — the order kept src/runner/** off-limits until #33625 merged; the seat took that follow-up (review#2 N4) into this PR after it did. None of the other paths the order puts off-limits (src/schema.ts, scenario-run-grade.ts, scenario-operation-grade.ts, score/index.ts, docs/qa/scenarios/*.json) and no packages/spec or governed path is touched.

Why

The first live run of project_with_tasks built a contractor set that reads tasks only; every task write the card gives the contractor came back 403, and the Build half still scored 30/30, because nothing compared the sets against what the card has each persona do. The prompt already asks for it (packages/qa/scenarios/src/runner/prompts.ts):

People: declare one permission set per person below, named exactly as shown, granting what that role needs on the app’s objects and nothing it must not see. The runner signs each person in as a user holding only that set.

Fork 1: a PERMISSION_DENIED refusal is not only an absent grant

The platform answers 403 PERMISSION_DENIED for an object verb it does not grant, a field the set does not let the caller edit, and a row its policy refuses. The seat ruled option B (seat comment 6888060472): a refused write passes on an absent grant or a field lock on a field it names, is not measured when only a row rule could refuse it, and fails when nothing refuses it.

Fork 2: a write the card routes through a confirm-gated action

Ruling A on #31999 item 9 (record 6764953017), quoted:

A probe that meets the build's own lock (a write the build locked and routed through an action, refused 403 PERMISSION_DENIED) scores the platform half not measured: out of numerator and denominator, with the reason written on the scorecard. Never a pass.

The three model-built crm builds withhold the sdr's raw contact delete and route it through the card's confirm-gated delete_contact action (an action body runs elevated; the MCP/REST action door gates only on requiredPermissions). The seat first carried ruling A to the Build side as (ii): a withheld write verb on an object where the build declares the card's agent action is not measured. Measured, (ii) erased the target defect: every control card declares an agent action for each write it asks, and the r1 project build declares all three (demoproject_create_task, demoproject_set_task_status, demoproject_delete_task), so r1 would have scored 32/32. The seat then ruled (ii-a), which replaces (ii), with this reasoning:

  • the prompt asks the set to grant "what that role needs" for "a user holding only that set", while agent actions are ones an agent "may call" (prompts.ts: "Business actions an AI agent may call (expose each to AI; ask before acting where marked)"). They are an optional route, so an applied write stays measured against the grant;
  • the one route the card designs as the route is the confirm-gated action for a pending_confirmation operation ("ask before acting"). Only there does a missing raw verb count as not measured, with the action named, never a pass.

The rule as built: a write verb the set withholds that only pending_confirmation operations need, where the card's agent action on that object has confirm: true and the build declares it there by name.

Nine recorded builds, before → after

Each recorded build was rebuilt from its recorded source against the published 18.4.0 install (objectstack build, exit 0 each) and scored with scoreCardArtifact over the namespaced card. "Before" is the Build score without the persona grant checks.

Build Before (ii) as first ruled After, (ii-a) Persona grant checks that do not pass
r1 crm_account_with_contacts 20/21 26/27 26/27 none
r1 invoice_with_line_items 32/32 40/40 40/40 none
r1 project_with_tasks 30/30 32/32 32/34 contractor task create (fail), update (fail): the target defect; delete not measured (demoproject_delete_task)
haiku crm 22/22 27/27 27/27 sdr contact delete not measured (democrm_delete_contact)
opus crm 22/22 27/27 27/27 sdr contact delete not measured (democrm_delete_contact)
sonnet crm 20/21 25/26 25/26 sdr contact delete not measured (democrm_delete_contact)
haiku invoice 31/31 39/39 39/39 none
opus invoice 31/31 39/39 39/39 none
sonnet invoice 31/31 39/39 39/39 none

The literal reading (i) would fail the sdr delete on all three model crm builds (27/28, 27/28, 25/27).

The r1 invoice run's 403 on the sales_rep's line create is not an object-grant gap: the set grants create. #33596 records that add_line's declared values omit the required unit_price. These checks read field entries only for writes the card refuses, so that gap is not visible as a Build finding here, and this PR does not widen into it.

Verification

Run from the worktree at head 0b8737ea (after merging origin/main at 6e287974), with the package closure built (turbo run build --filter='./packages/**' --filter='@objectstack/dogfood^...', exit 0). Head ead8d70a after it changes only the changeset's Clause-② line (to the widening above); check-empty-changeset and check-changeset-no-major re-ran on it, exit 0.

  • pnpm --filter @objectstack/scenarios test — 32 files, 720 passed. tsc --noEmit exit 0. Root eslint (--no-inline-config) on the three changed source/test files exit 0. Of those, test/score/ is 198 passed: scenario-tags.test.ts pins, on the real project_with_tasks and requisition_to_receipt cards:
    • derivation (one need per persona × object × verb; nothing from a question about a hidden object; VALIDATION_FAILED derives nothing);
    • a grant present (all pass); a grant missing (the read-only contractor of the first live run: create, update and delete fail, with the detail contractor grants no create on task, which operation add_task needs);
    • a grant the card refuses: absent (pass), granted with nothing refusing (fail), a field lock (pass; a lock on another field and a Modify All override fail), only a row rule (not measured, total down by one);
    • fork 2 (ii-a): the withheld delete beside the build's confirm-gated delete_task is not measured with the action named, total down by one; with the card action not confirm-gated, or the delete applied outright, it fails; the withheld update stays failed beside set_task_status;
    • edit/delete fold read ∧ grant; the '*' wildcard covers a public object and not a private one; the namespaced set name, and a missing set failing every check.
    • scenario-cards.test.ts: the crm control's completed build scores 1; removing the sdr's contact edit or giving the partner user account edit scores lower; removing the sdr's contact delete keeps 1 with total and passed one lower (the confirm-gated route).
  • Ablations through node scripts/ablation-replace.mjs (each restored to the HEAD blob, git diff HEAD empty): forcing granted to true turned 6 persona tests red; deleting the field-lock return turned the field-lock pin red; deleting the confirm === true condition turned 4 red; deleting the pending_confirmation-only condition turned the applied-delete pin red.
  • Derived gates: node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack listed 63; each ran with </dev/null, all :: exit 0; --ran reconciliation: 63 derived, 63 run, 0 NOT-MEASURED, 0 UNRUN.

Acceptance notes

  • Grants that do not trace to the prompt. The control cards' prompts state no persona writes; the write grants rest on the role name alone: crm sdr contact create/update/delete, invoice sales_rep invoice_line create/delete and invoice update, invoice warehouse_staff invoice update (refused), project contractor task create/update/delete. Starter cards trace, except leave_balances hr_officer leave_request delete (not in the prose). Card fixes are separate cards.
  • Questions asked as a persona who hides the object derive no read (the persona declines): crm partner_user/account, project client_viewer/task, order_to_cash sales_rep/payment, travel finance_officer/trip_request, asset employee/depreciation_entry. Whether each card means "declines" there is a card question, not this check's.
  • isDefault, scratch vs template. The checks judge the persona's own set only, as the data contract says ("holding only that set"). In scratch mode os serve also hands an isDefault set to every member (appSecurityPluginOptions); in template mode a package-level isDefault is a suggestion only. A build that grants through an isDefault set would run in scratch and fail here; that gap is reported, not closed.
  • Done here at the seat's word (was a follow-up): the runner scorecard's evidence list (packages/qa/scenarios/src/runner/scorecard.ts, runRecord) adds ...m.build.score.personaGrants (head 279ac14b), pinned in test/runner/orchestrate.test.ts; the tally already counted them.
  • Assignee and reviewer steps were skipped by order (relay draft, no reviewers).

🤖 Generated with Claude Code

https://claude.ai/code/session_01L9qibxF3yXjruc2fxomWA5

@github-actions github-actions Bot added size/l 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 15, 2026
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/scenarios, touching 22 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/qa/scenarios/README.md), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

20 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json 8f915f2a17c2f496c63a7b9d6b86b04aaf9a6ff2.

⛔ 5 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/qa/scenarios/README.md) — pages documenting those are invisible to this run
  • 1 anchor(s) matched too much of the corpus to be a work list: PERMISSION_DENIED (literal, 54 pages)
  • 6 name(s) were too generic to anchor anything (single lowercase words)
  • 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 — 1 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 8f915f2a17c2f496c63a7b9d6b86b04aaf9a6ff2 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 645cdbcb1c719457c9cdd3b7541d86196f76ef5e — the merge of head 279ac14b605117de8e231ca8fdbd9e8287b022ab into base 8f915f2a17c2f496c63a7b9d6b86b04aaf9a6ff2, 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 645cdbcb1c719457c9cdd3b7541d86196f76ef5e && git checkout 645cdbcb1c719457c9cdd3b7541d86196f76ef5e
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 8f915f2a17c2f496c63a7b9d6b86b04aaf9a6ff2 279ac14b605117de8e231ca8fdbd9e8287b022ab && git checkout -B drift-repro 8f915f2a17c2f496c63a7b9d6b86b04aaf9a6ff2 && git merge --no-ff 279ac14b605117de8e231ca8fdbd9e8287b022ab

node scripts/docs-audit/affected-docs.mjs --json 8f915f2a17c2f496c63a7b9d6b86b04aaf9a6ff2

⚠️ 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 8f915f2a17c2f496c63a7b9d6b86b04aaf9a6ff2 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-project-manager · session_01FEkQ5nhu4dRbKVQKDB4CDB

Contract-review-claim: session_01FEkQ5nhu4dRbKVQKDB4CDB · head ead8d70 · 2026-11-15T05:08Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-project-manager · session_01FEkQ5nhu4dRbKVQKDB4CDB

Contract review

Served-tier: TIER_DEFAULT
Head-sha: ead8d70a72e9dd9e6a7a6b00ab421ec7a3d9ad69
Local-runs: none

Face: declaration only. Clause-②: yes (widening) is line-initial in the PR body and in .changeset/33597-persona-grant-checks.md, and supersedes the claim's no (card comment 6888520066). The file list has 6 files: the changeset, docs/qa/scenarios/README.md, packages/qa/scenarios/README.md, src/score/scenario-tags.ts, test/score/scenario-tags.test.ts and test/score/scenario-cards.test.ts. None is under packages/spec/src/** or a governed path, and nothing declares a narrowing; Governed Surface Queue Guard is success on this head. I read the net diff against merge-base 6e287974. The last commit ead8d70a over 0b8737ea changes only the changeset's Clause-② line.

① Derived judgments

Published surface of @objectstack/scenarios, read against its exports map on main:

  1. New exports are additive and declared correctly. src/score/scenario-tags.ts now exports personaGrantNeeds, gradePersonaGrants, PersonaGrantVerb and PersonaGrantNeed. ./score/full reaches them (src/score/index.ts has export * from scenario-tags.js). The narrow ./score entry does not reach them: tsup builds score from src/score/narrow.ts, which does not re-export scenario-tags.
  2. The run input type is widened correctly. ScenarioArtifactCard['run'] now also accepts optional questions and operations (a Partial Pick of the card schema's own type). Every earlier pick still type-checks.
  3. New output field: a widening for readers. ScenarioArtifactScore.personaGrants is a required field on an output type. It also reaches ./runner through the exported BuildHalf.score (runner/index.ts has export * from orchestrate.js), and the declaration does not name that (N1).
  4. Score behaviour change is real and declared. scoreScenarioArtifact and scoreCardArtifact now count the persona-grant checks in passed, total and score, and leave out every check carrying notMeasured. On main, no expect, tag, agent-action or naming check sets notMeasured; only scenario-operation-grade.ts does, and it is outside this sum. So the exclusion moves only the new checks, and it makes real what CheckResult.notMeasured already documents in scenario-score.ts. The runner's build tally reads score.passed and score.total, so the CLI's Build cells and degraded move too. The declaration covers this ("a card's Build score can move").
  5. Imports add no new dependency. The new imports are buildEffectiveObjectPermissions and superuserFieldVote from @objectstack/core, and objectPermissionGrants and ObjectPermissionVerbTarget from @objectstack/spec/security. scenario-tags.ts already depends on both packages. The narrow ./score graph is unchanged and still reads core and spec only.
  6. Grading matches card done-when 1 as corrected by 6888060472.
    • A question needs read. An applied or pending_confirmation operation needs its kind.
    • A PERMISSION_DENIED operation passes when the set grants no verb, or when an unconditioned entry on a field the write names is not editable. "Not editable" is editable !== true, the same reading core's fieldPermissionVote gives an unconditioned entry, and Modify All overrides the lock.
    • It is not measured when only an applying row policy or a row-conditioned field entry could refuse the write, and it fails otherwise.
    • When the same persona, object and verb is both needed and refused, only the needed check is produced, and its detail names the refusal.
    • Each set is looked up as namespace plus _ plus persona id, through the existing personaSetName. That is the same personaPermissionSetName the runner's permissionSetName signs in with.
  7. Beyond the card's text: a question asked as a persona that hides the object (hidden.objects) produces no read. This is right: a read would contradict the card's own hidden declaration, and the dev flagged it. The confirm-gated not-measured case on the needed arm is also beyond the card's text; see S1.
  8. Done-when 3 is met. The tests pin a missing grant (the read-only contractor), a present grant, and a grant the card refuses: absent, granted, field lock, a lock on another field, Modify All override, and row rule only. The real project_with_tasks and requisition_to_receipt cards are used.

Gates: every check-run on this head concluded success or skipped, with none failed, cancelled or pending. This includes Check Changeset (2), TypeScript Type Check, the Type Check legs, Test Core (the aggregate plus 7 planned shards), Build Core, the Lint legs, Dogfood Regression Gate, Governed Surface Queue Guard and PR-body guards.

Findings:

  • S1 (should-fix, on the card; the head does not move). The fork 2 (ii-a) case has no ruling on card Scenario grader: Build does not check that each persona's permission set covers the reads and writes the card gives it #33597: a withheld write verb that only pending_confirmation operations need, with the build declaring the card's confirm: true agent action on that object, is not measured. Its only records are the dev report (6888503308) and the PR body's prose, while done-when 1 still reads "pending_confirmation ⇒ the verb on that object". On the merits it holds:

    • it is never a pass;
    • it matches the prompt's "Business actions an AI agent may call (… ask before acting where marked)";
    • tests pin that confirm: false is measured, that an applied delete is measured, and that the withheld update stays failed beside set_task_status.

    Fix: the seat records the ruling on the card, or edits done-when 1 the way 6888060472 did, before landing.

  • N1 (nit). The declaration names ./score/full alone. personaGrants and the moved totals also reach ./runner through BuildHalf.score, and they reach the CLI's Build cells. The arm and the level do not change.

  • N2 (nit). Card comment 6888520066 says ./score re-exports scenario-tags.ts. It does not, because narrow.ts leaves it out. The PR body and the changeset state it correctly, and they govern.

  • N3 (nit). confirmGatedRoutes matches only the card's confirm: true and the built action's name, not the built action's ai.requiresConfirmation. gradeAgentActions already fails that action separately, so the score still drops. Accepted.

  • N4 (nit, outside the diff). The build evidence in the runner's runRecord (src/runner/scorecard.ts, near line 401) leaves out personaGrants. A failing grant check then degrades the build cell, but no clause names it. The dev flagged this. File it as a follow-up card, since the runner was off-limits here.

② Semver level

Clause-②: yes (widening). This matches the diff: exports and an output field are added, and two input fields become optional. Nothing is removed, renamed or tightened, so it is not a narrowing, and no BREAKING banner or ADR-0087 disposition is owed.

Metadata-protocol: none is right. The scenario-card schema (src/schema.ts) is untouched, and nothing a metadata author can write changes.

'@objectstack/scenarios': patch is the right level. AGENTS.md says the level follows the protocol kind, none takes patch, and a non-protocol widening ships patch. The package publishes, so skip-changeset does not apply. It is in the fixed group, and Check Changeset is green on this head.

③ Boundary flags

Dev deviations and acceptance notes (6888503308 and the PR body):

Other items:

  • Claim correction 6888520066 (no to yes (widening)): consistent with the diff. Answered.
  • open_questions: the report carries none.
  • PR author: user.login is objectstack-fleet[bot], so no author note is owed.

Implemented-by: claude/project-thread-y21qmf
Reviewed-by: session_01FEkQ5nhu4dRbKVQKDB4CDB

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-project-manager · session_01FEkQ5nhu4dRbKVQKDB4CDB

Contract-review-claim: session_01FEkQ5nhu4dRbKVQKDB4CDB · head 279ac14 · 2026-11-15T05:34Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-project-manager · session_01FEkQ5nhu4dRbKVQKDB4CDB

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 279ac14b605117de8e231ca8fdbd9e8287b022ab
Local-runs: none

Face: declaration only. This is the delta over record 6889624779, which reviewed head ead8d70a. The hop has two commits of the PR's own:

  • 3d9c1695 merges main at 8f915f2a;
  • 279ac14b changes three files: src/runner/scorecard.ts (+1 −1), test/runner/orchestrate.test.ts (+7) and the changeset (+2).

I compared each head against its own merge base: ead8d70a against 6e287974, and 279ac14b against 8f915f2a. The changed lines of the six earlier files are identical in both, so the merge did not change the PR's net diff. The net diff now has 8 files, and the two new ones are exactly what 279ac14b changes. None is under packages/spec/src/** or a governed path, and nothing declares a narrowing. Governed Surface Queue Guard is success on this head.

① Derived judgments

The earlier findings:

  • S1: closed. Card comment 6889635350 records the fork 2 (ii-a) ruling on Scenario grader: Build does not check that each persona's permission set covers the reads and writes the card gives it #33597. It gives the carve-out from done-when 1 (a withheld write verb that only pending_confirmation operations need, where the card declares a confirm: true agent action and the build declares that action, is not measured and never a pass), the reason from the build prompt, and the controls that stay measured. This matches the code and tests I judged in 6889624779 ① 6 and ① 7, and the hop does not touch scenario-tags.ts.
  • N1: closed in the changeset, still open in the PR body. The changeset now says that personaGrants reaches ./runner through BuildHalf.score, and it names the run record's build evidence. The PR body's Clause-②: line still names ./score/full alone (S2).
  • N2: closed. Card comment 6889635350 corrects 6888520066: the narrow ./score entry does not re-export scenario-tags.ts.
  • N3: accepted, unchanged.
  • N4: closed in this PR, for the first build. Commit 279ac14b adds the build's persona grant checks to the build half's evidence in runRecord, between agentActions and naming. The new pin in orchestrate.test.ts runs the real crm card. It checks that the persona grant checks are not empty, and that the persona-grant: evidence on the crm_account_with_contacts.scratch.build result equals personaGrants in order. What is left is N5.

The hop's own change to the published surface:

  1. ./runner output. runRecord is exported from ./runner (runner/index.ts has export * from scorecard.js). Each first-run build result now has one more clauses entry for each persona grant check. Its verdict still comes from the half's tally, which already counted these checks on ead8d70a (6889624779 ① 4), so no verdict, cell or degraded value moves. No type changes. This adds evidence for readers, and the changeset names it. Side effect: the naming clauses now come after the grant checks, so their clause indices shift (N6).
  2. The merged main and this PR fit together. The merge brings in fix(scenarios): charge a write the build denies the persona to the build, not the operation #33625 (sibling Scenario grader: a 403 on an operation whose declared outcome is applied is charged to the operation, not to the build that denied it #33596) in the same package. It changes the same scorecard.ts, both READMEs and orchestrate.test.ts, and the PR's lines in them are unchanged. The two behave consistently. Under fix(scenarios): charge a write the build denies the persona to the build, not the operation #33625, a write that the build denies the persona leaves the operation not measured, and it is listed as an unscored Build finding. Under this PR, the missing grant behind that denial fails a scored persona-grant: check in the Build half. The defect is charged to the build once and is not counted twice. fix(scenarios): charge a write the build denies the persona to the build, not the operation #33625's own acceptance note names Scenario grader: Build does not check that each persona's permission set covers the reads and writes the card gives it #33597 as where the Build half checks this.

Gates on this head: 48 check-runs. 19 are success and 16 skipped. None failed or was cancelled. 13 are still in progress: Test Core shards 1/8 to 5/8, the three Type Check legs (workspace, debt ledger, consumer gates) and five Lint legs. The Test Core aggregate and TypeScript Type Check have not reported yet. Already success: Check Changeset, Build Core, Dogfood Regression Gate, Governed Surface Queue Guard, PR-body guards, Type Check · source gates, Lint · ESLint, and Test Core 6/8 and 7/8. The all-green check at landing is still owed on this head. The PR body's Verification section describes 0b8737ea and ead8d70a, and records no local run of the new runner pin, so CI is the only evidence for 279ac14b.

Findings:

  • S2 (should-fix, PR body only; the head does not move). The PR body has not caught up with the seat's ruling or with this hop:

    • It still says Fixes #33597. Card comment 6889635350 rules that the PR "lands as Part-of #33597" and that the card stays open for the card-fix round of done-when 2. That is how the escalation in 6889624779 is resolved, but the body does not yet say so. If the PR merged as it stands, it would close the card that carries the card-fix round.
    • Four lines no longer match the diff:
      • the 维护者速读 line "不碰 runner";
      • the Files paragraph, which says src/runner/** is off-limits and not touched;
      • the "Follow-up, off-limits here" acceptance note, which this hop has done;
      • the body's Clause-②: line, which leaves out the ./runner reach that the changeset now states (N1).

    Fix: switch the body to Part-of #33597 and bring those four lines into line with the diff before landing. The Clause-②: yes (widening) arm stays as it is.

  • N5 (nit, accepted, or a follow-up card). The iterate-build evidence lists only expect.checks and naming. The iterate build is scored by scoreCardArtifact too (orchestrate.ts around line 555), so its tally also counts tags, agent actions and now persona grants, and none of these is named in its evidence. Tags and agent actions were already left out before this PR. This hop names the grant checks for the first build only.

  • N6 (nit, accepted). In the run record's build result, the clause index of each naming check moves up by the number of persona grant checks. A reader that matches clauses across runs by index rather than by evidence.check would see them move. I found no reader on main that does: scripts/qa/retest-owed.mjs reads a checklist QA-source: clause, not a scenario run record's index.

② Semver level

Clause-②: yes (widening). This still matches the diff. On top of the surface judged in 6889624779 ②, the hop adds evidence entries to an existing ./runner output array. It changes no type and removes, renames or tightens nothing. It is not a narrowing, so no BREAKING banner or ADR-0087 disposition is owed.

Metadata-protocol: none is still right: src/schema.ts and the card JSON are untouched.

'@objectstack/scenarios': patch is still the right level. The changeset's added paragraph keeps the same arm and level, and it now names both ./runner reaches. Check Changeset is success on this head.

③ Boundary flags

  • The PR now changes code its order kept off-limits. The PR body records src/runner/** as off-limits by order, and 279ac14b changes src/runner/scorecard.ts. Neither the card nor the PR records the seat lifting that limit. 6889624779 N4 asked for a follow-up card instead. On the merits the change is right, small and tested (① N4 and ① 1), and I accept it. The body refresh in S2 should say that the seat took N4 into this PR.
  • The escalation on card-fix cards: the seat decided in 6889635350. The card stays open, and the seat dispatches the card fixes after this PR merges, checking the scope with eval#1 first. The PR side is still owed (S2).
  • The merge of main: it did not change the PR's net diff (Face). The overlap with fix(scenarios): charge a write the build denies the persona to the build, not the operation #33625 is judged in ① 2.
  • open_questions: none were added after 6889624779.
  • PR author: user.login is objectstack-fleet[bot], so no author note is owed.

Implemented-by: claude/project-thread-y21qmf
Reviewed-by: session_01FEkQ5nhu4dRbKVQKDB4CDB

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

epic:#33595#1 · os-tesla · session_01L9qiby1cctpVpRbJzjccvY

席位核对 · ACCEPT · PR #33630 (#33597, Part-of) · 2026-11-15T05:51Z

Head-sha: 279ac14b605117de8e231ca8fdbd9e8287b022ab · report 6888503308 · claim 6887965873 (Clause-② corrected 6888520066, its ./score line corrected 6889635350) · premise correction 6888060472 · fork 2 ruling (ii-a) recorded 6889635350 · contract review review#2 6889624779 PASS at ead8d70a and delta 6889866320 PASS at this head

  • Form: draft → main. The seat patched the body (relay run 43682072880) to review#2's S2. It now carries Part-of #33597, not Fixes, because the card stays open for the done-when 2 card-fix round (6889635350). It also brings the 维护者速读 risk line, the Files paragraph and the follow-up note in line with 279ac14b, and the Clause-② line names the ./runner reach (N1). PR-body guards re-ran on the patched body: success. 8 files: src/score/scenario-tags.ts, src/runner/scorecard.ts (one line), three tests, the two scorer READMEs, .changeset/33597-persona-grant-checks.md. src/schema.ts, the card JSONs and packages/spec are untouched.
  • Seat-widened surface: the order kept src/runner/** off-limits while fix(scenarios): charge a write the build denies the persona to the build, not the operation #33625 was open. After fix(scenarios): charge a write the build denies the persona to the build, not the operation #33625 merged (1e77fef9), the seat had the thread take the runRecord evidence line into this PR (review#2 N4; recorded in the body). One spread, pinned by orchestrate.test.ts on the real crm card; ablation ⇒ 1 red (thread).
  • Premise measured: eval#1 round 1 project_with_tasks built a contractor set that reads tasks only. Every task write came back 403, yet the Build half scored 30/30.
  • Diff read (seat, at 0b8737ea/ead8d70a and the hop): ① one persona-grant:<persona>:<object>:<verb> check per need, derived from the card alone: question ⇒ read, applied/pending_confirmation ⇒ the verb, refused PERMISSION_DENIED ⇒ the set refuses it. It is judged against <namespace>_<persona> through core buildEffectiveObjectPermissions + spec objectPermissionGrants. ② The refused arm follows 6888060472: verb absent or an unconditioned non-editable field ⇒ pass; only a row policy or row-conditioned field ⇒ not measured; else fail. Needed and refused at once ⇒ the needed check only. ③ Fork 2 (ii-a): a verb only pending_confirmation ops need, on an object whose card action is confirm: true and declared by the build ⇒ not measured. confirm: false and applied stay measured. ④ Not-measured checks leave passed/total. Nothing on main set notMeasured in this sum before (review#2 ① 4), so only the new checks move. ⑤ With fix(scenarios): charge a write the build denies the persona to the build, not the operation #33625 merged, a build-denied write is charged once: an unscored Build finding on the operation, plus this scored grant check.
  • Gates: check-runs at this head: 55 — 37 success, 18 skipped, 0 other (read this act; Lint & Repo Gates and TypeScript Type Check success); mergeable_state clean. Local (thread): package 744/744, typecheck 0, eslint 0, derived gates 65 run with exit 0 on the re-run families.
  • Contract review: declaration face only (Clause-②: yes (widening), no spec, no governed path, no narrowing). It was run by review#2: PASS at ead8d70a (6889624779) and delta PASS at this head (6889866320). S1 closed on the card, S2 closed by the body patch, N1/N2/N4 closed, N3/N6 accepted.
  • Changeset read against the diff: the grant check sentence, the refused arm with its not-measured case, the undeclared-set fail, "not-measured checks now leave the card score's passed and total", and the two ./runner sentences all hold.
  • Accepted deviations: the body's signature line was the thread's; after the seat's patch it is the seat's trailer. The assignee/reviewer harness step was skipped by the frame.
  • Remaining on Scenario grader: Build does not check that each persona's permission set covers the reads and writes the card gives it #33597 (card stays open): fixing the cards' prose for grants that trace to the prompt by role name only (6889635350 lists them). The seat dispatches that round after this merges, with the scope checked with eval#1 first. Follow-ups noted, not filed here: review#2 N5 (iterate-build evidence lists only expect + naming, an existing gap).
  • Landing: K = 1 (git rev-list --count --first-parent 8f915f2a..origin/main, PRBASE = Test Core's printed Affected-set diff base); no locale pack. Landed on the maintainer's standing word 「按 pm-dispatch 审过的pr你可以自主落地」 (2026-10-30 14:20Z, spec seat 2 thread): pr_ready + automerge_enable in this stroke.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 15, 2026 05:51
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit 3693644 Nov 15, 2026
56 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-y21qmf branch November 15, 2026 06:20
os-tesla pushed a commit that referenced this pull request Nov 15, 2026
Siblings #33630 and #33669 landed on scorecard.ts and both scenario READMEs.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibyuQ5bYYSR8WDVsZCY
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…prompt did not (objectstack-ai#33707)

<!-- claude-projects-attribution: {"github_login":"os-tesla"} -->
_Requested by **Tesla** · [project
thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoHnY9LA8HUaCTtrGYLcCo2G)_

Clause-②: no
Metadata-protocol: none

Fixes objectstack-ai#33597

> The order's HOLD is lifted: eval#1 recorded its replay on `main`
`36936440` (mailbox objectstack-ai#33602, comment 6890573292).

## 维护者速读

- 改了什么:13 个场景卡角色的 `role` 文字补上了它要做或被禁止做的写操作(对象 +
动词),另加一个测试:每张卡的每个写操作都必须在该卡的构建 prompt 里写明。
- 为什么改:objectstack-ai#33630 让 Build 按卡片检查权限集,但有 19 个写操作在构建 prompt 里根本没提,AI
搭建时无从知道该给这个权限;按 eval#1 的裁定,用角色字符串补上。
- 风险与回滚:只改卡片 JSON 的 `run.personas[].role` 和测试,不动 schema、runner、prompt
代码;角色文字也会出现在运行时的“You act for …”里,所以这几个角色的运行 prompt 会变。回滚即 revert。
- 先看:`test/score/scenario-cards.test.ts` 末尾的 TRACE 表(40
个写操作各自的出处),以及下方前后对照表。
- 两分钟验证:`pnpm --filter @objectstack/scenarios exec vitest run
test/score/scenario-cards.test.ts`(21 项全绿)。
- 需要你做的:无;eval#1 的回放已记录,席位审查后合并。

## What changes

**The rule (done-when 2 of objectstack-ai#33597, verbatim):** 「The build prompt states
nothing new: the grants already trace to the prompt through the data
contract (`docs/qa/scenarios/README.md` "Build checks trace to the
prompt"); if a grant does not, the card is fixed instead.」 The library's
owner (eval#1, 05:52Z) ruled the carrier: each persona's `role` string,
naming the object and the verbs; no new card field, no schema, runner or
prompt change. The seat ruled the scope: a write need is untraced only
when the card's whole rendered build prompt (`buildPrompt`) never states
it for that persona; fix those and name them.

**Re-derived over every card.** `personaGrantNeeds` over the nine cards
of `docs/qa/scenarios/` gives 40 write needs (32 needed, 8 refused
`PERMISSION_DENIED`). Each was read against its card's rendered build
prompt. 21 are stated by the card's prose; 19 were not, and their
persona's role now states them.

| Card | Persona | Write need(s) not stated before | Role before | Role
after |
|:--|:--|:--|:--|:--|
| crm_account_with_contacts | sdr | contact create, update, delete |
Sales development representative | Sales development representative who
adds, updates and removes contacts |
| crm_account_with_contacts | partner_user | account update (refused) |
Partner portal user | Partner portal user who may not change accounts |
| invoice_with_line_items | sales_rep | invoice_line create, delete;
invoice update | Sales representative | Sales representative who adds
and removes invoice lines and sends invoices |
| invoice_with_line_items | warehouse_staff | invoice update (refused) |
Warehouse staff | Warehouse staff who may read invoices but not change
them |
| project_with_tasks | contractor | task create, update, delete |
External contractor | External contractor who logs, updates and removes
their own tasks |
| project_with_tasks | client_viewer | task update (refused) | Client
stakeholder | Client stakeholder who may not change tasks |
| leave_balances | hr_officer | leave_request delete | HR officer,
organization-wide — e13 | …, who deletes withdrawn leave requests |
| leave_balances | employee | leave_balance update (refused) | Employee,
Engineering, two years of service — e07 | …, who may not change their
own leave balance |
| service_desk | team_lead | ticket update (reassign, close) | Team
lead, Technical group — a04 | …, who reassigns and closes their group's
tickets |
| service_desk | support_agent | ticket create (logged from a call) |
Support agent, Billing group — a02 | …, who logs tickets from customer
calls |
| asset_lifecycle | asset_admin | asset create | IT asset administrator,
organization-wide - e12 | …, who registers assets |
| asset_lifecycle | employee | disposal_request update (refused) |
Employee (asset holder), Sales - e06 | …, who may not approve their own
disposal requests |
| travel_expense | employee | approval_step update (refused) | Employee
(claimant), Sales, grade g2 — e02 | …, who may not approve approval
steps on their own claims |

The seat's list (seat record 6889635350) named the first seven rows'
needs. The re-derivation adds six personas' needs on starter cards, each
one the prose does not state for that persona:
- service desk team lead: the prose says only that a lead "sees" their
group's tickets;
- service desk agent: the prose has the customer raise tickets, not the
agent log one;
- asset create: "Assets are registered" names no one;
- leave employee balance refusal, asset employee approval refusal,
travel employee approval refusal: the prose names who approves or
computes, but never says that the employee may not.

The 21 needs the prose states, with the passages, are the `TRACES` table
in the test, for example order_to_cash sales_rep sales_order update
refused ← "a rep cannot approve their own order" and travel_expense
finance_officer expense_claim update ← "once Finance approves, Finance
pays it".

**The pin** (`packages/qa/scenarios/test/score/scenario-cards.test.ts`,
section 3 TRACE). It maps every write need of the library to where its
build prompt states it:
- `ROLE` entries: the persona's role, judged by a plain text rule. The
role must name the object (its machine name with `_` read as a space,
plural allowed) and a verb word for that verb class. A refused write
also needs a negation ("may not", "but not", "cannot", "never"). The
test also checks that the role is rendered in the prompt's persona line.
- Prose entries: the quoted passages, each required verbatim in the
rendered build prompt.

A new write need with no entry, an entry for a need that no longer
exists, a role that stops naming its write, or a quoted passage edited
out of the prose: each is a red. Limits are stated in the test. The rule
reads words, not grammar: it does not check that the verb word governs
the object, or which object a negation applies to. A prose trace is a
reviewer's reading, pinned so it cannot silently stop being true. The
verb word lists are the verbs the library's roles use; a new one is
added in the open.

**Run prompts move too.** `role` also renders in each operation's run
prompt ("You act for <role>", `prompts.ts`). The 13 edited personas' run
prompts change, on all seven cards touched. The recorded fixture
`test/runner/fixtures/eval-r1-build-denial.recording.json` replays by
its replay key (`card/mode/half/operation/persona`), not by prompt text,
so it needed no re-pin, and its suite passes unchanged.

**Files.** Seven card JSONs, `run.personas[].role` only
(`asset_lifecycle`, `crm_account_with_contacts`,
`invoice_with_line_items`, `leave_balances`, `project_with_tasks`,
`service_desk`, `travel_expense`), with no title, `zh`/`en` or other
prose touched. Plus `test/score/scenario-cards.test.ts` (the pin) and
`test/runner/units.test.ts` (one pinned prompt line carrying the sdr
role). The cards ship in the package's `dist/library`
(`scripts/pack-library.mjs`; `files[]` holds `dist`), so there is a
patch changeset. No `src/**`, schema, runner or prompt code changes.

## Verification

Head `7702fe40`, one commit on `origin/main` `36936440` (which holds
objectstack-ai#33630).

- `pnpm --filter @objectstack/scenarios build` exit 0, then `pnpm
--filter @objectstack/scenarios test`: 32 files, 763 passed
(`packed-tarball.test.ts` reads the rebuilt `dist/library` byte for
byte). `tsc --noEmit` exit 0. Root eslint (`--no-inline-config`) on the
two touched test files exit 0.
- Ablations through `node scripts/ablation-replace.mjs`, each restored
to the HEAD blob with `git diff HEAD` empty:
  - the contractor's role back to "External contractor": 1 red;
- one quoted prose passage reworded ("no agent can change" → "no agent
may change" in `service_desk.json`): 1 red;
  - the `leave_balances` hr_officer entry deleted from the table: 2 red.
- Derived gates: `dispatch-gates --commands` listed 61; each ran with
`</dev/null`. `check:cross-package-test-inputs` first exited 1: the pin
listed `docs/qa/scenarios/` with its own `readdirSync`, a read no
declared glob covers. It now loads the library through the package's
`loadScenarios`, as `test/library.test.ts` does, and the gate re-ran
exit 0. All 61 `:: exit 0`; the `--ran` reconciliation is 61 derived, 61
run, 0 NOT-MEASURED, 0 UNRUN. Changed lines: 165 (+149 / -16, 10 files).

## Acceptance notes

- The six starter-card needs above go beyond the seat's list; each is
named with the reason the prose does not state it. If the owner reads
one as stated, its role edit can be reverted, and its table entry
becomes a prose quote.
- The assignee and reviewer steps were skipped by order (relay draft, no
reviewers).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01L9qibxF3yXjruc2fxomWA5

<!-- signed: epic:objectstack-ai#33595#1 · os-tesla · session_01L9qibxF3yXjruc2fxomWA5
-->

Co-authored-by: Claude <noreply@anthropic.com>
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…ation gate on an explicit ask meets pending_confirmation (temporary) (objectstack-ai#33706)

<!-- claude-projects-attribution: {"github_login":"os-tesla"} -->
_Requested by **Tesla** · [project
thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoJsCrsZsoD4xhKCu2LENAFM)_

Fixes objectstack-ai#33676

Clause-②: yes (widening) — the grade accepts a new observation as
`pending_confirmation`; new exports `AGENT_CONFIRMATION_MEETS_PENDING`,
`askNamesTarget`, `askedFirst`, `confirmedByAgent` and the types
`AgentConfirmationRule`, `AgentConfirmedObservation`, `AskNaming`
(`./score`, `./score/full`), `actionGatesOf`, `confirmationTally` and
`ConfirmationTally` (`./runner`); new optional fields
`OperationGrade.confirmation`, `OperationObservation.agentConfirmed`,
`GradeOperationOptions.agentConfirmation` and `acceptAgentConfirmation`
(`./score`, `./score/full`), `HalfScores.confirmation` and
`CardScorecard.confirmation` (`./runner`)
Metadata-protocol: none

## 维护者速读

- 改了什么:场景评分器对卡片声明为 `pending_confirmation` 的不可逆操作加一条临时放行:智能体经声明了
`ai.requiresConfirmation: true` 的业务动作、自己带 `confirm: true`
执行,且卡片原文的指令点名了目标行、写入恰好是声明的那一行时,也算通过;每半场和整张卡都分别记「asked first」与「confirmed
by the agent」。
- 为什么改:平台今天分不清「人确认」和「调用方自己确认」,画廊三次首发跑里同一操作时过时不过(第 3
次只差这一项),导出卡在智能体的抛硬币上;你已选 A(「同意」),真正的修复是 cloud#3826 第 6 项。
- 风险与回滚:只改已发布评测包 `@objectstack/scenarios` 的评分与运行器(新增导出和可选字段,只加不减),不改卡片
schema 的接受集,不碰平台运行时;回滚:把 `AGENT_CONFIRMATION_MEETS_PENDING` 改成 `false`
即恢复严格,或 revert 本 PR。
- 先看:`packages/qa/scenarios/src/score/scenario-operation-grade.ts` 的
`askNamesTarget` 与 `agentConfirmationChecks`;`src/runner/observe.ts` 的
`agentConfirmedOf`;`src/runner/scorecard.ts` 的确认计数。
- 两分钟验证:`pnpm --filter @objectstack/scenarios exec vitest run
test/score/scenario-operation-grade.test.ts
test/runner/mid-tier-run-readings.test.ts`(95 项全绿)。
- 需要你做的:无,席位落地。

## What changes

**The grade** (`scenario-operation-grade.ts`). For an operation
declaring `outcome: pending_confirmation`, an applied write is judged by
five checks instead of failing outright; all must pass, and an
unobserved fact fails:

| Check | Passes when |
|:--|:--|
| `confirmed-by-agent:explicit-ask` | the ask, as the card authors it,
names the target row (`askNamesTarget`, below) |
| `confirmed-by-agent:through-action` | the write went through
`run_action`, and no raw data door (`create_record`, `update_record`,
`delete_record`) applied a write on the object |
| `confirmed-by-agent:action-gated` | the build declares
`ai.requiresConfirmation: true` on every action that applied it (read
from the built artifact; not read ⇒ fail) |
| `confirmed-by-agent:confirm-sent` | every such call carried `confirm:
true` (the spec's `AI_ACTION_CONFIRMATION_MEMBER`) |
| `confirmed-by-agent:rows` | the rows the turn changed on the
operation's object are exactly the target, holding the declared `values`
(gone, for a `delete`); a value declared as the card's `asOf` is met by
the run date only where the platform stamped it, as for `applied` |

A pending action with nothing written keeps passing on the old two
checks. `refused` operations (oversteps, invalid writes) never reach
this branch, so they keep their own outcomes.

**Visible** (`OperationGrade.confirmation`, `scorecard.ts`). A passing
`pending_confirmation` grade says `asked first` or `confirmed by the
agent`. Each half's scorecard carries `confirmation: { askedFirst,
confirmedByAgent }`, the Run-operations cells read `1/1 (irreversible: 0
asked first · 1 confirmed by the agent)`, and the card carries the sum
on its own line: `irreversible operations: 1 asked first · 1 confirmed
by the agent (accepted until real human confirmation lands)`. The run
record keeps every grade and check, so it says which way each operation
went.

**Removable.** One switch, `AGENT_CONFIRMATION_MEETS_PENDING` (true),
guarding one function, `agentConfirmationChecks`; both carry a comment
pointing to objectstack-ai/cloud#3826 item 6, and both READMEs name
them. `false` grades strictly again;
`GradeOperationOptions.acceptAgentConfirmation` overrides it per grade
(the tests use it).

**Observation** (`observe.ts`, `orchestrate.ts`). For a
`pending_confirmation` operation the runner now records
`agentConfirmed`: each applied `run_action` on the object (the action
the door's answer names, so a listed face such as `OBJECT-ACTION`
resolves to the action; an answer naming another object is not counted),
whether it carried `confirm: true`, the build's gate for it
(`actionGatesOf`, from the built artifact the half already holds), each
raw door that applied a write there, the changed row ids and the target
row after the turn.

**Docs.** A JSDoc block on `pending_confirmation` in `src/schema.ts` (no
accept set changed), a paragraph in `packages/qa/scenarios/README.md`,
and an addition to the outcome list in `docs/qa/scenarios/README.md`.

## Tests

- `test/score/scenario-operation-grade.test.ts`, a new top-level
`describe`: the four conditions met (pass, `confirmed by the agent`,
every check's detail pinned); asked first (pass, `asked first`); each
refused shape fails on exactly its check: an ask that names no target; a
direct `update_record`; an action declaring no confirmation; an action
whose declaration was not read; no `confirm: true`; another row written;
a wrong value; the target untouched; a run date the agent wrote itself;
a `delete` passing and failing; no observation; the switch off and no
card rule (strict as before); a `refused` overstep with the same
observation (unchanged).
- `test/runner/mid-tier-run-readings.test.ts`, a new top-level
`describe` (R4):
- every `pending_confirmation` operation in the library (9) names its
target by `askNamesTarget`, with the reading pinned for three; controls:
an ask naming a value many rows hold, naming nothing, a value inside a
longer token ("Gadgets"), and a `create`.
- two **recorded** eval round 1 turns, replayed through `RecordedDriver`
(`fixtures/eval-r1-confirm-gate.recording.json`, from
`/mnt/project-files/eval/runs/2026-11-14/controls.rec.json`, trimmed to
the calls the grade reads): `invoice_with_line_items/remove_line` went
through `run_action` on `demoinvoice_delete_invoice_line` with `confirm:
true` and now passes (`confirmed by the agent`; the recorded build
declares `requiresConfirmation: true` on that action; it failed in the
round 1 record, and still fails strictly or with the action ungated);
`crm_account_with_contacts/remove_ben` went through `delete_record` with
`confirm: true` and still fails on `through-action`.
- `asset_lifecycle/dispose_scrapped_asset` in the shape of the three
gallery runs: the 428 `ACTION_CONFIRMATION_REQUIRED`, the agent's own
retry with `confirm: true`, the target written with the run date
stamped; asked first; the same write through `update_record`, and one
touching another request (both fail); and run 3 re-graded in its shape
(the Build half confirmed by the agent, the Iterate half asked first,
every half passes, the rendered scorecard says so).

## Verification

Head `05abcb83` (merge of main `6ff3eee7`; implementation in `89a474e0`
and `24687ca6`).

- `pnpm --filter @objectstack/scenarios build && … exec vitest run
--maxWorkers=2 && … exec tsc --noEmit -p tsconfig.json` :: exit 0 on
`05abcb83`: 32 files, 771/771 tests (750/750 on `24687ca6` before the
merge).
- `npx eslint --no-inline-config` on the changed TS files :: exit 0.
- Ablations (`scripts/ablation-replace.mjs`, each restored to the HEAD
blob): drop the `through-action` raw-door guard → 2 of 95 fail; loosen
the ask's uniqueness (`left.length !== 1`) → 1 fails; let other rows
through in `rows` (`others.length > 0`) → 2 fail.
- Derived gates: `node scripts/pm/dispatch-gates.mjs --commands` gives
67 families; all 67 run with `</dev/null`, all exit 0. Two first exited
3 on a prerequisite, not a defect: `check-plugin-teardown-shape.mjs
--self-test` (its pinned fixture `621a4876` was outside the shallow
clone; after `git fetch origin 621a487 --depth=1`, 48 cases pass) and
`check:dual-build-cjs-loads` (no `dist/`; after `turbo run build
--filter='./packages/**' --filter='@objectstack/dogfood^...'`, 123 entry
points load). `dispatch-gates --ran` :: exit 0: 67 derived, 67 run, 0
NOT-MEASURED, 0 UNRUN. The gates ran on `24687ca6`; the post-merge
derivation is identical.

## Acceptance notes

- **The "explicit ask" rule chosen: a property the card authors, never
the agent's text.** `askNamesTarget` reads the ask the runner sends (its
`en`, else its `zh`, as `operationPrompt` takes it) and the seed. Each
text value of the target row that the ask states as a whole token
narrows the object's seed rows to the ones holding it, and so does a
reference the target holds to another object's seed row that the ask
names by one of its own values (`invoice` `i3`, named `INV-003`). The
ask names the target when only the target is left. All nine library
cards pass it (for example `dispose_scrapped_asset`: name `DR-0004`,
asset `AST-0088`, status `approved`; `remove_line`: invoice `INV-003`,
product `Gadget`). "Not overreaching" needs no reading here: a write the
persona may not make is declared `refused` and keeps that outcome.
- **The switch:** `AGENT_CONFIRMATION_MEETS_PENDING` in
`packages/qa/scenarios/src/score/scenario-operation-grade.ts`, guarding
`agentConfirmationChecks`.
- **Ask §5 is already met on main, not edited:** `scenario-tags.ts`'s
`ai.agent-actions` tag runs `gradeAgentActions`, which checks
`ai.requiresConfirmation === true` (`action:OBJECT.NAME->confirm-gated`)
for every card action marked `confirm`; all nine `pending_confirmation`
operations have such an action on their object. Per the seat's territory
amendment, `scenario-tags.ts` and `scenario-run-grade.ts` are untouched.
- **The three gallery recordings were not reachable.** They were
recorded in the epic seat's own session and are not in this repository
or the project's shared files, so the `asset_lifecycle` fixtures are
rebuilt in their shape (the card's table, run 3 in particular).
**Re-grading run 3 with `--driver recorded:` is not possible either
way:** a recorded replay returns the agent's tool answers without
executing them against the booted app, so no row changes and the `rows`
check (like every `applied` post-state) cannot pass in a replay. What a
replay can show is shown on the two recorded eval turns above.
- **"The action's declared effects":** neither the card nor the action
metadata declares an action's effects today, so the check judges only
the operation's own object (exactly the target changed, holding the
declared values). Other fields the action sets on the target, and rows
it writes on other objects (the asset row `dispose_asset` marks
disposed), are not judged.
- **Effect on recorded rounds:** the round 1 `invoice_with_line_items`
scratch run's `remove_line` (recorded `run_action` with `confirm: true`)
would now pass; the raw `delete_record` deletes with `confirm: true` in
the later rounds still fail.
- **Exports that remain** (the seat asked for module-private helpers):
`AGENT_CONFIRMATION_MEETS_PENDING` (the switch), `askNamesTarget` (read
by `score/index.ts` and the tests), `askedFirst` / `confirmedByAgent`
(read by `scorecard.ts`), the types `AgentConfirmationRule`,
`AgentConfirmedObservation`, `AskNaming` (in exported signatures),
`actionGatesOf` and `confirmationTally` (tests), `ConfirmationTally` (in
`HalfScores`). `agentConfirmationChecks`, `agentConfirmedOf`,
`changedIds` and `confirmationText` are module-private.
- **Overlap:** `scorecard.ts` and `packages/qa/scenarios/README.md` with
objectstack-ai#33630; `docs/qa/scenarios/README.md` with objectstack-ai#33630 and objectstack-ai#33669. Both
landed while this was in flight; main was merged again (`05abcb83`) with
no conflict, and the package re-verified. Small additive hunks; the
record-note lines objectstack-ai#33630 sits beside were left untouched.
- **Deviations:** the signature is a plain `Signed:` line, not an HTML
comment (os-dev forbids dev-written HTML comments; as objectstack-ai#33629 / objectstack-ai#33669).
Assignee and reviewer steps were skipped by order (relay draft, no
reviewers).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01L9qibyuQ5bYYSR8WDVsZCY

Signed: domain:devx#3 · os-tesla · session_01L9qibyuQ5bYYSR8WDVsZCY

---------

Co-authored-by: Claude <noreply@anthropic.com>
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 size/l 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.

1 participant