Files
coder/coderd/x
Ethan 62191910f8 fix(coderd/x/chatd): hoist system prompt fetch out of chat creation transaction (#24369) (#24415)
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.
2026-04-16 16:39:19 +10:00
..