Repository navigation
Conversation
on_turn had a type in each signature and a three-line note in one docstring (AuditExperiment.run_scenario_reps), and nothing in the README. Which roles fire when, what turn_index and max_turns mean, and what happens on a failure were only recoverable by reading run_scenario and SingleTurnAuditor side by side. OnTurn in model_auditor.py now names the callback type and documents the contract as the code behaves today, measured on both runners: "auditor" only when the auditor wrote the probe, so not on a test_prompt turn; "target" per turn; "judge" once, at max_turns - 1, including on a parse-failure judgment; nothing from a call that raised, and nothing after it. It also records what the arguments do not carry: no scenario name, so calls interleave under max_workers > 1, and a retried rep in run_scenario_reps fires again. The signatures use the alias, the README parameter table gets an on_turn row, and the run_scenario_reps docstring points to the alias. No behaviour change: with docstrings stripped, the AST of the three changed modules differs only in the nine annotations, the alias and the imports that bring it in. One test runs ModelAuditor and SingleTurnAuditor and asserts the full sequence for each, including the target-down and judge-down paths. It passes on the unchanged code too, since it pins existing behaviour.
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.
on_turnhad a type in each signature, a three-line note in therun_scenario_repsdocstring, and nothing in the README. Which roles fire when, whatturn_indexandmax_turnsmean, and what happens on a failure could only be recovered by readingrun_scenarioandSingleTurnAuditorside by side. I mentioned this on #95.What changes
OnTurninmodel_auditor.pynames the callback type and documents the contract as the code behaves today, measured on both runners:"auditor"only when the auditor wrote the probe, so not on atest_promptturn"target"per turn"judge"once, atmax_turns - 1, including when the judgment is a parse-failure ERRORmax_workers > 1, and a retried rep inrun_scenario_repsfires againThe nine
on_turnannotations use the alias, the README parameter table gets anon_turnrow, and therun_scenario_repsdocstring points to the alias.OnTurnis not exported fromsimpleaudit/__init__.py.No behaviour change: with docstrings stripped, the AST of the three changed modules differs only in the nine annotations, the alias and the imports that bring it in.
Testing
TestOnTurnContractintests/test_single_turn.pyrunsModelAuditorandSingleTurnAuditorand asserts the full sequence for each, including the target-down and judge-down paths. It passes on the unchanged code too, since it pins existing behaviour. Shifting the single-turn judge index from(0, 1, …)to(1, 1, …)fails it.1349 passed, 19 skipped on Python 3.13.15, against 1348 on
e5ec692in the same environment.Two edges, documented, not changed
ModelAuditor(max_turns=0)runs no turns, fires(-1, 0, "judge")and judges an empty conversation aspass. The contract statesmax_turnsis assumed to be at least 1.async defcallback is called but not awaited, so its body never runs. The contract says the callback must be a plain function.Either could be its own PR if wanted.
A note from a trial merge
Merging
main(9783293) into this branch gives no text conflicts, and the same holds fore5ec692alone. With or without this PR, the merged tree failstest_single_turn.py::TestEntryPoints::test_run_sync_does_not_fall_back_to_the_turn_loopwithTypeError: SingleTurnAuditor.run_async() got an unexpected keyword argument 'evidence_resolver', sincemainnow passesevidence_resolverfromrun(). Worth knowing before the next sync.