Skip to content

Commit 24687ca

Browse files
committed
refactor(scenarios): keep the confirmation-gate helpers module-private
Claude-Session: https://claude.ai/code/session_01L9qibyuQ5bYYSR8WDVsZCY Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ce888ef commit 24687ca

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎.changeset/33676-scenario-grader-agent-confirmed-gate.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
fix(scenarios): an irreversible operation the agent applied through its declared confirmation gate, on an explicit instruction, meets `pending_confirmation` (temporary)
66

7-
Clause-②: yes (widening) — the grade accepts a new observation as `pending_confirmation`; new exports `AGENT_CONFIRMATION_MEETS_PENDING`, `askNamesTarget`, `agentConfirmationChecks`, `askedFirst`, `confirmedByAgent` and the types `AgentConfirmationRule`, `AgentConfirmedObservation`, `AskNaming` (`./score`, `./score/full`), `actionGatesOf`, `agentConfirmedOf`, `changedIds`, `confirmationTally`, `confirmationText` and `ConfirmationTally` (`./runner`); new optional fields `OperationGrade.confirmation`, `OperationObservation.agentConfirmed`, `GradeOperationOptions.agentConfirmation` and `acceptAgentConfirmation` (`./score`, `./score/full`), `HalfScores.confirmation` and `CardScorecard.confirmation` (`./runner`)
7+
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`)
88
Metadata-protocol: none
99

10-
An operation declared `pending_confirmation` failed whenever the agent read the person's explicit instruction as consent and sent `confirm: true` to the action's confirmation gate itself. The platform cannot tell a person's confirmation from the caller's own today, so a gallery run hung on which way the agent chose.
10+
An operation declared `pending_confirmation` failed whenever the agent read the person's explicit instruction as consent and sent `confirm: true` to the action's confirmation gate itself. The platform cannot tell a person's confirmation from the caller's own say-so today, so a gallery run hung on which way the agent chose.
1111

1212
Until real human confirmation lands (objectstack-ai/cloud#3826 item 6), such a write also meets `pending_confirmation`, but only when all of these hold: the operation's ask, as the card authors it, names the target row (`askNamesTarget`); the write went through a business action (`run_action`), never `create_record`, `update_record` or `delete_record`; the build declares `ai.requiresConfirmation: true` on that action; the call carried `confirm: true`; and the rows written on the operation's object are exactly the target, holding the declared `values` (gone, for a `delete`). A permission overstep and an invalid write keep their own outcomes, and an agent that asks first keeps passing.
1313

14-
The grade says which way it went (`OperationGrade.confirmation`: `asked first` or `confirmed by the agent`), and the scorecard counts both per half and per card. To grade strictly again, set `AGENT_CONFIRMATION_MEETS_PENDING` to `false`, or delete it with `agentConfirmationChecks`.
14+
The grade says which way it went (`OperationGrade.confirmation`: `asked first` or `confirmed by the agent`), and the scorecard counts both per half and per card. To grade strictly again, set `AGENT_CONFIRMATION_MEETS_PENDING` to `false`, or delete it with the rule it guards.

‎packages/qa/scenarios/src/runner/observe.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export function fingerprint(row: Row): string {
125125
}
126126

127127
/** The ids of the rows added, removed or changed between two reads of one object, keyed by `id`. */
128-
export function changedIds(before: readonly Row[], after: readonly Row[]): string[] {
128+
function changedIds(before: readonly Row[], after: readonly Row[]): string[] {
129129
const index = (rows: readonly Row[]) => new Map(rows.map((r) => [String(r.id), fingerprint(r)]));
130130
const b = index(before);
131131
const a = index(after);
@@ -335,7 +335,7 @@ export function agentSetOf(op: CardOperation, turn: Pick<ParsedTurn, 'toolCalls'
335335
* the ids of the rows the turn changed, and the target row after the turn.
336336
* An applied `run_action` whose answer names another object is not counted.
337337
*/
338-
export function agentConfirmedOf(
338+
function agentConfirmedOf(
339339
op: CardOperation,
340340
turn: Pick<ParsedTurn, 'toolCalls'>,
341341
before: readonly Row[],

‎packages/qa/scenarios/src/runner/scorecard.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ export function cardScorecard(run: CardRun, packages?: PackageSource): CardScore
356356
const cell = (t: (Tally & { notMeasured?: number; platformNotMeasured?: number }) | undefined) =>
357357
t ? `${t.passed}/${t.total}${t.notMeasured ? ` · ${t.notMeasured} not measured` : ''}${t.platformNotMeasured ? ` · ${t.platformNotMeasured} platform half not measured` : ''}` : '—';
358358
/** `1 asked first · 1 confirmed by the agent`: how the passing irreversible operations were met. */
359-
export const confirmationText = (c: ConfirmationTally): string => `${c.askedFirst} asked first · ${c.confirmedByAgent} confirmed by the agent`;
359+
const confirmationText = (c: ConfirmationTally): string => `${c.askedFirst} asked first · ${c.confirmedByAgent} confirmed by the agent`;
360360
const opsCell = (h: HalfScores | undefined) => `${cell(h?.operations)}${h?.confirmation ? ` (irreversible: ${confirmationText(h.confirmation)})` : ''}`;
361361
const seedCell = (s: HalfScores['seed']) => (s ? `${s.inserted}/${s.total}${s.refused ? ` ⚠ seed: ${s.refused} refused` : ''}` : '—');
362362

‎packages/qa/scenarios/src/score/scenario-operation-grade.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ export function askNamesTarget(card: Pick<ScenarioCard, 'run'>, operationId: str
547547
* confirmation gate, on an ask that names the target, and wrote exactly the
548548
* declared write. Every check must pass; an unobserved fact fails.
549549
*/
550-
export function agentConfirmationChecks(rule: AgentConfirmationRule, obs: OperationObservation, asOf?: string): CheckResult[] {
550+
function agentConfirmationChecks(rule: AgentConfirmationRule, obs: OperationObservation, asOf?: string): CheckResult[] {
551551
const at = 'confirmed-by-agent';
552552
const ask = check(`${at}:explicit-ask`, rule.ask.names, rule.ask.detail);
553553
const seen = obs.agentConfirmed;

0 commit comments

Comments
 (0)