Skip to content

fix(harness): reject empty old string in file edits - #2453

Open
wangxuefen88 wants to merge 1 commit into
agentscope-ai:mainfrom
wangxuefen88:fix/2446-empty-old-string
Open

fix(harness): reject empty old string in file edits#2453
wangxuefen88 wants to merge 1 commit into
agentscope-ai:mainfrom
wangxuefen88:fix/2446-empty-old-string

Conversation

@wangxuefen88

Copy link
Copy Markdown

Summary

  • reject null or empty old_string before counting occurrences
  • prevent edit_file from hanging indefinitely
  • add regression tests for empty and null values

Testing

  • mvn -q -pl agentscope-harness -am test

Fixes #2446

@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@CLAassistant

CLAassistant commented Jul 28, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@oss-maintainer oss-maintainer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes look good. The guard clause correctly prevents the infinite loop caused by countOccurrences on an empty string, and the regression tests cover both null and empty cases.

Note: CLA is not yet signed — the contributor needs to sign it before merge.

@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: edit_file hangs indefinitely when old_string is empty

3 participants