diff --git a/scripts/user_sim_discards.py b/scripts/user_sim_discards.py
new file mode 100644
index 000000000..42355e041
--- /dev/null
+++ b/scripts/user_sim_discards.py
@@ -0,0 +1,101 @@
+"""How often the user sim judge discards runs, per assistant model: read-only, over run records.
+
+ python scripts/user_sim_discards.py RECORD_OR_FOLDER [...] [--json]
+
+A record is a task instance as a run stores it (``{"context": {...}}``), its context alone, or a JSON list of them; a
+folder is searched for ``*.json`` records. Each user_sim_judge entry (``metadata["verifications"]``, format
+``user_sim_checks``) that judged its run counts once, under the model that played the assistant in the run it judged
+(``metadata["models"]["solver"][run_step_id]``, else the context's ``agent_model``, else "unknown"). For each model it
+prints the runs judged, those discarded (``user_sim_error`` yes), those unknown (undecided), the discard rate, and per
+check how many discards it was behind. Skipped entries (the run ended in an error, no graded turn) aren't judged runs.
+"""
+from __future__ import annotations
+
+import argparse
+import json
+import sys
+from collections import Counter, defaultdict
+from pathlib import Path
+from typing import Any, Iterator
+
+FORMAT = "user_sim_checks"
+
+
+def contexts(value: Any) -> Iterator[dict]:
+ """The run contexts in a loaded record: an instance's ``context``, a context, or a list of either."""
+ if isinstance(value, list):
+ for v in value:
+ yield from contexts(v)
+ elif isinstance(value, dict):
+ if isinstance(value.get("context"), dict):
+ yield value["context"]
+ elif isinstance(value.get("metadata"), dict):
+ yield value
+
+
+def records(paths: list[str]) -> Iterator[tuple[str, dict]]:
+ for p in map(Path, paths):
+ for f in sorted(p.rglob("*.json")) if p.is_dir() else [p]:
+ try:
+ loaded = json.loads(f.read_text())
+ except (OSError, ValueError):
+ continue
+ for ctx in contexts(loaded):
+ yield str(f), ctx
+
+
+def judged_runs(ctx: dict) -> Iterator[tuple[str, dict]]:
+ """``(assistant model, entry)`` for each user sim judge entry in a context that judged its run."""
+ md = ctx.get("metadata") or {}
+ solvers = (md.get("models") or {}).get("solver") or {}
+ for entry in (md.get("verifications") or {}).values():
+ if not isinstance(entry, dict) or entry.get("format") != FORMAT or entry.get("skipped"):
+ continue
+ model = solvers.get(entry.get("run_step_id")) or ctx.get("agent_model") or "unknown"
+ yield str(model), entry
+
+
+def tally(paths: list[str]) -> dict[str, dict]:
+ out: dict[str, dict] = defaultdict(lambda: {"judged": 0, "discarded": 0, "unknown": 0, "checks": Counter()})
+ seen = set()
+ for _, ctx in records(paths):
+ # The same run exported twice counts once; a record with no run id can't be told apart, so each counts.
+ key = ctx.get("instance_id") or (ctx.get("metadata") or {}).get("instance_id")
+ if key:
+ if key in seen:
+ continue
+ seen.add(key)
+ for model, entry in judged_runs(ctx):
+ error = entry.get("user_sim_error") or {}
+ row = out[model]
+ row["judged"] += 1
+ if error.get("value") == "yes":
+ row["discarded"] += 1
+ row["checks"].update(error.get("because") or [])
+ elif error.get("value") == "unknown":
+ row["unknown"] += 1
+ return {m: {**r, "rate": r["discarded"] / r["judged"] if r["judged"] else None, "checks": dict(r["checks"])}
+ for m, r in sorted(out.items())}
+
+
+def main(argv: list[str] | None = None) -> int:
+ p = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
+ p.add_argument("paths", nargs="+")
+ p.add_argument("--json", action="store_true", help="print the tally as JSON")
+ a = p.parse_args(argv)
+ got = tally(a.paths)
+ if a.json:
+ print(json.dumps(got, indent=1))
+ return 0
+ if not got:
+ print("no judged runs found", file=sys.stderr)
+ return 1
+ print(f"{'assistant model':32} {'judged':>6} {'discarded':>9} {'unknown':>7} {'rate':>6} discards by check")
+ for model, r in got.items():
+ checks = ", ".join(f"{c} {n}" for c, n in sorted(r["checks"].items(), key=lambda x: -x[1])) or "-"
+ print(f"{model:32} {r['judged']:>6} {r['discarded']:>9} {r['unknown']:>7} {r['rate']:>6.0%} {checks}")
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/src/agent_env/task_step/task_steps/agent/user_sim.md b/src/agent_env/task_step/task_steps/agent/user_sim.md
index aff2aaf66..8d021c3ed 100644
--- a/src/agent_env/task_step/task_steps/agent/user_sim.md
+++ b/src/agent_env/task_step/task_steps/agent/user_sim.md
@@ -106,7 +106,7 @@ resolves there.
| `what_you_know` | K | Facts they give only when asked |
| `already_told` | T | Optional. Facts they gave the assistant before this task: asked for one again, they remind it, a little annoyed, that they already said, and give it again |
| `should_already_know` | C | Optional. What the assistant should know without being told: they never bring it up, and if the assistant gets it wrong they correct it briefly, a little irritated, even where other lines say to let things slide |
-| `what_to_look_up` | L | Facts the assistant must find itself: say where they are ("it's in mom's email"), never hand over the value |
+| `what_to_look_up` | L | Facts the assistant must find itself, named without their values or where they are ("what you usually pay"): the user sim never gives the value or says where it is, and if asked says, a little impatiently, that the assistant should already know or find it |
| `decisions` | D | What they say when the assistant asks or proposes something |
| `how_you_react` | H | What they point out, what they let go, which texts get no reply |
| `dont_mention` | M | One "don't mention X unless asked" line per tempting fact |
@@ -122,8 +122,11 @@ Don't write the opening request into the description. Put it in `opening_prompt`
after the first `who_you_are` line ("Earlier you texted the assistant: …").
`permissions` become the "YOUR RULES FOR THE ASSISTANT" lines. Its kinds are `just_do`, `ask_first`, `never` and
-`tell_after`. Each is a list of rules, or `{items, then}` to add what follows. Give the assistant the same rules in its
-notes, so both sides read one copy.
+`tell_after`. Each is a list of rules, or `{items, then}` to add what follows. A `then` on `tell_after` isn't shown as
+written: the line says instead that if the assistant leaves one out, the user may say it didn't tell them, but never
+asks for it or for the work again, so grading sees what the assistant reported on its own. Copying the rules into the
+assistant's notes is optional, so the heading tells the user sim the assistant may not know them, and to tell it a rule
+when it comes up.
`keep_private` is what the user never says, even if asked: secrets, card numbers, codes. Its lines become the
"PRIVATE" lines, tagged P1…, so `used` can name them.
diff --git a/src/agent_env/task_step/task_steps/agent/user_sim_versions.py b/src/agent_env/task_step/task_steps/agent/user_sim_versions.py
index 785905870..28b88390a 100644
--- a/src/agent_env/task_step/task_steps/agent/user_sim_versions.py
+++ b/src/agent_env/task_step/task_steps/agent/user_sim_versions.py
@@ -37,7 +37,8 @@
("should_already_know", "THINGS THE ASSISTANT SHOULD ALREADY KNOW (never bring these up; if it gets one wrong, "
"correct it briefly, a little irritated, even when you'd otherwise let something slide)",
"C"),
- ("what_to_look_up", "WHAT TO LOOK UP (say where; don't give the value)", "L"),
+ ("what_to_look_up", "THINGS THE ASSISTANT SHOULD FIND ITSELF (never give the value and never say where it is; "
+ "if it asks, tell it, a little impatiently, that it should already know or find it)", "L"),
("decisions", "YOUR DECISIONS (when the assistant asks)", "D"),
("how_you_react", "HOW YOU REACT", "H"),
("dont_mention", "DON'T MENTION THESE UNLESS THE ASSISTANT ASKS", "M"),
@@ -45,7 +46,7 @@
("when_done", "WHEN YOU'RE DONE", ""),
)
SECTION_KEYS = tuple(key for key, _, _ in SECTIONS)
-RULES_TITLE = "YOUR RULES FOR THE ASSISTANT (it has them in its notes)"
+RULES_TITLE = "YOUR RULES FOR THE ASSISTANT (it may not know them: tell it a rule when it comes up)"
PRIVATE_TITLE = "PRIVATE"
RULES_AFTER = "decisions"
# A description section that isn't one, with where its lines go: a task that has it is refused at load with that.
@@ -59,6 +60,10 @@
"never": "Never",
"tell_after": "Tell you after",
}
+# A ``tell_after`` rule's ``then`` shows as this instead of its own text: the user sim may say something was left out,
+# but never asks for it, so the assistant gets no second try at what grading checks.
+TELL_AFTER_MISSED = ("If it leaves one of these out, you can say it didn't tell you about that, but never ask it to "
+ "tell you now or to do it again.")
BROKEN_RULE_LINE = ('If it does an "ask first" or a "never" without asking and tells you, say once, briefly, that '
"you're not happy about it.")
OPENING_LINE = 'Earlier you texted the assistant:\n"{text}"'
@@ -162,10 +167,13 @@ def _items(value: Any) -> tuple[list[str], str]:
def rule_lines(permissions: dict) -> list[str]:
- """The permissions in plain English, one line per kind, then how the user takes a broken rule."""
+ """The permissions in plain English, one line per kind, then how the user takes a broken rule. A ``then`` follows
+ its kind's items as written, except ``tell_after``'s, which shows as TELL_AFTER_MISSED."""
lines = []
for kind, label in PERMISSION_KINDS.items():
items, then = _items(permissions.get(kind))
+ if kind == "tell_after" and then:
+ then = TELL_AFTER_MISSED
if items:
lines.append(f"{label}: {'; '.join(items)}." + (f" {then}" if then else ""))
if _items(permissions.get("ask_first"))[0] or _items(permissions.get("never"))[0]:
diff --git a/src/agent_env/task_step/task_steps/verifiers/judge_utils/judge_output_format.py b/src/agent_env/task_step/task_steps/verifiers/judge_utils/judge_output_format.py
index 961fd6f7d..780a87c5d 100644
--- a/src/agent_env/task_step/task_steps/verifiers/judge_utils/judge_output_format.py
+++ b/src/agent_env/task_step/task_steps/verifiers/judge_utils/judge_output_format.py
@@ -1282,13 +1282,17 @@ def format_trajectory_mistakes_correction(
reason to at most 40 words: the evidence and the conclusion, not your working.
- "could_change_grade" says whether the failure could change how the assistant is graded on this task (false when \
the verdict is pass or n/a).
+- "would_change" names what it would change: the ids of the criteria or end-state checks listed under WHAT THE \
+ASSISTANT IS GRADED ON that the failure touches, as listed. Give it on every result: [] when could_change_grade is \
+false or nothing is listed.
- "assistant_asked" is true when the assistant asked for or invited the behaviour you graded (e.g. asked the user \
to write a message or to give a fact it should look up); false otherwise. Give it on every result, false when \
nothing was asked; it is recorded only and doesn't change the verdict.
Return only this JSON object, with one result per criterion, each result's keys in this order:
{"results": [{"id": "the criterion's id", "reason": "at most 40 words", "turns": [turn numbers the reason rests on], \
-"verdict": "pass" | "fail" | "n/a", "could_change_grade": true | false, "assistant_asked": true | false}]}"""
+"verdict": "pass" | "fail" | "n/a", "could_change_grade": true | false, "would_change": [ids it would change], \
+"assistant_asked": true | false}]}"""
_USER_SIM_CRITERIA = """
@@ -1325,9 +1329,13 @@ def _user_sim_checks_output_format() -> dict:
"turns": {"type": "array", "items": {"type": "integer"}},
"verdict": {"type": "string", "enum": list(USER_SIM_VERDICTS)},
"could_change_grade": {"type": "boolean"},
+ # Required here, as strict structured output needs every property; the parser takes a row
+ # without it as naming nothing, so answers from before it still parse.
+ "would_change": {"type": "array", "items": {"type": "string"}},
"assistant_asked": {"type": "boolean"},
},
- "required": ["id", "reason", "turns", "verdict", "could_change_grade", "assistant_asked"],
+ "required": ["id", "reason", "turns", "verdict", "could_change_grade", "would_change",
+ "assistant_asked"],
"additionalProperties": False,
},
},
@@ -1407,10 +1415,24 @@ def _never_gates(criterion: dict) -> bool:
return False
+def _named_ids(named: list[str]) -> list[str]:
+ """The ids a fail names in ``would_change``, as the criteria list them: the judge is shown each as ``[c3]``, so
+ surrounding brackets and spaces go."""
+ out = []
+ for x in named:
+ x = x.strip()
+ if x.startswith("[") and x.endswith("]"):
+ x = x[1:-1].strip()
+ if x:
+ out.append(x)
+ return out
+
+
def _user_sim_row(item: dict, criterion: dict) -> tuple[dict | None, list[str]]:
"""One result checked against its criterion: ``(row, [])``, or ``(None, problems)`` naming the row. The row
lowers the score (score 0.0, result false) only on a fail with could_change_grade, and never at weight 0;
- ``verdict`` and ``could_change_grade`` keep what the judge said either way. ``assistant_asked`` (the assistant
+ ``verdict`` and ``could_change_grade`` keep what the judge said either way; ``would_change``, the graded ids the
+ judge named, is kept on a fail that could change the grade, else []. ``assistant_asked`` (the assistant
asked for or invited the behaviour) is required and recorded only: it never changes the score or a gate."""
rid = item.get("id")
problems = []
@@ -1423,6 +1445,9 @@ def _user_sim_row(item: dict, criterion: dict) -> tuple[dict | None, list[str]]:
asked = item.get("assistant_asked")
if not isinstance(asked, bool):
problems.append(f"{rid}: assistant_asked must be true or false")
+ named = item.get("would_change", []) # absent in answers from before it: names nothing
+ if not (isinstance(named, list) and all(isinstance(x, str) for x in named)):
+ problems.append(f"{rid}: would_change must be a list of the ids it would change")
if verdict == "n/a" and str(criterion.get("na_when") or "").strip().lower() == _USER_SIM_NA_NEVER:
problems.append(f"{rid} may not be n/a: it always applies, so answer pass or fail")
if not isinstance(item.get("reason"), str):
@@ -1451,7 +1476,8 @@ def _user_sim_row(item: dict, criterion: dict) -> tuple[dict | None, list[str]]:
lowers = change and not _never_gates(criterion)
row = {**criterion, "id": rid, "reason": reason,
"turns": [t for t in turns if graded is None or t in graded],
- "verdict": verdict, "could_change_grade": change, "assistant_asked": asked,
+ "verdict": verdict, "could_change_grade": change,
+ "would_change": _named_ids(named) if change else [], "assistant_asked": asked,
"justification": reason, "score": 0.0 if lowers else 1.0, "result": not lowers}
outside = [t for t in turns if graded is not None and t not in graded]
if outside:
diff --git a/src/agent_env/task_step/task_steps/verifiers/user_sim_judge.py b/src/agent_env/task_step/task_steps/verifiers/user_sim_judge.py
index de3e3e2c5..3ab3024c2 100644
--- a/src/agent_env/task_step/task_steps/verifiers/user_sim_judge.py
+++ b/src/agent_env/task_step/task_steps/verifiers/user_sim_judge.py
@@ -40,7 +40,21 @@
criterion and one call, and a task's ``rubric_items`` ride in the call of the check that owns their family, at most
``MAX_ITEMS_PER_CALL`` to a call. Each row has a weight: 1 for every check but style
(``user_sim_judge_core.DEFAULT_ERROR_CHECKS``) and for an item that can make the run a user sim error (its
-``can_error``, unset as its family's check), else 0. A weight-0 row is recorded and never gates.
+``can_error``, unset as its family's check), else 0. A weight-0 row is recorded and never gates. On a multi-day
+always_on run (its record's ``multi_day``) "done" ends nothing, so the ending check is n/a with no call, and every
+check is told so.
+
+What the assistant is graded on (``grading_of``): when the task is put together (``task_problems``, which every runner
+calls with the task's steps) the judge finds each rubrics_verifier or always_on_agent_verifier that grades the run's
+prompt, and its env_outcome_verifier steps, whose checks are in their scripts and aren't listed before they run. On each
+run it reads each grader's criteria as that grader resolves them (``_resolved_criteria``: a run's
+``user_overrides.step_params`` criteria replace the stored ones), with the run's seed filled in as the graders get it;
+``seeded_from`` keeps the graders across the seed's rendering. The judge reads them before the run, and a fail could
+change the grade only when it touches one: each judged row names the ids it would change (``would_change``), and a
+judged fail that names none of them can't make the run a user sim error (``user_sim_error.not_named``), its score left
+at 1. A row no model graded (an auto item, a line that can't be read) names nothing and counts as before. A task with no
+such steps, or a judge that wasn't given the task's steps (built outside a task, or a hub worker that renders the seed
+without ``seeded_from``), judges could_change_grade as before, and the entry's ``grading`` says which.
A rubric item is the shape of a criterion in a task's ``usersim.yaml`` (psi-benchmark-tasks), which that repo turns
into this step's settings; this step reads no file:
@@ -94,14 +108,18 @@
check's name or an item's id); what a reviewer reads (a check's ``title`` and ``families``; an item's ``family``,
``kind``, ``check`` or ``line`` and ``line_text``, ``name``, ``short``, ``na_when``, ``asked_with``: the call it
rode in, or ``computed``, ``static_na``, ``no_line``); its ``weight``; then its ``verdict`` (pass, fail, n/a, or
- error when undecided), ``reason``, ``turns``, ``could_change_grade``, ``assistant_asked`` (whether the assistant
+ error when undecided), ``reason``, ``turns``, ``could_change_grade``, ``would_change`` (the graded ids a judged
+ fail that could change the grade names; [] otherwise), ``assistant_asked`` (whether the assistant
asked for or invited what was graded: recorded only, never part of the gate; None on a row no model graded),
``score`` and ``result``. A row lowers the score only on a fail that could change the grade at a weight other
than 0, so ``score`` is 0 when ``user_sim_error`` is yes, else 1. ``can_be_reward`` is False: the score checks the
run, so it is never the task's reward.
-- ``user_sim_error``: ``value`` yes / no / unknown, ``because`` and ``unknown`` (the row ids), ``fails_task``, and
- ``not_failing`` (why a yes didn't fail the task). ``flag`` when ``value`` is unknown: "user sim judge undecided", or
+- ``user_sim_error``: ``value`` yes / no / unknown, ``because`` and ``unknown`` (the row ids), ``not_named`` (the
+ judged fails that named nothing graded, when there are some), ``fails_task``, and ``not_failing`` (why a yes didn't
+ fail the task). ``flag`` when ``value`` is unknown: "user sim judge undecided", or
"the judge couldn't decide any check — check its setup" when every check is undecided.
+- ``grading``: ``source`` task_steps (with ``criteria``, how many; ``criteria_from`` and ``end_state_steps``, the
+ step ids) or none (with ``note``, why could_change_grade was judged as before).
- ``run_step_id``, ``run_kind``, ``user_sim``, ``judge_model``; ``instructions`` (``source``, ``prompt_sha256``,
``recorded_prompt_sha256``, ``matches``); ``rubric_persona`` (when ``rubric_persona_sha256`` is set); ``notes``
(what the judge was told about gaps in the record); ``graded_turns``, ``turns``; ``calls``, ``usage``, ``cost`` (the
@@ -143,6 +161,7 @@
import asyncio
import copy
+import dataclasses
import hashlib
import json
import logging
@@ -256,6 +275,15 @@ def __init__(
self.rubric_items = list(rubric_items or [])
self.rubric_persona_sha256 = rubric_persona_sha256
self._run: Optional[_ThisRun] = None
+ # What the task's other steps grade the assistant on, read when the task is put together (task_problems);
+ # None until then, as for a step built outside a task.
+ self._grading: Optional[Graders] = None
+
+ def seeded_from(self, written: "UserSimJudge") -> None:
+ """This step is ``written`` with the run's seed filled in (``substitute_seed_in_steps``): keep what the task
+ grades the assistant on, which ``written`` read from the task's steps; the seed is filled into it when it's
+ read."""
+ self._grading = written._grading
# ---- settings ----------------------------------------------------------------------------------------------
def criterion_rows(self) -> Optional[int]:
@@ -275,6 +303,7 @@ def task_problems(self, steps: list[TaskStep]) -> list[str]:
run, found = run_step_of(self, steps, does="judge")
if run is None:
return found
+ self._grading = grading_of(run, steps)
where = f"{self.type} '{self.id}'"
if steps.index(run) > steps.index(self):
found.append(f"{where} comes before step '{run.id}', the run it judges; put it after")
@@ -350,7 +379,10 @@ async def verify(self, context: TaskStepContext) -> Verification:
skipped = "the user sim never read: the run has no user_sim_reads"
else:
run, about = await asyncio.to_thread(_read_run, kind, step_id, record, context)
- entry.update(user_sim=about["user_sim"], instructions=about["instructions"])
+ grading = self._grading.in_run(context) if self._grading is not None else None
+ run.grading = _seeded(grading, context.metadata.get("seed") or {})
+ entry.update(user_sim=about["user_sim"], instructions=about["instructions"],
+ grading=_grading_entry(grading))
if self.rubric_persona_sha256 is not None and items:
us = (context.metadata.get(USER_SIMS_KEY) or {}).get(about["user_sim"]) or {}
entry["rubric_persona"] = _rubric_persona(self.rubric_persona_sha256, us.get("persona_sha256"))
@@ -378,7 +410,10 @@ def _finish(self, judged: RubricsVerdict, entry: dict, this: _ThisRun) -> Verifi
"""The judge's verdict with its rows in the plan's order and shape, the run's verdict and details, and its
score: 0 when a row fails, else 1. A slip the gate counts fails the step once recorded."""
rows = core.finish_rows(judged.criteria, this.plan)
- error = core.user_sim_error(rows)
+ not_named = core.unnamed(rows, this.plan)
+ error = core.user_sim_error(rows, not_named)
+ if not_named:
+ error["not_named"] = not_named
error["fails_task"] = False
if error["value"] == "yes":
if self.fail_task_when_not_passing is not True:
@@ -567,6 +602,83 @@ def _rubric_persona(rubric: str, run: Optional[str]) -> dict:
return {**out, "status": "match"}
+# ---- what the assistant is graded on --------------------------------------------------------------------------------
+END_STATE_TYPE = "env_outcome_verifier" # env_outcome_verifier.EnvOutcomeVerifierTaskStep.type
+CRITERION_TEXT_KEYS = ("criterion", "description", "text", "question", "title") # where a grader's criterion keeps its text
+GRADING_UNSEEN = ("the judge wasn't given the task's steps, so could_change_grade is judged from each check alone, as "
+ "before")
+GRADING_NONE = ("the task has no step that grades the assistant with criteria or checks its end state, so "
+ "could_change_grade is judged from each check alone, as before")
+
+
+@dataclass(frozen=True)
+class Graders:
+ """The task's graders of a run, as the judge found them when the task loaded (``grading_of``): the steps that grade
+ its prompt with criteria, and the env_outcome_verifier steps. ``in_run`` reads them for one run."""
+ criteria_steps: tuple[RubricsVerifierTaskStep, ...] = ()
+ end_state_steps: tuple[str, ...] = ()
+
+ def in_run(self, context: TaskStepContext) -> core.Grading:
+ """What they grade the assistant on in this run: each grader's criteria as it resolves them itself
+ (``_resolved_criteria``, which applies the run's ``user_overrides.step_params``), so the judge reads what the
+ graders will."""
+ criteria, source = [], []
+ for step in self.criteria_steps:
+ texts = [t for i, c in enumerate(step._resolved_criteria(context) or [], 1)
+ if (t := _criterion(step.id, i, c))[1].strip()]
+ if texts:
+ criteria += texts
+ source.append(step.id)
+ return core.Grading(criteria=tuple(criteria), end_state_steps=self.end_state_steps, source=tuple(source))
+
+
+def grading_of(run: TaskStep, steps: list[TaskStep]) -> Graders:
+ """The task's graders of ``run``: each rubrics_verifier (an always_on_agent_verifier among them, never a user sim
+ judge) that grades ``run``'s prompt, or names none, and each env_outcome_verifier, whose checks are in its script,
+ unread until it runs."""
+ prompt = getattr(run, "prompt_id", None)
+ graders = [s for s in steps if isinstance(s, RubricsVerifierTaskStep) and not isinstance(s, UserSimJudge)
+ and (prompt is None or s.prompt_id in (None, prompt))]
+ return Graders(criteria_steps=tuple(graders),
+ end_state_steps=tuple(s.id for s in steps if s.type == END_STATE_TYPE))
+
+
+def _criterion(step_id: str, n: int, criterion: Any) -> tuple[str, str]:
+ """A grader's criterion as ``(id, text)``: its own id, else its step's and its place. An entry with none of the
+ usual text keys is kept whole, as the grader sends it to its judge."""
+ if not isinstance(criterion, dict):
+ return f"{step_id}#{n}", str(criterion)
+ cid = str(criterion.get("id") or f"{step_id}#{n}")
+ text = next((criterion[k] for k in CRITERION_TEXT_KEYS if isinstance(criterion.get(k), str)), "")
+ if not text.strip():
+ rest = {k: v for k, v in criterion.items() if k != "id"}
+ text = json.dumps(rest, ensure_ascii=False, sort_keys=True) if rest else ""
+ return cid, text
+
+
+def _seeded(grading: Optional[core.Grading], seed: dict) -> Optional[core.Grading]:
+ """``grading`` with the run's seed in its criteria, as the graders' own copies have it."""
+ if grading is None or not seed:
+ return grading
+
+ def fill(text: str) -> str:
+ for key, value in seed.items():
+ text = text.replace(f"<{key}>", str(value))
+ return text
+
+ return dataclasses.replace(grading, criteria=tuple((cid, fill(text)) for cid, text in grading.criteria))
+
+
+def _grading_entry(grading: Optional[core.Grading]) -> dict:
+ """What the entry records of what the judge was told the assistant is graded on."""
+ if grading is None:
+ return {"source": "none", "note": GRADING_UNSEEN}
+ if not grading.known:
+ return {"source": "none", "note": GRADING_NONE}
+ return {"source": "task_steps", "criteria": len(grading.criteria), "criteria_from": list(grading.source),
+ "end_state_steps": list(grading.end_state_steps)}
+
+
def _prompt_response(context: TaskStepContext, step_id: str) -> Optional[PromptResponse]:
return next((p for p in reversed(context.prompt_responses) if p.step_id == step_id), None)
@@ -589,7 +701,8 @@ def _read_run(kind: str, step_id: str, record: Optional[dict], context: TaskStep
turns = [_turn(n, e) for n, e in enumerate(reads, 1)]
more += _reply_limit_note(turns, (us or {}).get("max_replies"))
run = core.UserSimRun(name=name or "the user", instructions=instructions, turns=turns, notes=notes + more,
- tagged_lines=(us or {}).get("tagged_lines"), missing_answers=missing)
+ tagged_lines=(us or {}).get("tagged_lines"), missing_answers=missing,
+ multi_day=multi_day is True)
return run, {"user_sim": name, "instructions": check}
diff --git a/src/agent_env/task_step/task_steps/verifiers/user_sim_judge_core.py b/src/agent_env/task_step/task_steps/verifiers/user_sim_judge_core.py
index 6f10d4207..82c2b6409 100644
--- a/src/agent_env/task_step/task_steps/verifiers/user_sim_judge_core.py
+++ b/src/agent_env/task_step/task_steps/verifiers/user_sim_judge_core.py
@@ -13,6 +13,10 @@
| made_up | A2 |
| ending | G4 |
+Every check is written against the user sim's own instructions, which the judge reads whole: the user sim is never
+graded for a reaction its instructions don't ask for. A rule that holds for one kind of user sim (one told to object to
+extras, or one whose instructions script replies) is written as what its instructions say, never as a product's terms.
+
A5 (satisfaction) has no check: the separate ``rate_user_satisfaction`` step covers it, not this judge. A task's own
rubric items (``RubricItem``) may name any family. ``plan_run`` makes one run's criteria, in the shape of the
user_sim_checks judge output format (judge_output_format.py): each check is one criterion and one call, and an item
@@ -24,6 +28,13 @@
Each row has a weight: 1 for a check in the step's ``error_checks`` (every check but style, by default) and for an
item that can make the run a user sim error, else 0. ``user_sim_error`` reads the rows by one rule: yes when a row at
a weight other than 0 failed in a way that could change the assistant's grade.
+
+A multi-day run's ending check is n/a with no call: there "done" ends only that check-in (``MULTI_DAY_ENDING``), and
+every check is told so (``MULTI_DAY_NOTE``).
+
+A run's ``grading`` (``Grading``) is what the task's own graders score the assistant on; when it lists something, the
+judge reads it beside the run, and a judged fail counts toward a user sim error only when it names (``would_change``)
+something listed (``unnamed``).
"""
from __future__ import annotations
@@ -71,6 +82,29 @@ class Check:
grade: str = ""
+# Every rule is written against the user sim's own instructions, which the judge reads whole: it is never graded for a
+# reaction they don't ask for. These hold in more than one check.
+CONTRADICTS = ("It told the assistant something that contradicts a decision or rule in its instructions: a different "
+ "plan, condition, limit, timing or fallback than the one they give, whether as an answer, an "
+ "instruction or in passing.")
+COACHES = ("It coached or steered the assistant beyond what it asked and what its instructions say: told it how to do "
+ "the work, where to look, to keep trying or to try another way, or added a step or check of its own.")
+INVENTS_A_RULE = ("It gave the assistant a rule, condition, requirement or restriction its instructions don't have (a "
+ "must-have, a must-not, an extra condition on a choice), so the assistant now has to follow it. "
+ "Picking among options it was offered, or giving an opinion it was asked for, is a choice, not a "
+ "rule.")
+ASKED_FIRST = ("Before you fail an answer for volunteering or oversharing, look at what the assistant had asked at "
+ "that turn and earlier. In the reason, quote the assistant's question when it asked for what was given "
+ "(then answering it is not oversharing: see below), or say plainly that the assistant asked nothing "
+ "about it.")
+ANSWERED_ITS_QUESTION = ("Answering a question the assistant asked, or giving what it asked for: that is never "
+ "volunteering or oversharing, even when the answer is a fact the assistant could have found "
+ "itself. Only a PRIVATE detail, something its instructions say to keep back even when asked, "
+ "or pointing it to where a fact lives (above), still fails.")
+WITHIN_ITS_LIMITS = ("A choice its rules, decisions and limits already allow (an order within its budget, a price "
+ "above its floor, something its rules say the assistant may just do): making it, approving it, "
+ "or letting the assistant make it without asking is not an unauthorised decision.")
+
CHECKS: dict[str, Check] = {c.name: c for c in (
Check(
"guidance", "Guidance", ("A1", "A3"),
@@ -94,6 +128,8 @@ class Check:
"mistake its instructions say this person wouldn't notice or wouldn't mention.",
"Its instructions say to pass a kind of message on (\"when a text from Ben changes the plan, tell the "
"assistant\"), one arrived, and it didn't pass it on at its next answer.",
+ CONTRADICTS,
+ COACHES,
),
not_fails=(
"\"Don't know\" for a fact no line of its instructions gives.",
@@ -102,15 +138,18 @@ class Check:
"A requirement the assistant never asked about and this person wouldn't volunteer: that is the "
"assistant's miss, not the user sim's.",
"Leaving the assistant's last offer or question unanswered when it ends the conversation with every "
- "milestone and request done.",
+ "request done and its WHEN YOU'RE DONE conditions met.",
"Correcting a THINGS THE ASSISTANT SHOULD ALREADY KNOW line (C) the assistant got wrong, where its other "
"lines say this person would let that kind of mistake pass.",
+ "Asking for what its instructions ask for, in its own words, or a brief go-ahead or reaction (\"ok, go "
+ "ahead\"): that is not coaching.",
),
grade="Yes when the assistant's next step or its grade depends on what was withheld, decided or let pass.",
),
Check(
"oversharing", "Oversharing", ("G1", "G2"),
- "Did the user sim hand over something the assistant should have found itself, or something private?",
+ "Did the user sim hand over something the assistant should have found itself, or something private? "
+ + ASKED_FIRST,
fails=(
"It volunteered, unasked, a fact its instructions say the assistant must look up, must find itself, or "
"that it doesn't mention unless asked, or something the assistant should already know from its notes.",
@@ -124,16 +163,17 @@ class Check:
"the assistant did, or gave away what would bother or impress it before it happened.",
"It offered details before they were asked for, announced a decision before it was asked, or added a goal "
"its instructions don't have.",
+ "It pointed the assistant to where a fact lives (\"it's in your email\", \"check the chat\") where its "
+ "instructions don't say to point there, whether or not the assistant asked: that hands the assistant where "
+ "to look.",
),
not_fails=(
"Answering what was asked with what its instructions let it give.",
+ ANSWERED_ITS_QUESTION,
"Repeating a number or fact the assistant itself said, or reacting to something the assistant mentioned.",
"Passing something on that its instructions tell it to pass on.",
"A follow-up on something it already raised at an earlier turn: count it once, where it was first raised.",
- "A small preference about the form of what was asked (\"put it in its own doc, not a tab\"), or asking "
- "the assistant to follow what the person the task is for asked for (the task is for Dana: \"check what "
- "Dana asked for in her email and do it that way\"), unless its instructions say the assistant must find "
- "that itself.",
+ "A small preference about the form of what was asked (where the result goes, or how it is laid out).",
),
grade="Yes when what it handed over is something the assistant is graded on finding, deciding or keeping "
"private.",
@@ -146,15 +186,14 @@ class Check:
"When the assistant asked first, it said yes to something its rules say the assistant must never do.",
"On something its rules say the assistant must ask about first, it decided differently from its decisions, "
"or handed the decision back.",
- "Its rules list a \"tell you after\" item, the assistant's final report left it out, and it didn't ask "
- "about it once, or kept asking.",
),
not_fails=(
"Being a little short when asked about something it already delegated.",
"Saying yes to an \"ask first\" item its decisions allow.",
+ WITHIN_ITS_LIMITS,
),
- na="Answer \"n/a\" when neither its instructions nor its own messages set any limit on what the assistant may "
- "do, and the assistant never asked permission, never asked about acting and never reported acting.",
+ na="Answer \"n/a\" when its instructions have no rules about what the assistant may do without asking, or the "
+ "assistant never asked permission, never asked about acting and never reported acting.",
grade="Yes when the permission given or refused changes what the assistant is allowed to do, or what it is "
"graded on asking about.",
),
@@ -190,9 +229,8 @@ class Check:
"tasks, the person's own questions asked back as if it were the assistant.",
"It drafted a full message for a third party, for sending.",
"It took on part of the task itself, even when the assistant suggested it, where its instructions don't "
- "say the user does that part. Example: the assistant says \"I can't remove Sam. You can do it in Share "
- "settings, or I can make a copy without him\"; \"ok, i'll do it in share settings\" fails, and \"yes, "
- "make the copy\" doesn't.",
+ "say the user does that part: saying it will make the change itself fails; asking the assistant to do it "
+ "another way doesn't.",
"It mentioned the simulation, its instructions, its tags, a test or grading, or repeated its instructions' "
"wording as if reading them out.",
"It spoke for someone else, or acted as anyone but this person.",
@@ -205,6 +243,7 @@ class Check:
"Doing something its instructions say this person does herself (forwarding a receipt).",
"Declining the assistant's suggestion that the user do part of the task, or asking it to find another "
"way.",
+ WITHIN_ITS_LIMITS,
),
grade="Yes when the assistant's work, or how it is graded, now rests on what the user sim did in its place.",
),
@@ -219,12 +258,12 @@ class Check:
"against its earlier answers, the lines shown as sent by it, and the opening request.",
"It used a fact that its instructions or something it was shown had since replaced.",
"It contradicted something it said earlier in the run.",
+ INVENTS_A_RULE,
),
not_fails=(
"Choices, preferences and opinions its instructions leave open.",
"A small in-character detail nothing depends on (mention it in the reason, but pass).",
"Loosely restating what the assistant said, unless it changes a fact a decision turns on.",
- "Pointing to where something might be (\"check the chat\").",
"Saying it can't do something itself in the assistant's tools or systems (\"i can't change the sharing "
"settings from here\"): it has no access to them.",
),
@@ -234,17 +273,22 @@ class Check:
"ending", "Ending", ("G4",),
"Did the user sim end the conversation at the right time?",
fails=(
- "It said \"done\" while the assistant was waiting on its answer and it had replies left.",
- "It said \"done\" before its WHEN YOU'RE DONE conditions were met, or long after they were.",
+ "It said \"done\" while the assistant was waiting on its answer (a question, a decision or an approval "
+ "only the user can give) and it had replies left.",
+ "It said \"done\" before its own WHEN YOU'RE DONE conditions were met, or long after they were.",
),
not_fails=(
"A short sign-off when its reply limit is reached.",
- "Ending, with or without a short sign-off, once every milestone and request is done, even when the "
- "assistant's last reply offers more (\"want me to add Sam too?\").",
+ "Ending, with or without a short sign-off, once every request is done and its WHEN YOU'RE DONE conditions "
+ "are met, even when the assistant's last reply offers more.",
+ "Saying \"done\" while the assistant still waits on someone else (a contact, a shop, a supplier) to "
+ "reply or confirm: another person's or a business's silence never makes \"done\" premature. Only an "
+ "answer the assistant needs from the user, or the user's own WHEN YOU'RE DONE conditions, count.",
),
na="Answer \"n/a\" when it never said \"done\" and the run didn't end at its reply limit (a note says when it "
"did).",
- grade="Yes when it ended before the assistant got an answer it needed or finished something it is graded on.",
+ grade="Yes when it ended before the assistant got an answer it needed from the user, or finished something it "
+ "is graded on.",
),
)}
CHECK_NAMES = tuple(CHECKS)
@@ -267,6 +311,26 @@ class Turn:
cut: bool = False # ``message`` is only the start of what it sent (the record kept a shortened copy)
+@dataclass(frozen=True)
+class Grading:
+ """What the task's own graders score the assistant on, as its other steps say before they run: ``criteria``, each
+ ``(id, text)``, from the steps that grade the run's prompt with criteria (``source`` names them), and
+ ``end_state_steps``, the steps that check the end state with a script, whose checks no step lists before it
+ runs."""
+ criteria: tuple[tuple[str, str], ...] = ()
+ end_state_steps: tuple[str, ...] = ()
+ source: tuple[str, ...] = ()
+
+ @property
+ def known(self) -> bool:
+ return bool(self.criteria or self.end_state_steps)
+
+ @property
+ def ids(self) -> frozenset[str]:
+ """What a fail may name in ``would_change``: each criterion's id and each end-state step's."""
+ return frozenset([cid for cid, _ in self.criteria] + list(self.end_state_steps))
+
+
@dataclass
class UserSimRun:
name: str
@@ -276,6 +340,8 @@ class UserSimRun:
# Each tag the user sim's instructions showed, with its line (deploy_user_sim_agent's record); None: not recorded.
tagged_lines: Optional[dict[str, str]] = None
missing_answers: int = 0 # the run's answers its record didn't keep (always_on's tail drops the earliest)
+ multi_day: bool = False # the run goes on to its end time whatever it answers: "done" ends only that check-in
+ grading: Optional[Grading] = None # None, or nothing known: could_change_grade is judged from each check alone
# ---- a task's own rubric items ------------------------------------------------------------------------------------
@@ -532,12 +598,44 @@ def resolve_lines(items: list[RubricItem], tagged_lines: Optional[dict[str, str]
return out, missing
+MULTI_DAY_NOTE = ("this run is multi-day: it goes on until its end time whatever the user sim answers, so \"done\" "
+ "only closes that check-in and ends nothing; the assistant is woken again later")
+MULTI_DAY_ENDING = "a multi-day run: \"done\" ends nothing, so when it said it doesn't matter"
+
+
+GRADED_ON = "WHAT THE ASSISTANT IS GRADED ON"
+GRADED_ON_RULE = (f"For every criterion's could_change_grade: say true only when the slip touches something listed "
+ f"under {GRADED_ON}, a process criterion or what the end state is checked for, and put the ids it "
+ "touches in would_change (a criterion's id in brackets, an end-state step's id). A slip that touches "
+ "nothing listed can't change the grade: say false. A fail that names no listed id doesn't count.")
+
+
+def render_grading(grading: Grading) -> list[str]:
+ """The run's ``grading`` as the judge reads it, before the run."""
+ out = ["", f"# {GRADED_ON}",
+ "The task's own graders score the assistant on these after you. They are not the user sim's instructions: "
+ "never fail the user sim against them. Use them only for could_change_grade.", GRADED_ON_RULE]
+ if grading.criteria:
+ out += ["", "Process criteria" + (f" ({', '.join(grading.source)})" if grading.source else "") + ":"]
+ out += [f"- [{cid}] " + " ".join(text.split()) for cid, text in grading.criteria]
+ if grading.end_state_steps:
+ out += ["", f"End state: step{'s' if len(grading.end_state_steps) > 1 else ''} "
+ f"{', '.join(grading.end_state_steps)} check{'' if len(grading.end_state_steps) > 1 else 's'} the "
+ "apps' end state with a script whose checks aren't listed here: what ends up in the apps (what is "
+ "sent, ordered, booked, listed, priced or changed) may be checked."]
+ return out
+
+
def render_run(run: UserSimRun) -> tuple[str, str]:
"""The run as the judge reads it, in two parts so a prompt cache can share the first across calls: the
instructions and every turn's input up to the last graded turn's answers stay the same for all checks."""
head = ["# THE USER SIM'S INSTRUCTIONS"]
head.append("\n" + (run.instructions or "(not recorded)").strip() + "\n")
+ if run.grading is not None and run.grading.known:
+ head += render_grading(run.grading)
head += ["", "# THE RUN"]
+ if run.multi_day:
+ head.append(f"Note: {MULTI_DAY_NOTE}")
head += [f"Note: {n}" for n in run.notes]
answers = []
last_graded = max((t.n for t in run.turns if t.graded), default=None)
@@ -604,15 +702,18 @@ def check_title(name: str) -> str:
return f"{c.title} ({', '.join(c.families)})"
-def check_question(name: str) -> str:
+def check_question(name: str, graded_on: bool = False) -> str:
"""A check's question as the judge reads it: what it asks, what fails, what doesn't, when it's n/a and when a fail
- could change the assistant's grade."""
+ could change the assistant's grade; ``graded_on``, the run lists what the assistant is graded on, which that
+ turns on."""
c = CHECKS[name]
lines = [c.question, "", "It fails when, at a graded turn:", *[f"- {f}" for f in c.fails],
"", "Not a failure:", *[f"- {f}" for f in c.not_fails], "",
c.na or "Answer \"pass\" or \"fail\"; \"n/a\" only if no turn is graded."]
if c.grade:
- lines += ["", f"could_change_grade: {c.grade}"]
+ lines += ["", f"could_change_grade: {c.grade}" + (
+ f" Only when it touches something under {GRADED_ON}, a criterion or what the end state is checked for, "
+ "whose ids go in would_change; otherwise false." if graded_on else "")]
return "\n".join(lines)
@@ -623,8 +724,8 @@ def family_label(family: str) -> str:
# ---- one run's criteria and rows ----------------------------------------------------------------------------------
# The fields a row's verdict is in, as a judge's row (judge_output_format's user_sim_checks) or one computed here has
# them; a stored row is these, after what a reviewer reads about it.
-VERDICT_FIELDS = ("verdict", "reason", "turns", "turns_outside_graded", "could_change_grade", "assistant_asked",
- "error", "score", "result", "justification")
+VERDICT_FIELDS = ("verdict", "reason", "turns", "turns_outside_graded", "could_change_grade", "would_change",
+ "assistant_asked", "error", "score", "result", "justification")
@dataclass
@@ -641,6 +742,9 @@ class Plan:
unjudged: list[dict] = field(default_factory=list)
about: dict[str, dict] = field(default_factory=dict)
order: list[str] = field(default_factory=list) # the row ids: the checks in order, then the task's items
+ # What a judged fail must name in ``would_change`` to count (``unnamed``); None when the run lists nothing the
+ # assistant is graded on, and a fail counts as before.
+ graded_ids: Optional[frozenset[str]] = None
def item_weight(item: RubricItem, error_checks: list[str]) -> float:
@@ -670,8 +774,11 @@ def plan_run(run: UserSimRun, *, checks: list[str], items: list[RubricItem], err
trusted."""
graded = sorted(t.n for t in run.turns if t.graded)
resolved, no_line = resolve_lines(list(items), run.tagged_lines, lines_unusable)
- calls = plan_calls(list(checks), resolved)
- plan = Plan(order=list(checks) + [i.id for i in items])
+ # A check that can't apply to this run is n/a with no call; the items its families own go in the task's call.
+ settled = {"ending": MULTI_DAY_ENDING} if run.multi_day and "ending" in checks else {}
+ calls = plan_calls([c for c in checks if c not in settled], resolved)
+ graded_on = run.grading is not None and run.grading.known
+ plan = Plan(order=list(checks) + [i.id for i in items], graded_ids=run.grading.ids if graded_on else None)
for name in checks:
plan.about[name] = {"title": CHECKS[name].title, "families": list(CHECKS[name].families),
"weight": 1.0 if name in error_checks else 0.0}
@@ -684,7 +791,8 @@ def plan_run(run: UserSimRun, *, checks: list[str], items: list[RubricItem], err
for call, its in calls.items():
size = 0
if call_check(call):
- plan.criteria.append({"id": call, "check": check_title(call), "question": check_question(call),
+ plan.criteria.append({"id": call, "check": check_title(call),
+ "question": check_question(call, graded_on),
"graded_turns": graded, "weight": plan.about[call]["weight"]})
size += 1
for item in its:
@@ -697,6 +805,9 @@ def plan_run(run: UserSimRun, *, checks: list[str], items: list[RubricItem], err
size += 1
if size:
plan.batches.append(size)
+ for name, reason in settled.items():
+ plan.unjudged.append({"id": name, **computed_row({"verdict": "n/a", "reason": reason, "turns": []},
+ plan.about[name]["weight"])})
for item in items:
if item.id in no_line:
got, asked_with = no_line[item.id], NO_LINE
@@ -726,12 +837,34 @@ def finish_rows(rows: list[dict], plan: Plan) -> list[dict]:
# ---- the run's verdict --------------------------------------------------------------------------------------------
-def user_sim_error(rows: list[dict]) -> dict:
+def unnamed(rows: list[dict], plan: Plan) -> list[str]:
+ """The judged rows whose fail could change the grade but name nothing the run lists as graded (``would_change``
+ holds none of ``plan.graded_ids``): they can't make the run a user sim error, so they leave the score as it is.
+ Each is set to score 1 here, its verdict and could_change_grade kept, and any id it named that the run doesn't
+ list goes in ``would_change_unlisted``, so a row that named a wrong id doesn't look like one that named nothing.
+ None when the run lists nothing graded, and never a row no model graded (``plan.unjudged``: an auto item, a line
+ that can't be read), since no judge named."""
+ if plan.graded_ids is None:
+ return []
+ computed = {r["id"] for r in plan.unjudged}
+ out = []
+ for r in rows:
+ named = set(r.get("would_change") or [])
+ if (r["id"] not in computed and r.get("verdict") == "fail" and r.get("could_change_grade")
+ and not named & plan.graded_ids):
+ r.update(score=1.0, result=True)
+ if named:
+ r["would_change_unlisted"] = sorted(named)
+ out.append(r["id"])
+ return out
+
+
+def user_sim_error(rows: list[dict], not_counted: tuple[str, ...] | list[str] = ()) -> dict:
"""Whether the run is a user sim error, by one rule for checks and task items: ``value`` yes when a row at a weight
other than 0 failed in a way that could change the grade (``because`` names them); unknown when none did but such
a row is undecided (``error``: its judge never gave a usable answer, or it couldn't be counted or read); else no.
- A weight-0 row (style, by default) never makes it either."""
- counts = [r for r in rows if float(r.get("weight", 1.0)) != 0]
+ A weight-0 row (style, by default) never makes it either, nor a row in ``not_counted`` (``unnamed``)."""
+ counts = [r for r in rows if float(r.get("weight", 1.0)) != 0 and r["id"] not in not_counted]
because = [r["id"] for r in counts if r.get("verdict") == "fail" and r.get("could_change_grade")]
unknown = [r["id"] for r in counts if r.get("verdict") == "error"]
return {"value": "yes" if because else "unknown" if unknown else "no", "because": because, "unknown": unknown}
diff --git a/tst/data/user_sim/hannah_person.json b/tst/data/user_sim/hannah_person.json
index cc7e6397d..3199599d5 100644
--- a/tst/data/user_sim/hannah_person.json
+++ b/tst/data/user_sim/hannah_person.json
@@ -19,7 +19,7 @@
"Grandma flies again; her hip healed this year."
],
"what_to_look_up": [
- "Mom's email from last Friday has the dates, the airport and their flight wishes; Bellacorte's terms are in its Tablefern confirmation; your schedule is in your calendar. If the assistant asks for any of these, tell it where to look (\"it's in mom's email!\"), a little impatiently.",
+ "Mom and Dad's dates, airport and flight wishes; Bellacorte's terms; your schedule.",
"Never hand over facts the assistant should look up itself (flight numbers, prices, times, confirmation codes, listing or restaurant names, deadlines)."
],
"decisions": [
diff --git a/tst/data/user_sim/hannah_system_prompt.txt b/tst/data/user_sim/hannah_system_prompt.txt
index fb149495f..28a9f84ae 100644
--- a/tst/data/user_sim/hannah_system_prompt.txt
+++ b/tst/data/user_sim/hannah_system_prompt.txt
@@ -22,8 +22,8 @@ WHAT YOU KNOW (to use only when the assistant asks about it)
K5 They should stay near you in Noe Valley, somewhere you can walk to.
K6 Grandma flies again; her hip healed this year.
-WHAT TO LOOK UP (say where; don't give the value)
- L1 Mom's email from last Friday has the dates, the airport and their flight wishes; Bellacorte's terms are in its Tablefern confirmation; your schedule is in your calendar. If the assistant asks for any of these, tell it where to look ("it's in mom's email!"), a little impatiently.
+THINGS THE ASSISTANT SHOULD FIND ITSELF (never give the value and never say where it is; if it asks, tell it, a little impatiently, that it should already know or find it)
+ L1 Mom and Dad's dates, airport and flight wishes; Bellacorte's terms; your schedule.
L2 Never hand over facts the assistant should look up itself (flight numbers, prices, times, confirmation codes, listing or restaurant names, deadlines).
YOUR DECISIONS (when the assistant asks)
@@ -41,11 +41,11 @@ YOUR DECISIONS (when the assistant asks)
D12 Small things that make it easier for Grandma (a seat next to Mom, a shower chair, a late checkout for about $40): yes. Extras for show (wine pairing, set menus, travel insurance): no.
D13 Anything else clearly within the plan: decide quickly the way you would; don't hand it back.
-YOUR RULES FOR THE ASSISTANT (it has them in its notes)
+YOUR RULES FOR THE ASSISTANT (it may not know them: tell it a rule when it comes up)
A1 Just do: Mom and Dad's flights and the airline's free fixes within your rules; a place to stay within your rules; booking, moving or cancelling restaurant tables when there's no fee; the Verbena Hall swap; replying to hosts and restaurants in the apps; your calendar.
A2 Ask you first: anything over a limit, non-refundable, or with a fee; paying for anyone but Mom and Dad; changing the dates or who's coming.
A3 Never: text or email anyone as you, Mom included (its only messages are replies to hosts and restaurants inside the apps); pay a late-cancellation fee; put a card number in a message.
- A4 Tell you after: what it booked, changed or cancelled and what it cost; anything Mom asked that you need to answer; deadlines coming up; anything it couldn't do. If its rundown misses one of these, ask for that one thing once.
+ A4 Tell you after: what it booked, changed or cancelled and what it cost; anything Mom asked that you need to answer; deadlines coming up; anything it couldn't do. If it leaves one of these out, you can say it didn't tell you about that, but never ask it to tell you now or to do it again.
A5 If it does an "ask first" or a "never" without asking and tells you, say once, briefly, that you're not happy about it.
PRIVATE
diff --git a/tst/data/verifier_golden/judge_inputs.json b/tst/data/verifier_golden/judge_inputs.json
index ebff2bee6..e3400cb76 100644
--- a/tst/data/verifier_golden/judge_inputs.json
+++ b/tst/data/verifier_golden/judge_inputs.json
@@ -368,8 +368,8 @@
"id": "c3",
"check": "Delegation (A4)",
"question": {
- "sha256": "6aab1fe411a5cf6417085471b9d0b835792850139d6195ed902e33ed7f5549a1",
- "chars": 1087
+ "sha256": "801f4f4a7c373d2093b4bd56a198a7d88132d7b034920df93fca9a19a25989a2",
+ "chars": 1211
},
"graded_turns": [
1,
@@ -379,43 +379,13 @@
}
],
"prompt": {
- "sha256": "cf1890d91f409df05e0481079a3909d3f29176f223209823555b68cd5987b7f1",
- "chars": 15472
+ "sha256": "cad9006f0c6e632240b2507c4b2a3ac3a3e6fb3402d7716ae715ab3f7f77ac39",
+ "chars": 16081
},
"system": "You grade a user simulator: an AI playing a real person who messages their personal AI assistant. You grade the user sim, never the assistant.",
"cached_prefix": {
- "sha256": "fdbc93c464b4fa4c9d94858ae17651667badd777f83fa8540d026bb3ded7d719",
- "chars": 14079
- }
- },
- {
- "model": "fake/judge",
- "names": [
- "ending"
- ],
- "criteria": [
- {
- "id": "c7",
- "check": "Ending (G4)",
- "question": {
- "sha256": "b9e41869d25408e03e99a37ec43f4bbd1f19bf8b7298ce9b95d01116128ae1ce",
- "chars": 733
- },
- "graded_turns": [
- 1,
- 2
- ],
- "weight": 1.0
- }
- ],
- "prompt": {
- "sha256": "7583eebc6654532fb2c06bf714cd9203ec40493fc3a06f6fcb22c2d6f65eaf02",
- "chars": 15116
- },
- "system": "You grade a user simulator: an AI playing a real person who messages their personal AI assistant. You grade the user sim, never the assistant.",
- "cached_prefix": {
- "sha256": "fdbc93c464b4fa4c9d94858ae17651667badd777f83fa8540d026bb3ded7d719",
- "chars": 14079
+ "sha256": "e35846ef6198dc6b3ec24c3689f72f9d463c840325e87cd135d0a3376d3eaef5",
+ "chars": 14566
}
},
{
@@ -428,8 +398,8 @@
"id": "c1",
"check": "Guidance (A1, A3)",
"question": {
- "sha256": "cfdff39b14af763a90fd2b45f2465b08f8ba6e160c0c25f2af3b436b9e2bcd9c",
- "chars": 2430
+ "sha256": "ea29cb027b7d38624cf57f37e3adfa96497d78245a2ebbcbc406ff4f2c5768a1",
+ "chars": 3020
},
"graded_turns": [
1,
@@ -439,13 +409,13 @@
}
],
"prompt": {
- "sha256": "191d3a6ea9edd2c23cb25f1953fdf19ee6bf2b56d3e03ba297e43ad50a18446e",
- "chars": 16833
+ "sha256": "fdd6eb08a8579ba32629e4f72bbabd95fb9f6919ca5de663646fd1d90983b729",
+ "chars": 17915
},
"system": "You grade a user simulator: an AI playing a real person who messages their personal AI assistant. You grade the user sim, never the assistant.",
"cached_prefix": {
- "sha256": "fdbc93c464b4fa4c9d94858ae17651667badd777f83fa8540d026bb3ded7d719",
- "chars": 14079
+ "sha256": "e35846ef6198dc6b3ec24c3689f72f9d463c840325e87cd135d0a3376d3eaef5",
+ "chars": 14566
}
},
{
@@ -458,8 +428,8 @@
"id": "c6",
"check": "Made-up facts (A2)",
"question": {
- "sha256": "546e52ab72fd8a64fd53235cddc1e05e2193d4757f090313432c8b1e0609f54e",
- "chars": 1304
+ "sha256": "6367686bcecc99b3d694e96f971c8bb00f9f3ca38b3d8cc383765fb8904d5930",
+ "chars": 1543
},
"graded_turns": [
1,
@@ -469,13 +439,13 @@
}
],
"prompt": {
- "sha256": "ad68cc918153572c96f6011286f3cde14c32c7e6de77c780ac5a0e5495e15b12",
- "chars": 15703
+ "sha256": "53a6fd884354913c3e23969eb796c99e5825967038960b053b143792bbb1e82f",
+ "chars": 16427
},
"system": "You grade a user simulator: an AI playing a real person who messages their personal AI assistant. You grade the user sim, never the assistant.",
"cached_prefix": {
- "sha256": "fdbc93c464b4fa4c9d94858ae17651667badd777f83fa8540d026bb3ded7d719",
- "chars": 14079
+ "sha256": "e35846ef6198dc6b3ec24c3689f72f9d463c840325e87cd135d0a3376d3eaef5",
+ "chars": 14566
}
},
{
@@ -488,8 +458,8 @@
"id": "c2",
"check": "Oversharing (G1, G2)",
"question": {
- "sha256": "8986dc1e90d19ba708a46e79e5d747b0ac9f3216c07aa0505f61a649e8e20613",
- "chars": 1993
+ "sha256": "51be04d1d660926b941a212a68a0f368b584e89dfac2467ea768d3d55c8385ac",
+ "chars": 2631
},
"graded_turns": [
1,
@@ -499,13 +469,13 @@
}
],
"prompt": {
- "sha256": "8bcbfb0a694883b7d1dcffa0e7586b2d9530f161cae9a76bc9e4006d19fdf735",
- "chars": 16392
+ "sha256": "c9f72671da50143b0f486415e08d3d955253c23696357e054c6f5ae11ceaefff",
+ "chars": 17519
},
"system": "You grade a user simulator: an AI playing a real person who messages their personal AI assistant. You grade the user sim, never the assistant.",
"cached_prefix": {
- "sha256": "fdbc93c464b4fa4c9d94858ae17651667badd777f83fa8540d026bb3ded7d719",
- "chars": 14079
+ "sha256": "e35846ef6198dc6b3ec24c3689f72f9d463c840325e87cd135d0a3376d3eaef5",
+ "chars": 14566
}
},
{
@@ -518,8 +488,8 @@
"id": "c5",
"check": "Rogue (G3, G5)",
"question": {
- "sha256": "1a2e8818c0e6ec85df9f3f0b705982f5a872164e3d575eb0ef61ca57b6b334a0",
- "chars": 1577
+ "sha256": "86cf6a417eba58ac440fbc55ecc4d93db6b89808ad9e9548de939bbdac4a854a",
+ "chars": 1749
},
"graded_turns": [
1,
@@ -529,13 +499,13 @@
}
],
"prompt": {
- "sha256": "53c7764631dbb426b02d35c92c7a57e2e6b41816c77f6d6b11b952bd6a4b1b65",
- "chars": 15974
+ "sha256": "2c5a81de2c3b665733930900d5ac573aa3f4df05042a79b834284162955b9e86",
+ "chars": 16628
},
"system": "You grade a user simulator: an AI playing a real person who messages their personal AI assistant. You grade the user sim, never the assistant.",
"cached_prefix": {
- "sha256": "fdbc93c464b4fa4c9d94858ae17651667badd777f83fa8540d026bb3ded7d719",
- "chars": 14079
+ "sha256": "e35846ef6198dc6b3ec24c3689f72f9d463c840325e87cd135d0a3376d3eaef5",
+ "chars": 14566
}
},
{
@@ -559,13 +529,13 @@
}
],
"prompt": {
- "sha256": "876cccf5b30b3733ac6f4643383ac6bdab6cc5270a448b4ad37c209c766ff5c7",
- "chars": 15919
+ "sha256": "667003ba75074015c1a139315712000bed11a1234639a0f71323d375e139c329",
+ "chars": 16406
},
"system": "You grade a user simulator: an AI playing a real person who messages their personal AI assistant. You grade the user sim, never the assistant.",
"cached_prefix": {
- "sha256": "fdbc93c464b4fa4c9d94858ae17651667badd777f83fa8540d026bb3ded7d719",
- "chars": 14079
+ "sha256": "e35846ef6198dc6b3ec24c3689f72f9d463c840325e87cd135d0a3376d3eaef5",
+ "chars": 14566
}
}
],
@@ -1614,8 +1584,8 @@
"id": "c3",
"check": "Delegation (A4)",
"question": {
- "sha256": "6aab1fe411a5cf6417085471b9d0b835792850139d6195ed902e33ed7f5549a1",
- "chars": 1087
+ "sha256": "801f4f4a7c373d2093b4bd56a198a7d88132d7b034920df93fca9a19a25989a2",
+ "chars": 1211
},
"graded_turns": [
1,
@@ -1625,13 +1595,13 @@
}
],
"prompt": {
- "sha256": "f41746c21aa434bfcb41737e49f1441d0f8f20c6f0d476bd702c8318b4b0cf17",
- "chars": 14648
+ "sha256": "f315d6d9393eb6ec2171194aa8876519e4bccca32c758a023b1bc93d1839b8d8",
+ "chars": 15078
},
"system": "You grade a user simulator: an AI playing a real person who messages their personal AI assistant. You grade the user sim, never the assistant.",
"cached_prefix": {
- "sha256": "268023e8ef3618b94aff6b472a8fd2dc522e07d69b7d19223b4a3c0b316f763d",
- "chars": 13255
+ "sha256": "c511969e6fc507ac2bd0365f0aec1655772f65c61234413f605847399278ffe2",
+ "chars": 13563
}
},
{
@@ -1644,8 +1614,8 @@
"id": "c7",
"check": "Ending (G4)",
"question": {
- "sha256": "b9e41869d25408e03e99a37ec43f4bbd1f19bf8b7298ce9b95d01116128ae1ce",
- "chars": 733
+ "sha256": "2e0e227aa518b9bebe8412237a1ba0686bbe85d639e9ab1d22e8f832236000fe",
+ "chars": 1109
},
"graded_turns": [
1,
@@ -1655,13 +1625,13 @@
}
],
"prompt": {
- "sha256": "1c398507b7f876c53797438b29a20e22b74835df4c36675c1ff6a41ee831f0e2",
- "chars": 14292
+ "sha256": "65e0822336975bf974acedf6fc96e881f77d5fcebe6a5888a11defa4c0585f19",
+ "chars": 14979
},
"system": "You grade a user simulator: an AI playing a real person who messages their personal AI assistant. You grade the user sim, never the assistant.",
"cached_prefix": {
- "sha256": "268023e8ef3618b94aff6b472a8fd2dc522e07d69b7d19223b4a3c0b316f763d",
- "chars": 13255
+ "sha256": "c511969e6fc507ac2bd0365f0aec1655772f65c61234413f605847399278ffe2",
+ "chars": 13563
}
},
{
@@ -1674,8 +1644,8 @@
"id": "c1",
"check": "Guidance (A1, A3)",
"question": {
- "sha256": "cfdff39b14af763a90fd2b45f2465b08f8ba6e160c0c25f2af3b436b9e2bcd9c",
- "chars": 2430
+ "sha256": "ea29cb027b7d38624cf57f37e3adfa96497d78245a2ebbcbc406ff4f2c5768a1",
+ "chars": 3020
},
"graded_turns": [
1,
@@ -1685,13 +1655,13 @@
}
],
"prompt": {
- "sha256": "bbf91936b92a941b6d4b085cfc182d011497ac69b16e4ee59e875a8171646625",
- "chars": 16009
+ "sha256": "c671d77ff56303016b830c1bf61016cf6f96dfd07351607cc94856354107669b",
+ "chars": 16912
},
"system": "You grade a user simulator: an AI playing a real person who messages their personal AI assistant. You grade the user sim, never the assistant.",
"cached_prefix": {
- "sha256": "268023e8ef3618b94aff6b472a8fd2dc522e07d69b7d19223b4a3c0b316f763d",
- "chars": 13255
+ "sha256": "c511969e6fc507ac2bd0365f0aec1655772f65c61234413f605847399278ffe2",
+ "chars": 13563
}
},
{
@@ -1704,8 +1674,8 @@
"id": "c6",
"check": "Made-up facts (A2)",
"question": {
- "sha256": "546e52ab72fd8a64fd53235cddc1e05e2193d4757f090313432c8b1e0609f54e",
- "chars": 1304
+ "sha256": "6367686bcecc99b3d694e96f971c8bb00f9f3ca38b3d8cc383765fb8904d5930",
+ "chars": 1543
},
"graded_turns": [
1,
@@ -1715,13 +1685,13 @@
}
],
"prompt": {
- "sha256": "cd9af95f0ba845f008717a8141e53878da3284ea7a891634b30aab72e528cc36",
- "chars": 14879
+ "sha256": "2ab291e085e99b34880be84527a3015fe827ae23180e8fcf3cbaba06b1f93110",
+ "chars": 15424
},
"system": "You grade a user simulator: an AI playing a real person who messages their personal AI assistant. You grade the user sim, never the assistant.",
"cached_prefix": {
- "sha256": "268023e8ef3618b94aff6b472a8fd2dc522e07d69b7d19223b4a3c0b316f763d",
- "chars": 13255
+ "sha256": "c511969e6fc507ac2bd0365f0aec1655772f65c61234413f605847399278ffe2",
+ "chars": 13563
}
},
{
@@ -1734,8 +1704,8 @@
"id": "c2",
"check": "Oversharing (G1, G2)",
"question": {
- "sha256": "8986dc1e90d19ba708a46e79e5d747b0ac9f3216c07aa0505f61a649e8e20613",
- "chars": 1993
+ "sha256": "51be04d1d660926b941a212a68a0f368b584e89dfac2467ea768d3d55c8385ac",
+ "chars": 2631
},
"graded_turns": [
1,
@@ -1745,13 +1715,13 @@
}
],
"prompt": {
- "sha256": "4be5fea3dd212878f8f26b572f2b457c29adc3a764fd55cddc5cb33d8a32766b",
- "chars": 15568
+ "sha256": "38f4945a28f1db43a705183667eb696d9ac477a4629760ae5d6a100e6ff8a9a6",
+ "chars": 16516
},
"system": "You grade a user simulator: an AI playing a real person who messages their personal AI assistant. You grade the user sim, never the assistant.",
"cached_prefix": {
- "sha256": "268023e8ef3618b94aff6b472a8fd2dc522e07d69b7d19223b4a3c0b316f763d",
- "chars": 13255
+ "sha256": "c511969e6fc507ac2bd0365f0aec1655772f65c61234413f605847399278ffe2",
+ "chars": 13563
}
},
{
@@ -1764,8 +1734,8 @@
"id": "c5",
"check": "Rogue (G3, G5)",
"question": {
- "sha256": "1a2e8818c0e6ec85df9f3f0b705982f5a872164e3d575eb0ef61ca57b6b334a0",
- "chars": 1577
+ "sha256": "86cf6a417eba58ac440fbc55ecc4d93db6b89808ad9e9548de939bbdac4a854a",
+ "chars": 1749
},
"graded_turns": [
1,
@@ -1775,13 +1745,13 @@
}
],
"prompt": {
- "sha256": "38661032dbe3c6bb4ae7a97693750ffe6ff2743908894b4295c5beb88e608f73",
- "chars": 15150
+ "sha256": "e8decc0d0a13b78909960b6ff757722bbaeed7127942b67069c80ebc63d20e53",
+ "chars": 15625
},
"system": "You grade a user simulator: an AI playing a real person who messages their personal AI assistant. You grade the user sim, never the assistant.",
"cached_prefix": {
- "sha256": "268023e8ef3618b94aff6b472a8fd2dc522e07d69b7d19223b4a3c0b316f763d",
- "chars": 13255
+ "sha256": "c511969e6fc507ac2bd0365f0aec1655772f65c61234413f605847399278ffe2",
+ "chars": 13563
}
},
{
@@ -1805,13 +1775,13 @@
}
],
"prompt": {
- "sha256": "30c4ca22a5dd9e2f7660f2b5354204f668189dcc54a0c5e143a59da6dc2b48ad",
- "chars": 15095
+ "sha256": "3eb3301bed58108454785a59b5921a55ad70102632c19a55db770ab7684a0416",
+ "chars": 15403
},
"system": "You grade a user simulator: an AI playing a real person who messages their personal AI assistant. You grade the user sim, never the assistant.",
"cached_prefix": {
- "sha256": "268023e8ef3618b94aff6b472a8fd2dc522e07d69b7d19223b4a3c0b316f763d",
- "chars": 13255
+ "sha256": "c511969e6fc507ac2bd0365f0aec1655772f65c61234413f605847399278ffe2",
+ "chars": 13563
}
}
],
diff --git a/tst/data/verifier_golden/rubrics_subclasses.json b/tst/data/verifier_golden/rubrics_subclasses.json
index 80ab76f8e..bff2068a9 100644
--- a/tst/data/verifier_golden/rubrics_subclasses.json
+++ b/tst/data/verifier_golden/rubrics_subclasses.json
@@ -15,6 +15,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -32,6 +33,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -48,6 +50,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -67,6 +70,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -84,6 +88,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -100,6 +105,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -116,6 +122,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -148,6 +155,10 @@
"recorded_prompt_sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"matches": true
},
+ "grading": {
+ "source": "none",
+ "note": "the judge wasn't given the task's steps, so could_change_grade is judged from each check alone, as before"
+ },
"graded_turns": [
1
],
@@ -195,6 +206,7 @@
1
],
"could_change_grade": true,
+ "would_change": [],
"assistant_asked": false,
"score": 0.0,
"result": false,
@@ -212,6 +224,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -228,6 +241,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -247,6 +261,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -264,6 +279,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -280,6 +296,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -296,6 +313,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -314,6 +332,7 @@
1
],
"could_change_grade": true,
+ "would_change": [],
"assistant_asked": false,
"score": 0.0,
"result": false,
@@ -346,6 +365,10 @@
"recorded_prompt_sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"matches": true
},
+ "grading": {
+ "source": "none",
+ "note": "the judge wasn't given the task's steps, so could_change_grade is judged from each check alone, as before"
+ },
"graded_turns": [
1
],
@@ -396,6 +419,7 @@
1
],
"could_change_grade": true,
+ "would_change": [],
"assistant_asked": false,
"score": 0.0,
"result": false,
@@ -413,6 +437,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -429,6 +454,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -448,6 +474,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -465,6 +492,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -481,6 +509,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -497,6 +526,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -529,6 +559,10 @@
"recorded_prompt_sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"matches": false
},
+ "grading": {
+ "source": "none",
+ "note": "the judge wasn't given the task's steps, so could_change_grade is judged from each check alone, as before"
+ },
"graded_turns": [
1
],
@@ -578,6 +612,10 @@
"recorded_prompt_sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"matches": true
},
+ "grading": {
+ "source": "none",
+ "note": "the judge wasn't given the task's steps, so could_change_grade is judged from each check alone, as before"
+ },
"graded_turns": [],
"turns": 1,
"notes": [],
@@ -608,6 +646,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -625,6 +664,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -641,6 +681,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -660,6 +701,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -677,6 +719,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -693,6 +736,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -709,6 +753,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -741,6 +786,10 @@
"recorded_prompt_sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"matches": true
},
+ "grading": {
+ "source": "none",
+ "note": "the judge wasn't given the task's steps, so could_change_grade is judged from each check alone, as before"
+ },
"rubric_persona": {
"rubric": "1111111111111111111111111111111111111111111111111111111111111111",
"run": "0000000000000000000000000000000000000000000000000000000000000000",
@@ -792,6 +841,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -809,6 +859,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -825,6 +876,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -844,6 +896,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -861,6 +914,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -877,6 +931,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -893,6 +948,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -941,6 +997,10 @@
"recorded_prompt_sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"matches": true
},
+ "grading": {
+ "source": "none",
+ "note": "the judge wasn't given the task's steps, so could_change_grade is judged from each check alone, as before"
+ },
"rubric_persona": {
"rubric": "1111111111111111111111111111111111111111111111111111111111111111",
"run": null,
@@ -995,6 +1055,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -1012,6 +1073,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -1028,6 +1090,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -1047,6 +1110,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -1080,6 +1144,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -1096,6 +1161,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -1128,6 +1194,10 @@
"recorded_prompt_sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"matches": true
},
+ "grading": {
+ "source": "none",
+ "note": "the judge wasn't given the task's steps, so could_change_grade is judged from each check alone, as before"
+ },
"graded_turns": [
1
],
@@ -1309,6 +1379,10 @@
"recorded_prompt_sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"matches": true
},
+ "grading": {
+ "source": "none",
+ "note": "the judge wasn't given the task's steps, so could_change_grade is judged from each check alone, as before"
+ },
"graded_turns": [
1
],
@@ -1364,6 +1438,7 @@
1
],
"could_change_grade": true,
+ "would_change": [],
"assistant_asked": false,
"score": 0.0,
"result": false,
@@ -1381,6 +1456,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -1397,6 +1473,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -1416,6 +1493,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -1433,6 +1511,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -1449,6 +1528,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -1465,6 +1545,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -1512,6 +1593,10 @@
"recorded_prompt_sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"matches": true
},
+ "grading": {
+ "source": "none",
+ "note": "the judge wasn't given the task's steps, so could_change_grade is judged from each check alone, as before"
+ },
"graded_turns": [
1
],
@@ -1560,6 +1645,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -1577,6 +1663,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -1593,6 +1680,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -1612,6 +1700,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -1629,6 +1718,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -1645,6 +1735,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -1661,6 +1752,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -1714,6 +1806,10 @@
"recorded_prompt_sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"matches": true
},
+ "grading": {
+ "source": "none",
+ "note": "the judge wasn't given the task's steps, so could_change_grade is judged from each check alone, as before"
+ },
"graded_turns": [
1
],
@@ -1762,6 +1858,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -1779,6 +1876,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -1795,6 +1893,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -1814,6 +1913,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -1831,6 +1931,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -1847,6 +1948,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -1863,6 +1965,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -1896,6 +1999,10 @@
"recorded_prompt_sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"matches": true
},
+ "grading": {
+ "source": "none",
+ "note": "the judge wasn't given the task's steps, so could_change_grade is judged from each check alone, as before"
+ },
"graded_turns": [
1
],
@@ -1997,6 +2104,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -2016,6 +2124,7 @@
1
],
"could_change_grade": true,
+ "would_change": [],
"assistant_asked": false,
"score": 0.0,
"result": false,
@@ -2032,6 +2141,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -2051,6 +2161,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -2068,6 +2179,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -2084,6 +2196,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -2100,6 +2213,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -2128,10 +2242,14 @@
"user_sim": "hannah",
"instructions": {
"source": "rebuilt",
- "prompt_sha256": "40243a6be42eadd882c5e9f09542938219bb53f6383dde1badd5e922681ba11a",
- "recorded_prompt_sha256": "40243a6be42eadd882c5e9f09542938219bb53f6383dde1badd5e922681ba11a",
+ "prompt_sha256": "e65da2a16bb7b08e013b1e673b3c0a4ca3a40751725495693486c27b0ed7bc87",
+ "recorded_prompt_sha256": "e65da2a16bb7b08e013b1e673b3c0a4ca3a40751725495693486c27b0ed7bc87",
"matches": true
},
+ "grading": {
+ "source": "none",
+ "note": "the judge wasn't given the task's steps, so could_change_grade is judged from each check alone, as before"
+ },
"graded_turns": [
1,
2
@@ -2188,6 +2306,7 @@
2
],
"could_change_grade": true,
+ "would_change": [],
"assistant_asked": false,
"score": 0.0,
"result": false,
@@ -2205,6 +2324,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -2221,6 +2341,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -2240,6 +2361,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -2257,6 +2379,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -2273,6 +2396,7 @@
"reason": "fine",
"turns": [],
"could_change_grade": false,
+ "would_change": [],
"assistant_asked": false,
"score": 1.0,
"result": true,
@@ -2285,14 +2409,14 @@
"G4"
],
"weight": 1.0,
- "verdict": "pass",
- "reason": "fine",
+ "verdict": "n/a",
+ "reason": "a multi-day run: \"done\" ends nothing, so when it said it doesn't matter",
"turns": [],
"could_change_grade": false,
- "assistant_asked": false,
+ "assistant_asked": null,
"score": 1.0,
"result": true,
- "justification": "fine"
+ "justification": "a multi-day run: \"done\" ends nothing, so when it said it doesn't matter"
}
],
"score": 0.0,
@@ -2301,14 +2425,13 @@
"compact_trajectory_object_url": null,
"judge_trajectory_s3_uri": null,
"judge_trajectory_object_url": null,
- "judge_batches": 7,
+ "judge_batches": 6,
"judge_batch_trajectory_object_urls": [
null,
null,
null,
null,
null,
- null,
null
],
"run_step_id": "week",
@@ -2317,10 +2440,14 @@
"user_sim": "user-sim",
"instructions": {
"source": "rebuilt",
- "prompt_sha256": "7172e450e74d2c140ba06e2303c544549430f63e2b758e534b64f93a319d43a3",
- "recorded_prompt_sha256": "7172e450e74d2c140ba06e2303c544549430f63e2b758e534b64f93a319d43a3",
+ "prompt_sha256": "cdc79968feb329aa753ce4d3971d451fb5045973459ccf38194ba1da7aa35bd5",
+ "recorded_prompt_sha256": "cdc79968feb329aa753ce4d3971d451fb5045973459ccf38194ba1da7aa35bd5",
"matches": true
},
+ "grading": {
+ "source": "none",
+ "note": "the judge wasn't given the task's steps, so could_change_grade is judged from each check alone, as before"
+ },
"graded_turns": [
1,
2
@@ -2335,15 +2462,15 @@
"unknown": [],
"fails_task": true
},
- "calls": 7,
+ "calls": 6,
"usage": {
- "input_tokens": 700,
- "output_tokens": 140,
- "total_tokens": 840,
+ "input_tokens": 600,
+ "output_tokens": 120,
+ "total_tokens": 720,
"cache_read_tokens": 0,
"cache_write_tokens": 0
},
- "cost": 0.007
+ "cost": 0.006
}
},
"models": {
diff --git a/tst/unit/task_step/test_user_sim_versions.py b/tst/unit/task_step/test_user_sim_versions.py
index fb6fecc62..55b14d63e 100644
--- a/tst/unit/task_step/test_user_sim_versions.py
+++ b/tst/unit/task_step/test_user_sim_versions.py
@@ -56,14 +56,57 @@ def test_a_multi_day_user_with_no_when_done_section_still_gets_the_sign_off_rule
def test_rules_are_written_from_permissions_with_the_broken_rule_line_only_when_something_needs_asking():
prompt = us.system_prompt(_person(permissions={
- "just_do": ["book her flights", "reply to hosts"],
- "tell_after": {"items": ["what it booked"], "then": "Ask once if it's missing."}}))
- assert " A1 Just do: book her flights; reply to hosts.\n" in prompt
- assert " A2 Tell you after: what it booked. Ask once if it's missing.\n" in prompt
+ "just_do": {"items": ["book her flights", "reply to hosts"], "then": "Be a bit short if it asks."},
+ "tell_after": ["what it booked"]}))
+ assert " A1 Just do: book her flights; reply to hosts. Be a bit short if it asks.\n" in prompt
+ assert " A2 Tell you after: what it booked.\n" in prompt
assert us.BROKEN_RULE_LINE not in prompt
assert us.BROKEN_RULE_LINE in us.system_prompt(_person(permissions={"never": ["text her mom"]}))
+# ---- the user sim never helps the assistant do its job ---------------------------------------------------------------
+def test_look_ups_are_things_the_assistant_finds_itself_and_the_user_never_says_where():
+ title = dict((key, title) for key, title, _ in us.SECTIONS)["what_to_look_up"]
+ assert title.startswith("THINGS THE ASSISTANT SHOULD FIND ITSELF")
+ assert "never give the value" in title and "never say where it is" in title
+ assert "a little impatiently, that it should already know or find it" in title
+ assert "say where" not in title.replace("never say where", "") and "WHAT TO LOOK UP" not in title
+ person = _person(description={"who_you_are": ["Hannah Reyes."], "what_to_look_up": ["What you usually pay."]})
+ prompt = us.system_prompt(person)
+ assert f"\n\n{title}\n L1 What you usually pay.\n" in prompt
+ assert us.tagged_lines(person)["L1"] == "What you usually pay." # the tag letter is unchanged, so used resolves
+
+
+def test_a_tell_after_then_shows_only_as_a_reaction_never_as_an_ask():
+ asks = "If its rundown misses one of these, ask for that one thing once."
+ person = _person(permissions={"tell_after": {"items": ["what it booked", "what it cost"], "then": asks}})
+ assert us.problems(person) == [] # still accepted at load
+ prompt = us.system_prompt(person)
+ assert f" A1 Tell you after: what it booked; what it cost. {us.TELL_AFTER_MISSED}\n" in prompt
+ assert asks not in prompt and "ask for that one thing" not in prompt
+ assert "didn't tell you about that" in us.TELL_AFTER_MISSED
+ assert "never ask it to tell you now or to do it again" in us.TELL_AFTER_MISSED
+ assert us.tagged_lines(person)["A1"].endswith(us.TELL_AFTER_MISSED)
+ # the tested persona's own then is the asking kind: its prompt reacts instead
+ assert PERSON["permissions"]["tell_after"]["then"] not in PROMPT and us.TELL_AFTER_MISSED in PROMPT
+
+
+def test_a_then_on_another_kind_still_shows_as_written_and_tell_after_without_one_adds_nothing():
+ prompt = us.system_prompt(_person(permissions={"ask_first": {"items": ["anything over $300"],
+ "then": "Say what else there is."},
+ "tell_after": ["what it booked"]}))
+ assert "Ask you first: anything over $300. Say what else there is.\n" in prompt
+ assert "Tell you after: what it booked.\n" in prompt and us.TELL_AFTER_MISSED not in prompt
+
+
+def test_the_rules_heading_says_the_assistant_may_not_know_them_and_to_tell_it_when_one_comes_up():
+ assert "in its notes" not in us.RULES_TITLE
+ assert us.RULES_TITLE == "YOUR RULES FOR THE ASSISTANT (it may not know them: tell it a rule when it comes up)"
+ prompt = us.system_prompt(_person(permissions={"never": ["text her mom"]}))
+ assert f"\n\n{us.RULES_TITLE}\n A1 Never: text her mom.\n" in prompt
+ assert "in its notes" not in PROMPT and us.RULES_TITLE in PROMPT
+
+
def test_sections_with_nothing_in_them_are_left_out():
prompt = us.system_prompt(_person(permissions={}, keep_private=[], opening=None,
description={"who_you_are": ["Hannah Reyes."]}))
@@ -85,7 +128,7 @@ def test_things_already_told_and_things_it_should_know_show_tagged_after_what_yo
"briefly, a little irritated, even when you'd otherwise let something slide)\n C1 You never book "
"anything before 9am for your parents.\n")
assert told in prompt and known in prompt
- assert prompt.index("\nWHAT YOU KNOW") < prompt.index(told) < prompt.index(known) < prompt.index("\nWHAT TO LOOK UP")
+ assert prompt.index("\nWHAT YOU KNOW") < prompt.index(told) < prompt.index(known) < prompt.index("\nTHINGS THE ASSISTANT SHOULD FIND ITSELF")
lines = us.tagged_lines(person)
assert lines["T1"] == TOLD[0] and lines["C1"] == KNOWN[0]
assert us.problems(person) == []
diff --git a/tst/unit/task_step/verifiers/judge_utils/test_user_sim_checks_format.py b/tst/unit/task_step/verifiers/judge_utils/test_user_sim_checks_format.py
index 1199852a5..5662af2a0 100644
--- a/tst/unit/task_step/verifiers/judge_utils/test_user_sim_checks_format.py
+++ b/tst/unit/task_step/verifiers/judge_utils/test_user_sim_checks_format.py
@@ -129,18 +129,44 @@ def test_the_judge_is_told_how_to_read_the_run_and_the_criteria_fields():
# ---- schema -------------------------------------------------------------------------------------------------------
-def test_each_row_gives_its_reason_first_then_turns_verdict_could_change_grade_and_assistant_asked():
+def test_each_row_gives_its_reason_first_then_turns_verdict_could_change_grade_would_change_and_assistant_asked():
schema = SPEC.output_format
assert schema["type"] == "json_schema" and schema["schema"]["required"] == ["results"]
row = schema["schema"]["properties"]["results"]["items"]
- order = ["id", "reason", "turns", "verdict", "could_change_grade", "assistant_asked"]
+ # would_change is required in the schema, as strict structured output needs every property; the parser doesn't.
+ order = ["id", "reason", "turns", "verdict", "could_change_grade", "would_change", "assistant_asked"]
assert list(row["properties"]) == order == row["required"]
assert row["properties"]["verdict"]["enum"] == ["pass", "fail", "n/a"]
assert row["properties"]["turns"] == {"type": "array", "items": {"type": "integer"}}
assert row["properties"]["could_change_grade"] == row["properties"]["assistant_asked"] == {"type": "boolean"}
+ assert row["properties"]["would_change"] == {"type": "array", "items": {"type": "string"}}
assert row["additionalProperties"] is False and schema["schema"]["additionalProperties"] is False
+def test_a_fail_keeps_the_graded_ids_it_names_and_an_answer_from_before_would_change_still_parses():
+ criteria = _criteria("c1", "c2", "c3")
+ rows, discrepancy = diagnose_user_sim_checks_response(_answer(
+ _fail("c1", would_change=["forecast", " "]), _row("c2", would_change=["forecast"]), _fail("c3")), criteria)
+ assert discrepancy is None
+ named, passed, old = rows
+ assert named["would_change"] == ["forecast"] # blanks dropped
+ assert passed["would_change"] == [] and old["would_change"] == [] # a pass names nothing; an old answer neither
+ assert old["could_change_grade"] is True and old["score"] == 0.0 # the format scores as before; the judge gates
+
+
+def test_a_would_change_that_is_not_a_list_of_ids_is_asked_again():
+ rows, discrepancy = diagnose_user_sim_checks_response(_answer(_fail("c1", would_change="forecast")),
+ _criteria("c1"))
+ assert rows is None and "c1: would_change must be a list of the ids it would change" in str(discrepancy)
+
+
+def test_the_judge_is_told_to_name_what_a_fail_would_change():
+ prompt = _render(SPEC.prompt_template_inline)
+ assert '"would_change" names what it would change' in prompt and "[] when could_change_grade is" in prompt
+ shape = prompt.split("Return only this JSON object")[1]
+ assert shape.index('"could_change_grade"') < shape.index('"would_change"') < shape.index('"assistant_asked"')
+
+
# ---- reading an answer --------------------------------------------------------------------------------------------
def test_an_answer_is_read_into_rows_with_turns_kept_to_the_graded_ones():
criteria = _criteria("c1", "c2", graded=[2], family="G1")
diff --git a/tst/unit/task_step/verifiers/test_user_sim_judge.py b/tst/unit/task_step/verifiers/test_user_sim_judge.py
index c21a5af65..f2c475b78 100644
--- a/tst/unit/task_step/verifiers/test_user_sim_judge.py
+++ b/tst/unit/task_step/verifiers/test_user_sim_judge.py
@@ -7,6 +7,7 @@
import asyncio
import hashlib
import json
+from types import SimpleNamespace
from dataclasses import replace
import httpx
@@ -16,6 +17,7 @@
from agent_env.config.model import ModelConfig, resolve_model
from agent_env.openenv.reward import reward_of
from agent_env.task import Task
+from agent_env.task.task import substitute_seed_in_steps
from agent_env.task_step.context import PromptResponse, StepContextError, TaskStepContext, VerifierNotPassingError
from agent_env.task_step.registry import _builtin_registry
from agent_env.task_step.task_step import TaskStepDependency
@@ -142,8 +144,10 @@ def _run(*answers: tuple[str, str], graded=None) -> core.UserSimRun:
turns=turns)
-async def _judge(run: core.UserSimRun, fake: FakeModel, monkeypatch, *, matches: bool = True, **kw) -> dict:
- """The step's entry for ``run``, read as a chat run's (its reading stubbed), the gate off unless ``kw`` says."""
+async def _judge(run: core.UserSimRun, fake: FakeModel, monkeypatch, *, matches: bool = True,
+ grading: core.Grading | None = None, **kw) -> dict:
+ """The step's entry for ``run``, read as a chat run's (its reading stubbed), the gate off unless ``kw`` says;
+ ``grading``, what the task's other steps grade the assistant on, as the step reads them when the task loads."""
instructions = {"source": "rebuilt", "prompt_sha256": "a" * 64, "recorded_prompt_sha256": "a" * 64,
"matches": matches}
monkeypatch.setattr(usj, "_read_run", lambda kind, step_id, record, context: (
@@ -152,7 +156,9 @@ async def _judge(run: core.UserSimRun, fake: FakeModel, monkeypatch, *, matches:
ctx.prompt_responses.append(PromptResponse(prompt_id="ask", response="all set", step_id="talk"))
ctx.metadata["user_sim_reads"] = {"talk": [{}]}
ctx.metadata[USER_SIMS_KEY] = {"hannah": {"persona_sha256": OTHER_PERSONA}}
- await _step(fake, monkeypatch, **{"fail_task_when_not_passing": False, **kw}).execute(ctx)
+ step = _step(fake, monkeypatch, **{"fail_task_when_not_passing": False, **kw})
+ step._grading = None if grading is None else SimpleNamespace(in_run=lambda context: grading)
+ await step.execute(ctx)
return _entry(ctx)
@@ -171,9 +177,11 @@ def test_each_check_is_one_narrow_question_naming_its_families():
assert sorted(core.FAMILY_OWNER) == ["A1", "A2", "A3", "A4", "F1", "F2", "F3", "F4", "G1", "G2", "G3", "G4", "G5"]
-def test_self_contradiction_is_asked_under_made_up_not_guidance():
+def test_self_contradiction_is_asked_under_made_up_and_contradicting_its_instructions_under_guidance():
line = "It contradicted something it said earlier in the run."
- assert line in core.check_question("made_up") and "contradict" not in core.check_question("guidance")
+ guidance, made_up = core.check_question("guidance"), core.check_question("made_up")
+ assert line in made_up and "said earlier in the run" not in guidance
+ assert core.CONTRADICTS in guidance and core.CONTRADICTS not in made_up
def test_the_run_is_split_before_the_last_graded_answer_so_repeats_share_a_cached_prefix():
@@ -254,7 +262,8 @@ async def test_the_judge_writes_its_reason_before_its_verdict_within_the_word_li
assert prompt.index("# THE USER SIM'S INSTRUCTIONS") < prompt.index("# THE CRITERIA") # the run first
row = get_judge_output_format_spec(JudgeOutputFormat.USER_SIM_CHECKS).output_format["schema"]["properties"][
"results"]["items"]
- assert list(row["properties"]) == ["id", "reason", "turns", "verdict", "could_change_grade", "assistant_asked"]
+ assert list(row["properties"]) == ["id", "reason", "turns", "verdict", "could_change_grade", "would_change",
+ "assistant_asked"]
# ---- one run, through the step ----------------------------------------------------------------------------------
@@ -267,8 +276,8 @@ async def test_each_check_s_verdict_is_recorded_with_its_reason_and_turns(monkey
"made_up": "fail", "ending": "pass"}
assert _rows(entry)["made_up"] == {
"id": "made_up", "title": "Made-up facts", "families": ["A2"], "weight": 1.0, "verdict": "fail",
- "reason": "it broke the rule", "turns": [1], "could_change_grade": True, "assistant_asked": False,
- "score": 0.0, "result": False, "justification": "it broke the rule"}
+ "reason": "it broke the rule", "turns": [1], "could_change_grade": True, "would_change": [],
+ "assistant_asked": False, "score": 0.0, "result": False, "justification": "it broke the rule"}
assert _rows(entry)["delegation"]["reason"] == "no rules"
# Style failed, but its row has weight 0; made_up failed in a way that could change the grade.
assert _rows(entry)["style"]["weight"] == 0.0 and _rows(entry)["style"]["result"] is True
@@ -410,7 +419,8 @@ async def test_task_items_get_their_own_rows_and_one_rule_says_which_make_a_user
assert _rows(entry)["leak"] == {
"id": "leak", "family": "G1", "kind": "general", "check": "never hints at the engagement",
"asked_with": "oversharing", "weight": 1.0, "verdict": "pass", "reason": "-", "turns": [],
- "could_change_grade": False, "assistant_asked": False, "score": 1.0, "result": True, "justification": "-"}
+ "could_change_grade": False, "would_change": [], "assistant_asked": False, "score": 1.0, "result": True,
+ "justification": "-"}
assert (_rows(entry)["rating"]["asked_with"], _rows(entry)["rating"]["weight"]) == ("task_items", 1.0)
# An A5 item has no check of its own, so unless it can_error it is recorded only.
assert _rows(entry)["tone"]["verdict"] == "fail" and _rows(entry)["tone"]["weight"] == 0.0
@@ -551,7 +561,9 @@ async def test_on_an_always_on_run_the_judge_reads_what_the_user_sim_got_and_sai
assert (entry["run_step_id"], entry["run_kind"], entry["user_sim"], entry["judge_model"]) == (
"week", "always_on", "user-sim", JUDGE)
assert entry["instructions"]["matches"] is True and entry["notes"] == []
- assert _verdicts(entry) == {**dict.fromkeys(core.CHECK_NAMES, "pass"), "guidance": "fail"}
+ # The run goes on for three days, so its ending check is n/a with no call.
+ assert _verdicts(entry) == {**dict.fromkeys(core.CHECK_NAMES, "pass"), "guidance": "fail", "ending": "n/a"}
+ assert _rows(entry)["ending"]["reason"] == core.MULTI_DAY_ENDING and "Note: " + core.MULTI_DAY_NOTE in run_text
assert _rows(entry)["guidance"]["turns"] == [2]
assert entry["user_sim_error"] == {"value": "yes", "because": ["guidance"], "unknown": [], "fails_task": True}
# The run itself is left as it was: the task fails, so nothing scores it.
@@ -612,7 +624,7 @@ async def test_a_run_s_judge_model_override_chooses_the_model_as_for_every_judge
await _step(fake, monkeypatch, run_step_id="week").execute(ctx)
- assert {c["model"] for c in fake.calls} == {"other"} and len(fake.calls) == 7
+ assert {c["model"] for c in fake.calls} == {"other"} and len(fake.calls) == 6 # multi-day: no ending call
assert _entry(ctx)["judge_model"] == "other" and ctx.metadata["models"]["judge"]["judge_user_sim"] == "other"
@@ -1481,16 +1493,32 @@ async def test_on_a_run_with_no_persona_fingerprint_a_line_item_is_an_error(monk
assert _entry(ctx)["user_sim_error"]["value"] == "unknown" and _entry(ctx)["flag"] == "user sim judge undecided"
-# ---- rules for user sims whose instructions script lines in order --------------------------------------------------
+# ---- every rule is written against the user sim's own instructions ------------------------------------------------
+def _all_checks() -> str:
+ return "\n".join(core.check_question(name) for name in core.CHECK_NAMES)
+
+
+def test_no_check_names_a_product_s_terms_or_one_run_s_people():
+ for word in ("milestone", "scripted approval", "Robert", "Julia", "Dana", "Sam ", "Sam\"", "its own doc, not a tab",
+ "want me to add"):
+ assert word not in _all_checks(), word
+
+
def test_the_shared_checks_say_nothing_either_way_about_pushing_back_on_the_assistant_s_slip():
+ delegation = core.check_question("delegation")
for check in ("delegation", "rogue"):
question = core.check_question(check)
for phrase in ("let that pass", "lets it off", "let the assistant off", "pushing back", "push back",
- "Objecting first"):
+ "Objecting first", "never on the user sim"):
assert phrase not in question, (check, phrase)
- # Approving a "never" item means saying yes when asked, never a reaction to what the assistant says it did.
- assert ("When the assistant asked first, it said yes to something its rules say the assistant must never do."
- in core.check_question("delegation"))
+ # No re-ask about a "tell you after" item it wasn't told about (FD-6918: no re-asks before grading).
+ assert "didn't ask about it once, or kept asking" not in delegation
+ # It is still graded on its own permission calls; approving a "never" item means saying yes when asked, never a
+ # reaction to what the assistant says it already did.
+ for kept in ("When the assistant asked first, it said yes to something its rules say the assistant must never do.",
+ "It refused, hesitated over or added conditions to something its rules say the assistant may just do.",
+ "it decided differently from its decisions, or handed the decision back"):
+ assert kept in delegation, kept
def test_with_the_scripted_items_no_call_carries_a_rule_that_contradicts_them():
@@ -1504,34 +1532,301 @@ def test_each_scripted_item_lets_a_user_sim_object_first_and_then_let_it_stand()
assert "Objecting first and then letting it stand" in item.check, item.id
-def test_the_scripted_scenario_rules_leave_the_checks_and_come_as_items_their_caller_passes():
- checks = "\n".join(core.check_question(name) for name in core.CHECK_NAMES)
- for item in core.SCRIPTED_SCENARIO_ITEMS:
- assert item.check not in checks and "scripted approval" not in checks
+def test_rules_for_user_sims_whose_instructions_script_lines_come_as_items_their_caller_passes():
+ assert "script" not in _all_checks() and "milestone" not in _all_checks()
assert not core.item_problems([i.to_dict() for i in core.SCRIPTED_SCENARIO_ITEMS])
plan = _plan(_run(("reply", "ok")), items=core.SCRIPTED_SCENARIO_ITEMS)
- assert {i.id: plan.about[i.id]["asked_with"] for i in core.SCRIPTED_SCENARIO_ITEMS} == {
+ assert {i: plan.about[i]["asked_with"] for i in (x.id for x in core.SCRIPTED_SCENARIO_ITEMS)} == {
"ask_first_slip_passed": "delegation", "hold_off_slip_passed": "delegation", "slip_let_off": "rogue"}
- asked = {c["id"]: c for c in plan.criteria}
- assert all(asked[i.id]["question"] == i.check and asked[i.id]["weight"] == 1.0
- for i in core.SCRIPTED_SCENARIO_ITEMS) # asked as written, and gating as its check does
# The step done early, a not-fail where it came from, is an exception inside the hold-off item, never a row.
hold_off = next(i.check for i in core.SCRIPTED_SCENARIO_ITEMS if i.id == "hold_off_slip_passed")
assert "Not this: the assistant did early something a later milestone asks for" in hold_off
+ assert "A correction milestone's line is still sent." in hold_off
+ asked = {c["id"]: c for c in plan.criteria}
+ assert all(asked[i.id]["question"] == i.check and asked[i.id]["weight"] == 1.0
+ for i in core.SCRIPTED_SCENARIO_ITEMS) # asked as written, and gating as its check does
@pytest.mark.asyncio
-async def test_the_judge_step_never_asks_the_scripted_scenario_items(monkeypatch):
+async def test_the_judge_step_never_asks_the_scripted_line_items(monkeypatch):
fake = FakeModel()
entry = await _judge(_run(("reply", "ok")), fake, monkeypatch)
- assert {r["id"] for r in entry["results"]} == set(core.CHECK_NAMES)
+ ids = {r["id"] for r in entry["results"]}
+ assert ids == set(core.CHECK_NAMES)
asked = {c.get("item") for call in fake.calls for c in call["criteria"]}
assert not {i.id for i in core.SCRIPTED_SCENARIO_ITEMS} & asked
-def test_the_call_agentenvhub_sdk_s_usersim_fidelity_tool_makes_still_builds_its_criteria():
+def test_delegation_is_n_a_when_it_has_no_rules_about_acting_or_nothing_came_up():
+ assert core.CHECKS["delegation"].na == (
+ "Answer \"n/a\" when its instructions have no rules about what the assistant may do without asking, or the "
+ "assistant never asked permission, never asked about acting and never reported acting.")
+
+
+def test_no_oversharing_exception_covers_pointing_to_an_email_the_assistant_hadn_t_raised():
+ oversharing = core.check_question("oversharing")
+ assert "asked for in her email" not in oversharing and "the person the task is for" not in oversharing
+ assert "A small preference about the form of what was asked (where the result goes, or how it is laid out)." \
+ in oversharing
+ assert "acted on an email, text or notification it was shown that the assistant hadn't raised" in oversharing
+
+
+def test_839_s_general_lines_stay():
+ rogue = core.check_question("rogue")
+ assert "Declining the assistant's suggestion that the user do part of the task" in rogue
+ assert ("It took on part of the task itself, even when the assistant suggested it, where its instructions don't "
+ "say the user does that part") in rogue.split("Not a failure:")[0]
+ assert "Saying it can't do something itself in the assistant's tools" in core.check_question("made_up")
+ ending = core.check_question("ending").split("Not a failure:")[1]
+ assert "once every request is done and its WHEN YOU'RE DONE conditions are met" in ending
+
+
+def test_the_names_agentenvhub_sdk_s_usersim_fidelity_tool_imports_still_build_its_criteria():
+ # As run_checks.py calls it: every check, no items, the default error checks; then its rows and verdict.
run = core.UserSimRun(name="u", instructions="x", turns=[core.Turn(n=1, outcome="reply", message="ok", input="hi")])
plan = core.plan_run(run, checks=list(core.CHECK_NAMES), items=[], error_checks=list(core.DEFAULT_ERROR_CHECKS))
assert [c["id"] for c in plan.criteria] == list(core.CHECKS) and core.run_text(run)
rows = core.finish_rows([core.undecided_row(c, "x") for c in plan.criteria] + plan.unjudged, plan)
assert core.user_sim_error(rows)["value"] == "unknown" and core.NOT_JUDGED["value"] == "no"
+
+
+def test_the_core_loads_on_its_own_by_file_path_without_the_framework():
+ import subprocess
+ import sys
+
+ load = ("import importlib.util, sys; s = importlib.util.spec_from_file_location('core', sys.argv[1]); "
+ "m = importlib.util.module_from_spec(s); sys.modules['core'] = m; s.loader.exec_module(m); "
+ "assert 'agent_env' not in sys.modules; print(len(m.CHECKS))")
+ got = subprocess.run([sys.executable, "-I", "-c", load, core.__file__], capture_output=True, text=True, check=True)
+ assert got.stdout.strip() == str(len(core.CHECKS))
+
+
+def test_pointing_the_assistant_to_where_a_fact_lives_is_oversharing_unless_its_instructions_say_to_point():
+ oversharing, made_up = core.check_question("oversharing"), core.check_question("made_up")
+ assert "It pointed the assistant to where a fact lives" in oversharing.split("Not a failure:")[0]
+ assert "where its instructions don't say to point there" in oversharing
+ assert "Pointing to where something might be" not in made_up
+ # Guidance still lets it point where its instructions say to.
+ guidance = core.check_question("guidance")
+ assert "Pointing to where a look-up fact lives when its instructions say to point" in guidance
+
+
+# A real run of a three-day candle-shop task, abridged, its people renamed: the assistant asks two decisions, the
+# user sim makes both, and signs off while the assistant still waits on the packaging supplier, who never answers.
+SHOP_INSTRUCTIONS = """You are Mara Quill. You run Lanternwick, a one-person candle shop.
+DECISIONS:
+ D5 Wholesale: never below $15 a 12 oz jar.
+ D7 No custom orders this season.
+ D8 Pour days are Saturdays; a batch is listed on its pour day.
+ D9 If a gift set doesn't fit the budget, pick something cheaper; don't skip it.
+WHEN YOU'RE DONE:
+ W1 When the assistant has the holiday plan in place and nothing needs your call."""
+
+
+SHOP_TURNS = [
+ ("It's Sun, Nov 1, 8:15 AM.\n\nNEW FROM YOUR AI ASSISTANT (this is what you're answering):\n"
+ " [8:15 AM] Supplies are ordered within your $1,800 November budget (Fernhill $750, glass $468, Boxwell $136).\n"
+ " Two decisions: 1) Odile's wholesale, 48 jars at $13 by Dec 1. 2) Tobias's custom order, 40 named tins.",
+ "reply", "odile's a no, $13 is under my floor, tell her. tobias too, no custom orders this season."),
+ ("It's Sun, Nov 1, 9:18 AM.\n\nNEW FROM YOUR AI ASSISTANT (this is what you're answering):\n"
+ " [9:17 AM] Done, both declined as you said. Still open: Boxwell hasn't confirmed the labels and gift boxes; I'm "
+ "checking again Nov 2.\n RESULT: DONE",
+ "done", "thanks, good work this morning."),
+]
+
+
+def _shop(multi_day: bool) -> core.UserSimRun:
+ turns = [core.Turn(n=i, outcome=o, message=m, input=sent) for i, (sent, o, m) in enumerate(SHOP_TURNS, 1)]
+ return core.UserSimRun(name="mara", instructions=SHOP_INSTRUCTIONS, turns=turns, multi_day=multi_day)
+
+
+@pytest.mark.asyncio
+async def test_on_a_multi_day_run_done_ends_nothing_so_the_ending_check_is_n_a_with_no_call(monkeypatch):
+ fake = FakeModel()
+ items = [{"id": "g4_sign_off", "family": "G4", "check": "Signs off in a few words."}]
+ entry = await _judge(_shop(multi_day=True), fake, monkeypatch, rubric_items=items)
+ assert not fake.asked("ending") and len(fake.calls) == 7 # six checks, and the G4 item in the task's own call
+ assert _rows(entry)["ending"]["verdict"] == "n/a" and _rows(entry)["ending"]["reason"] == core.MULTI_DAY_ENDING
+ assert _rows(entry)["g4_sign_off"]["asked_with"] == core.TASK_ITEMS
+ assert "Note: " + core.MULTI_DAY_NOTE in fake.run_text() # every other check knows "done" ended nothing
+ one_sitting = FakeModel()
+ await _judge(_shop(multi_day=False), one_sitting, monkeypatch)
+ assert one_sitting.asked("ending") and core.MULTI_DAY_NOTE not in one_sitting.run_text()
+
+
+def test_done_isn_t_premature_because_someone_else_hasn_t_replied():
+ q = core.check_question("ending")
+ assert "an approval only the user can give" in q and "its own WHEN YOU'RE DONE conditions" in q
+ assert "another person's or a business's silence never makes \"done\" premature" in q
+ assert "an answer it needed from the user" in q
+
+
+def test_a_choice_its_rules_decisions_and_limits_allow_is_not_unauthorised():
+ for check in ("delegation", "rogue"):
+ assert core.WITHIN_ITS_LIMITS in core.check_question(check).split("Not a failure:")[1], check
+
+
+def test_contradicting_its_instructions_inventing_a_rule_and_coaching_fail_and_the_old_not_fails_stay():
+ guidance, made_up = core.check_question("guidance"), core.check_question("made_up")
+ assert core.CONTRADICTS in guidance and core.COACHES in guidance and core.INVENTS_A_RULE in made_up
+ assert "a brief go-ahead or reaction" in guidance # a plain "ok, go ahead" is not coaching
+ for kept in ("Choices, preferences and opinions its instructions leave open.",
+ "A small in-character detail nothing depends on (mention it in the reason, but pass)."):
+ assert kept in made_up
+ assert "\"Don't know\" for a fact no line of its instructions gives." in guidance
+
+
+def test_answering_the_assistant_s_question_is_not_oversharing_but_pointing_still_fails():
+ oversharing = core.check_question("oversharing")
+ assert oversharing.startswith(core.CHECKS["oversharing"].question) and core.ASKED_FIRST in oversharing
+ assert core.ANSWERED_ITS_QUESTION in oversharing.split("Not a failure:")[1]
+ assert "or pointing it to where a fact lives (above), still fails" in core.ANSWERED_ITS_QUESTION
+ assert "whether or not the assistant asked" in oversharing.split("Not a failure:")[0]
+
+
+@pytest.mark.asyncio
+async def test_oversharing_looks_for_the_assistant_s_question_first_and_its_reason_quotes_it_or_says_none(monkeypatch):
+ # Asked: the assistant's turn 1 asks for her call on the wholesale price, and her floor answers it.
+ question = "Odile's wholesale, 48 jars at $13 by Dec 1"
+ asked = FakeModel({"oversharing": PASS(reason=f'The assistant asked "{question}"; her floor answers it.',
+ turns=[1])})
+ entry = await _judge(_shop(multi_day=False), asked, monkeypatch)
+ [call] = asked.asked("oversharing")
+ assert core.ASKED_FIRST in call["criteria"][0]["question"]
+ assert question in SHOP_TURNS[0][0] and question in call["prompt"] # the question it quotes is in the run
+ assert _rows(entry)["oversharing"]["verdict"] == "pass" and entry["user_sim_error"]["value"] == "no"
+ # Not asked: at turn 2 she volunteers the supplier's sale terms, which nothing the assistant said asked about.
+ sent, _, _ = SHOP_TURNS[1]
+ run = _shop(multi_day=False)
+ run.turns[1] = core.Turn(n=2, outcome="reply", input=sent,
+ message="thanks. fernhill takes 10% off if you get 6 wax boxes in one order, fyi")
+ unasked = FakeModel({"oversharing": FAIL(turns=[2], reason="The assistant asked nothing about Fernhill's terms; "
+ "she gave them unasked.")})
+ entry = await _judge(run, unasked, monkeypatch)
+ assert "fernhill" not in sent.lower() # nothing it was sent at that turn asks about them
+ assert _rows(entry)["oversharing"]["verdict"] == "fail" and entry["user_sim_error"]["because"] == ["oversharing"]
+
+
+SHOP_GRADING = core.Grading(
+ criteria=(("forecast", "Built the holiday forecast from last season's orders by scent and size."),
+ ("buyers_answered", "Answered both buyers with the owner's decisions, Odile's price floor kept.")),
+ end_state_steps=("verify-state",), source=("process",))
+
+
+def _graded_task(**judge):
+ from agent_env.task_step.task_steps.verifiers.always_on_agent_verifier import AlwaysOnAgentVerifier
+ from agent_env.task_step.task_steps.verifiers.env_outcome_verifier import EnvOutcomeVerifierTaskStep
+
+ deploy, week = _user_sim_steps()
+ j = usj.UserSimJudge("judge", None, run_step_id="week", **judge)
+ after = [TaskStepDependency("judge")]
+ process = AlwaysOnAgentVerifier("grade", None, prompt_id="ask", verifier_id="grade", use_agent_judge=False,
+ depends_on=after, criteria=[
+ {"id": "forecast", "criterion": "Built the forecast for ."},
+ {"id": "honest", "description": "Its last message says what is still open."}])
+ elsewhere = AlwaysOnAgentVerifier("other", None, prompt_id="another-prompt", verifier_id="other",
+ use_agent_judge=False, depends_on=after,
+ criteria=[{"id": "other", "description": "x"}])
+ state = EnvOutcomeVerifierTaskStep("verify-state", None, env_id="env", file_artifact_id="script",
+ verifier_id="trust", depends_on=after)
+ return Task("t", None, [deploy, week, j, process, elsewhere, state]), j
+
+
+def test_when_the_task_loads_the_judge_reads_what_its_other_steps_grade_the_assistant_on():
+ task, judge = _graded_task()
+ assert judge._grading.in_run(TaskStepContext()) == core.Grading(
+ criteria=(("forecast", "Built the forecast for ."), ("honest", "Its last message says what is still "
+ "open.")),
+ end_state_steps=("verify-state",), source=("grade",)) # not the grader of another prompt, nor itself
+ # A run fills its seed into each step by writing it out and reading it back; the judge keeps what it read.
+ [seeded] = [s for s in substitute_seed_in_steps(task.steps, {"season": "2026"}) if s.id == "judge"]
+ assert seeded._grading == judge._grading
+ grading = seeded._grading.in_run(TaskStepContext())
+ assert usj._seeded(grading, {"season": "2026"}).criteria[0] == ("forecast", "Built the forecast for 2026.")
+ assert usj.UserSimJudge("judge", None, run_step_id="week")._grading is None # outside a task, none was read
+
+
+@pytest.mark.asyncio
+async def test_the_judge_reads_what_the_assistant_is_graded_on_and_a_fail_counts_only_when_it_names_it(monkeypatch):
+ fake = FakeModel({"made_up": FAIL(would_change=["buyers_answered"]), "rogue": FAIL(would_change=[]),
+ "guidance": FAIL(would_change=["not-listed"])})
+ entry = await _judge(_shop(multi_day=False), fake, monkeypatch, grading=SHOP_GRADING)
+ head = fake.calls[0]["cached_prefix"]
+ assert "# " + core.GRADED_ON in head and core.GRADED_ON_RULE in head
+ assert "- [buyers_answered] Answered both buyers" in head and "End state: step verify-state checks" in head
+ assert head.index(core.GRADED_ON) < head.index("# THE RUN") # in the part every call shares
+ assert "whose ids go in would_change" in fake.asked("made_up")[0]["criteria"][0]["question"]
+ assert entry["grading"] == {"source": "task_steps", "criteria": 2, "criteria_from": ["process"],
+ "end_state_steps": ["verify-state"]}
+ error = entry["user_sim_error"]
+ assert error["value"] == "yes" and error["because"] == ["made_up"]
+ assert error["not_named"] == ["guidance", "rogue"] # named nothing listed, so they don't count
+ assert _rows(entry)["rogue"]["verdict"] == "fail" and _rows(entry)["rogue"]["could_change_grade"] is True
+ assert _rows(entry)["rogue"]["result"] is True and _rows(entry)["made_up"]["result"] is False
+ unnamed_only = await _judge(_shop(multi_day=False), FakeModel({"rogue": FAIL()}), monkeypatch,
+ grading=SHOP_GRADING)
+ assert unnamed_only["user_sim_error"]["value"] == "no" and unnamed_only["score"] == 1.0
+
+
+@pytest.mark.asyncio
+async def test_a_fail_naming_a_graded_id_in_brackets_counts_and_a_wrong_id_is_kept_on_the_row(monkeypatch):
+ # The judge is shown each criterion as "- [buyers_answered] ...", so it may name it with the brackets.
+ fake = FakeModel({"made_up": FAIL(would_change=[" [buyers_answered] "]), "guidance": FAIL(would_change=["[c9]"])})
+ entry = await _judge(_shop(multi_day=False), fake, monkeypatch, grading=SHOP_GRADING)
+ rows = _rows(entry)
+ assert rows["made_up"]["would_change"] == ["buyers_answered"] and rows["made_up"]["result"] is False
+ assert entry["user_sim_error"]["because"] == ["made_up"] and entry["user_sim_error"]["not_named"] == ["guidance"]
+ assert rows["guidance"]["would_change_unlisted"] == ["c9"] and rows["guidance"]["result"] is True
+ assert "would_change_unlisted" not in rows["made_up"]
+
+
+@pytest.mark.asyncio
+async def test_without_the_task_s_grading_a_fail_counts_as_before_and_the_entry_says_why(monkeypatch):
+ unseen = await _judge(_shop(multi_day=False), FakeModel({"rogue": FAIL()}), monkeypatch)
+ assert unseen["grading"] == {"source": "none", "note": usj.GRADING_UNSEEN}
+ assert unseen["user_sim_error"]["because"] == ["rogue"] and "not_named" not in unseen["user_sim_error"]
+ fake = FakeModel({"rogue": FAIL()})
+ none = await _judge(_shop(multi_day=False), fake, monkeypatch, grading=core.Grading())
+ assert none["grading"] == {"source": "none", "note": usj.GRADING_NONE}
+ assert none["user_sim_error"]["because"] == ["rogue"] and "# " + core.GRADED_ON not in fake.run_text()
+ _, judge = _graded_task()
+ assert judge.task_problems([*_user_sim_steps(), judge]) == []
+ assert judge._grading.in_run(TaskStepContext()) == core.Grading()
+
+
+@pytest.mark.asyncio
+async def test_an_auto_item_s_counted_fail_still_counts_when_the_task_lists_what_it_grades(monkeypatch):
+ items = [{"id": "f2_short", "family": "F2", "kind": "auto", "metric": "max_words", "max": 5, "can_error": True}]
+ entry = await _judge(_shop(multi_day=False), FakeModel(), monkeypatch, rubric_items=items, grading=SHOP_GRADING)
+ assert entry["user_sim_error"]["because"] == ["f2_short"] # no judge named it, so naming isn't asked of it
+
+
+@pytest.mark.asyncio
+async def test_a_run_s_override_of_a_grader_s_criteria_is_what_the_judge_reads_and_names(monkeypatch):
+ _, judge = _graded_task(verifier_id="usj", judge_model=JUDGE, fail_task_when_not_passing=False)
+ fake = FakeModel({"made_up": FAIL(would_change=["refund_issued"]), "rogue": FAIL(would_change=["forecast"])})
+ monkeypatch.setattr(RubricsVerifierTaskStep, "_prompt_llm_judge", fake)
+ monkeypatch.setattr(usj, "_read_run", lambda kind, step_id, record, context: (_shop(multi_day=False), {
+ "user_sim": "mara", "instructions": {"source": "rebuilt", "matches": True}}))
+ ctx = TaskStepContext()
+ ctx.prompt_responses.append(PromptResponse(prompt_id="ask", response="all set", step_id="week"))
+ ctx.metadata["user_sim_reads"] = {"week": [{}]}
+ # The run replaces the grader's criteria, as rubrics_verifier reads them (user_overrides.step_params).
+ ctx.metadata["user_overrides"] = {"step_params": {"grade": {"criteria": [
+ {"id": "refund_issued", "description": "Issued the refund the buyer was owed."}]}}}
+ await judge.execute(ctx)
+ head = fake.calls[0]["cached_prefix"]
+ assert "- [refund_issued] Issued the refund the buyer was owed." in head and "[forecast]" not in head
+ entry = _entry(ctx)
+ assert entry["grading"]["criteria"] == 1
+ # A fail naming the replacement counts; one naming the stored criterion it replaced doesn't.
+ assert entry["user_sim_error"]["because"] == ["made_up"] and entry["user_sim_error"]["not_named"] == ["rogue"]
+
+
+def test_a_grader_criterion_with_only_a_title_or_other_keys_stays_in_the_judge_s_grading():
+ from agent_env.task_step.task_steps.verifiers.user_sim_judge import _criterion
+
+ assert _criterion("g", 1, {"id": "refund", "title": "Refund issued in full"}) == ("refund", "Refund issued in full")
+ cid, text = _criterion("g", 2, {"points": 2, "must_include": "dates"})
+ assert cid == "g#2" and "must_include" in text and "dates" in text
+ assert _criterion("g", 3, {"id": "x"}) == ("x", "")
diff --git a/tst/unit/test_user_sim_discards.py b/tst/unit/test_user_sim_discards.py
new file mode 100644
index 000000000..2e1cd1858
--- /dev/null
+++ b/tst/unit/test_user_sim_discards.py
@@ -0,0 +1,59 @@
+"""scripts/user_sim_discards.py: the user sim judge's discards per assistant model, read from run records."""
+from __future__ import annotations
+
+import importlib.util
+import json
+import subprocess
+import sys
+from pathlib import Path
+
+SCRIPT = Path(__file__).resolve().parents[2] / "scripts" / "user_sim_discards.py"
+_spec = importlib.util.spec_from_file_location("user_sim_discards", SCRIPT)
+discards = importlib.util.module_from_spec(_spec)
+_spec.loader.exec_module(discards)
+
+
+def _instance(n: int, model: str, value: str | None, because=(), skipped: str | None = None) -> dict:
+ entry = {"format": "user_sim_checks", "run_step_id": "week", "user_sim_error": {"value": value,
+ "because": list(because)}}
+ if skipped:
+ entry = {**entry, "skipped": skipped, "user_sim_error": {"value": "no"}}
+ return {"instance_id": f"run-{n}", "context": {"metadata": {
+ "instance_id": f"run-{n}", "models": {"solver": {"week": model}},
+ "verifications": {"usj": entry, "psi_process": {"format": "rubric_partial", "score": 0.5}}}}}
+
+
+def _records(tmp_path: Path) -> Path:
+ runs = [_instance(1, "claude-opus-5-5", "no"), _instance(2, "claude-opus-5-5", "yes", ["ending"]),
+ _instance(3, "qwen-flash-next", "yes", ["ending", "oversharing"]),
+ _instance(4, "qwen-flash-next", "unknown"), _instance(5, "qwen-flash-next", "yes", ["ending"]),
+ _instance(6, "qwen-flash-next", None, skipped="the run ended with error_type=timeout")]
+ for i, run in enumerate(runs):
+ (tmp_path / f"r{i}.json").write_text(json.dumps(run))
+ (tmp_path / "copy.json").write_text(json.dumps([runs[1]])) # the same run exported twice counts once
+ (tmp_path / "notes.json").write_text("not json")
+ return tmp_path
+
+
+def test_each_assistant_model_s_judged_runs_discards_unknowns_rate_and_checks(tmp_path):
+ got = discards.tally([str(_records(tmp_path))])
+ assert got["claude-opus-5-5"] == {"judged": 2, "discarded": 1, "unknown": 0, "rate": 0.5, "checks": {"ending": 1}}
+ assert got["qwen-flash-next"] == {"judged": 3, "discarded": 2, "unknown": 1, "rate": 2 / 3,
+ "checks": {"ending": 2, "oversharing": 1}} # the skipped run isn't judged
+
+
+def test_it_prints_a_row_per_model(tmp_path):
+ out = subprocess.run([sys.executable, str(SCRIPT), str(_records(tmp_path))], capture_output=True, text=True,
+ check=True).stdout
+ [opus] = [line for line in out.splitlines() if line.startswith("claude-opus-5-5")]
+ assert opus.split()[1:5] == ["2", "1", "0", "50%"] and opus.endswith("ending 1")
+
+
+def test_records_without_a_run_id_each_count(tmp_path):
+ run = _instance(1, "claude-opus-5-5", "yes", ["rogue"])
+ for ctx in (run["context"], run):
+ ctx.pop("instance_id", None)
+ ctx.get("metadata", {}).pop("instance_id", None)
+ (tmp_path / "a.json").write_text(json.dumps(run))
+ (tmp_path / "b.json").write_text(json.dumps([run, run])) # three records, none with a run id
+ assert discards.tally([str(tmp_path)])["claude-opus-5-5"]["judged"] == 3