fix: stabilize TestExecutorAutostopAIAgentActivity#26004
Draft
zedkipp wants to merge 1 commit into
Draft
Conversation
The test computed tick times from the test-side time.Now() and relied on the database NOW() inside ActivityBumpWorkspace landing in the same minute. Executor.runOnce truncates the tick to the minute, so when time.Now() fired in the last few hundred milliseconds of a minute the bumped deadline overshot the truncated tick by less than 60 seconds. GetWorkspacesEligibleForTransition filters with deadline < @now and excluded the workspace, leaving stats.Transitions empty. Anchor both tick times to workspace_builds.deadline read back from the database after the working PatchAppStatus. bumpedDeadline.Add(time.Minute) truncates strictly above the deadline for any sub-minute remainder, making the autostop tick deterministic.
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.
The test computed tick times from the test-side wall clock and relied on the database
NOW()insideActivityBumpWorkspacelanding in the same minute.Executor.runOncetruncates the tick to the minute, so whentime.Now()fired in the last few hundred milliseconds of a minute the bumped deadline overshot the truncated tick by less than 60 seconds.GetWorkspacesEligibleForTransitionfilters withdeadline < @nowand excluded the workspace, leavingstats.Transitionsempty.Anchor both tick times to
workspace_builds.deadlineread back from the database after the workingPatchAppStatus. bumpedDeadline.Add(time.Minute)truncates strictly above the deadline for any sub-minute remainder, making the autostop tick deterministic.