Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.

Conversation

@enyst
Copy link
Contributor

@enyst enyst commented Aug 16, 2025

Summary

  • Introduce GeminiEditor with Gemini-CLI–compatible replace behavior.

Key Semantics

  • Normalize matching/comparison on LF; preserve original EOLs when writing
  • Error when new_string == old_string
  • If file is missing and old_string == '': create file with new_string
  • If file is missing and old_string != '': error
  • Enforce expected_replacements (default 1); error on mismatch or 0
  • Enforce absolute path and workspace-root boundaries; reject directories
  • Return old/new content to enable accurate upstream diffs

Why

  • Align ACI editor with Gemini-CLI semantics to improve reliability of Gemini models using replace.

Companion PR

  • OpenHands routes FileEditAction(command='replace', impl_source=OH_ACI) to GeminiEditor when present; falls back to OHEditor('str_replace') otherwise.

Co-authored-by: openhands [email protected]

…__init__; add unit tests

Co-authored-by: OpenHands-GPT-5 [email protected]
@enyst enyst changed the title GeminiEditor (Phase 1a): Gemini-CLI–style replace with EOL preservation and expected_replacements GeminiEditor (Phase 1a): Gemini replace with EOL and expected_replacements Aug 16, 2025
@enyst enyst changed the title GeminiEditor (Phase 1a): Gemini replace with EOL and expected_replacements GeminiEditor: replace with EOL and expected_replacements Aug 16, 2025
@enyst enyst changed the title GeminiEditor: replace with EOL and expected_replacements GeminiEditor: replace with expected_replacements and EOL handling (Phase 1a) Aug 16, 2025
openhands-agent and others added 7 commits August 16, 2025 23:06
…CLIResult.error on parameter issues\n\nMatches unit test expectations in tests/unit/editor/test_gemini_editor.py.\n\nCo-authored-by: openhands <[email protected]>
Helps reduce the amount of retries when using an LLM like Devstral.
…fixes All-Hands-AI#154) (All-Hands-AI#157)

* editor: clamp view_range end to file length, emit warning instead of error when beyond EOF (fixes All-Hands-AI#154)

- Normalize end_line by capping to num_lines and allow -1 as before
- Append NOTE: warning to output when clamped
- Update tests to assert on warning text

Co-authored-by: openhands <[email protected]>

* Prepend warning message instead of appending it

Co-authored-by: openhands <[email protected]>

* Update openhands_aci/editor/editor.py

* Update openhands_aci/editor/editor.py

* bump to 0.3.2

* Update tests/integration/editor/test_error_handling.py

---------

Co-authored-by: openhands <[email protected]>
Co-authored-by: Ryan H. Tran <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants