Evaluation and QualityAgent task and trajectory outcomesPrincipal
How would you separate coding-agent errors from nondeterministic test results?
By Amit Kumar2 min readWorked answer includedReviewed 28 Sept 2026
The question
Interview question
A fixed patch from a coding agent passes the evaluator once and fails twice without any regenerated code. Decide how to identify whether the patch introduced a race or the evaluator is unstable. Explain the controls, reference artifacts and reporting policy you need before comparing models or using pass/fail as a training reward.
Draft your approach first
Take a few minutes before you read the answer. Name the constraint that matters most, the failure you are designing for and how you would know it worked.
Reveal the worked answerWorked answer
Hold the patch fixed and rerun the evaluator. If the pass result flips, the variation cannot be attributed to a new model output in those runs. Maybe the test depends on timing, external data, order, a random seed or a shared resource. Pytest's flaky-test guidance defines the basic phenomenon: a test can intermittently pass or fail under apparently unchanged code.
For example, a test may allocate a fixed network port that another trial is using. The reference patch and candidate both fail only under parallel execution, pointing toward a shared test resource. In a different case, only the candidate fails when two threads update the same counter, while the reference uses synchronization. That is evidence of a candidate race, not permission to discard an inconvenient test. The control artifact and controlled schedule distinguish the hypotheses.
For an agent benchmark, this is more than a noisy CI inconvenience. The verifier supplies the success label, and sometimes the training reward. A patch that passes one out of three runs might be a correct solution exposed to a bad test, or an incorrect solution exploiting a flaky assertion. Treating the best run as truth inflates success. Treating a single failure as truth can reject a good patch. Repeatedly trying until green also creates an extra attempt budget, separate from the agent's ability to write code.
I would pin the repository commit, dependency versions, test image, input data and environment. Run the same artifact several times with test order and parallelism varied in a controlled way. Record failing assertions, seed, timing and external calls. Compare with a known reference patch and the original failing repository. If the reference also flips, isolate or repair the test. If only this patch flips, inspect whether it introduced a race or relies on an unstable behavior. “Flaky test” is not automatically an excuse for the candidate.
For reporting, separate stable passes, stable failures and unresolved nondeterministic cases. State the rerun policy before looking at candidate results and apply it equally across models. Do not silently exclude unstable cases from one model's denominator or award pass on any green run. For training, quarantine uncertain rewards until the verifier can be trusted, otherwise the policy may learn to chase lucky outcomes.
The deeper question is what the benchmark measures. It should measure whether the agent solved the task under a defined execution contract. If the contract itself changes from run to run, a point estimate of agent quality carries false precision.
Related questions
Keep practising evaluation and quality
Follow another question in this area, or search the complete library.
Get my essays on AI engineering and distributed systems by email. Subscribe to ArchCrux