Repository navigation
Claim a pending evaluation run before replaying it - #713
Merged
Merged
Conversation
EvaluationRunJob checked `run.pending?` and the scenario runner then wrote `running`, as two steps. A job delivered twice, or two workers that both loaded the run as pending, each replayed the whole suite (every replay a billed provider call that may call the agent's tools), or with scenario_evaluation_fan_out on each enqueued a full set of replay jobs. ScenarioEvaluationRunner#call now moves the run from pending to running in one conditional update, as AgentExecutionJob#claim_pending does, and a runner that loses the claim returns without writing to the run. The claim sits in the runner, so ProjectEvaluationJob, which has the same check-then-run shape, is covered as well. It happens before the selection is read, so a selection that raises (an unsupported provider in a re-run's models) now fails the run instead of leaving it pending forever: `run` was still unassigned when the rescue ran.
11 of 19 tasks
1 task done
Merged
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 this does
EvaluationRunJobcheckedrun.pending?, and the scenario runner wroterunninglater, as two steps. A job delivered twice, or two workers that both loaded the run as pending, each replayed the whole suite: every replay a billed provider call that may call the agent's tools. Withscenario_evaluation_fan_outon, each enqueued a full set ofEvaluationReplayJobs.ProjectEvaluationJobhas the same check-then-run shape.ScenarioEvaluationRunner#callnow claims the run first with one conditional update (pending→runningwhere the status is stillpending), asAgentExecutionJob#claim_pendingdoes since #664. A runner that loses the claim returns the run without writing to it. The claim sits in the runner rather than in each job, soEvaluationRunJob,ProjectEvaluationJoband anyrun!(run:)caller are covered. Nothing is held over the replays, and there is no migration.Claiming first also fixes a second bug in the same lines.
runused to be assigned only afterselected_scenariosandmodel_specs, so an error raised there reached the rescue withrun == nil, and a run created byrun_later!stayed pending forever. One example is a re-run whose stored model names a provider the dashboard does not support. Such a run now fails with the error.Unchanged: a worker that dies after the claim leaves the run
running. That is the gap #664 describes for agent runs, and recovering from it belongs with #674.Tests, in
actionagent/test/evaluation_run_claim_test.rb:failedinstead of stayingpending.running,completeorfailedrun as it is.Type of change
Scope check
Related issue
None filed. This is the evaluation-run counterpart of #662/#664.
Quality check
bin/rubocopon the changed files)CliContractTest(rack-sessionundefined method 'id' for Hash), which fail identically on an untouchedmainin this environmentOwnership
API changes