agentscope-ai / agentscope-ai/agentscope-java

[Bug]:Fail to continue Human-in-the-Loop

未關閉
#466 5 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
area/core/agent enhancement
主要語言
Java
星號
5.6k
分支
1.3k
平均合併
4 天 12 小時
30 天內合併 PR
77

描述

**Describe the bug**

While testing the "Human-in-the-Loop" example, I encountered two issues when asking an unrelated question instead of responding to the human confirmation prompt:
1. The system still executes the pending (dangerous) tool despite no explicit user confirmation.
2. When using the Dashscope model, this scenario triggers an error.

**To Reproduce**

1. Modify the example by marking the get_time tool as a "dangerous tool" (i.e., requiring Human-in-the-Loop confirmation).
2. In the first conversation turn, ask: "What time is it now?" — this triggers the tool and pauses for human confirmation.
3. In the second turn, instead of confirming or rejecting, send an unrelated message such as: "Hello."
4. Observe that the tool is still executed, and an error occurs if the Dashscope model is in use.

Image

The memory is as follow:

```jsonl
{"id":"ec3ae4f1-1f05-4692-8033-a584fe984870","name":"User","role":"USER","content":[{"type":"text","text":"现在几点了"}],"metadata":{},"timestamp":"2026-01-07 15:35:01.258"}
{"id":"949120c2-e3b5-425a-9d1b-bfcc561e816b","name":"Assistant","role":"ASSISTANT","content":[{"type":"tool_use","id":"call_68fb4655bd26456a8fdb950c","name":"get_time","input":{},"metadata":{},"content":"{}"}],"metadata":{"_chat_usage":{"inputTokens":641,"outputTokens":11,"time":1.095,"totalTokens":652}},"timestamp":"2026-01-07 15:35:02.884"}
{"id":"2aba2d4c-1f99-4e84-9da1-3d71f6af3860","name":"User","role":"USER","content":[{"type":"text","text":"你好啊"}],"metadata":{},"timestamp":"2026-01-07 15:35:12.136"}
{"id":"97e20709-5b23-48ef-a15a-b0c200ebf6aa","name":"Assistant","role":"TOOL","content":[{"type":"tool_result","id":"call_68fb4655bd26456a8fdb950c","name":"get_time","output":[{"type":"text","text":"Current time: 2026-01-07 15:35:12"}],"metadata":{}}],"metadata":{},"timestamp":"2026-01-07 15:35:12.510"}
```

**Expected behavior**

- The system should not execute the pending tool unless the user explicitly confirms it. If the user sends an unrelated message during the Human-in-the-Loop confirmation phase (e.g., asking a different question), the agent should either continue waiting for a valid confirmation/rejection or handle the new query appropriately—without proceeding with the original tool call.
- When using the Dashscope large language model, this scenario should not trigger any error. Otherwise, the entire conversation session may become unrecoverable and unable to function correctly afterward. But this doesn't seem to be AgentScope's responsibility—it likely falls under DashScope's domain. I tried using a model from Volcengine Ark (e.g., doubao-seed-1-6-251015), and it worked without issues. From another perspective, perhaps the system should be designed to gracefully handle (or be compatible with) such scenarios instead.

**Error messages**

```text
Error: DashScope API error: <400> InternalError.Algo.InvalidParameter: An assistant message with "tool_calls" must be followed by tool messages responding to each "tool_call_id". The following tool_call_ids did not have response messages: message[3].role
```

**Environment (please complete the following information):**

- AgentScope-Java Version: 1.0.6
- Java Version: 17.0.8
- OS: macOS Tahoe(26.2)

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。