mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-30 00:22:10 -04:00
fix(chat): guard non-numeric agent tool budget setting
Guard the agent_max_tool_calls settings read so hand-edited or agent-written non-numeric settings.json values fall back to 0 instead of crashing agent-mode chat stream initialization. Add regression coverage for guarded coercion.
This commit is contained in:
@@ -1255,7 +1255,14 @@ def setup_chat_routes(
|
||||
try:
|
||||
from src.settings import get_setting
|
||||
from src.agent_tools import MAX_AGENT_ROUNDS as _DEFAULT_ROUNDS
|
||||
_tool_budget = int(get_setting("agent_max_tool_calls", 0))
|
||||
# Per-message tool budget from settings; guard defensively in
|
||||
# case settings.json was hand-edited to a non-numeric value
|
||||
# (the HTTP admin endpoint validates, but direct edits bypass
|
||||
# it). 0 = unlimited, matching auth_routes set_settings().
|
||||
try:
|
||||
_tool_budget = int(get_setting("agent_max_tool_calls", 0))
|
||||
except (TypeError, ValueError):
|
||||
_tool_budget = 0
|
||||
# Per-message round cap from settings; clamp defensively in
|
||||
# case settings.json was hand-edited to a bad value.
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user