agentscope-ai / agentscope-ai/agentscope-java

[Bug]: edit_file hangs indefinitely when old_string is empty

オープン
#2,446 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
area/core/agent bug
主要言語
Java
スター
5.6k
フォーク
1.3k
平均マージ
4日 12時間
マージ済み PR(30日)
77

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。