What Operating System are you using (both controller, and any agents involved in the problem)?
Ubuntu Linux - reproducible on any OS since this is a pure python logic bug.
Reproduction steps
- start the chatbot with an LLM provider configured.
- send any user query that triggers the agentic retrieval pipeline (get_chatbot_reply_new_architecture or the _get_reply_simple_query_pipeline path).
- the LLM generates tool calls where a required parameter is missing - e.g:
{"tool":"search_jenkins_docs", "params": {"keywords": "test"}} (missing the required query param).
- _get_agent_tool_calls() calls validate_tool_calls() to validate the parsed tool calls.
- validate_tool_calls() crashes with
KeyError.
Expected Results
validate_tool_calls() should return False cleanly (without crashing) when a required parameter is missing from a tool call, allowing the caller (_get_agent_tool_calls) to fall back to default tool calls gracefully.
the warning message should correctly say "Param query is missing" (not "is not expected").
Actual Results
two bugs:
-
KeyError crash : after line 87 confirms param_name not in params, the code falls through,which does params[param_name] - this raises KeyError because the param was just confirmed absent.
-
Misleading warning message : the log says "Param %s is not expected" but the logic is checking the opposite - a required param is missing. The message should say "Param %s is missing".
Anything else?
the crash is currently masked in production because _get_agent_tool_calls() in chat_service.py catches KeyError as part of a broad except clause and silently falls back to default tool calls. however, this means:
- the validation never returns a clean
False - it always crashes
- noisy tracebacks pollute logs on every LLM-generated tool call with a missing param
- the misleading "is not expected" warning confuses debugging (it reads as if the param is extra, not absent)
Are you interested in contributing a fix?
yes, I would like to fix this. I will also add a corresponding unit test.
What Operating System are you using (both controller, and any agents involved in the problem)?
Ubuntu Linux - reproducible on any OS since this is a pure python logic bug.
Reproduction steps
{"tool":"search_jenkins_docs", "params": {"keywords": "test"}}(missing the required query param).KeyError.Expected Results
validate_tool_calls() should return
Falsecleanly (without crashing) when a required parameter is missing from a tool call, allowing the caller (_get_agent_tool_calls) to fall back to default tool calls gracefully.the warning message should correctly say
"Param query is missing"(not"is not expected").Actual Results
two bugs:
KeyError crash : after line 87 confirms
param_name not in params, the code falls through,which doesparams[param_name]- this raisesKeyErrorbecause the param was just confirmed absent.Misleading warning message : the log says
"Param %s is not expected"but the logic is checking the opposite - a required param is missing. The message should say"Param %s is missing".Anything else?
the crash is currently masked in production because _get_agent_tool_calls() in chat_service.py catches
KeyErroras part of a broad except clause and silently falls back to default tool calls. however, this means:False- it always crashesAre you interested in contributing a fix?
yes, I would like to fix this. I will also add a corresponding unit test.