You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(server-https): mutual recursion between stream_llm_response and handle_tool_follow_up causes unbounded stack growth #152
stream_llm_response and handle_tool_follow_up in server-https/app.py call each other with no depth limit, creating unbounded mutual recursion.
Call Chain
stream_llm_response()
└─► handle_tool_follow_up()
└─► stream_llm_response() # follow-up triggers another tool_calls
└─► handle_tool_follow_up()
└─► stream_llm_response()
└─► ... (no stopping condition)
Root Cause
When the LLM returns finish_reason == "tool_calls" in a follow-up response, stream_llm_response calls handle_tool_follow_up again. There is no recursion depth counter or maximum hop limit — so a model that repeatedly requests tools will cause a stack overflow and crash the server process.
This is a real failure mode in agentic workloads where the LLM issues multiple sequential tool calls — exactly the multi-hop scenario this system is designed to support.
Impact
Server process crashes under multi-hop agentic queries
No error is surfaced to the client — connection drops silently
Affects all users sharing the same server process
Proposed Fix
Introduce a max_depth parameter (default: 3) passed through both functions. If depth exceeds the limit, return a graceful fallback response instead of recursing further.
Activity
Kunal-Somani commentedon Mar 21, 2026
/assign
fix(server-https): add recursion depth limit to prevent stack overflo…
chasecadet commentedon Nov 20, 2026
Thank you for reporting this!
We are closing pre-restructure issues targeting the legacy
server/,server-https/,manifests/,kagent-feast-mcp/, or in-processSentenceTransformerprototype code. In #207, #210, #233, #240, and #249,kubeflow/docs-agentmigrated to dedicated TEI (text-embeddings-inference), FastMCP (docs-agent-mcp/mcp-server/), shared modular KFP pipelines (docs-agent-mcp/pipelines/), and Helm charts (docs-agent-mcp/charts/).If you still observe an equivalent issue on the current
mainstack, please feel free to open a new issue using the current issue templates.