Skip to content

Handle circular references in jsonability checks#1416

Open
CodingFeng101 wants to merge 1 commit into
AgentOps-AI:mainfrom
CodingFeng101:codex/agent-small-fix
Open

Handle circular references in jsonability checks#1416
CodingFeng101 wants to merge 1 commit into
AgentOps-AI:mainfrom
CodingFeng101:codex/agent-small-fix

Conversation

@CodingFeng101

Copy link
Copy Markdown

Summary

  • Treat circular-reference ValueErrors as non-jsonable in is_jsonable()
  • Update the serialization regression test to assert the boolean contract instead of expecting the helper to raise

Why

is_jsonable() is a predicate used by serialization helpers to decide whether telemetry payload values can be JSON-encoded. json.dumps() raises ValueError for circular references, so the predicate could raise instead of returning False for a non-jsonable object. Handling this the same way as TypeError and OverflowError keeps the helper fail-safe for unusual agent payloads.

Validation

  • .\.venv\Scripts\python.exe -m pytest tests/unit/test_serialization.py -q
  • python -m ruff check agentops/helpers/serialization.py tests/unit/test_serialization.py
  • python -m ruff format --check agentops/helpers/serialization.py tests/unit/test_serialization.py
  • git diff --check

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.

1 participant