OpenHands / OpenHands/software-agent-sdk

[Bug]: Planning file editor drops inherited observation and diff data

Open
#4,668 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug priority:medium ready-for-dev tools
Dominant language
Python
Stars
1.1k
Forks
539
Avg merge
1d 19h
Merged PRs (30d)
137

Description

Bug Description

PlanningFileEditorExecutor adapts the canonical file editor result by copying only command, content, is_error, and path (openhands-tools/openhands/tools/planning_file_editor/impl.py:46-68).

PlanningFileEditorObservation inherits FileEditorObservation, whose prev_exist, old_content, and new_content fields drive structured edit state and diff visualization (file_editor/definition.py:69-134). Those fields are silently discarded, so planning edits cannot produce the complete inherited observation or expected diff view. Future base fields can drift the same way.

Expected Behavior

Planning results should preserve all canonical file-editor observation data while retaining their distinct serialized planning kind.

Actual Behavior

An independent, self-contained reproducer is posted in the issue comments. Save
it as /tmp/repro_4668.py, then run:

uv run python /tmp/repro_4668.py

On SDK commit bc5dfc50d, it exercises real temporary files and both real file-editor executors; no mocks and prints:

regular_old_content_present=True
regular_new_content_present=True
regular_has_diff=True
planning_old_content_present=False
planning_new_content_present=False
planning_has_diff=False
plan_edit_applied=True
Suggested Implementation

Pass the inherited planning action directly to the configurable base executor, then construct PlanningFileEditorObservation from the complete base observation dump rather than a hand-maintained field list. Keep the planning action/observation classes for event compatibility.

Acceptance Criteria
  • Create and edit operations preserve prev_exist, old_content, and new_content.
  • Planning edit visualization contains the expected diff.
  • Edits outside the configured plan remain rejected and arbitrary views remain allowed.
  • Planning action/observation kinds and public schemas remain unchanged.
Version

Current main at 6d3881035. Existing issue search found no duplicate.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with openhands-tools/openhands/tools/planning_file_editor/impl.py:46-68 and compare it with file_editor/definition.py:69-134. Run the self-contained reproducer from the comments with uv run python /tmp/repro_4668.py to observe the missing inherited fields and diff. Done means planning create and edit operations preserve the inherited observation data and diff, while plan restrictions, arbitrary views, and public event schemas remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.