Skip to content

fix: handle overwrite serialization#426

Merged
cristipufu merged 1 commit intomainfrom
fix/handle_overwrite_serialize
Jan 19, 2026
Merged

fix: handle overwrite serialization#426
cristipufu merged 1 commit intomainfrom
fix/handle_overwrite_serialize

Conversation

@cristipufu
Copy link
Copy Markdown
Member

@cristipufu cristipufu commented Jan 19, 2026

Description

Fix Overwrite serialization in state events

Overwrite is a LangGraph type that bypasses the default reducer and replaces a channel's value directly instead of appending to it. We use it in conversational agents to replace the system message at the start of each turn.

The serialize_output function wasn't handling Overwrite properly — it fell through to the generic iterable handler, which failed to convert it and returned the raw object. This caused json.dumps to fail downstream.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for handling LangGraph's Overwrite type during serialization of runtime outputs. The Overwrite type is a LangGraph wrapper that signals state replacement rather than appending, particularly used in conversational agents. Without this fix, serialization would fail when encountering Overwrite objects.

Changes:

  • Added Overwrite serialization handling in serialize_output function to unwrap and serialize the contained value
  • Updated dependency versions for uipath, uipath-core, and uipath-runtime packages
  • Bumped uipath-langchain version to 0.4.8

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/uipath_langchain/runtime/_serialize.py Added handling for LangGraph's Overwrite type in the serialize_output function by checking isinstance and recursively serializing the wrapped value
pyproject.toml Updated package version to 0.4.8 and bumped minimum required versions of uipath (2.5.9) and uipath-runtime (0.5.1) dependencies
uv.lock Updated lock file to reflect new package versions and their corresponding hashes

Comment on lines +20 to +22
# Handle LangGraph types
if isinstance(output, Overwrite):
return serialize_output(output.value)
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

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

The new Overwrite serialization handling is missing test coverage. While the Overwrite type is used in the codebase (e.g., in init_node.py for conversational agents), there are no tests verifying that serialize_output correctly handles Overwrite instances. Consider adding unit tests to verify that when an Overwrite object is passed to serialize_output, it correctly extracts and serializes the wrapped value.

Copilot uses AI. Check for mistakes.
@cristipufu cristipufu merged commit d2bbaec into main Jan 19, 2026
45 checks passed
@cristipufu cristipufu deleted the fix/handle_overwrite_serialize branch January 19, 2026 08:17
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.

3 participants