Skip to content

Conversation

@hassiebp
Copy link
Contributor

@hassiebp hassiebp commented Jul 1, 2025

Important

Fixes data mutation issue in media_manager.py by copying dictionaries before processing Anthropic media, ensuring data integrity.

  • Behavior:
    • In media_manager.py, _process_data_recursively() now creates a shallow copy of the data dictionary before modifying it when processing Anthropic media.
    • This prevents unintended mutations of the original dictionary, ensuring data integrity.
  • Tests:
    • Added sleep(1) in test_openai.py to ensure proper timing for asynchronous operations.

This description was created by Ellipsis for 48af701. You can customize this summary. It will automatically update as commits are pushed.


Greptile Summary

Disclaimer: Experimental PR review

Fixes a data mutation issue in Anthropic media handling by implementing safe dictionary copying in langfuse/_task_manager/media_manager.py.

  • Modified media manager to create a shallow copy of input dictionary before processing Anthropic media data, preventing unintended side effects from direct mutations
  • Important defensive programming fix that maintains data integrity when the same dictionary is referenced elsewhere in the codebase

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

LGTM

1 file reviewed, no comments
Edit PR Review Bot Settings | Greptile

@hassiebp hassiebp merged commit e5e4006 into main Jul 1, 2025
10 checks passed
@hassiebp hassiebp deleted the fix-anthropic-media-mut branch July 1, 2025 13:47
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