Skip to content

fix: stabilize TestExecutorAutostopAIAgentActivity#26004

Draft
zedkipp wants to merge 1 commit into
mainfrom
zedkipp/fix-ai-agent-autostop-flake
Draft

fix: stabilize TestExecutorAutostopAIAgentActivity#26004
zedkipp wants to merge 1 commit into
mainfrom
zedkipp/fix-ai-agent-autostop-flake

Conversation

@zedkipp
Copy link
Copy Markdown
Contributor

@zedkipp zedkipp commented Jun 2, 2026

The test computed tick times from the test-side wall clock 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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant