Skip to content

Fix watchdog replay validation for nullable action results#914

Merged
wuman001 merged 1 commit into
mainfrom
fix/watchdog-replay-nullable-action-results
May 25, 2026
Merged

Fix watchdog replay validation for nullable action results#914
wuman001 merged 1 commit into
mainfrom
fix/watchdog-replay-nullable-action-results

Conversation

@wuman001

Copy link
Copy Markdown
Collaborator

Summary

  • make nullable ActionResult string fields align with watchdog-serialized payloads
  • add a regression test that exercises the real ensure_action_results() + arm_post_tool_progress_watchdog() replay path
  • prevent Observation(**payload) from failing on null action result fields during watchdog retries

Test Plan

  • pytest -q tests/runners/test_post_tool_progress_watchdog.py tests/runners/test_tool_reset_compat.py tests/core/agent/test_dynamic_tool_registration_e2e.py tests/core/agent/test_tool_result_followup_format.py

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the ActionResult model in aworld/core/common.py to use Optional[str] for the error, action_name, tool_name, and tool_call_id fields, ensuring better compatibility with Pydantic v2 validation for null values. It also introduces a new test case in tests/runners/test_post_tool_progress_watchdog.py to verify that the watchdog handles these nullable fields correctly. The review feedback suggests adopting the str | None syntax for consistency with modern Python standards and recommends expanding the test assertions to ensure other core fields like success and is_done are preserved during processing.

Comment thread aworld/core/common.py
Comment on lines +20 to +25
error: Optional[str] = None
keep: bool = False
action_name: str = None
tool_name: str = None
action_name: Optional[str] = None
tool_name: Optional[str] = None
# llm tool call id
tool_call_id: str = None
tool_call_id: Optional[str] = None

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The explicit use of Optional[str] is correct for Pydantic v2 validation when handling serialized payloads that may contain null values. However, for consistency with other parts of the codebase (e.g., line 63), you might consider using the more modern str | None syntax if the project is targeting Python 3.10+.

Comment on lines +123 to +126
assert emitted[0].payload.action_result[0].error is None
assert emitted[0].payload.action_result[0].tool_name is None
assert emitted[0].payload.action_result[0].action_name is None
assert emitted[0].payload.action_result[0].tool_call_id is None

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

While these assertions verify the fix for nullable fields, it would be beneficial to also assert that the other core fields of the ActionResult (like success, is_done, and content) are correctly preserved after the serialization/deserialization cycle in the watchdog.

@wuman001 wuman001 requested review from ahgpt and rainsonGain May 25, 2026 09:42
@wuman001 wuman001 merged commit 420ab5d into main May 25, 2026
1 check passed
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.

2 participants