Repository navigation
feat(verifiers): user_satisfaction_grading, the run graded from the user's side - #935
anisha2102 wants to merge 7 commits into
Conversation
…ser's side A recorded-only step that grades the assistant the way its user would, from what the user saw: one judge call reads the run as user_sim_judge does, the rating's lines and the run step's system prompt, lists every action and every ask the assistant made, and logs each incident at the check-in where the user could first see it. Its 1-5 score is computed from that log. It never fails the task and decides no verdict; it runs after the user sim judge and the rating. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…swer, never charges a free incident, and logs the final read - An answer missing a part of RUN_SCHEMA or an end outcome isn't a log: it's asked again, and fails the grade after MAX_ATTEMPTS, rather than scoring the missing parts as nothing wrong (answer_problems). - Merging a check-in's incidents in one dimension keeps the worst one the assistant could have known about, with its own could_know, so a free incident never makes a knowable one cost more. No stored log's score changes. - What the user read after the last check-in is one more check-in (with_final_read), so an incident or a fix there has a check-in and its quote is checked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sarah-chitty-1
left a comment
There was a problem hiding this comment.
Nice idea, and the split into a pure scoring core plus a step file matches how user_sim_judge is built. Before it lands in the shared framework, there are four bugs to fix and some restructuring so it reuses the framework's judge code instead of copying it.
Bugs
- Is this meant to count toward the task's score, or be recorded only? The PR (and #54) say recorded only. My understanding was that it should feed into the score, so worth a double check. Either way, two fixes:
- If recorded only, set
can_be_reward = False, asUserSimJudgedoes. Without it,openenv/reward.pytreats this step as a reward candidate. In a task with one real scorer, it then refuses with "name the one that is its reward". - If it should count, feed it into the task's aggregate step rather than making it a second main score. #54 would then need its "read by no aggregate" rule removed.
- Both ways: rename the 1–5 key (e.g.
score_1_5). Todayentry["score"]holds the 1–5 number and overwrites the grade's 0–1scoreinverifications[vid], sorecorded_scoresreports 4.85 next to 0.9 for the same run.
- If recorded only, set
- A malformed answer can still score 5/5.
answer_problemschecks that the lists exist, but not the items in them. An incident with"severity": "Severe", a stringturn, or an unknown dimension is dropped intoproblems, and the run scores 5.0. A wrong-type field (a listtext, an intrepeat_of) gets past the check, then crashesapply_runafter the call is paid for. Please validate againstRUN_SCHEMAwithjsonschema(already a dependency), check everyturnis a real check-in, and ask again on any error, so a score never comes from an answer with dropped incidents. Also add"strict": Trueto the response format, asrubrics_verifierdoes. - The checklists don't always force the incident. In
_check_actions, if the judge filed twooversteppedincidents at the check-in with the purchase, the severe bump can land on the free one (could_know=False) whilecollapsedkeeps the cheap knowable one. The unapproved purchase then costs 0.15._check_askscan also lower a judge's major incident to minor. A test for each would help. - A spoiled run can still be graded.
verifynever reads the user sim judge'suser_sim_error. With nouser_sim_judgein the task, its gate off, or an undecided verdict, the step grades the run anyway. Please skip unless the run'suser_sim_judgeentry hasuser_sim_error == "no", and require the judge step at load (todaytask_problemsonly checks the dependency when the step exists).
Reuse instead of copies
-
_askre-implementsrubrics_verifier's direct call, its retry loop and the call record. It's weaker:- it re-sends the same prompt without saying what was wrong;
- it retries setup errors three times;
- it ignores the judge's
effortandmax_thinking_tokens.
Either subclass
RubricsVerifierTaskStepwith a whole-run output format spec (asUserSimJudgeandTRAJECTORY_MISTAKESdo), or move that call and its correction loop into a publicjudge_utilshelper and use it here. Then_ask,core.parseandRESPONSE_FORMATcan go. -
_find_runand the skip checks at the top ofverifycopyUserSimJudge's. One public "load the user sim run, or say why to skip" helper inuser_sim_judge, used by both steps, would replace them. It would also replace the eight private imports (_load,_read_run,_cost,_usage, …). -
_seededduplicatestask.substitute_seed_in_steps;_store_logduplicates the base class's object-store handling.
Smaller
- Weights: the scoring weights (
COST,REPEAT_STEP,RECOVERED,CAP,OUTCOME_COST) are hard-coded with no version recorded. Make them a step setting (likemistake_severity_weights), or record them in the entry. - Section letters:
KNOWN_SECTIONS = "ACT"copies the user sim's section letters. Read them fromuser_sim_versions.SECTIONS. RESULT:lines: the prompt's rule about "RESULT: DONE" lines is one harness's convention. Make it a setting, or drop it from the shared prompt.- Repeats: a repeat across dimensions isn't enforced, and
collapsedcan take the wrong incident'srepeat_of. - One call per run: a long multi-day run can hit the 16k output cap. A truncated answer then fails twice more at full price.
- Tests: please add tests for bugs 1–4 and a truncated answer.
…, recorded only, grading only a run its user sim judge found clean - It is a RubricsVerifierTaskStep, as UserSimJudge is, with a new output format, user_satisfaction_log: rubrics_verifier's call, retries, correction loop, judge_calls record, effort and max_thinking_tokens. Its own call, parse and response format are gone. Settings that don't apply are refused at load (PINNED), and a run's overrides can't make it an agent judge (RUN_FIXED). - can_be_reward is False. The 1-5 score is score_1_5, so the entry's score is the grade's 0-1 one. user_sim_judge.grading_of counts only steps that can be the reward. - answer_problems checks the answer against RUN_SCHEMA with jsonschema and every check-in number against the run's, so an answer with a dropped or misread incident is asked again, never scored. - The action checklist raises the incident the score keeps. A repeat_of naming another dimension is dropped, and collapsed keeps the kept incident's own repeat_of. - A run is graded only when every user_sim_judge of it judged it and found user_sim_error no, and the task needs a user_sim_judge of the run at load. - Shared with user_sim_judge: find_run and FoundRun.read, user_sim_errors and answered_calls. task.substitute_seed is factored out of substitute_seed_in_steps. user_sim_versions names RULES_TAG. - The entry keeps the whole log and the score's weights. The RESULT line rule leaves the shared prompt for a task's grading_policy_prompt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, Sarah. All four bugs were real, and the step now reuses the framework's judge code instead of copying it. It's all in c6f8e04. Bugs
Reuse
Smaller
Tested
|
sarah-chitty-1
left a comment
There was a problem hiding this comment.
Thanks, this is a big improvement: all four bugs are fixed, it's built on rubrics_verifier the way UserSimJudge is, and the shared-code changes leave existing tasks and the user sim judge as they were. Approving, with a few small fixes before merge:
collapseddepends on order on a tie. When two incidents at one check-in cost the same, the first listed is kept with only its ownrepeat_of. Two minorput_it_on_meat one check-in, one a repeat, cost 0.38 or 0.30 depending on which comes first. On a tie, keep the one that costs more, or the one with a repeat.- Layering:
judge_output_formatnow importsuser_satisfaction_grading_core, so the sharedjudge_utilsdepends on one verifier. MoveRUN_SCHEMA+answer_problemsintojudge_output_format(asuser_sim_checkskeeps its schema there), or register the spec from the step module. _storedcopiesuser_sim_judge._load. Make that loader public and use it.- Merge with psi-benchmark-tasks #54: the RESULT rule now comes from the task's
grading_policy_prompt, so PSI runs lose it until #54 lands.
…dent, its format in judge_output_format, and skips a run a judge failed on - collapsed: on a tie of could_know and severity at one check-in and dimension, keep the incident that costs most (a repeat, one not put right), so the score never depends on the order the judge listed them in. Groups are collapsed in check-in order, so a repeat's cost is read from what the earlier check-ins kept. - The user_satisfaction_log format's words (USER_SATISFACTION_DIMENSIONS, _SEVERITIES, _OUTCOMES), its schema (USER_SATISFACTION_LOG_SCHEMA) and its answer check (user_satisfaction_log_problems) move into judge_output_format, as user_sim_checks keeps its own; judge_output_format imports no verifier. The core keeps what each word means, the log and the score, and a test holds the two to the same words in the same order. - user_sim_judge._load is public as load_stored, and user_satisfaction_grading uses it instead of its own copy. - The step keeps the step ids of the task's user_sim_judges of the run (task_problems; seeded_from carries them) and skips the run when one of them failed or never ran, as its grade shows: such a judge leaves no verdict, so another judge's clean verdict no longer lets the run be graded. Step ids, not verifier ids: a rubrics_verifier with no verifier_id gets a fresh one each time the task loads. - The test reads recorded_scores from task.result, where main moved it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cklists' evidence, and scheduled messages - Five dimensions, checked in order: unauthorized_action, ignored_preference, needless_handoff, contradictory_claim, unreported_outcome (they replace overstepped, put_it_on_me, ignored_me, got_it_wrong, left_hanging, too_much). A stated wish about length or options is ignored_preference; an unstated one is logged but free, so too_much is gone. - The asks checklist says when the person had already decided an ask (decided_at) and what in the run shows the assistant could have handled it itself (could_because: its rules, something it did elsewhere in the run, a promise, or none). Asking again about something decided is ignored_preference; an ask nothing shows it could have handled is no incident. An ask is judged by what it's for: asking the person to find out something the assistant could find out itself where it works is a handoff, and so is one made right after the assistant reports it saw the thing isn't done. - The actions checklist says when the person OK'd an announced action (ok_at). An announcement that got its yes in time, or that went ahead only with their yes, is logged but free. - Messages the task sent for the person at set times are marked scheduled (core.mark_scheduled): whatever they sent before their first answer, and an always_on run's scripted_user_line events (user_sim_judge.scripted_user_lines). A scheduled message is never the person chasing; a promise to keep checking and report that wasn't kept is its own unreported_outcome. The entry lists them as `scheduled`. - A contradictory_claim whose correction comes with the fix already done, in the same message, is put right at its own check-in. - The words, schema and check stay in judge_output_format (USER_SATISFACTION_DIMENSIONS, USER_SATISFACTION_COULD_BECAUSE, USER_SATISFACTION_LOG_SCHEMA); the prompt holds no task's facts or examples. Tested on 26 runs of four always-on tasks' current versions, each judged 3 times by these dimensions and by the six before them: rank correlation with the user sims' own ratings 0.87 for the mean (0.81 before), and 22 of the 26 runs within 0.5 across repeats (18 before). The 78 stored judge answers replay through this core with the prototype's scores exactly, and all pass the answer check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| for i in ledger.incidents: | ||
| if i.dimension == "unauthorized_action" and i.turn == at and i.severity == "minor" and i.approved_at is None: | ||
| i.approved_at = when |
There was a problem hiding this comment.
One approval clears unrelated actions
_approve clears every minor unauthorized_action at a check-in, not just the action the user approved. If the assistant announces two purchases together and later makes only one with permission, its announced_at causes both announcements to become free. The other purchase never got permission, but its penalty disappears and the run gets a higher grade. Match the approval to the specific action before setting approved_at.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agent_env/task_step/task_steps/verifiers/user_satisfaction_grading_core.py
Line: 594-596
Comment:
**One approval clears unrelated actions**
`_approve` clears every minor `unauthorized_action` at a check-in, not just the action the user approved. If the assistant announces two purchases together and later makes only one with permission, its `announced_at` causes both announcements to become free. The other purchase never got permission, but its penalty disappears and the run gets a higher grade. Match the approval to the specific action before setting `approved_at`.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.There was a problem hiding this comment.
Fixed in b5c9048. A purchase's checklist entry only names the check-in it was announced at, not which announcement it was, so the fix counts rather than matches. A check-in's announcements are freed only once every action announced there without an OK has its yes: either all of them were OK'd before they happened (ok_at), or as many have been made since with a yes, each naming that check-in. So your case, two announced and one made with permission, keeps its 0.15. A mix of some OK'd and some made also keeps it, since those might be the same purchase. An announcement that never got a yes is never freed.
test_one_yes_never_frees_two_announcements covers one yes, two yeses, two OK'd, the mix, and a checklist that leaves the announcement out. The 78 stored judge answers from the offline comparison still replay to the same scores.
An announcement incident at a check-in was freed by any yes naming it: a purchase made later with the person's yes freed every announcement at that check-in, so two purchases announced together and one made with permission left the other free too. _settle now frees a check-in's announcements only when every action announced there without an OK got its yes: all OK'd before they happened (ok_at), or as many made since with a yes, each naming that check-in. A purchase names only the check-in it was announced at, so with some OK'd and some made the two may be one action, and the check-in keeps its cost. When the check-in's checklist lists no announcement, its announcement incidents are counted instead. The 78 stored judge answers from the offline comparison replay to the same scores. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What and why
rate_user_satisfactionasks the user sim for one 1-5 rating once the run is over. That says how the run felt, but not what went wrong, when or how often, and two runs that both get a 1 look the same. This addsuser_satisfaction_grading, a step that grades the assistant the way its user would, from what the user saw, and keeps a log of it.user_sim_judgereads it: the persona rebuilt and checked againstprompt_sha256, and every check-in'suser_sim_readinput and answer;system_prompt, so what the assistant could have known follows what it was told;scripted_user_lineevents. A scripted "any update?" is never the user chasing.unauthorized_action,ignored_preference,needless_handoff,contradictory_claim,unreported_outcome. Then comes the end outcome.ignored_preference. A taste the user never stated is logged but free.scoreis the 1-5 score as 0-1; the entry keeps the 1-5 one asscore_1_5. Its rows weigh 0.can_be_rewardis false andfail_task_on_errordefaults to false: it's never the task's reward, never fails the task and decides no verdict.user_sim_judgeof the run in the task judged it and founduser_sim_errorno. A judge that failed or never ran left no verdict (its grade, by step id, says which), so the run isn't graded.user_sim_judgeof the run, and makes the step depend on it and onrate_user_satisfaction.log.It is a
RubricsVerifierTaskStep, asUserSimJudgeis:judge_calls), andeffortandmax_thinking_tokensare rubrics_verifier's.user_satisfaction_log: one criterion for the whole run. Likeuser_sim_checks, it lives wholly injudge_output_format: its words (dimensions, severities, outcomes, what shows the assistant could have handled an ask), its JSON schema, and itsdiagnose_response. That checks the log against the schema and the run's check-ins, so an answer that isn't a whole log is asked again with what was wrong.grading_policy_prompt, such as a harness's closingRESULT:line not counting as an incident.Shared with
user_sim_judge, which uses them too:find_runandFoundRun.read: the run, or why it's skipped;answered_calls: the entry'scalls,usageandcost;user_sim_errors: the judges' verdicts on a run;load_stored: a JSON object a step stored, read back (it was_load);scripted_user_lines: what an always_on task sent for the user at set times.user_sim_judge's prompt and grading are unchanged. Itsgrading_ofnow counts only steps that can be the reward, so it never takes this step for one of the assistant's graders.Files:
verifiers/user_satisfaction_grading_core.py: the prompt, what the log's words mean, the scheduled-message marking, the log, the checklists and the score. No model call and no I/O.verifiers/user_satisfaction_grading.py: the step.judge_utils/judge_output_format.py: theuser_satisfaction_logformat: its words, its schema and the answer check. It imports no verifier.verifiers/user_sim_judge.py: the shared helpers above.task/task.py:substitute_seed, factored out ofsubstitute_seed_in_steps.agent/user_sim_versions.py:RULES_TAGandPRIVATE_TAG, the two letters that weren't constants.registry.pyand inepisode/rules.py(UNAFFECTED).agent/user_sim.md.How it was tested
tst/unit/task_step/verifiers/test_user_satisfaction_grading.py, 35 tests. They cover:ignored_preference, repeats and their dimension, fixes (a correction fixed in the same message included), ties at one check-in in either order, "could know" with and without the assistant's instructions, and the judge's ids kept across an added incident;always_onrun (test_user_sim_judge's rig) through LiteLLM's mock;make lintand theplugin-apicheck (no break) pass.tst/unit/task_step,tst/unit/taskandtst/unit/openenv: 5,456 pass. The two failures need a writable/app, and a local result write within 10 s, which this machine's slow disk misses.agent-env task run --start-step <this step> --context-json <saved context>on 8 saved runs of three tasks, with local stores, the local runner and a real Opus judge: 7 were graded in one call each with the strict format, each costing $0.08-0.19, and 1 was skipped, as its user sim judge had found a slip.🤖 Generated with Claude Code
The previous approval finding still needs a fix before merging.
Fix with agent prompt
Summary
Adds
user_satisfaction_grading, which grades the assistant from what its user saw.Reviews (10) · Last reviewed commit: "fix(verifiers): one yes frees only the a..." · Reviewed by Greptile