feat: remove unused chat statuses pending, paused, and completed (#27064)

The chatd state machine only recognizes `waiting`, `running`, `error`,
`requires_action`, and `interrupting`. Remove the unused `pending`,
`paused`, and `completed` values from the database enum, backend, SDK,
frontend, generated queries, and API docs.

Migration `000543_chat_status_remove_unused` remaps existing `pending`
rows to `running`, remaps `paused` and `completed` rows to `waiting`,
drops the obsolete `idx_chats_pending` index, and recreates
`chats_expanded` around the enum swap. It also removes the dead
`AcquireChats` query and all remaining query literals for the deleted
statuses.

**NOTE**: The enum swap can break chat queries from older replicas
during a mixed-version rollout because they still reference
`'pending'::chat_status`. Chats are experimental, so this PR accepts
that limited rollout window instead of adding a two-release expand and
contract sequence.

> This PR was authored by Mux (AI agent) on Mike's behalf.
This commit is contained in:
Michael Suchacz
2026-07-13 20:28:28 +02:00
committed by GitHub
parent e0b57f3154
commit 6f6d7539c8
53 changed files with 293 additions and 878 deletions
+8 -8
View File
@@ -1280,11 +1280,11 @@ func TestChatContextHydration(t *testing.T) {
hashH := []byte{0x01, 0x02, 0x03}
hashOther := []byte{0xff, 0xee}
chatNull := newChat(database.ChatStatusWaiting, agent.ID) // never hydrated
chatMatch := newChat(database.ChatStatusRunning, agent.ID) // already at hashH
chatDrift := newChat(database.ChatStatusRunning, agent.ID) // drifted, active
chatTerminal := newChat(database.ChatStatusCompleted, agent.ID) // drifted, terminal
chatArchived := newChat(database.ChatStatusRunning, agent.ID) // drifted, archived
chatNull := newChat(database.ChatStatusWaiting, agent.ID) // never hydrated
chatMatch := newChat(database.ChatStatusRunning, agent.ID) // already at hashH
chatDrift := newChat(database.ChatStatusRunning, agent.ID) // drifted, active
chatTerminal := newChat(database.ChatStatusError, agent.ID) // drifted, terminal
chatArchived := newChat(database.ChatStatusRunning, agent.ID) // drifted, archived
chatOtherAgent := newChat(database.ChatStatusRunning, otherAgent.ID)
// Pin starting hashes; chatNull is intentionally left NULL.
@@ -13019,7 +13019,7 @@ func TestChatPinOrderConstraints(t *testing.T) {
parent, err := db.InsertChat(ctx, database.InsertChatParams{
OrganizationID: org.ID,
Status: database.ChatStatusCompleted,
Status: database.ChatStatusWaiting,
ClientType: database.ChatClientTypeUi,
OwnerID: owner.ID,
LastModelConfigID: modelCfg.ID,
@@ -13029,7 +13029,7 @@ func TestChatPinOrderConstraints(t *testing.T) {
child, err := db.InsertChat(ctx, database.InsertChatParams{
OrganizationID: org.ID,
Status: database.ChatStatusCompleted,
Status: database.ChatStatusWaiting,
ClientType: database.ChatClientTypeUi,
OwnerID: owner.ID,
LastModelConfigID: modelCfg.ID,
@@ -13050,7 +13050,7 @@ func TestChatPinOrderConstraints(t *testing.T) {
chat, err := db.InsertChat(ctx, database.InsertChatParams{
OrganizationID: org.ID,
Status: database.ChatStatusCompleted,
Status: database.ChatStatusWaiting,
ClientType: database.ChatClientTypeUi,
OwnerID: owner.ID,
LastModelConfigID: modelCfg.ID,