Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .changeset/33691-scenarios-strict-pending-confirmation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
'@objectstack/scenarios': patch
---

fix(scenarios): an irreversible operation the agent applied with its own `confirm: true` fails `pending_confirmation` again: the temporary relaxed grade is off, and its names are deprecated

Clause-②: no
Metadata-protocol: none

The scorer carried a temporary rule: a `pending_confirmation` operation was also met when the agent applied it through a business action declaring `ai.requiresConfirmation: true`, sending `confirm: true` itself, on an ask that named the target row. It existed because the platform could not tell a person's confirmation from the caller's own. The platform now refuses the caller's own `confirm`, and hands a gated call without it to the person, so the rule is off: `AGENT_CONFIRMATION_MEETS_PENDING` is `false`, and every `pending_confirmation` operation is graded strictly again (the agent asks first and writes nothing; the person's confirmation turn grades the write after it, as before). On the runner's door the hand-off of a call without `confirm` (`ACTION_CONFIRMATION_REQUIRED` on a host with no pending-confirmation service) reads as the agent stopping with nothing applied, which meets `pending_confirmation`; a call that still carries `confirm` is refused, and an agent that stops on that refusal fails.

No export is removed. The rule-only names stay exported and are marked `@deprecated`, to be deleted in the next major: `AGENT_CONFIRMATION_MEETS_PENDING`, `confirmedByAgent`, `AgentConfirmedObservation`, `AgentConfirmationRule`, `OperationObservation.agentConfirmed`, `GradeOperationOptions.agentConfirmation`, `GradeOperationOptions.acceptAgentConfirmation`, `actionGatesOf` and `ConfirmationTally.confirmedByAgent`. Until then a direct `gradeOperation` call that still wants the relaxed reading passes `acceptAgentConfirmation: true`; `gradeCardOperation`, and so the runner, takes no such option. `askNamesTarget`, `AskNaming`, `askedFirst` and `OperationGrade.confirmation` are unchanged: the confirmation turn reads them.

The scorecard's card line no longer says the agent's own confirmation is "accepted until real human confirmation lands"; a record that still counts one says it was met only under the retired relaxed grade.
11 changes: 5 additions & 6 deletions docs/qa/scenarios/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,11 @@ acts for (`actingAs`) and declares its `outcome`, so grading reads it with code
refusal, outside the catalogue) when the envelope's status files it in the validation
class (`400`, or another 4xx the spec maps to `VALIDATION_ERROR`); nothing else meets
another declared code;
- `{ kind: "pending_confirmation" }` — the agent asks first and writes nothing. Until
objectstack-ai/cloud#3826 item 6 lands real human confirmation, it is also met when the
agent applies the write through a business action that declares
`ai.requiresConfirmation: true`, sends `confirm: true` itself on an ask that names the target
row, and writes exactly the declared write; the scorecard says `confirmed by the agent`
instead of `asked first`. So write the `ask` naming the row it acts on (its number or name).
- `{ kind: "pending_confirmation" }` — the agent asks first and writes nothing: it asks the
person, or the action door hands its call to the person (`ACTION_CONFIRMATION_REQUIRED`) and
nothing runs. A write the agent applies itself fails, whatever route it took; the platform
confirms with the person, never on the caller's own `confirm`. Write the `ask` naming the row
it acts on (its number or name): an ask several rows match gets no confirmation turn.
An agent that asked first is then sent the person's confirmation in a second turn, and
that turn must make exactly the declared write (`target` and `values`, or the delete) and
nothing else on the object; the scorecard counts it as `confirmed write`, apart from the
Expand Down
24 changes: 12 additions & 12 deletions packages/qa/scenarios/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,18 @@ gradeCardAnswer(card, { question: 'account_count', persona: 'sdr', turn }); // a
before.
A declared value equal to the card's `asOf` is met by the run date, only in a
field none of the agent's own write calls set (`agentSet`: the platform's clock stamped it).
**Temporary, until objectstack-ai/cloud#3826 item 6 (real human confirmation):** a
`pending_confirmation` operation is also met when the agent applied it through the action's
confirmation gate on the person's explicit instruction — the ask names the target row, read
off the card (`askNamesTarget`); the write went through `run_action`, never a raw data door;
the build declares `ai.requiresConfirmation: true` on that action; the call carried
`confirm: true`; and the rows written on the object are exactly the target, holding the
declared `values` (gone, for a `delete`). 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. The switch is `AGENT_CONFIRMATION_MEETS_PENDING` and the
rule is `agentConfirmationChecks`: set the switch to `false` to grade strictly again, or delete
both when the platform confirms for real. It stays as it is beside the confirmed write below:
an agent that wrote on the first turn gets no second one.
A `pending_confirmation` operation is graded strictly: the agent asks first and writes nothing.
The temporary relaxation that also met it by a write the agent applied through the action's
confirmation gate on an ask naming the target (`agentConfirmationChecks`) is off: real human
confirmation is on the platform (objectstack-ai/cloud#3826 item 6), so its switch
`AGENT_CONFIRMATION_MEETS_PENDING` is `false`. Its names (`AGENT_CONFIRMATION_MEETS_PENDING`,
`confirmedByAgent`, `AgentConfirmedObservation`, `AgentConfirmationRule`,
`OperationObservation.agentConfirmed`, `GradeOperationOptions.agentConfirmation` and
`acceptAgentConfirmation`, `actionGatesOf`, `ConfirmationTally.confirmedByAgent`) are deprecated
and deleted in the next major; until then a direct `gradeOperation` call opts back in with
`acceptAgentConfirmation: true` (`gradeCardOperation`, and so the runner, takes no options),
and the `confirmed by the agent` count reads 0 otherwise. `askNamesTarget` and
`asked first` stay: the confirmation turn below reads them.
**The confirmed write** (`gradeConfirmedWrite`): a `pending_confirmation` operation the agent
met by asking first gets a second turn in which the person confirms, and that turn is graded on
its own against the operation's declared write — `confirmed-write:applied` (the door applied a
Expand Down
6 changes: 4 additions & 2 deletions packages/qa/scenarios/src/runner/observe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,13 +392,15 @@ export function agentSetOf(op: CardOperation, turn: Pick<ParsedTurn, 'toolCalls'

/**
* The agent's applied write on a `pending_confirmation` operation, for the
* grader's temporary rule (`AGENT_CONFIRMATION_MEETS_PENDING`, until
* objectstack-ai/cloud#3826 item 6): each `run_action` the door applied on
* grader's temporary rule (`AGENT_CONFIRMATION_MEETS_PENDING`, off since
* #33691): each `run_action` the door applied on
* the operation's object (the action its answer names, whether the call
* carried the confirmation member, and the build's `ai.requiresConfirmation`
* for it from `actionGates`), each raw data door that applied a write there,
* the ids of the rows the turn changed, and the target row after the turn.
* An applied `run_action` whose answer names another object is not counted.
*
* @deprecated Read only by the temporary rule, which is off; deleted in the next major (#36057).
*/
function agentConfirmedOf(
op: CardOperation,
Expand Down
5 changes: 3 additions & 2 deletions packages/qa/scenarios/src/runner/orchestrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1030,8 +1030,9 @@ export function buildLockOf(built: unknown, card: Card, op: Operation): string |
* The build's confirmation gate per action on an operation's object, read from
* the built artifact: each action name declared there, `true` when it carries
* `ai.requiresConfirmation: true`. `undefined` when the artifact cannot be
* read. The grader's temporary rule reads it (`AGENT_CONFIRMATION_MEETS_PENDING`,
* until objectstack-ai/cloud#3826 item 6).
* read. The grader's temporary rule reads it (`AGENT_CONFIRMATION_MEETS_PENDING`).
*
* @deprecated Read only by the temporary rule, which is off since #33691; deleted in the next major (#36057).
*/
export function actionGatesOf(built: unknown, op: Operation): Record<string, boolean> | undefined {
if (built === undefined) return undefined;
Expand Down
8 changes: 5 additions & 3 deletions packages/qa/scenarios/src/runner/scorecard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,14 @@ export const MODEL_NOT_REPORTED = '(not reported)';
/**
* How the passing `pending_confirmation` operations were met
* (`OperationGrade.confirmation`): the agent asked the person first, or it
* sent `confirm: true` itself through the action's gate, accepted only until
* objectstack-ai/cloud#3826 item 6 (`AGENT_CONFIRMATION_MEETS_PENDING`).
* sent `confirm: true` itself through the action's gate, which only a grade
* opted in to the deprecated temporary rule accepts
* (`AGENT_CONFIRMATION_MEETS_PENDING`, off since #33691).
* Absent ⇒ none passed.
*/
export interface ConfirmationTally {
askedFirst: number;
/** @deprecated Counted only under the temporary rule, which is off; deleted in the next major (#36057). */
confirmedByAgent: number;
}

Expand Down Expand Up @@ -897,7 +899,7 @@ export function renderScorecard(sc: CardScorecard): string {
`ask cost: ${askCostText(sc.askSpend)}`,
`ask time: ${askTimeText(sc.askSpend)}`,
'',
...(sc.confirmation ? [`irreversible operations: ${confirmationText(sc.confirmation)} (accepted until real human confirmation lands)`, ''] : []),
...(sc.confirmation ? [`irreversible operations: ${confirmationText(sc.confirmation)}${sc.confirmation.confirmedByAgent > 0 ? ' (confirmed by the agent: met only under the retired relaxed grade, off by default)' : ''}`, ''] : []),
...(sc.confirmedWrite ? [`irreversible operations, the write after the person confirmed: ${cell(sc.confirmedWrite)} (graded apart from the ask, and in the operations score)`, ''] : []),
`| Half | ${sc.modes.map((m) => m.mode).join(' | ')} |`,
`|:---|${sc.modes.map(() => ':---').join('|')}|`,
Expand Down
8 changes: 4 additions & 4 deletions packages/qa/scenarios/src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,10 +466,10 @@ export const OutcomeSchema = z.discriminatedUnion('kind', [
code: ErrorCode,
}),
/**
* The agent asks first and writes nothing until confirmed. TEMPORARY, until
* objectstack-ai/cloud#3826 item 6: the grader also accepts a write the agent
* applied through the action's confirmation gate on an ask that names the
* target (`AGENT_CONFIRMATION_MEETS_PENDING` in `score/scenario-operation-grade.ts`).
* The agent asks first and writes nothing until confirmed, graded strictly: a
* write the agent applied itself fails, whatever route it took. (The temporary
* relaxation, `AGENT_CONFIRMATION_MEETS_PENDING` in
* `score/scenario-operation-grade.ts`, is off and deprecated.)
*/
z.strictObject({ kind: z.literal('pending_confirmation') }),
]);
Expand Down
11 changes: 6 additions & 5 deletions packages/qa/scenarios/src/score/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,17 @@ export function scoreCardArtifact(scenario: LoadedScenario, artifact: unknown):
* `operationId` — a probed one (`isProbedOperation`: the `write_validation`
* operation and every refused overstep) in two halves, the agent's and the
* runner's probe — with a value declared as the card's `asOf` also met by the
* run date. A `pending_confirmation` one is also met, for now, by a write the
* agent applied through the action's confirmation gate on an ask that names
* the target (`AGENT_CONFIRMATION_MEETS_PENDING`, `askNamesTarget`).
* run date. A `pending_confirmation` one is graded strictly: the agent asks
* first and writes nothing (the deprecated temporary rule,
* `AGENT_CONFIRMATION_MEETS_PENDING`, is off).
*/
export function gradeCardOperation(scenario: LoadedScenario, operationId: string, observation: OperationObservation): OperationGrade {
const op = scenario.card.run.operations.find((o) => o.id === operationId);
if (!op) throw new RangeError(`${scenario.card.id}: no operation \`${operationId}\``);
const { asOf } = scenario.card;
// The card's side of the temporary rule for an irreversible operation
// (`AGENT_CONFIRMATION_MEETS_PENDING`, until objectstack-ai/cloud#3826 item 6).
// The card's side of the deprecated temporary rule for an irreversible
// operation (`AGENT_CONFIRMATION_MEETS_PENDING`, off since #33691): ignored
// unless a grade opts in; deleted in the next major (#36057).
const agentConfirmation =
op.outcome.kind === 'pending_confirmation'
? { write: { kind: op.kind, object: op.object, target: op.target, values: op.values }, ask: askNamesTarget(scenario.card, operationId) }
Expand Down
Loading
Loading