You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit dc45b1e
Browse filesBrowse the repository at this point in the historyBrowse files
feat(qa): skill-evals grader takes an any-of form; objectstack-ai case 6 moves to it (#37969)
<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DLCo5F2y7fgbM8tstGoyyUn)_Fixes#37928
Clause-②: no
Metadata-protocol: none
## 维护者速读
-
用户能看到什么变化:用户无感。看技能评测结果的人会看到,一道题现在可以写「这几种写法出现任意一种就算对」,仍是逐字匹配,不做归一化,不用模型判分;AI
技能包的第 6 题(让脚本拿令牌批量批准 AI 待审项)第一个改用它。
- 为什么做:属于「技能评测可信」这条线。第 6
题原来要求两个英文短语同时出现,答对但换了措辞或用中文作答的也被判错;这次先录一轮,十个带技能的正确答案只有一个过关。
- 出错会怎样:受影响的只有评测读数,产品行为不变。新写法若放得太松,会把没掌握规则的答案判对;本次在推送后的版本上另跑一轮全新的十对十:带技能
9/10,不带技能 0/10。可以直接撤回,撤回后第 6 题回到原来的误判。
- 要你做什么:评测文件属于对外发布的技能包,需要你批准这一处判分词的改动。
## What changes
**The form.** `assertions.must_contain_any` sits beside `must_contain`
and `must_not_contain` in a skill eval case. It is a list of groups,
each group a list of literal tokens. A group is met when at least one of
its tokens is in the answer, and every group is required, so `[["a",
"b"], ["c"]]` reads "(`a` or `b`) and `c`". Matching is what the other
two forms use: a literal, case-sensitive substring, nothing normalised,
no model judge.
**The key name and the report of an unmet group** (both the author's
choice on this card):
- Key: `must_contain_any` in the eval JSON; `mustContainAny` on the
parsed case.
- Result: `gradeAnswer` returns `unmetAny`, the unmet groups, each group
whole and in the case's order. The key is present only when a group is
unmet, so a result for a case without the form is byte-identical to
before. A run record carries the same `unmetAny` under the same rule,
and `--regrade` drops a stale one.
- Summary: `CaseScore.withSkillUnmetAny` holds the deduplicated unmet
groups of the failing with-skill turns, and the per-case table prints
each in the existing missed column as ``(none of: `a` / `b`)``.
**The reader** (`cases.ts`) refuses, with the case's location: a
`must_contain_any` that is not a list; a group that is not a list of
strings; an empty group (no answer could meet it); a group holding an
empty token (every answer contains it). A case with no token in any of
the three forms still refuses as asserting nothing, and a case that
asserts only groups is read.
**The hash.** `hashCase` includes the groups only when a case has any.
Every case without the form keeps its hash, so `--regrade` reads earlier
rounds as before. A case that gains a group, or has one edited, hashes
anew: recordings keyed on that case's hash re-key, `--regrade` sets its
earlier records apart, and the case compares across rounds only after a
re-run. Case 6 moves from `sha256:bd7f01e4b5bc2ac3…` to
`sha256:b6390ca3b27f04dd…`.
**Case 6** of `skills/objectstack-ai/evals/skills-tools-knowledge.json`:
```diff
- "must_contain": ["signed-in session", "refused"],
+ "must_contain_any": [["ai:approve", "signed-in session", "refused", "never decides"]],
"must_not_contain": ["pendingActions.approve("]
```
One group of four: the permission name the skill says does not decide
the item (`ai:approve`), where deciding happens (`signed-in session`),
and two refusal terms (`refused`, `never decides`). All four are
spellings of the approval paragraph the case grades and of the case's
own reference answer. The prompt, `expected_output` and
`must_not_contain` are unchanged; no other case and no skill text
changes.
Files:
`packages/qa/scenarios/src/skill-evals/{grade,cases,run,summary,self-test}.ts`,
`packages/qa/scenarios/README.md`, case 6's `assertions`, one changeset
(`@objectstack/scenarios` patch for the published README,
`@objectstack/skills` patch for the eval file).
Read first, by risk: (1) the case 6 hunk above, the only published-skill
change; (2) `anyOfProblem` and the asserts-nothing sum in `cases.ts`;
(3) `gradeAnswer` in `grade.ts`.
Two-minute check: `pnpm --filter @objectstack/scenarios skill-evals
--self-test` prints `✓ skill-evals self-test: 40 rows pass.`
## Tests
All on head `07fe4d2fa8`.
- Grader self-test, exit 0, `✓ skill-evals self-test: 40 rows pass.` (34
before). Six new rows:
- a group met by its second token passes;
- a group with none of its tokens fails and names the group (the answer
differs from a token only in case);
- beside a met group, `must_contain` and `must_not_contain` decide as
before, and a second unmet group fails;
- the reader refuses seven malformed shapes and reads a case asserting
only groups;
- a case without groups hashes as it did before the form (compared
against the old hash computed in the row), a group added or edited
re-keys, and `--regrade` sets the earlier record apart;
- the summary names the unmet group whole.
- Ablation, once: `gradeAnswer` mutated to treat every group as met
(`scripts/ablation-replace.mjs`, anchor 1 to 0, blob `33487785e247` to
`d9ab5806089f`). The self-test went red on three rows (the
none-of-its-tokens row, the beside-a-met-group row, the summary row) and
did not reach its verdict; restored, blob equals HEAD and `git diff
HEAD` is empty.
- `pnpm --filter @objectstack/scenarios typecheck`: exit 0.
- Package suite under the verify lock, after building the package: `Test
Files 45 passed (45)`, `Tests 1395 passed (1395)`, `VERDICT command-exit
0`. The existing suite under `test/skill-evals/` is untouched and
passes, including its exact-shape assertions on the grader's result.
- `node scripts/check-skills-token-ratchet.mjs`: exit 0, no ceiling
raised (the script is not in the diff).
## Acceptance
Both rounds ran case 6 alone through the runner's own turn machinery,
the login's default model, Claude Code 2.1.332, 10 draws per arm, no
invalid or error turn.
| round | head | case 6 tokens | with the skill | without the skill |
|:--|:--|:--|--:|--:|
| A, the recording the tokens were drawn from | `f0bbe3940e` | as on
`main` (both of `signed-in session`, `refused`) | 1/10 | 0/10 |
| A's answers read against the new group (offline, not a measurement) |
| the new group | 10/10 | 0/10 |
| **B, fresh, the acceptance round** | `07fe4d2fa8` | the new group |
**9/10** | **0/10** |
The bar is at least 8/10 with the skill and at most 2/10 without: round
B meets it. No retune was made.
- Round A, with the skill: all ten answers decline to approve on the
token, state that only the person the call ran as decides in the app,
and offer a list-and-report script; four answered in Chinese. Nine name
`ai:approve`; the tenth says the calls "are refused". Nine failed on
`main`'s tokens for lacking `signed-in session` (they wrote, for
example, "while signed in", or the Chinese for it), which is the
misgrade this card is about.
- Round A, without the skill: seven wrote the approval script with
`pendingActions.approve(`; three asked questions first and proposed
alternatives without knowing the platform rule.
- Round B, with the skill: ten correct answers of the same kind. Nine
pass (`ai:approve` in eight, `refused` in eight, `never decides` in
three, `signed-in session` in one). The one miss is a correct answer
that wrote "ObjectStack refuses it" and "The server refuses an API key
or token" and named no `ai:approve`: the present tense of a token the
group holds in the past tense.
- Round B, without the skill: three wrote `pendingActions.approve(`;
seven asked first or proposed alternatives; none carries a token of the
group.
## Acceptance notes
- `ui/scripts/check-skill-eval-tokens.mjs` checks that every
`must_contain` token is taught by its bundle and does not read
`must_contain_any`, so the four tokens are not scored by it. Read by
hand: each occurs in `skills/objectstack-ai/SKILL.md` (`ai:approve` 1,
`signed-in session` 1, `never decides` 1, `refused` 9). That gate stays
green on this head (exit 0). Extending it to the new form is outside
this card's file surface.
- The round-B miss shows the residual: a correct answer in the present
tense ("refuses") with no `ai:approve`. It is inside the bar and is left
as measured.
- Half of round A's with-skill answers and most no-skill answers came
back in Chinese on an English prompt; English-phrase tokens cannot match
those, which is why the group leans on the code spelling `ai:approve`.
## Verification
- Derived local gates (`node scripts/pm/dispatch-gates.mjs --commands`,
68 commands on `07fe4d2fa8`): 67 exit 0; `pnpm
check:dual-build-cjs-loads` exit 3, PREREQUISITE NOT MET (it reads every
package's `dist/`, and only the scenarios closure is built here), read
as NOT MEASURED and left to CI. `--ran` reconciliation: `68 derived, 67
run, 1 NOT-MEASURED, 0 UNRUN`, exit 0.
- `check:nul-bytes` exit 0; `ui` `check:skill-eval-tokens` exit 0.
- NOT MEASURED: `test:repo` and the full gate farm, reason: CI's.
## Deviations
- The CLI has no per-case filter, and a whole-bundle round at 10 draws
is 240 turns. Both rounds were driven by a scratch script (not
committed) that selects case 6 from the workspace catalog and calls the
runner's own `preflight`, `planRound`, `executeRound` and
`summariseRound`, so arms, argv, grading and records are the runner's.
The rounds' records are in the session scratchpad, not in the
repository.
- Each round is one case at 10 draws per arm on one model; nothing here
measures the other cases.
- The suite under `packages/qa/scenarios/test/skill-evals/` gained no
case: it is outside the card's file surface, and the self-test carries
the new coverage as the card asks.
---
_Generated by [Claude
Code](https://claude.ai/code/session_016WV4cxBECSPtHxQMZDHSie)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
feat(qa): the skill-evals grader takes an any-of form, `must_contain_any`; `objectstack-ai` case 6 moves to it
7
+
8
+
Clause-②: no
9
+
Metadata-protocol: none
10
+
11
+
A skill eval case can now list `assertions.must_contain_any` beside `must_contain` and `must_not_contain`: a list of groups, each a list of tokens, and a group is met when at least one of its tokens is in the answer. Every group is required, so `[["a", "b"], ["c"]]` reads "(`a` or `b`) and `c`". Matching is the same as the other two forms: a literal, case-sensitive substring, nothing normalised, no model judge. The reader refuses a `must_contain_any` that is not a list of groups, a group that is empty or not a list of strings, a group holding an empty token, and a case with no token in any of the three forms. A failing run record names each unmet group whole in `unmetAny` (the key is absent when every group is met), and the round summary prints it in the missed column as `(none of: a / b)`. The runner runs from a checkout only; of `@objectstack/scenarios`, the published README is what changes.
12
+
13
+
The case hash covers the groups only when a case has any, so every case without the form keeps its hash and `skill-evals --regrade` reads its earlier records as before. A case that gains a group, or has one edited, has a new hash: its earlier records are set apart, and it compares across rounds only after a re-run.
14
+
15
+
`skills/objectstack-ai/evals/skills-tools-knowledge.json` case 6 (an operator script asked to approve AI pending actions on an API token) now requires one of `ai:approve`, `signed-in session`, `refused` or `never decides` in place of both `signed-in session` and `refused`, which failed correct answers that worded the refusal another way or answered in another language. Its prompt, reference answer and forbidden token are unchanged, and so is the skill text.
Copy file name to clipboardExpand all lines: packages/qa/scenarios/README.md
+11-5Lines changed: 11 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -995,7 +995,7 @@ wrapper, with no change to the runner.
995
995
## Running the published skills' eval cases — `skill-evals`
996
996
997
997
Every published skill bundle carries eval cases (`skills/BUNDLE/evals/*.json`: a `prompt`, an `expected_output` and
998
-
`assertions.must_contain` / `must_not_contain`). `skill-evals` sends each case to the local Claude Code login twice,
998
+
`assertions.must_contain` / `must_contain_any` / `must_not_contain`). `skill-evals` sends each case to the local Claude Code login twice,
999
999
once with the bundle installed and once without, and grades each answer by the case's own tokens. A trigger case
1000
1000
asks instead whether the skill was loaded, and runs with the bundle installed beside its competitors only. It runs from this checkout only. It is not part of the published `bin` or `exports`, not a CI job and not a merge gate. The cases are
1001
1001
the skill authors' and the runner never edits them.
@@ -1025,8 +1025,13 @@ pnpm --filter @objectstack/scenarios skill-evals --self-test # the runner's o
1025
1025
`--no-session-persistence`. A read outside the directory needs a permission no turn is given, and `-p` denies it.
1026
1026
The skills built into Claude Code are present in both arms.
1027
1027
-**Grading**: the answer is the result line's text, the reply a user reads. It passes when every `must_contain` token
1028
-
is in it and no `must_not_contain` token is. Tokens match as literal, case-sensitive substrings, and no model judges
1029
-
an answer. A turn whose init line shows the wrong arm is `invalid`: the with-skill arm does not list the bundle, or
1028
+
is in it, every `must_contain_any` group has at least one of its tokens in it, and no `must_not_contain` token is.
1029
+
Tokens match as literal, case-sensitive substrings in all three forms, nothing is normalised, and no model judges
1030
+
an answer. `must_contain_any` is a list of groups, each a list of tokens, for a case whose correct answers do not
1031
+
share one literal: `[["ai:approve", "signed-in session"], ["refused", "403"]]` reads "(the first or the second) and
1032
+
(the third or the fourth)". The reader refuses a group that is empty or holds an empty token, and a case with no
1033
+
token in any of the three forms. A failing record names each unmet group whole in `unmetAny` (the key is absent when
1034
+
every group is met), and the summary's missed column prints it as `(none of: a / b)`. A turn whose init line shows the wrong arm is `invalid`: the with-skill arm does not list the bundle, or
1030
1035
the no-skill arm lists one or launches one. A bundle whose `SKILL.md` sets `user-invocable: false` (`objectui`) is
1031
1036
never in the init line's `skills` list, though the model can launch it. Its with-skill turns are graded, and each
1032
1037
record's `armEvidence` says whether the turn launched the bundle (`launched`) or nothing in the stream shows it
@@ -1060,11 +1065,12 @@ pnpm --filter @objectstack/scenarios skill-evals --self-test # the runner's o
1060
1065
`evals/files/`, so the arms still differ only in the bundle. A case whose prompt states its context needs none.
1061
1066
`--regrade DIR` applies the current rules to a recorded round's answers and arm facts. A changed record keeps the
1062
1067
verdict its turn was first given as `regradedFrom`. Each record carries `caseHash`, a hash of its case's prompt and
1063
-
token lists as the turn ran them. A case changed or removed since the round is set apart: it is not regraded, its
1068
+
token lists as the turn ran them, its `must_contain_any` groups included when it has any: a case with none hashes
1069
+
as it did before the form existed, and a case moved to it has a new hash. A case changed or removed since the round is set apart: it is not regraded, its
1064
1070
records are left as they are, and the summary names it outside every pass rate. A record with no hash predates the
1065
1071
hash; it is regraded against the case as it is now, and the summary counts it as unhashed.
1066
1072
-**Records**: by default the round goes to `docs/qa/platform-checklist/runs/skill-evals/ROUND/` (git-ignored), or to
1067
-
`--out`. It holds one `runs/*.json` per turn (verdict, missing and forbidden tokens, the answer, the skills listed
1073
+
`--out`. It holds one `runs/*.json` per turn (verdict, missing and forbidden tokens, unmet any-of groups, the answer, the skills listed
1068
1074
and launched, the skill files read, the served model, the CLI's notional cost and the rate-limit reading), `round.json` (environment,
1069
1075
scope and the full per-case scores on both arms) and `summary.md`. The summary has one row per bundle (each arm's
1070
1076
pass rate, the with-skill failing cases, and the cases where the no-skill arm scored at least as high) and then
refusals.push({path: at,message: '`assertions.must_contain` / `must_not_contain` must each be a list of strings'});
189
217
return;
190
218
}
191
-
if(rawMc.length+rawMnc.length===0){
192
-
refusals.push({path: at,message: 'asserts nothing: a case with no `must_contain` and no `must_not_contain` would pass every answer'});
219
+
constbadAny=anyOfProblem(rawAny);
220
+
if(badAny){
221
+
refusals.push({path: at,message: badAny});
222
+
return;
223
+
}
224
+
constgroups=rawAnyasstring[][];
225
+
if(rawMc.length+rawMnc.length+groups.length===0){
226
+
refusals.push({path: at,message: 'asserts nothing: a case with no `must_contain`, no `must_contain_any` and no `must_not_contain` would pass every answer'});
193
227
return;
194
228
}
195
229
mc=rawMc;
196
230
mnc=rawMnc;
231
+
any=groups;
197
232
}
198
233
constkey=caseKey(bundle,file,id);
199
234
if(seen.has(key)){
@@ -210,6 +245,7 @@ export function parseEvalFile(bundle: string, file: string, text: string): { cas
if(caseDrift(rec,c)==='changed')thrownewError(`--regrade: \`${rec.key}\` has changed since the turn ran (record ${rec.caseHash}, now ${hashCase(c)}); a changed case is set apart, never regraded`);
0 commit comments