test: D1-12 enforce BoundedToolLoop via config.chat_max_tool_rounds

This commit is contained in:
2026-05-30 09:13:03 +02:00
parent d688c61b0e
commit 925fe97007
4 changed files with 88 additions and 2 deletions

View File

@@ -411,7 +411,7 @@ defmodule BDS.AI.Chat do
tools,
runtime,
opts,
@chat_max_tool_rounds
chat_max_tool_rounds()
),
{:ok, reply} <-
maybe_generate_chat_title(conversation.id, user_message.content, reply, opts) do
@@ -752,6 +752,14 @@ defmodule BDS.AI.Chat do
ChatTools.available_specs(project_id, Catalog.model_capabilities(model))
end
# BoundedToolLoop: the tool-calling round count is capped by
# config.chat_max_tool_rounds (falling back to the built-in default).
defp chat_max_tool_rounds do
:bds
|> Application.get_env(:chat, [])
|> Keyword.get(:max_tool_rounds, @chat_max_tool_rounds)
end
defp chat_system_prompt(project_id, tools) do
base = get_setting("ai.system_prompt") || @default_system_prompt