From 29c8a838ee943d85ae50d37c5ddad38035561ff0 Mon Sep 17 00:00:00 2001 From: Hugo Dutka Date: Mon, 27 Jul 2026 11:48:35 +0000 Subject: [PATCH] fix(coderd/x/chatd): avoid request recorder race --- coderd/x/chatd/chatd_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/coderd/x/chatd/chatd_test.go b/coderd/x/chatd/chatd_test.go index 4d7d31629b3..7accb04b464 100644 --- a/coderd/x/chatd/chatd_test.go +++ b/coderd/x/chatd/chatd_test.go @@ -6343,7 +6343,6 @@ func TestActiveServer_BasicAssistantGenerationAndPromptPreparation(t *testing.T) require.GreaterOrEqual(t, last.RuntimeMs.Int64, int64(0)) requireTextPart(t, last, "done") - requests = newAnthropicRequestRecorder() server = newActiveTestServer(t, db, ps, func(cfg *chatd.Config) { cfg.AIBridgeTransportFactory = chatAIGatewayTransportFactoryPointer(chattest.NewMockAIBridgeTransport(t, anthropicURL, chattest.WithPreservePath())) }) @@ -6358,9 +6357,10 @@ func TestActiveServer_BasicAssistantGenerationAndPromptPreparation(t *testing.T) require.NoError(t, err) waitForChatStatus(ctx, t, db, planChat.ID, database.ChatStatusWaiting) - planRequests := filterAnthropicStreamingRequests(requests.all()) - require.Len(t, planRequests, 1) - toolNames = anthropicRequestToolNames(planRequests[0]) + allGenerationRequests := filterAnthropicStreamingRequests(requests.all()) + require.Len(t, allGenerationRequests, len(generationRequests)+1) + planRequest := allGenerationRequests[len(generationRequests)] + toolNames = anthropicRequestToolNames(planRequest) require.Contains(t, toolNames, "read_file") require.NotContains(t, toolNames, "write_file") }