refactor: move chat error kinds into codersdk (#24955)

Moves the chat error kind taxonomy from `coderd/x/chatd/chaterror` into
`codersdk.ChatErrorKind` and types `ChatError.Kind` /
`ChatStreamRetry.Kind` so generated TypeScript exposes an SDK-owned
union, including `usage_limit`. Backend chat classification now
references the SDK constants directly while preserving the existing JSON
string values.

Keeps chat usage-limit admission failures on their existing 409 response
shape. The frontend maps structured usage-limit responses to the
SDK-owned `usage_limit` kind, uses generated `TypesGen.ChatErrorKind`
directly, and removes the local string union and alias.
This commit is contained in:
Ethan
2026-05-06 11:57:48 +10:00
committed by GitHub
parent dc14ab6b97
commit 46a60e6d5d
29 changed files with 305 additions and 233 deletions
+1 -1
View File
@@ -587,7 +587,7 @@ func TestSubscribeRetryEventAcrossInstances(t *testing.T) {
require.NotNil(t, retryEvent)
require.Equal(t, 1, retryEvent.Attempt)
require.Greater(t, retryEvent.DelayMs, int64(0))
require.Equal(t, "rate_limit", retryEvent.Kind)
require.Equal(t, codersdk.ChatErrorKindRateLimit, retryEvent.Kind)
require.Equal(t, "openai", retryEvent.Provider)
require.Equal(t, 429, retryEvent.StatusCode)
require.Contains(t, retryEvent.Error, "rate limiting requests")