Repository navigation
feat(verifiers): give verifiers the run's conversation and trigger firing logs - #241
Open
sarah-chitty-1 wants to merge 5 commits into
Open
sarah-chitty-1 wants to merge 5 commits into
sarah-chitty-1 wants to merge 5 commits into
Conversation
…ring logs `run_context.load_run_context` reads what a run recorded about the prompt a verifier grades into a `RunContext`: the stored conversation, every user-side turn included (the prompt, then the user-sim's or a human's messages), each user message marked with the agent triggers that wrote it and the extra fields the user-sim returned; each env's gateway firing log, from the envelope prompt_agent captures; and the user agent's own firing log. What the run meant to record but can't be read is named in `unavailable`, so a missing log is not read as an empty one. `RunContext.as_of_turn(k)` cuts it the way `grade_up_to_turn` cuts the trajectory: the messages up to turn k's reply and the events from before turn k+1's message. rubrics_verifier: `run_context_for_judge` (["conversation", "trigger_log"]) appends a Conversation and a Trigger firings section to the judge prompt, cut at `grade_up_to_turn`; messages and logs are bounded. env_outcome_verifier: a script whose `verify` takes two parameters is called `verify(mcp_url, run)`; `prompt_id` picks the prompt, the run's last one by default. A one-parameter `verify` is called as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e-line comments - env_outcome_verifier calls `verify(mcp_url, run=...)` only when the script names a `run` parameter; a script with any other second parameter is called exactly as before (new test). - Every added comment and docstring is one line; pre-existing ones are as they were. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sarah-chitty-1
marked this pull request as ready for review
October 19, 2026 19:42
… not empty; a turn cut without the conversation withholds the logs - load_run_context marks agent_trigger_events unavailable when the prompt's user agent had triggers (a firing recorded for the step, or a registration for its user agent; any registration when the conversation can't be read) but prompt_agent stored no firing log. The judge's Trigger firings section now lists every unavailable log, not only the env ones. - as_of_turn withholds the firing logs, and marks each unavailable, when it can't find when the next turn began (no conversation was read), instead of returning them uncut. - The 200-character cap on a read error's message is RunContext.ERROR_MAX_CHARS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ass variables RUN_CONTEXT_MESSAGE_MAX_CHARS (4000) and RUN_CONTEXT_EVENTS_MAX (200) move from module level onto RubricsVerifierTaskStep as ClassVars, beside its other limits; render_run_context reads them there. Same values, same rendering. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Give verifiers the run's conversation, including the user sim's turns, and the trigger firing logs, in a general way.
Today
env_outcome_verifiergets only the MCP URL. A task with triggers or a user sim can't grade "noticed the change", "asked before acting" or "didn't leak the answer" without pulling those records itself.run_context.load_run_contextbuilds aRunContextfrom what the run recorded:fired) and the user sim's extra fields.unavailable, so a missing log isn't mistaken for an empty one.as_of_turn(k)cuts it the way feat(rubrics_verifier): grade a multi-turn run as of turn k #222 grades "as of turn k": messages up to turn k's reply, and events from before turn k+1's message.rubrics_verifier: a newrun_context_for_judge: ["conversation", "trigger_log"]adds Conversation and Trigger firings sections to the judge prompt, cut atgrade_up_to_turn. Size is capped: 4000 characters per message, the latest 200 events per log.env_outcome_verifier: a script whoseverifynames arunparameter is called asverify(mcp_url, run=...). Every other script, one with an unrelated second parameter included, is called exactly as before.prompt_idpicks which prompt, defaulting to the run's last one.Worth a look
verifythat namesrun, and the judge only whenrun_context_for_judgeis set. Nothing changes for existing tasks or scripts.prompt_agentstores at the end of a prompt. The latest capture is the env's whole log, so in a task with several prompts it can include events from later prompts. It's cut by turn, not by prompt.agent_prompt_response_verifierdoesn't get the run context. Should it get criteria like "trigger X fired"?grade_up_to_turnwithuse_trajectory=False. With the conversation shown to the judge, that could be allowed; the rule is left unchanged here.prompt_agentonly logs a warning when it can't read the user agent's firing log back, so the loader infers that a log was expected. It was if the step recorded a trigger firing or the prompt's user agent had registered triggers. If the conversation can't be read, any registered agent trigger counts.as_of_turncan't find when turn k+1 began, it withholds every firing log and marks each one unavailable, so an early grade never sees later events."env_changes"part.Tests
tst/unit/task_step/verifiers/test_run_context.py, 26 new tests against the real local conversation and object stores: the loader, the turn cut, missing records (a user-agent log that wasn't read back, and a turn cut with no conversation to cut by), the judge prompt sections, size caps and option validation, and which scripts getrun(arunparameter does; one, two-with-another-name don't).test_verifier_run_context_local.pyruns a real two-turn conversation, with the echo agent as both solver and user sim, and reads it back throughload_run_context.ruff, plugin-api (no break against the merge base) anduv lock --checkpass; the local integration test passes. The branch still merges cleanly with current main.🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; the previous requirement is satisfied and no new blocking issue was found.Summary
Gives verifiers optional access to the recorded conversation and trigger firing logs.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR Conversation[Stored conversation] --> Context[RunContext] Logs[Saved trigger logs] --> Context Context --> Script[Script that requests run] Context --> Cut[Optional turn cutoff] Cut --> Render[Selected sections and size limits] Render --> Judge[Rubric judge]Reviews (3) · Last reviewed commit: "review: the judge's run-context limits a..." · Reviewed by Greptile