Repository navigation
feat(verifiers): user_interaction_grading, the run graded from the user's side - #935
anisha2102 wants to merge 10 commits into
Conversation
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.
|
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.
|
Thanks, Sarah. Your four fixes are in Your fixes (
Also from Greptile: with two user_sim_judges of one run, a failed one left no verdict, so the other's clean one let the run be graded. The step now keeps the judges' step ids and skips the run when one failed or never ran. The dimensions ( Testing on newer runs showed the six dimensions mixing things up. A stated preference broken by re-asking, by listing what was ruled out, or by offering it again landed in three different dimensions. Hand-backs of things the assistant couldn't do counted as laziness. A task's scripted "any update?" counted as the user chasing. So there are now five, checked in order:
What changed with them:
Greptile found a bug in the announcement rule, fixed in Tested
|
|
🤖 Automated Claude routine — Env Pod PR Context Review. This is a bot, not Edgar Arakelyan; not a human review. Cross-PR context: #981 changes the same error-skip that this PR moves into
Running Generated by Claude Code |
…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>
…, 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>
…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>
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>
… without the end outcome Rename user_satisfaction_grading to user_interaction_grading (verifier_id psi_interaction_grading, format user_interaction_log): it grades how working with the assistant went for the user, not whether the job got done. - The end outcome is recorded and costs nothing (OUTCOME_COST and the outcome row are gone). Scoring what the user was told made an honest "it didn't work" cost 2.5 more than a "done" that wasn't; the end-state checks own whether the job got done. - A line of the user sim's should-already-know (C) or find-itself (L) sections is one the assistant could know whatever its instructions say (FINDABLE_SECTIONS), and ignored_preference counts what the records it works from show. - ignored_preference covers how and how often the user wants to hear from it, and telling them again what they already know or settled; an unstated "update with nothing new" stays free. - The actions checklist: a request to find, compare or draft doesn't cover sending, buying or booking, and a yes to do something once doesn't cover repeating it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…test on 14 new tasks
- A yes covers only what the person knew: when the assistant had seen something that plainly bears on an action
(it costs them money, the reason they gave doesn't hold), it isn't OK'd until it tells them, even if they asked for it
("cancel uber one" when it was saving them money).
- The person's own decisions (spending or moving their money, accepting or turning down an offer, cancelling
something of theirs) need an OK with no rule saying so, and an incident for one is could_know: true.
- An offer or suggestion they can ignore with nothing lost isn't an ask; the same question sent again before they
could answer is one ask.
- A labelled fallback offered once when nothing fits isn't going against a limit; offering it again after a no is.
- A plan or status its own figures, or what the person knows, show can't hold is a contradictory_claim.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…on, and going silent A blind review of 52 graded runs found two kinds of failure the judge missed. The first is a yes the person gave in time that the assistant let lapse (a 10-minute ticket hold, then "your reply came too late"). The second is a direct question or request it never took up because it never wrote again. - ignored_preference: not acting on a yes or decision given in time (by the times the person saw) is one, major. Excused only by something outside it the person saw, or by the thing changing from what they said yes to. - contradictory_claim: "your reply came too late" when the times show it didn't. - unreported_outcome: going silent. When the rating's read shows nothing more came after the last check-in, that check-in gets a note saying so and when the run ended, in the person's own time from the rating's ask (read_time). So the judge can tell days of silence from a run that ended on the person's answer. Re-graded both sets (54 runs, Opus 5.5). Against the blind reviewers' fair scores, the mean |score - fair| goes from 0.42 to 0.36. Concert lggnrlsq goes from 4.62 to 1.17 (fair 2) and the silent holiday run x6thj354 from 4.4 to 3.8 (fair 2). The silence rule fired on that run only, of the 50 that got the note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…agent's own failure ended, as user_sim_judge does Main's #981 has user_sim_judge judge an always_on run that ended on its agent's own failure (its turns failing too many times in a row, or one timing out) instead of skipping it. The rebase puts that exception in the shared find_run, so this step reaches rubrics_verifier's call for such a run too; without _judges_failed_run it was skipped there as a prompt_error and the grade failed. It now grades the run, as its user sim judge judges it: the person's side of a run whose assistant stopped answering is what this score is for. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3a7ad93 to
7c72402
Compare
| group = [Incident(**{**vars(i), "repeat_of": into.get(i.repeat_of, "")}) for i in groups[key]] | ||
| kept = max(group, key=lambda i: (i.could_know, rank[i.severity], cost(out, i))) # on a tie, the first listed | ||
| out.incidents.append(kept) | ||
| into.update({i.id: kept.id for i in group}) |
There was a problem hiding this comment.
Repeats inherit unrelated history
collapsed points every incident in a group at the group's winner, even when they concern different problems. Suppose I2 repeats I1, an unrelated major I3 beats I2 at the same check-in, and I4 repeats I2. The rewrite makes I4 repeat I3 instead, losing the link to I1. Its minor cost becomes 0.225 instead of 0.30.
The reverse also happens: repeating a free incident can gain a charge when its ID is replaced by an unrelated known incident. Keep the original repeat history when choosing which incidents contribute to the score.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agent_env/task_step/task_steps/verifiers/user_interaction_grading_core.py
Line: 762-765
Comment:
**Repeats inherit unrelated history**
`collapsed` points every incident in a group at the group's winner, even when they concern different problems. Suppose `I2` repeats `I1`, an unrelated major `I3` beats `I2` at the same check-in, and `I4` repeats `I2`. The rewrite makes `I4` repeat `I3` instead, losing the link to `I1`. Its minor cost becomes 0.225 instead of 0.30.
The reverse also happens: repeating a free incident can gain a charge when its ID is replaced by an unrelated known incident. Keep the original repeat history when choosing which incidents contribute to the score.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
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_interaction_grading, a step that grades how working with the assistant went for its user, from what the user saw, and keeps a log of it. Its 1-5 score is the user interaction score. It doesn't grade whether the job got done: the end-state checks own that.Since the last review
The branch is rebased on main (the approved head b5c9048 is now 4b7dac5). Four commits since, after Hark's feedback on the proposal, a test on 14 tasks not used to write the prompt, and the rebase:
user_satisfaction_grading:verifier_idpsi_interaction_grading, output formatuser_interaction_log, step id<slug>-interaction-grading.FINDABLE_SECTIONS), andignored_preferencecounts what the records it works from show.unsolicited_update, is part ofignored_preference: how and how often the user wants to hear from it, and telling them again what they already know or settled. An unstated "update with nothing new" stays free; after the user says so, each one counts.contradictory_claim.ignored_preference, and "your reply came too late" when the times show it didn't is acontradictory_claim;unreported_outcome: a question or request nothing it said afterwards took up.user_sim_judgejudge such a run instead of skipping it. The rebase puts that exception in the sharedfind_run, and this step gets the same_judges_failed_runasuser_sim_judge, so it grades the run too; without it the step reached rubrics_verifier's call and failed the grade as aprompt_error.How it works
user_sim_judgereads it: the persona rebuilt and checked againstprompt_sha256, and every check-in'suser_sim_readinput and answer;read_time, from the rating's ask), so the judge can tell days of silence from a run that ended on the user's 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. The end outcome (done, partly, not done, as the user was told) follows, recorded only.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_judgejudges it.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), the judge model, andeffortandmax_thinking_tokensare rubrics_verifier's.user_interaction_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_interaction_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_interaction_grading.py: the step.judge_utils/judge_output_format.py: theuser_interaction_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_interaction_grading.py, 43 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 (a should-know or find-itself line always), the end outcome costing nothing (an honest "not done" scores as a "done" with the same incidents), and the judge's ids kept across an added incident;always_onrun (test_user_sim_judge's rig) through LiteLLM's mock;make lint(ruff) passes. Intst/unit/task_step,tst/unit/taskandtst/unit/openenv, 5,666 pass. The 151 that fail on this shared machine fail the same way on main (367eeea): they write to or run files under/tmp, which another user's/tmp/agentenvblocks here. None is in a file this PR touches.🤖 Generated with Claude Code
Confidence Score: 4/5

Fix the repeat-history calculation before merging so unrelated incidents cannot change later repeat costs.
Findings
Fix with agent prompt
Summary
Adds
user_interaction_gradingto record incidents from the user's side and compute a separate interaction score.All five supplied previous threads are unnumbered. Their original issues are addressed by schema checks, preserved incident state, numbered final reads, required judge-grade checks and approval counting.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR A[Run and user check-ins] --> B[Require clean user-sim judgments] B --> C[Add rating read and scheduled-message labels] C --> D[Judge returns incident log] D --> E[Check schema and check-in numbers] E --> F[Apply checklists] F --> G[Choose incidents and compute score] G --> H[Store log and recorded-only grade]Reviews (18) · Last reviewed commit: "fix(verifiers): user_interaction_grading..." · Reviewed by Greptile