agentscope-ai / agentscope-ai/agentscope-java

[Bug]: FileSystemTool 没有正确返回ToolResultState.ERROR

Aberta
#2,745 0 comentários 0 reações 0 responsáveis Ver no GitHub
area/core/tool bug
Linguagem predominante
Java
Estrelas
5.6k
Forks
1.3k
Merge médio
4d 12h
PRs com merge (30d)
77

Descrição

**AgentScope-Java is an open-source project. To involve a broader community, we recommend asking your questions in English.**

**Describe the bug**
FileSystemTool调用失败,例如write_file,返回字符串"Error: " + r.error(),不符合ReActAgent.determineToolResultState的判断,返回的仍然是ToolResultState.SUCCESS

[FilesystemTool.java (line 88)]
@Tool(
name = "write_file",
description = "Write content to a new file, creating parent directories if needed.")
public String writeFile(
RuntimeContext runtimeContext,
@ToolParam(name = "path", description = "Target file path") String path,
@ToolParam(name = "content", description = "File content to write") String content) {
WriteResult r = abstractFilesystem.write(runtimeContext, norm(path), content);
return r.isSuccess() ? "Written to " + r.path() : "Error: " + r.error();
}

[ReActAgent.java (line 2883)]
private ToolResultState determineToolResultState(ToolResultBlock result) {
if (result.isSuspended()) {
return ToolResultState.RUNNING;
}
if (result.getState() != null && result.getState() != ToolResultState.RUNNING) {
return result.getState();
}
if (result.getOutput() != null
&& result.getOutput().stream()
.anyMatch(
b ->
b instanceof TextBlock tb
&& tb.getText() != null
&& tb.getText().startsWith("[ERROR]"))) {
return ToolResultState.ERROR;
}
return ToolResultState.SUCCESS;

**Expected behavior**
WriteResult r.isSuccess() == false 时,返回ToolResultState.ERROR

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.