Skip to content

Commit 63db724

Browse files
fix(scenarios): read a go-ahead request as pending_confirmation, and give add_line's ask one reading (#34039)
<!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9A7gLNZd4BVM44cuSthZiw1)_ Fixes #33977 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:评测打分器把「还没删、请你回复同意后我再删」这类回复判成了「没尝试写」,现在按请求同意的三种说法(反问、点明需要你的同意、以你同意为条件的提议)都判为「待确认」;发票卡 add_line 的问句改成只有一种读法。 - 为什么改:这两处是卡片和打分器自己的错,每个模型同样被扣分(2026-11-15 评测 121 个失败里占 25 个),会掩盖云端选模型要看的真实差距。 - 风险与回滚:只动评测包的打分判定和一张场景卡的问句,不碰产品运行时;判定变宽只影响「没有任何写调用、也没改行」的回合;回滚即 revert 本 PR。 - 先看:packages/qa/scenarios/src/runner/observe.ts 的 asksToConfirm 与三条短语表;再看 units.test.ts 新增的两条测试(含不该判成待确认的对照)。 - 两分钟验证:`pnpm --filter @objectstack/scenarios exec vitest run test/runner/units.test.ts`,预期全绿,其中两条新测试名含 go-ahead。 - 需要你做的:无,席位落地。 ## What changes Two fixes from the eval#1 classification on #33973 (comment 6896724405), both the card's own wording or reading rather than any model. 1. **Grader, rule 5 (`packages/qa/scenarios/src/runner/observe.ts`).** Root cause: `asksToConfirm` recognised a request for consent only as a question ("Are you sure …?", "Shall I …?", "Do you want me to …?") or by the bare verb `confirm` (its trailing word boundary also missed the noun "confirmation"). An agent that wrote nothing and said "Nothing has been deleted yet … I need your go-ahead first. Reply yes and I'll delete Ben Ode." asked for consent in the two other shapes of the same request, so the turn fell through to rule 7 and graded `refused (no write attempted)` on a `pending_confirmation` operation it had met. The reading is now split by shape, each a closed phrase list: - `ASKS_WHETHER`: the question, as before, plus "confirmation"; - `NAMES_CONSENT`: the person's own consent named as what the write waits on ("your go-ahead", "your approval", "your permission", "your consent", "your OK", "your sign-off"; Chinese 需要你的同意/批准/许可/授权). Only "your …" counts: "an admin's approval is needed" names someone else and stays a refusal; - `OFFERS_ON_ASSENT`: the write offered on the person's assent ("Reply yes and I'll …", "Once you approve, I'll …", "Let me know if you want me to …"; Chinese 回复“是” …, 你同意后 …). Rule order is unchanged: a write call, a coded refusal and a read refusal still outrank the reply's wording (rule 5 applies only with no write call). The module header's rule 5 line names the three shapes. 2. **Card (`docs/qa/scenarios/invoice_with_line_items.json`, `add_line`).** The ask "Add 2 Widgets to INV-003, 10 in total." read three ways (10 items, 10 Widgets, amount 10). It now reads "Add a line to INV-003: 2 Widgets, amount 10."; `values` are unchanged (`quantity: 2`, `amount: 10`). Edited as a text fragment, not reserialised. The loader's card checks still pass (`library.test.ts`, `refusals.test.ts`, and the whole package suite below). 3. **Changeset** `.changeset/33977-scenarios-go-ahead-request.md` (`@objectstack/scenarios` patch, both declaration lines). Not touched (out of scope per the card): whether a delete the user asked for by name still needs a confirmation (76 of the 121, waiting on the maintainer), the delete tool's description, and any card's confirmation rule. `packages/qa/scenarios/README.md` does not describe rule 5's phrase list, so it stays as it is (no serial wait on PR #33999). ## Tests - New, `packages/qa/scenarios/test/runner/units.test.ts`: - `observedAnswer — the ordered rules` › "a request for a go-ahead before the write, in any of its three shapes, ⇒ pending_confirmation; a question that asks no consent ⇒ noWriteAttempted": each shape in English and Chinese; controls: a which-record question, someone else's approval, a bare "yes", and a go-ahead request after an applied write (still `applied`). - `observeOperation → gradeCardOperation, on the real crm card` › "remove_ben (eval run 2026-11-15 …)": the eval reply's shape through `observeOperation` and `gradeCardOperation` passes `pending_confirmation`; control: the same turn asking only which Ben is meant grades `(no write attempted)` and fails. - Changed because of the card edit, `packages/qa/scenarios/test/runner/mid-tier-run-readings.test.ts`: R3's verb roster row `invoice_with_line_items/add_line` goes from `add 2 Widgets` to `add a line to INV-003`. The row must be a word-for-word run of the ask, and the old phrase is no longer in it; "I didn't add a line to INV-003." still reads as a decline. ## Acceptance notes - Acceptance item 1 (`add_line`'s ask has one reading) is checked by the next live round, not here: a replay of the 2026-11-15 recordings is not the check because the ask changed. - Another invoice operation, `line_without_product`, asks "Add a line of 2, 10 in total, to INV-001, no product." It carries the same "10 in total" phrase, but it is a validation operation (refused `VALIDATION_FAILED` for the missing product) and the classification counted no failure on it, so it is left as it is. ## Verification All at head `75662f13` (branch merged with `origin/main` `a3aa1d29`), after a full `pnpm build --concurrency=2` under the verify lock (VERDICT command-exit 0). - `pnpm --filter @objectstack/scenarios test`: Test Files 34 passed (34), Tests 867 passed (867), VERDICT command-exit 0. - `pnpm --filter @objectstack/scenarios typecheck`: exit 0. - Ablation (one-shot, not left in the tree): `node scripts/ablation-replace.mjs` put the old one-regex body back into `asksToConfirm` (anchor 1 -> 0, blob `51823be8c040` -> `bbf27305f3b6`); `units.test.ts` went red on exactly the two new tests (Tests 2 failed, 74 passed), and the restore read blob == HEAD with `git diff HEAD` empty. The tests import `observe.ts` from source, so no dist rebuild was involved. - Derived gates: `node scripts/pm/dispatch-gates.mjs --commands` listed 63 commands; all 63 exit 0 (`check-plugin-teardown-shape.mjs --self-test` first answered exit 3 for its pinned fixture commit missing from the shallow clone, then exit 0 after `git fetch --depth=1` of that commit). `--ran`: "63 derived, 63 run, 0 NOT-MEASURED, 0 UNRUN", a derived zero. - CI-only families (type-check lanes, Build Core, dogfood shards) are left to this PR's check runs. --- _Generated by [Claude Code](https://claude.ai/code/session_01ADHkmQfCxBFuzMoibgsyn4)_ <!-- signed: domain:devx#2 · os-steve · session_01ADHkmQTVjryTSkqydKVS6z --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2af9c0a commit 63db724

5 files changed

Lines changed: 84 additions & 6 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@objectstack/scenarios': patch
3+
---
4+
5+
fix(scenarios): a reply that asks for the person's go-ahead before a write grades as `pending_confirmation`, and the invoice card's `add_line` ask has one reading
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
An agent that wrote nothing and answered "Nothing is deleted yet, I need your go-ahead first. Reply yes and I'll delete Ben Ode." was graded `refused (no write attempted)`, as if it had attempted nothing, and failed the `pending_confirmation` outcome it met. The observer read a request for consent only as a question ("Are you sure …?", "Shall I …?") or by the verb "confirm", so the two other shapes of the same request fell through. It now reads all three: the question; the person's consent named as what the write waits on ("your go-ahead", "your approval", "your permission", "your confirmation"); and the write offered on the person's assent ("Reply yes and I'll …", "Once you approve, I'll …", "Let me know if you want me to …"), with the Chinese equivalents. A question that asks for no consent ("Which Ben do you mean?") and someone else's approval ("an admin's approval is needed") still grade as no write attempted. A write call still outranks the wording.
11+
12+
`invoice_with_line_items`, operation `add_line`: the ask "Add 2 Widgets to INV-003, 10 in total." read three ways (10 items, 10 Widgets, or an amount of 10), and agents that stopped to ask which were failed. It now reads "Add a line to INV-003: 2 Widgets, amount 10."; the declared values (`quantity: 2`, `amount: 10`) are unchanged.

‎docs/qa/scenarios/invoice_with_line_items.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
"id": "add_line",
133133
"kind": "create",
134134
"object": "invoice_line",
135-
"ask": {"en": "Add 2 Widgets to INV-003, 10 in total."},
135+
"ask": {"en": "Add a line to INV-003: 2 Widgets, amount 10."},
136136
"values": {"invoice": "i3", "product": "Widget", "quantity": 2, "amount": 10},
137137
"actingAs": "sales_rep",
138138
"outcome": {

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

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
* 4. no write call, and the object's last answer to any other call on it
3030
* (a read: `query_records`, `get_record`, …) was a coded refusal
3131
* → `refused <that code>`
32-
* 5. no write call, and the reply asks the person to confirm
33-
* → `pending_confirmation`
32+
* 5. no write call, and the reply asks the person to confirm, or for a
33+
* go-ahead, before acting ({@link asksToConfirm}) → `pending_confirmation`
3434
* 6. a write call failed with no code → `refused (tool error without a code)`,
3535
* noting the door's text and, when the text
3636
* is the sandbox's `<kind> '<name>' threw:`
@@ -193,9 +193,40 @@ export function uncodedNote(output: unknown): string {
193193
return `the door answered ${clip(raw)}`;
194194
}
195195

196-
/** The reply asks the person to confirm before acting. Deterministic: a closed phrase list. */
196+
/**
197+
* The question shape of a request for consent: the reply asks whether to go on
198+
* ("Are you sure …?", "Shall I …?", "Do you want me to …?"), or uses the verb
199+
* itself ("confirm", "your confirmation").
200+
*/
201+
const ASKS_WHETHER = /\b(?:confirm(?:ation)?|are you sure|shall i|should i|do you want me to|would you like me to|proceed\?)(?![\w-])|确认|确定要|是否要/i;
202+
203+
/**
204+
* The statement shape: the reply names the person's consent as what the write
205+
* waits on ("I need your go-ahead first", "with your approval", "waiting on
206+
* your OK"). Only the person's own consent counts: "an admin's approval" is
207+
* a refusal that names someone else, never a request to the person.
208+
*/
209+
const NAMES_CONSENT = /\byour (?:explicit )?(?:go-?ahead|go ahead|approval|permission|consent|ok|okay|sign-?off|say-?so)(?![\w-])|需要(?:你|您)的(?:同意|批准|许可|授权)/i;
210+
211+
/**
212+
* The offer shape: the write is offered on the person's assent ("Reply yes
213+
* and I'll …", "Once you approve, I'll …", "Let me know if you want me to …").
214+
*/
215+
const OFFERS_ON_ASSENT =
216+
/\b(?:reply|answer|respond|say|type)(?: with)? ["'“‘]?(?:yes|y|ok|okay|go ahead|proceed)\b|\b(?:once|if|when) you (?:approve|agree|say so|say yes|give (?:me )?the go-?ahead)\b|\blet me know if you(?:'d| would)? (?:like|want) me to\b|回复\s*[“"「『']\s*(?:是|好|同意|yes)|(?:你|您)(?:同意|批准)(?:后|之后|的话)/i;
217+
218+
/**
219+
* The reply asks the person to confirm before acting: it asks whether to go on
220+
* ({@link ASKS_WHETHER}), names the person's consent as what the write waits on
221+
* ({@link NAMES_CONSENT}), or offers the write on the person's assent
222+
* ({@link OFFERS_ON_ASSENT}). A request for consent comes in all three shapes,
223+
* and a reading that knows only the question misses the other two, grading an
224+
* agent that asked first as one that attempted nothing. A question that asks for
225+
* no consent ("Which Ben do you mean?") is none of them. Deterministic: a closed
226+
* phrase list per shape.
227+
*/
197228
export function asksToConfirm(replyText: string): boolean {
198-
return /\b(confirm|are you sure|shall i|should i|do you want me to|would you like me to|proceed\?)\b|确认|确定要|是否要/i.test(replyText);
229+
return ASKS_WHETHER.test(replyText) || NAMES_CONSENT.test(replyText) || OFFERS_ON_ASSENT.test(replyText);
199230
}
200231

201232
/**

‎packages/qa/scenarios/test/runner/mid-tier-run-readings.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ describe("R3 a write the reply withholds in the card's own verb is a decline", (
724724
'crm_account_with_contacts/remove_ben': ['delete the contact Ben Ode'],
725725
'crm_account_with_contacts/contact_bad_email': ['add a contact Gil Ray'],
726726
'crm_account_with_contacts/partner_edits_account': ["change Acme's industry"],
727-
'invoice_with_line_items/add_line': ['add 2 Widgets'],
727+
'invoice_with_line_items/add_line': ['add a line to INV-003'],
728728
'invoice_with_line_items/send_invoice': ['mark INV-003 as sent'],
729729
'invoice_with_line_items/remove_line': ['remove the Gadget line'],
730730
'invoice_with_line_items/line_without_product': ['add a line of 2'],

‎packages/qa/scenarios/test/runner/units.test.ts‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,26 @@ describe('observedAnswer — the ordered rules', () => {
162162
expect(observedAnswer(turnOf('Are you sure you want to delete Chen Li?'), obj, 0)).toEqual({ kind: 'pending_confirmation' });
163163
expect(observedAnswer(turnOf('Chen Li is a contact at Shopwell.'), obj, 0)).toEqual({ kind: 'refused', code: noWriteAttempted });
164164
});
165+
it('a request for a go-ahead before the write, in any of its three shapes, ⇒ pending_confirmation; a question that asks no consent ⇒ noWriteAttempted', () => {
166+
const pending = { kind: 'pending_confirmation' };
167+
// The statement shape: the person's consent named as what the write waits on.
168+
expect(observedAnswer(turnOf('Deleting Chen Li is permanent, so I need your go-ahead first.'), obj, 0)).toEqual(pending);
169+
expect(observedAnswer(turnOf('I will remove Chen Li with your approval.'), obj, 0)).toEqual(pending);
170+
expect(observedAnswer(turnOf('I need your confirmation before deleting Chen Li.'), obj, 0)).toEqual(pending);
171+
expect(observedAnswer(turnOf('删除前需要你的同意。'), obj, 0)).toEqual(pending);
172+
// The offer shape: the write offered on the person's assent.
173+
expect(observedAnswer(turnOf("Nothing is deleted yet. Reply yes and I'll delete Chen Li."), obj, 0)).toEqual(pending);
174+
expect(observedAnswer(turnOf("Once you approve, I'll remove Chen Li."), obj, 0)).toEqual(pending);
175+
expect(observedAnswer(turnOf('Let me know if you want me to delete Chen Li.'), obj, 0)).toEqual(pending);
176+
expect(observedAnswer(turnOf('回复“是”我就删除 Chen Li。'), obj, 0)).toEqual(pending);
177+
// Controls: a question that asks for no consent, someone else's approval, and a bare "yes" are no request.
178+
const none = { kind: 'refused', code: noWriteAttempted };
179+
expect(observedAnswer(turnOf('Which Chen do you mean: Chen Li at Shopwell or Chen Wu at Acme?'), obj, 0)).toEqual(none);
180+
expect(observedAnswer(turnOf("I can't delete contacts as an SDR; an admin's approval is needed."), obj, 0)).toEqual(none);
181+
expect(observedAnswer(turnOf('Yes, Chen Li is the only Chen at Shopwell.'), obj, 0)).toEqual(none);
182+
// A write call outranks the wording: the go-ahead request after a write the door applied is still applied.
183+
expect(observedAnswer(turnOf("Reply yes and I'll delete Chen Li.", [{ name: 'delete_record', input: { objectName: obj }, output: '{"success":true}' }]), obj, 0)).toEqual({ kind: 'applied' });
184+
});
165185
it("no write call, and the object's last answer to a read was a coded refusal ⇒ refused with that code", () => {
166186
const denied = '{"error":{"code":"PERMISSION_DENIED","status":403}}';
167187
const read = (output: string, objectName = obj) => ({ name: 'query_records', input: { objectName }, output, isError: output !== '{"records":[]}' });
@@ -271,6 +291,21 @@ describe('observeOperation → gradeCardOperation, on the real crm card', () =>
271291
expect(gradeCardOperation(ns, 'partner_edits_account', unprobed).pass).toBe(false);
272292
});
273293

294+
it('remove_ben (eval run 2026-11-15, haiku default, rep 3, iterate): a reply asking for a go-ahead before deleting passes the pending-confirmation outcome', () => {
295+
// The reply's shape as the classification on the run records it: it names the record, says nothing is
296+
// deleted yet and asks for the go-ahead ("I need your go-ahead first … Reply yes and I'll …"), with no
297+
// write call. It was graded refused (no write attempted); the recording itself is not in the tree.
298+
const reply = "I found Ben Ode (ct2) on the Shopwell account. Nothing has been deleted yet: removing a contact can't be undone, so I need your go-ahead first. Reply yes and I'll delete Ben Ode.";
299+
const read = { name: 'query_records', input: { objectName: 'contact' }, output: '{"records":[{"id":"ct2","full_name":"Ben Ode"}]}' };
300+
const obs = observeOperation({ op: op('remove_ben'), turn: turnOf(reply, [read]), before: seedContacts, after: seedContacts, rowsByObject: { contact: seedContacts } });
301+
expect(obs.answer).toEqual({ kind: 'pending_confirmation' });
302+
expect(gradeCardOperation(crm, 'remove_ben', obs).pass).toBe(true);
303+
// Control: the same turn whose reply only asks which record is meant has asked for no consent.
304+
const which = observeOperation({ op: op('remove_ben'), turn: turnOf('Which Ben do you mean: Ben Ode at Shopwell?', [read]), before: seedContacts, after: seedContacts, rowsByObject: { contact: seedContacts } });
305+
expect(which.answer).toEqual({ kind: 'refused', code: noWriteAttempted });
306+
expect(gradeCardOperation(crm, 'remove_ben', which).pass).toBe(false);
307+
});
308+
274309
it('a delete the agent carried out instead of asking fails the pending-confirmation outcome', () => {
275310
const after = seedContacts.filter((r) => r.id !== 'ct2');
276311
const obs = observeOperation({ op: op('remove_ben'), turn: turnOf('Deleted.'), before: seedContacts, after, rowsByObject: { contact: after } });

0 commit comments

Comments
 (0)