diff --git a/coderd/exp_chats_test.go b/coderd/exp_chats_test.go index a804ea7031..69c29d71e7 100644 --- a/coderd/exp_chats_test.go +++ b/coderd/exp_chats_test.go @@ -6688,7 +6688,7 @@ func TestSendMessageQueuesEffectiveModelConfigID(t *testing.T) { t.Parallel() ctx := testutil.Context(t, testutil.WaitLong) - client, db := newChatClientWithDatabase(t) + client, db := newChatClientWithDatabase(t, withChatWorkerDisabled) user := coderdtest.CreateFirstUser(t, client.Client) modelConfigA := createChatModelConfig(t, client) modelConfigB := createAdditionalChatModelConfig(t, client, coderdtest.TestChatProviderOpenAICompat, "gpt-4o-mini-queued-"+uuid.NewString()) @@ -6739,7 +6739,7 @@ func TestQueuedMessageWithoutOverrideCapturesEnqueueTimeModel(t *testing.T) { t.Parallel() ctx := testutil.Context(t, testutil.WaitLong) - client, db := newChatClientWithDatabase(t) + client, db := newChatClientWithDatabase(t, withChatWorkerDisabled) user := coderdtest.CreateFirstUser(t, client.Client) modelConfigA := createChatModelConfig(t, client) modelConfigB := createAdditionalChatModelConfig(t, client, coderdtest.TestChatProviderOpenAICompat, "gpt-4o-mini-later-"+uuid.NewString()) @@ -6866,7 +6866,7 @@ func TestWatchChatsStatusChangeCarriesUpdatedLastModelConfigID(t *testing.T) { t.Parallel() ctx := testutil.Context(t, testutil.WaitLong) - client, db := newChatClientWithDatabase(t) + client, db := newChatClientWithDatabase(t, withChatWorkerDisabled) user := coderdtest.CreateFirstUser(t, client.Client) modelConfigA := createChatModelConfig(t, client) modelConfigB := createAdditionalChatModelConfig(t, client, coderdtest.TestChatProviderOpenAICompat, "gpt-4o-mini-watch-promote-"+uuid.NewString()) @@ -8421,7 +8421,7 @@ func TestInterruptChat(t *testing.T) { t.Parallel() ctx := testutil.Context(t, testutil.WaitLong) - client, db := newChatClientWithDatabase(t) + client, db := newChatClientWithDatabase(t, withChatWorkerDisabled) user := coderdtest.CreateFirstUser(t, client.Client) modelConfig := createChatModelConfig(t, client) @@ -9674,7 +9674,7 @@ func TestPromoteChatQueuedMessage(t *testing.T) { t.Parallel() ctx := testutil.Context(t, testutil.WaitLong) - client, db := newChatClientWithDatabase(t) + client, db := newChatClientWithDatabase(t, withChatWorkerDisabled) user := coderdtest.CreateFirstUser(t, client.Client) modelConfig := createChatModelConfig(t, client) @@ -9800,7 +9800,7 @@ func TestPromoteChatQueuedMessage(t *testing.T) { t.Parallel() ctx := testutil.Context(t, testutil.WaitLong) - client, db := newChatClientWithDatabase(t) + client, db := newChatClientWithDatabase(t, withChatWorkerDisabled) user := coderdtest.CreateFirstUser(t, client.Client) modelConfig := createChatModelConfig(t, client) @@ -14207,6 +14207,11 @@ func TestSubmitToolResults(t *testing.T) { // inserts an assistant message containing tool-call parts for each // given toolCallID, and sets the chat status to requires_action. // It returns the chat row so callers can exercise the endpoint. + // + // Callers must build their coderd with withChatWorkerDisabled: an + // unowned requires_action chat is a worker acquisition candidate, + // and a takeover would synthesize tool cancellations and change the + // chat status underneath the test. setupRequiresAction := func( ctx context.Context, t *testing.T, @@ -14271,7 +14276,7 @@ func TestSubmitToolResults(t *testing.T) { t.Parallel() ctx := testutil.Context(t, testutil.WaitLong) - client, db := newChatClientWithDatabase(t) + client, db := newChatClientWithDatabase(t, withChatWorkerDisabled) user := coderdtest.CreateFirstUser(t, client.Client) modelConfig := createChatModelConfig(t, client) @@ -14288,10 +14293,9 @@ func TestSubmitToolResults(t *testing.T) { }) require.NoError(t, err) - // Verify status is no longer requires_action. The chatd - // loop may have already picked the chat up and - // transitioned it further (pending → running → …), so we - // accept any non-requires_action status. + // Verify status is no longer requires_action. The worker is + // disabled, so the transition comes from SubmitToolResults + // itself. gotChat, err := client.GetChat(ctx, chat.ID) require.NoError(t, err) require.NotEqual(t, codersdk.ChatStatusRequiresAction, gotChat.Status, @@ -14339,7 +14343,7 @@ func TestSubmitToolResults(t *testing.T) { t.Parallel() ctx := testutil.Context(t, testutil.WaitLong) - client, db := newChatClientWithDatabase(t) + client, db := newChatClientWithDatabase(t, withChatWorkerDisabled) user := coderdtest.CreateFirstUser(t, client.Client) modelConfig := createChatModelConfig(t, client) @@ -14361,7 +14365,7 @@ func TestSubmitToolResults(t *testing.T) { t.Parallel() ctx := testutil.Context(t, testutil.WaitLong) - client, db := newChatClientWithDatabase(t) + client, db := newChatClientWithDatabase(t, withChatWorkerDisabled) user := coderdtest.CreateFirstUser(t, client.Client) modelConfig := createChatModelConfig(t, client) @@ -14383,7 +14387,7 @@ func TestSubmitToolResults(t *testing.T) { t.Parallel() ctx := testutil.Context(t, testutil.WaitLong) - client, db := newChatClientWithDatabase(t) + client, db := newChatClientWithDatabase(t, withChatWorkerDisabled) user := coderdtest.CreateFirstUser(t, client.Client) modelConfig := createChatModelConfig(t, client) @@ -14413,7 +14417,7 @@ func TestSubmitToolResults(t *testing.T) { t.Run("DuplicateToolCallID", func(t *testing.T) { t.Parallel() ctx := testutil.Context(t, testutil.WaitLong) - client, db := newChatClientWithDatabase(t) + client, db := newChatClientWithDatabase(t, withChatWorkerDisabled) user := coderdtest.CreateFirstUser(t, client.Client) modelConfig := createChatModelConfig(t, client) @@ -14436,7 +14440,7 @@ func TestSubmitToolResults(t *testing.T) { t.Parallel() ctx := testutil.Context(t, testutil.WaitLong) - client, db := newChatClientWithDatabase(t) + client, db := newChatClientWithDatabase(t, withChatWorkerDisabled) user := coderdtest.CreateFirstUser(t, client.Client) modelConfig := createChatModelConfig(t, client) @@ -14455,7 +14459,7 @@ func TestSubmitToolResults(t *testing.T) { t.Parallel() ctx := testutil.Context(t, testutil.WaitLong) - client, db := newChatClientWithDatabase(t) + client, db := newChatClientWithDatabase(t, withChatWorkerDisabled) user := coderdtest.CreateFirstUser(t, client.Client) modelConfig := createChatModelConfig(t, client) @@ -14484,7 +14488,7 @@ func TestSubmitToolResults(t *testing.T) { t.Parallel() ctx := testutil.Context(t, testutil.WaitLong) - client, db := newChatClientWithDatabase(t) + client, db := newChatClientWithDatabase(t, withChatWorkerDisabled) firstUser := coderdtest.CreateFirstUser(t, client.Client) modelConfig := createChatModelConfig(t, client) @@ -14512,7 +14516,7 @@ func TestSubmitToolResults(t *testing.T) { t.Parallel() ctx := testutil.Context(t, testutil.WaitLong) - client, db := newChatClientWithDatabase(t) + client, db := newChatClientWithDatabase(t, withChatWorkerDisabled) user := coderdtest.CreateFirstUser(t, client.Client) modelConfig := createChatModelConfig(t, client)