From feb7695948a9b40d11e04347f6c3dc649c7ad03b Mon Sep 17 00:00:00 2001 From: Hugo Dutka Date: Wed, 19 Aug 2026 09:06:06 +0000 Subject: [PATCH] fix(coderd): remove per-chat system prompt limit --- coderd/exp_chats.go | 9 --------- coderd/exp_chats_test.go | 21 --------------------- 2 files changed, 30 deletions(-) diff --git a/coderd/exp_chats.go b/coderd/exp_chats.go index d725fef4d5b..e4d382c0f26 100644 --- a/coderd/exp_chats.go +++ b/coderd/exp_chats.go @@ -1310,15 +1310,6 @@ func (api *API) postChats(rw http.ResponseWriter, r *http.Request) { return } - // Validate per-chat system prompt length. - const maxSystemPromptLen = 10000 - if len(req.SystemPrompt) > maxSystemPromptLen { - httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{ - Message: "System prompt exceeds maximum length.", - Detail: fmt.Sprintf("System prompt must be at most %d characters, got %d.", maxSystemPromptLen, len(req.SystemPrompt)), - }) - return - } contentBlocks, titleSource, inputError := createChatInputFromRequest(ctx, api.Database, req) if inputError != nil { httpapi.Write(ctx, rw, http.StatusBadRequest, *inputError) diff --git a/coderd/exp_chats_test.go b/coderd/exp_chats_test.go index 1d2111b4cef..da0edd73215 100644 --- a/coderd/exp_chats_test.go +++ b/coderd/exp_chats_test.go @@ -843,27 +843,6 @@ func TestPostChats(t *testing.T) { } }) - t.Run("PerChatSystemPromptTooLong", func(t *testing.T) { - t.Parallel() - - ctx := testutil.Context(t, testutil.WaitLong) - client := newChatClient(t) - user := coderdtest.CreateFirstUser(t, client.Client) - _ = createChatModelConfig(t, client) - - longPrompt := strings.Repeat("a", 10001) - _, err := client.CreateChat(ctx, codersdk.CreateChatRequest{ - OrganizationID: user.OrganizationID, Content: []codersdk.ChatInputPart{ - { - Type: codersdk.ChatInputPartTypeText, - Text: "hello", - }, - }, - SystemPrompt: longPrompt, - }) - requireSDKError(t, err, http.StatusBadRequest) - }) - t.Run("WorkspaceNotAccessible", func(t *testing.T) { t.Parallel()