feat: configure acquire chat batch size (#23196)

## Summary
- add a hidden deployment config option for chat acquire batch size
(`CODER_CHAT_ACQUIRE_BATCH_SIZE` / `chat.acquireBatchSize`)
- thread the configured value into chatd startup while preserving the
existing default of `10`
- clamp the deployment value to the `int32` range before passing it into
chatd
- regenerate the API/docs/types/testdata artifacts for the new config
field

## Why
`chatd` currently acquires pending chats in batches of `10` via a
compile-time default. This change makes that batch size
operator-configurable from deployment config, so we can tune acquisition
behavior without another code change.
This commit is contained in:
Ethan
2026-03-19 00:54:32 +11:00
committed by GitHub
parent 8b4d35798a
commit fc3508dc60
9 changed files with 113 additions and 13 deletions
+22
View File
@@ -1437,6 +1437,11 @@ func (c *DeploymentValues) Options() serpent.OptionSet {
Parent: &deploymentGroupNotifications,
YAML: "inbox",
}
deploymentGroupChat = serpent.Group{
Name: "Chat",
YAML: "chat",
Description: "Configure the background chat processing daemon.",
}
deploymentGroupAIBridge = serpent.Group{
Name: "AI Bridge",
YAML: "aibridge",
@@ -3600,6 +3605,18 @@ Write out the current server config as YAML to stdout.`,
Group: &deploymentGroupClient,
YAML: "hideAITasks",
},
// Chat Options
{
Name: "Chat: Acquire Batch Size",
Description: "How many pending chats a worker should acquire per polling cycle.",
Flag: "chat-acquire-batch-size",
Env: "CODER_CHAT_ACQUIRE_BATCH_SIZE",
Value: &c.AI.Chat.AcquireBatchSize,
Default: "10",
Group: &deploymentGroupChat,
YAML: "acquireBatchSize",
Hidden: true, // Hidden because most operators should not need to modify this.
},
// AI Bridge Options
{
Name: "AI Bridge Enabled",
@@ -4052,9 +4069,14 @@ type AIBridgeProxyConfig struct {
UpstreamProxyCA serpent.String `json:"upstream_proxy_ca" typescript:",notnull"`
}
type ChatConfig struct {
AcquireBatchSize serpent.Int64 `json:"acquire_batch_size" typescript:",notnull"`
}
type AIConfig struct {
BridgeConfig AIBridgeConfig `json:"bridge,omitempty"`
BridgeProxyConfig AIBridgeProxyConfig `json:"aibridge_proxy,omitempty"`
Chat ChatConfig `json:"chat,omitempty" typescript:",notnull"`
}
type SupportConfig struct {