fix: scope title regeneration per chat (#23729)

Previously, generating a new agent title used a page-global pending
state, so one in-flight regeneration disabled the action for every chat
in the Agents UI.

This change tracks regenerations by chat ID, updates the Agents page
contracts to use `regeneratingTitleChatIds`, and adds sidebar story
coverage that proves only the active chat is disabled.
This commit is contained in:
Michael Suchacz
2026-03-29 00:01:53 +01:00
committed by GitHub
parent a399aa8c0c
commit bfeb91d9cd
12 changed files with 358 additions and 108 deletions
+4 -3
View File
@@ -3677,11 +3677,12 @@ func TestRegenerateChatTitle(t *testing.T) {
)
require.NoError(t, err)
defer res.Body.Close()
require.Equal(t, http.StatusConflict, res.StatusCode)
require.Equal(t, http.StatusOK, res.StatusCode)
var resp codersdk.Response
var resp codersdk.Chat
require.NoError(t, json.NewDecoder(res.Body).Decode(&resp))
require.Equal(t, "Title regeneration already in progress for this chat.", resp.Message)
require.Equal(t, chat.ID, resp.ID)
require.Equal(t, "pending chat without worker", resp.Title)
persisted, err := db.GetChatByID(dbauthz.AsSystemRestricted(ctx), chat.ID)
require.NoError(t, err)