Skip to content

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

Closed

Description

@lazyboy20150303

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

Activity

  1. added
    bug
    on Aug 17, 2026
  2. added
    area/core/tool
    on Aug 17, 2026
  3. moved this from Backlog to In progress in AgentScope Javaon Aug 17, 2026
  4. added a commit that references this issue on Aug 20, 2026
    bdd4602
  5. moved this from In progress to Done in AgentScope Javaon Oct 10, 2026
  6. added a commit that references this issue on Oct 10, 2026
    20dc107
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/core/toolbug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions