Skip to content

Commit 3a75b75

Browse files
committed
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
1 parent 995c604 commit 3a75b75

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

server/routers/chat_router.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,11 +819,17 @@ def make_resume_chunk(content=None, **kwargs):
819819
content=getattr(msg, "content", ""), msg=msg_dict, metadata=metadata, status="loading"
820820
)
821821

822+
# Check for new interrupts (support multiple human in the loop)
823+
langgraph_config = {"configurable": input_context}
824+
async for chunk in check_and_handle_interrupts(
825+
agent, langgraph_config, make_resume_chunk, meta, thread_id
826+
):
827+
yield chunk
828+
822829
meta["time_cost"] = asyncio.get_event_loop().time() - start_time
823830
yield make_resume_chunk(status="finished", meta=meta)
824831

825832
# 保存消息到数据库
826-
langgraph_config = {"configurable": input_context}
827833
conv_manager = ConversationManager(db)
828834
await save_messages_from_langgraph_state(
829835
agent_instance=agent,

0 commit comments

Comments
 (0)