Repository navigation
feat(task): compare two attempts' run records by the lock table, and agent-env task diff - #974
Open
earakely-scale wants to merge 10 commits into
Open
earakely-scale wants to merge 10 commits into
earakely-scale wants to merge 10 commits into
Conversation
…`agent-env task diff` `task/drift.py` classes every difference between two attempts' records by the lock table's rows: hard when they ran different things (task, entity versions and image identity, role models, overrides, result rules and verifier settings, the last two also offering a regrade), soft for code meant to change under a run (core and plugin packages, Python, verifier packages, a role's endpoint host, where its sandboxes ran), never for how a version was asked for or how the config was found. Every record field is in a row or named as not compared, which a test holds. An image's identity, not its artifact's version, says whether it changed, so an image put again from an unchanged context is the same image. `agent-env task diff A [B]` lists the differences of two attempts, an instance's latest or INSTANCE@EPOCH, or of one instance's first and latest, and exits 0 when they ran the same thing, 1 on hard drift and 2 when they can't be compared; `--json` prints the comparison. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ne attempt read is drift only when both ran them A resume runs only the rest of a task's steps, which read less, so an entity its first attempt read and it didn't is no difference. Each attempt now records the ids of the steps it was asked to run (`steps_run`, from its start step to its end step), and the comparator counts an entity only one attempt read as hard drift when both ran the same steps, as when the configured default agent changed between two full runs, and otherwise leaves such entities out, saying how many and why. `steps_run` itself is never drift. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…1 is only ever a verdict Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s alone, and what each read is indexed once An attempt records its env, artifact and provider types once it finishes, so a killed one's runtime lists its step types alone; those it didn't record aren't differences. Each attempt's reads are indexed once per comparison, so two attempts with 3,000 reads compare in tens of milliseconds rather than seconds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tings, and a run records the formats it prescribes A rubrics judge's settings record the trajectory source of each turn it read, the host its calls reached and which settings a run's overrides changed. Compared as settings, two runs alike but for their conversations' length were hard drift with a regrade offered. Now each has a row of its own: the formats a judge read, however many turns, soft, as a copy that failed is read natively; the host its calls reached soft, as a role's endpoint host is; the names of the settings overrides changed never, as their values are compared. Each attempt records the trajectory formats it prescribes (`trajectory_formats`, from its overrides or else the config), hard, so a change of what judges are given stays hard, and the override itself isn't compared twice. The judges write these keys by the names the comparator reads them by. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…prescribed formats compare without false drift A judge's per-turn trajectory sources past the settings' inline cap are kept as their hash, so the comparator couldn't read them. The judge now also records the distinct formats it read (`trajectory_formats_read`), a few names, which the comparator reads; a record that keeps only the hash, and no summary, isn't compared on them, and the listing says so. An attempt recorded before its prescribed formats were is compared by its own `trajectory_formats` override, and one that records neither isn't compared on them, with a note, rather than counted as a change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e compare without false drift From a review of the comparator against runs that ran the same thing: - Each attempt records whether it completed the steps it ran (`completed`: none failed, tolerated or not, and no cancel). An entity only one attempt read, or a type only one used, is a difference only when both ran and completed the same steps, so a run that failed early is no longer hard drift for what it didn't reach. - Where a run's sandboxes run is soft by every key that says so (`SANDBOX_OVERRIDE_KEYS`, which `sandbox_overrides` sets, `sandbox` included), and a judge's `judge_sandbox_type` is compared as where it ran, soft. - The override row leaves out each role's model and endpoint, which the role rows compare as they resolve; a secret's reference, as an API key's, is never drift; a step's `step_params` are compared each by name, an endpoint among them soft. - A grade's settings are compared where both verifiers started with the same value, so a setting they started with otherwise is one difference and its graded value isn't misread. - Pins are compared when an attempt's reads aren't recorded, and the listing says "in what both recorded" when anything wasn't compared. - A trajectory formats value named wrongly records None for that field rather than dropping the attempt's records. - The grading-evidence and placement settings are sets in the verifier base, and the registry's name in a record is one helper (`registry_name`) the recorder and the comparator share. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…override or a failed grade compares without missing or false drift - `Task.run` notes each step it dispatches and whether it reached its end, a verdict that fails the step included (`step_dispatched`, `step_ended`). `steps_run` (now on the lock beside `completed`) is the steps it ran, in the task's order, a retry's included, so a resume whose retry reruns an earlier step says so; `completed` is that each reached its end, so a verifier that graded "not passing" no longer makes its attempt incomplete. - Model overrides (`agent_model`, `user_model`, `judge_model`) are compared again, hard: a role's model is resolved where no step names one, so a run given the config's model where the task's step names another read as alike. Only endpoint overrides are left to the role rows. - A failed grade's settings aren't the attempt's graded settings: its calls hadn't filled in what they fill in. - What a row can't compare it says why: each row declares its own reason, and the comparison gathers them, so a type only one attempt used is now said, and a trajectory formats override that isn't a list is named as such. - `RUN_ENDPOINT_OVERRIDES` is exported from `config/model.py` and shared; the step-params check names `step_params`; AGENTS.md keeps the comparator's invariants and points at `ROWS`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ask diff puts before it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… said not to be compared The formats row now lists every verifier both attempts graded, so its reason for one it can't compare is said even when neither attempt has a summary, rather than the listing saying "the same thing ran" unqualified. 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
The second of three pieces that let two runs of a task be told apart and compared. The first (#967) has each attempt of a run record what ran it and what it was asked to do and read. This one says which differences between two attempts' records matter, by the lock table, and lists them with a new command.
task/drift.pycompares two attempts' records (compare) row by row (ROWS). Each difference carries its row, the key within the row that differs, both values, and its class (Drift):regrade, since their grades can't be compared until one is regraded under the other's rules.agent-env task diff A [B]lists every difference. Each of A and B names a task instance, for its latest attempt, or one attempt asINSTANCE@EPOCH. With A alone, its first attempt is compared with its latest, as a run with its resume. It exits 0 when they ran the same thing, 1 on hard drift, and 2 when they can't be compared, any error reading the store included, so 1 is only ever a verdict.--jsonprints the comparison.steps_run, the steps it actually ran, in the task's order, a retry's included, as a resume runs only the rest and a retry may rerun an earlier step;completed, whether each of them reached its end: it returned, or raised a verdict once it had graded (VerifierNotPassingError,JudgeDisagreementError); an error or a cancel stops it short.Task.runnotes each step as it dispatches it and how it ended (step_dispatched,step_ended), and a worker that runs steps itself does the same;trajectory_formats, the trajectory formats it prescribes to the agents whose trajectories its judges read, from its overrides or else the config. A value named wrongly records None for this field alone.judge_endpoint_host,trajectory_sources,overridden) by constants in the verifier base, which the comparator reads by. A rubrics judge also records the distinct formats it read (trajectory_formats_read), a few names, since its per-turn list past the settings' inline cap is kept only as its hash.The lock table
steps_hash, the seed applied)step_paramsby its name, a role's model among themagent_sandbox,env_sandboxandsandboxoverrides, and where a verifier's judge ranstep_paramsnameNot compared, each with its reason in
NOT_COMPARED: the attempt epoch, the stage and the record version. The endpoint overrides (litellm_base_url,judge_litellm_base_url) and the trajectory formats override aren't listed as overrides, since the role rows and the prescribed formats compare them as they resolve. What a row can't compare it says why (Comparison.not_compared): each row declares its own reason, and the comparison gathers them. A test holds that every field of the records is in a row or inNOT_COMPARED, so a field added later can't go unclassified.Choices made here, for review
task diff. The design's other callers, the eval engine's resume, rerun and compare, don't exist yet, and no eval-level lock is stored yet. They call the samecompareand decide on its classes: refuse hard drift unless--allow-drift, which marks the eval instancenot_like_for_like, offer a regrade first, warn on soft drift. That policy,--allow-driftandnot_like_for_likecome with them, as nothing here would consume them.never. So rebuilding an unchanged build context, which puts a new version with the samesource:identity, is the same image.verifierrow, the role's model row, the plugin's version row. Its other fields are compared only where both attempts have it.set while gradingrow compares only the settings a verifier's grade records differently from how it started, such as a judge's model it resolves as it calls. A setting changed from the start is reported once, by the starting settings' row.env:API key, is never drift. Where a run's sandboxes run is soft by every keysandbox_overridessets,sandboxincluded, and by where a judge the step deploys ran (judge_sandbox_type). A step'sstep_paramsare compared each by name, an endpoint among them soft, as the trl harness gives each episode its own.trajectory_formatsoverride would otherwise list a second time. A record that keeps a judge's formats only as a hash, with no summary, isn't compared on them, and the listing says so.steps_runortrajectory_formats. One withoutsteps_runis compared only on the entities both attempts read. One withouttrajectory_formatsis compared by its owntrajectory_formatsoverride, and one with neither isn't compared on them. Each case comes with a note, never a false difference.agent_effortoverride (or the step's owneffort, in its content), and an unrecorded macOS build as the computer image's identity.Not in this PR
--allow-driftandnot_like_for_like.Tests
tst/unit/task/drift_test.py:NOT_COMPARED, and every row has a case.regradewhere the table says.never; at another identity, both its version and its identity are hard.step_paramsis its own override.sandboxis soft, as is where a judge ran; an endpoint override is the role rows', and soft instep_params; an API key's reference is never drift; a model override is hard though the role it names resolves alike. Two judges that started with different effort are one difference however they graded.tst/unit/cli/task_diff_test.py: exit 0, 1 and 2, the listing, the regrade line, an instance alone,INSTANCE@EPOCH(a local id starts with@),--json, a store that fails exiting 2, and two realTask.runruns with differentstep_paramsplus a resume that starts after the step that reads entities, through the command.tst/unit/task/run_lock_test.py: the steps an attempt ran and whether each reached its end, for every way it ends (every step passing, a step failing the run, a failure tolerated, a step retried then passing, a verifier's verdict failing the run, a cancel), a retry within a resume that reruns an earlier step, a failed grade recording no graded settings, and the formats it prescribes from the config and from the run, a value named wrongly recording None and the rest.Tested on Linux hosts
On fresh EC2 hosts with the stores on SQLite, MongoDB 7 (a one-node replica set) and DynamoDB Local, at 550ddeb, this PR's head. Model spend was a few cents of Haiku and Sonnet.
unzipfor two, and the twomcp_cli_buildercodegen tests. They fail the same way onmain.agent-env task diffover real runs (task run,LocalRunner,agent-env run), on each backend, with 0 problems:--judge-modelis hard drift in the judge's role model;neverand exits 0;never, and the entities only the passing one read aren't compared, with a note;LocalRunnerfrom step 1, compared with its first attempt by its instance alone, exits 0: its first attempt ran the steps up to the one that failed and the resume the rest, bothnever, and the entities only the first read aren't compared;--jsonparses, and a missing instance or a lone attempt exits 2;agent-env runbundle runs in the@localnamespace exit 0.task diffreads, 60 rounds on MongoDB and on DynamoDB Local, half of them a pair that differs: 120 of 120 gave the right verdict. Over every run, a round that couldn't read the store exited 2 naming its error, never a wrong verdict.agent-env run:--judge-model claude-sonnet-5-5is hard drift in the judge's model and in the override, with a regrade offered, and the names of the settings the override changed asnever;--sandbox localexits 0: the three sandbox overrides, soft.The "Integration Tests" check fails on modal 1.7.0, released 2026-11-30, which removed
modal.Sandbox._experimental_create: its unlocked install took 1.7.0, and four Modal provider unit tests fail, the same on any branch. This PR doesn't touch Modal. The checks that install fromuv.lock, which pins modal 1.6.3, pass. It's being fixed separately.🤖 Generated with Claude Code
Confidence Score: 5/5

The PR appears safe to merge.Summary
Adds
agent-env task diffto compare attempts by the lock table.All six supplied previous findings are addressed in the current code. No new actionable issues were found.
Reviews (15) · Last reviewed commit: "fix(task): a judge whose formats both at..." · Reviewed by Greptile