From 3a75b75bfd35d1fc72dd41b9b54860ece6c93fdc Mon Sep 17 00:00:00 2001 From: jonasHanhan Date: Thu, 15 Jan 2026 16:21:00 +0800 Subject: [PATCH] fix: multiple Human in the loop approvals getting stuck (#453) Add check_and_handle_interrupts call to resume_agent_chat function to make it consistent with the main chat flow. Root cause: - Main chat flow checks for pending interrupts after stream ends - Resume flow was missing this check - When a new interrupt was triggered after resume, frontend never received the new approval request Fix: - Add the same interrupt detection logic after stream ends in resume flow --- server/routers/chat_router.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/routers/chat_router.py b/server/routers/chat_router.py index 3d005689..713cf8e6 100644 --- a/server/routers/chat_router.py +++ b/server/routers/chat_router.py @@ -819,11 +819,17 @@ async def resume_agent_chat( content=getattr(msg, "content", ""), msg=msg_dict, metadata=metadata, status="loading" ) + # Check for new interrupts (support multiple human in the loop) + langgraph_config = {"configurable": input_context} + async for chunk in check_and_handle_interrupts( + agent, langgraph_config, make_resume_chunk, meta, thread_id + ): + yield chunk + meta["time_cost"] = asyncio.get_event_loop().time() - start_time yield make_resume_chunk(status="finished", meta=meta) # 保存消息到数据库 - langgraph_config = {"configurable": input_context} conv_manager = ConversationManager(db) await save_messages_from_langgraph_state( agent_instance=agent,