test(cron): stabilize model precedence test and fix potential flakes#32165
Closed
markfietje wants to merge 4 commits intoopenclaw:mainfrom
Closed
test(cron): stabilize model precedence test and fix potential flakes#32165markfietje wants to merge 4 commits intoopenclaw:mainfrom
markfietje wants to merge 4 commits intoopenclaw:mainfrom
Conversation
This was referenced Mar 2, 2026
Contributor
Greptile SummaryStabilized the cron model precedence test by addressing two root causes of intermittent failures:
The changes are minimal, focused, and directly address the stated problems without introducing new risks. Confidence Score: 5/5
Last reviewed commit: 6cd6a48 |
6cd6a48 to
5af2616
Compare
Contributor
Author
|
Closing as this has been superseded by internal stabilization fixes in main (e.g., 1212328). Glad to see the session store race is resolved. |
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.
Summary
This PR stabilizes the cron model precedence tests to prevent intermittent CI failures caused by shared mock state or session clobbering.
Problem
Intermittent failures were observed in
src/cron/isolated-agent.uses-last-non-empty-agent-text-as.test.tswhere expectations onrunEmbeddedPiAgentwould fail (e.g., receivinganthropicwhenopenaiwas expected).This was likely due to:
mock.calls.at(-1)is sensitive to parallel or unexpected internal calls.cron:job-1) across multiple sequential calls in a test could lead to persistence race conditions if background tasks were involved.Solution
expectEmbeddedProviderModelto usetoHaveBeenCalledWithwithexpect.objectContaining, which is more robust than checking the last call manually.runTurnWithStoredModelOverrideuses unique session keys for each distinct verification step within the test case.Verification
src/cron/isolated-agent.uses-last-non-empty-agent-text-as.test.tspass locally.pnpm checkandpnpm tsgopass 100% green.