From acd5f01b4b452fa1c8c23ef40f42a8da9ad8ee86 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Mon, 6 Apr 2026 22:08:49 -0400 Subject: [PATCH] fix: use GreaterOrEqual for step runtime assertion in chatloop test (#24067) Fixes https://github.com/coder/internal/issues/1418 The `TestRun_ActiveToolsPrepareBehavior` test asserts `persistedStep.Runtime > 0`, but on Windows the timer resolution (~15ms) means the in-memory mock model can complete within the same clock tick, producing a measured duration of `0s`. Change the assertion from `require.Greater` to `require.GreaterOrEqual` so that a legitimately measured zero duration on low-resolution clocks does not cause a flake. > Generated by Coder Agents --- coderd/x/chatd/chatloop/chatloop_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/coderd/x/chatd/chatloop/chatloop_test.go b/coderd/x/chatd/chatloop/chatloop_test.go index 05bf3bf181..6424810934 100644 --- a/coderd/x/chatd/chatloop/chatloop_test.go +++ b/coderd/x/chatd/chatloop/chatloop_test.go @@ -70,8 +70,8 @@ func TestRun_ActiveToolsPrepareBehavior(t *testing.T) { require.Equal(t, 1, persistStepCalls) require.True(t, persistedStep.ContextLimit.Valid) require.Equal(t, int64(4096), persistedStep.ContextLimit.Int64) - require.Greater(t, persistedStep.Runtime, time.Duration(0), - "step runtime should be positive") + require.GreaterOrEqual(t, persistedStep.Runtime, time.Duration(0), + "step runtime should be non-negative") require.NotEmpty(t, capturedCall.Prompt) require.False(t, containsPromptSentinel(capturedCall.Prompt))