fix(task_tool): fallback to configurable thread_id when context is mi… (#1343)

* fix(task_tool): fallback to configurable thread_id when context is missing

task_tool only read thread_id from runtime.context, but when invoked
via LangGraph Server, thread_id lives in config.configurable instead.
Add the same fallback that ThreadDataMiddleware uses (PR #1237).

Fixes subagent execution failure: 'Thread ID is required in runtime
context or config.configurable'

* remove debug logging from task_tool
This commit is contained in:
SHIYAO ZHANG
2026-03-28 16:44:15 +08:00
committed by GitHub
parent c2dd8937ed
commit 690d80f46f

View File

@@ -86,6 +86,8 @@ async def task_tool(
sandbox_state = runtime.state.get("sandbox")
thread_data = runtime.state.get("thread_data")
thread_id = runtime.context.get("thread_id") if runtime.context else None
if thread_id is None:
thread_id = runtime.config.get("configurable", {}).get("thread_id")
# Try to get parent model from configurable
metadata = runtime.config.get("metadata", {})