mirror of
https://github.com/coder/coder.git
synced 2026-06-03 04:58:23 +00:00
62191910f8
Partial backport of #24369 to `release/2.32`. Only the `CreateChat` fix in `coderd/x/chatd/chatd.go` applies here — the second call site in `subagent.go` (`createChildSubagentChatWithOptions`) doesn't exist on this branch since the child-subagent-chat creation path was added after the branch cut. The fix hoists the `resolveDeploymentSystemPrompt` call out of the `InTx` closure so the transaction doesn't hold one DB connection while the helper tries to check out another via `p.db`. Under concurrent chat creation load this pattern can cause pool starvation. This is not urgent enough to warrant an immediate patch release — the bug only manifests under high concurrent chat creation load. It should be fine to ride along with the next scheduled 2.32.x patch.