agentscope-ai / agentscope-ai/agentscope-java

[Bug]: edit_file hangs indefinitely when old_string is empty

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

Descrição

Calling edit_file with an empty old_string never returns.

Reproduction:

filesystem.edit(runtimeContext, "/notes.md", "", "replacement", false);

The loop in FilesystemUtils.countOccurrences() calls indexOf("", idx).
Because the empty string has length 0, idx never advances and the loop runs forever.

Expected behavior:
Return a normal validation error such as:
"old_string must not be empty"

Suggested fix:
Validate oldString before countOccurrences() and add a unit test with a timeout assertion.

This should be a small backward-compatible fix with no API change.

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.