Skip to content

[codex] Restore parse model serialization#1381

Open
pragnyanramtha wants to merge 1 commit into
AgentOps-AI:mainfrom
pragnyanramtha:codex/restore-parse-model-serialization
Open

[codex] Restore parse model serialization#1381
pragnyanramtha wants to merge 1 commit into
AgentOps-AI:mainfrom
pragnyanramtha:codex/restore-parse-model-serialization

Conversation

@pragnyanramtha
Copy link
Copy Markdown

Summary

  • restore model_to_dict support for raw response objects that expose parse()
  • guard parse recursion by tracking object identity and falling back to __dict__ when parsing fails or returns itself
  • unskip and extend serialization tests for parsed models, self-referential parse results, and parse failures

Root cause

safe_serialize already routed objects with parse() into model_to_dict, and the helper docstring promised raw API response support, but the parse branch was commented out after recursion problems. Those objects fell through to __dict__, which could lose the parsed response payload expected by instrumentation code.

Validation

  • uv run pytest tests/unit/test_serialization.py -q
  • uv run ruff check agentops/helpers/serialization.py tests/unit/test_serialization.py

Note: uv run --locked ... currently fails because the checked-in uv.lock wants to be rewritten by this uv version; this PR intentionally leaves the lockfile untouched.

@pragnyanramtha pragnyanramtha marked this pull request as ready for review May 17, 2026 01:40
Copilot AI review requested due to automatic review settings May 17, 2026 01:40
Copy link
Copy Markdown
Contributor

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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