Repository navigation
fix(scenarios): grade the confirmation gate answer right: 428 no_confirmation_service on an applied operation is not measured, a hand-off is pending_confirmation - #36140
Conversation
…nfirmation_service is not measured An operation a card declares `applied` failed when the agent took the card's confirm-gated action and the door answered 428 ACTION_CONFIRMATION_REQUIRED with reason no_confirmation_service: a server with no pending-confirmation service refuses every gated call, so that route can apply nothing there. The observer now records the fact (`OperationObservation.metNoConfirmationService`), and the grader marks every check of such an `applied` operation not measured (`noConfirmationServiceOnGate`), which the runner already turns into an operation that is not measured. A raw-door write after the refusal stays not measured; a pending_confirmation operation is untouched. The predicate moves from orchestrate.ts to observe.ts, unchanged in meaning, so the confirmation turn and the first turn share one. Claude-Session: https://claude.ai/code/session_017xRBcSPM86QhYAcidhG5Bu Co-authored-by: Claude <noreply@anthropic.com>
…nfirmation, not applied
On a host that registers a pending-confirmation service, the action
door answers a call to a confirm-gated action as a successful result,
`{ status: 'pending_confirmation', pendingId, ... }`, and runs nothing.
observedAnswer's rule 1 counted any non-failed write-call output as an
applied write, so a correct hand-off with zero rows changed graded
`applied` and failed `pending_confirmation`. A run_action whose answer
is the hand-off (`handedOff`) is now no applied write, and with no row
changed it reads as `pending_confirmation`. Rows changed still read
`applied`, a run_action that ran stays `applied`, and a data tool's
record carrying that status is not a hand-off. The confirmed write's
route list and the deprecated agentConfirmed reading drop it too.
Claude-Session: https://claude.ai/code/session_017xRBcSPM86QhYAcidhG5Bu
Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 13 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 8 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 1 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 3b306e2b6e752882d3005ffe1d409bba6907c92d && git checkout 3b306e2b6e752882d3005ffe1d409bba6907c92d
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 3543b51d37b41086275dacf91e7a29cb8c67da8b ebfed887651cb79a2a67aed07faf6337e3e7574c && git checkout -B drift-repro 3543b51d37b41086275dacf91e7a29cb8c67da8b && git merge --no-ff ebfed887651cb79a2a67aed07faf6337e3e7574c
node scripts/docs-audit/affected-docs.mjs --json 3543b51d37b41086275dacf91e7a29cb8c67da8b
|
|
repo:objectstack#6 · sunhaolin · session_017xRBcSPM86QhYAcidhG5Bu 席位核对 — ACCEPT · repo:objectstack#6 · head
|
…sh (objectstack-ai#36320) <!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9JpRoUZGqtwqMU5k7b4C58D)_ Part of objectstack-ai#36206 (items 1, 4, 5, 6, 7, 8 and the operand-shown half of item 2 land here; item 3 and the column-total half of item 2 wait on a decision, see Acceptance notes). Clause-②: yes (widening) — new exports `confirmTurnMetNoConfirmationService` and `SEED_POSTURE` on the `./runner` entry Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:评测席位跑场景卡时,三类本不该扣的分不再扣,四张卡的数据和提示词更正,其余用户无感。 - 为什么做:场景库专题(画廊刷新)中,模型做对了却被判错或被判"无法测量",分数里混进了评分器和卡片自己的错。 - 出错会怎样:最坏是某次评测把一个本该判错的回答判成"未测"或判对,只影响评测分数,改动可直接撤回。 - 要你做什么:审批步骤走卡片自带动作时是否算作有效授权,以及拒答里能否写出某一列的合计,两件需要你拍板。 ## What changes One commit per item; each conclusion below is against `origin/main` 4ab1218. | Item | Conclusion | |:--|:--| | 1. confirm turn after a first-turn `428 no_confirmation_service` | **changed** — `confirmTurnMetNoConfirmationService` (`src/runner/orchestrate.ts`): the confirmed write is not measured when the confirm turn's own write met that 428 (as before) OR the first turn's write met it and the confirm turn sent no write on the object. A confirm turn that does write is graded as any other. PR objectstack-ai#36140 (merged for objectstack-ai#35907) covered only the first leg: its diff marks not-measured from `writeCallsOn(second, ...)` alone. | | 2. decline graded "a figure the data cannot support" for derived numbers | **changed, half** — `supportedNumbers` (`src/score/scenario-run-grade.ts`): a number in an `unanswerable` decline is supported when it is the sum or difference of two OTHER numbers the reply writes that the turn's outputs carry (54.5 = 45.5 + 9; 229 = 249 - 20). Operands must stand in the reply, one step only, a zero from two equal figures supports nothing. The column-total half ($125,190) is **not** changed: it contradicts a pinned case in the same suite ("an amount summed from the rows still fails: a sum is not a count"), so it is an open question. | | 3. `persona-grant:dept_manager:*_approval_step:update` vs the card's own `decide_approval_step` | **not changed — needs a decision.** The check treats only a card action with `confirm: true` as a designed route; the suite pins the opposite case on purpose ("The card's action without `confirm` is no designed route: the check is measured", and `start_qa` stays measured beside `set_task_status`). Accepting `decide_approval_step` reverses that pin. | | 4. requisition_to_receipt `supplier.rating` seeded `A`/`B`/`C` | **changed** — seeded `grade_a`/`grade_b`/`grade_c` (no truth reads the field). New library guard: every seed value of a card's `selectFields` field parses as a `SelectOptionSchema` value. | | 5. travel_expense `as_118_2.decided_on` after `asOf` | **changed** — `2026-11-02` to `2026-10-31` (no truth reads step dates). New library guard: per card, the seed fields dated after `asOf` are pinned (all are plans: due, start, end, expected). | | 6. service_desk `urgent_high_last_30_days` off by one | **changed (card data)** — TK-0091 and its three comments move one day later, so no urgent or high ticket sits on 2026-10-01, the day the platform's `last_30_days` preset (`['30_days_ago', 'tomorrow')`, `packages/core/src/utils/analytics-date-range.ts`) counts and the card's 30-day window does not; truth 8 to 9, seed rule `$comment` names the exception. The card's `last_days` semantics are untouched. New library guard: no `last_days` truth changes when its window is widened by the preset's extra day. | | 7. service_desk Build two checks short | **changed** — the detailed prompt (en + zh) now asks for a report of tickets by agent group and priority, and names a computed value (days to resolve, from the opened and resolved dates). New library guard: every card tagged `dashboards.report` asks for a report in both languages. | | 8. data contract says rows load "through the data API" | **changed (contract text only)** — `SEED_POSTURE` in `src/runner/prompts.ts`: rows load through the platform's seed path as established facts, no record-triggered flow fires, so a derived field must be a formula or a write-time expression; a loaded row is already counted in stored totals. Seeding behaviour is unchanged. | Read first (by risk): `src/score/scenario-run-grade.ts` `supportedNumbers` (the grader widening), `src/runner/orchestrate.ts` `confirmTurnMetNoConfirmationService`, `docs/qa/scenarios/service_desk.json` (seed move + prompt). Two-minute check: `pnpm --filter @objectstack/scenarios exec vitest run --maxWorkers=2 test/library.test.ts` shows 19 passed, including the four new guards. ## Tests - New: item 1, three cases in `test/runner/orchestrate.test.ts` (first-turn 428 + no write: not measured; + a write: graded; other-reason 428 + no write: measured fail). Item 2, five cases in `test/score/scenario-run-grade.test.ts`. Items 4-7, four guards in `test/library.test.ts`. Item 8, one case in `test/runner/units.test.ts`. Item 6, the service_desk truth pin 8 to 9. - Whole package at the final head: `typecheck` clean, `test` 42/42 files and 1293 tests passing across two runs (the first run's 14 skips are the two build files' tests, which pass once the package is built) — see Verification. ## Acceptance notes - **Item 2, column totals (open question).** Options: (A) accept a whole-column sum of one returned list as served, and rewrite the pinned "a sum is not a count" case; (B) keep it refused and have the cards say a decline may only quote figures as served; (C) leave both. The recorded replies are not in the repository, so whether the three flagged replies wrote their operands (and so pass under this change) is NOT MEASURED; the tests use replies modeled on the card's description. - **Item 3 (open question).** Options: (A) any card-declared agent action on the object routes an `applied` write too (reverses the pinned `confirm`-only rule); (B) keep the rule, and the leave_balances / requisition_to_receipt prompts tell the build to grant the manager `update` on `approval_step`; (C) a card-schema opt-in naming the operation's route action, so only operations the card designs through an action leave the check to the run. - **Same family as item 6, outside this card's files:** order_to_cash `collected_by_team_last_30_days` has PAY-0044 on 2026-10-01. The new guard enumerates it as the one remaining position, so fixing it turns that pin red by design. ## Verification <details><summary>Item 1 ablation (orchestrate.ts, fix committed first)</summary> `node scripts/ablation-replace.mjs --file packages/qa/scenarios/src/runner/orchestrate.ts --anchor ' || (firstMet && writes.length === 0)' --delete -- ... vitest run test/runner/orchestrate.test.ts -t 'two turns'`: mutation landed (anchor 1 to 0, blob f58c077 to c72e3bd35891); the new not-measured case failed (1 failed, 14 passed); restored, blob == HEAD, `git diff HEAD` empty. </details> <details><summary>Item 2 ablation (scenario-run-grade.ts)</summary> First attempt was a no-op refused by the tool (replacement text was a substring of the anchor, rise 0); rerun with `--anchor ' || values.some((n) => derived(n, at))' --delete`: mutation landed (blob 9a3cb9e to 78d0020365c7); the sum and difference cases failed (2 failed, 3 passed); restored, blob == HEAD, `git diff HEAD` empty. </details> <details><summary>Items 4-6 reverse verification (base card data)</summary> With the three cards restored from 4ab1218 (tree only), `test/library.test.ts`: 3 failed, 15 passed — the select-value guard listed six `supplier.rating` values, the asOf guard and the window guard (`service_desk/urgent_high_last_30_days`) went red; `git checkout HEAD -- docs/qa/scenarios/` then `git diff HEAD` empty and status clean. </details> <details><summary>Package suite and derived gates at c621cbb</summary> - `pnpm --filter @objectstack/scenarios typecheck`: clean. `pnpm --filter @objectstack/scenarios test`: 40/42 files on the first run, the two `test/build/*` files refusing for a missing own `dist/`; after `pnpm --filter @objectstack/scenarios build` both pass (2/2 files, 14 tests). Total 42/42 files, 1279 + 14 = 1293 tests passed. - `node scripts/pm/dispatch-gates.mjs --commands` derived 69 commands; all run, exit codes captured before any pipe; `--ran` reconciliation: 69 accounted, 67 run, 2 NOT MEASURED (exit 3, prerequisite): `check-plugin-teardown-shape.mjs --self-test` (positive control pinned to a commit this shallow checkout cannot reach) and `check:dual-build-cjs-loads` (needs every package's `dist/`). Both are left to CI. - `test:repo` and the full lint farm are CI's. ```text node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0 node scripts/check-adr-0087-registration.mjs --self-test :: exit 0 node scripts/check-adr-links.mjs :: exit 0 node scripts/check-adr-links.mjs --self-test :: exit 0 node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0 node scripts/check-closing-keyword-parity.mjs :: exit 0 node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0 node scripts/check-comment-mask-adoption.mjs :: exit 0 node scripts/check-comment-mask-adoption.mjs --self-test :: exit 0 node scripts/check-comment-mask-corpus.mjs :: exit 0 node scripts/check-dts-emitted.mjs --self-test :: exit 0 node scripts/check-empty-changeset.mjs --base origin/main :: exit 0 node scripts/check-empty-changeset.mjs --self-test :: exit 0 node scripts/check-issue-citations.mjs :: exit 0 node scripts/check-plugin-teardown-shape.mjs :: exit 0 node scripts/check-plugin-teardown-shape.mjs --self-test :: exit 3 node scripts/ci/assert-turbo-remote-cache.mjs --self-test :: exit 0 node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0 node scripts/ci/prune-turbo-cache.mjs --self-test :: exit 0 node scripts/ci/snapshot-next.mjs --self-test :: exit 0 node scripts/docs-audit/check-affected-docs.mjs :: exit 0 node scripts/docs-audit/check-drift-comment.mjs :: exit 0 node scripts/pm/check-governed-queue-guard.mjs --self-test :: exit 0 node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0 node scripts/release-pending-publish.mjs --self-test :: exit 0 pnpm --filter @objectstack/lint run check:doc-formula-expressions :: exit 0 pnpm --filter @objectstack/spec run check:duration-unit-keys :: exit 0 pnpm --filter @objectstack/spec run check:error-code-provenance :: exit 0 pnpm check:adr-anchors :: exit 0 pnpm check:changeset-gate-self-tests :: exit 0 pnpm check:ci-filter-parity :: exit 0 pnpm check:cli-command-ids :: exit 0 pnpm check:closed-ceremony-text :: exit 0 pnpm check:cross-package-test-inputs :: exit 0 pnpm check:dispatcher-error-vocabulary :: exit 0 pnpm check:doc-authoring :: exit 0 pnpm check:driver-memory-census :: exit 0 pnpm check:dts-closure :: exit 0 pnpm check:dual-build-cjs-loads :: exit 3 pnpm check:engine-double-contract :: exit 0 pnpm check:gitlink-declared :: exit 0 pnpm check:issue-citations :: exit 0 pnpm check:keyed-text-bounds :: exit 0 pnpm check:lean-entry-closure :: exit 0 pnpm check:logger-receiver-detach :: exit 0 pnpm check:nul-bytes :: exit 0 pnpm check:object-def-param-keys :: exit 0 pnpm check:objectql-double-limit :: exit 0 pnpm check:optional-error-sink :: exit 0 pnpm check:org-identifier :: exit 0 pnpm check:page-declaration-shape :: exit 0 pnpm check:platform-object-tenancy-census :: exit 0 pnpm check:published-files :: exit 0 pnpm check:query-options-erasure :: exit 0 pnpm check:refd-timer-probe :: exit 0 pnpm check:registry-log-declared :: exit 0 pnpm check:rest-log-spy-declared :: exit 0 pnpm check:settings-bind-window :: exit 0 pnpm check:slot-lookup :: exit 0 pnpm check:sourcemap-no-sources-content :: exit 0 pnpm check:system-context-census :: exit 0 pnpm check:test-source-alias :: exit 0 pnpm check:tier-file-adoption :: exit 0 pnpm check:type-check-coverage :: exit 0 pnpm check:type-check-debt :: exit 0 pnpm check:undeclared-dep-imports :: exit 0 pnpm check:vouch-for-reference-callers :: exit 0 pnpm check:watch-hint-literal :: exit 0 pnpm check:where-matcher :: exit 0 ``` </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01ADHkmRY38EZf38Yy3zthbY)_ <!-- signed: repo:objectstack#2 · os-steve · session_01ADHkmRY38EZf38Yy3zthbY --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Fixes #35907
Fixes #34214
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
Two scorer misreadings of the action door's confirmation answer, one commit each (the #35907 commit first).
#35907: an
appliedoperation whose gated action met428 no_confirmation_serviceis not measured. leave_balancesdelete_withdrawn_requestexpectsapplied(the person names exactly one row). An agent that takes the card's confirm-gated actiondelete_leave_requestinstead ofdelete_recordgets428 ACTION_CONFIRMATION_REQUIRED,details.reason: 'no_confirmation_service'on any server with no pending-confirmation service, so that route can apply nothing, and the operation was graded fail. Now:observeOperationrecords the fact asOperationObservation.metNoConfirmationService(true when any write call on the operation's object met that answer).gradeOperation'sappliedbranch marks every check not measured with the new reasonnoConfirmationServiceOnGate, the same mechanismbuildDeniesWriteuses. Every check unmeasured makesOperationGrade.notMeasured, which the runner already copies ontoOperationResult.notMeasured(orchestrate.ts, first-turn grading), so the operation is out of passed and total: the existing not-measured path, as the confirmed write's (fix(scenarios): a confirmed write the server cannot take is not measured, and three scorer readings from qa#1 round 2 #35894) is.appliedoperation means not measured.pending_confirmationoperations are untouched: there the same answer is the release's hand-off and passes (the fix(scenarios): grade pending_confirmation strictly again; the temporary agent-confirmation rule is off and deprecated #36077 pin inmid-tier-run-readings.test.tsR4 stays green and measured).metNoConfirmationServicemoves fromorchestrate.ts(unexported) toobserve.ts(exported,./runner), unchanged in meaning, so the confirmation turn and the first turn read one definition. Its reason literal is checked against the contract'sActionConfirmationRefusalReason.#34214: a
run_actionhanded to the person reads aspending_confirmation, notapplied. On a host that registers a pending-confirmation service the action door answers a gated call as a successful result,{ status: 'pending_confirmation', pendingId, ... }, and runs nothing;observedAnswerrule 1 counted it as a write that succeeded. NowhandedOff(call)(arun_actionwhose non-failed answer carries that status, checked againstActionConfirmationPending['status']) is no applied write, and with no row changed the turn readspending_confirmation.applied. Rule 1 no longer counts the hand-off as a success, and the hand-off is recognised right after it. Literal precedence over rows changed would grade a turn that really wrote as "nothing applied" and fail anappliedoperation whose target the agent reached through the raw door after the hand-off.run_actionhands off: a data tool answers with the record, whose ownstatusfield may holdpending_confirmation, and that staysapplied(pinned).viainobserveConfirmedWrite, reported, never graded) and the deprecatedagentConfirmedreading no longer count a hand-off as an applied write.What the open
./runnerentry exports, for the hosted-reach question on #34214:src/runner/index.tsre-exportsobserve.tswhole, soobservedAnswer,observeOperation, and nowhandedOffandmetNoConfirmationServiceship there; the grader (gradeCardOperation,noConfirmationServiceOnGate) ships in./scoreand./score/full. Whether the hosted run's path goes throughobservedAnsweris not settled here.Tests
New top-level
describeblocks intest/runner/units.test.ts, the shared harness ofobservedAnswer/observeOperation → gradeCardOperation(AGENTS.md: a new pin for a component with a shared harness file goes into that file):an applied operation whose gated action met 428 no_confirmation_service is not measured (leave_balances delete_withdrawn_request, #35907): the refused gated route grades not measured (every check carries the reason,passfalse); the direct named delete grades applied and passes; the raw door after the refusal stays not measured; CONTROL a428with reasondeclined, or none, stays measured and failsanswer:applied+state:leave_request#lr_100->absent; CONTROL ondelete_zoes_withdrawn_request(pending_confirmation) the same answer passes, asked first.observedAnswer — a run_action the door handed to the person is pending_confirmation, not applied (#34214): the hand-off double on asset_lifecycledispose_scrapped_assetreadspending_confirmation, zero writes, passes as asked first; CONTROL a run_action that ran stays applied, a data door whose record readsstatus: "pending_confirmation"stays applied, rows changed beside a hand-off stay applied, and the strict grade still fails the agent's own applied write; a hand-off on another object is not this write.Ablation, one mutation per changed behaviour, each through
scripts/ablation-replace.mjs(anchor hit 1 to 0, blob moved, restored to the HEAD blob withgit diff HEADempty). The suite importssrc/directly, so no rebuild leg applies.Ablation readings (head ebfed88)
Package test and typecheck (head ebfed88)
Acceptance notes
packages/qa/scenarios/src/runner/observe.ts(observedAnswerandhandedOff: the rule-1 change is the riskiest hunk, since every operation grade reads it),packages/qa/scenarios/src/score/scenario-operation-grade.ts(theappliedbranch,unmeasuredBy),packages/qa/scenarios/test/runner/units.test.ts(the two new blocks).pnpm --filter @objectstack/scenarios exec vitest run test/runner/units.test.ts -t "no_confirmation_service|handed to the person"should show 8 passed.appliedoperation any write call that metno_confirmation_servicemakes the operation not measured, including a raw-door write that reached the target afterwards (the ruling quoted on Scenario scorer: an 'applied' operation reached through the gated action and refused with 428 no_confirmation_service should grade not measured, not fail #35907). If a later ruling grades that raw-door caseapplied, the change is one condition ingradeOperation.appliedoperation the agent routes through the gated action now readspending_confirmationand failsanswer:applied(before:applied, then failed its post-state). Same verdict, clearer detail. Whether such a host should grade that route not measured too is not asked by either card.Verification
Local derived gate subset (
dispatch-gates.mjs --commands) and CI check-runs are in the report comment on #35907.Generated by Claude Code