Skip to content

fix(sdk): tolerate orphaned tool observations - #4592

Draft
jstar0 wants to merge 1 commit into
OpenHands:mainfrom
jstar0:fix/4591-orphan-observation
Draft

fix(sdk): tolerate orphaned tool observations#4592
jstar0 wants to merge 1 commit into
OpenHands:mainfrom
jstar0:fix/4591-orphan-observation

Conversation

@jstar0

@jstar0 jstar0 commented Aug 23, 2026

Copy link
Copy Markdown

HUMAN:


AGENT:

Why

ToolCallMatchingProperty.manipulation_indices raised KeyError when crash recovery left an observation-like event without its matching action. This could permanently prevent a conversation from continuing after restart recovery.

Summary

  • Ignore observations whose tool_call_id has no action in the current view.
  • Preserve strict duplicate-observation detection for tool calls that do have a matching action.
  • Add property-level and View-level regression coverage.

Issue Number

Fixes #4591

How to Test

  • uv run pytest tests/sdk/context/view
  • uv run pre-commit run --files openhands-sdk/openhands/sdk/context/view/properties/tool_call_matching.py tests/sdk/context/view/properties/test_tool_call_matching.py tests/sdk/context/view/test_view_manipulation_indices.py

The focused view suite passes 150 tests. The regression tests cover both an orphaned AgentErrorEvent and a duplicate observation; the latter remains a strict pairing error.

Video/Screenshots

Not applicable for this SDK-only behavior fix. The regression is covered by deterministic tests using an in-memory event sequence.

Type

  • Bug fix
  • Feature
  • Refactor
  • Breaking change
  • Docs / chore

Notes

This change does not alter persisted event formats or public APIs.

Co-authored-by: openhands <openhands@all-hands.dev>
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]: ToolCallMatchingProperty.manipulation_indices crashes on orphaned observation, permanently bricking conversations after a restart

1 participant