Skip to content

fix: serialize Laminar span_context UUIDs as strings for JSON compatibility#2000

Merged
neubig merged 2 commits intomainfrom
fix-laminar-span-context-json-serialization
Feb 11, 2026
Merged

fix: serialize Laminar span_context UUIDs as strings for JSON compatibility#2000
neubig merged 2 commits intomainfrom
fix-laminar-span-context-json-serialization

Conversation

@neubig
Copy link
Copy Markdown
Contributor

@neubig neubig commented Feb 11, 2026

Summary

Fixes a bug introduced in PR #1988 where Laminar.get_laminar_span_context_dict() returns uuid.UUID objects which are not JSON serializable, causing all PR review workflows to fail with:

Object of type UUID is not JSON serializable

Root Cause

PR #1988 added code to capture span context for trace continuation:

span_context = Laminar.get_laminar_span_context_dict()

However, get_laminar_span_context_dict() returns a dict with uuid.UUID objects (not strings), which fails when json.dump() is called.

Fix

Use get_laminar_span_context().model_dump(mode="json") instead, which properly serializes UUIDs as strings:

laminar_span_context = Laminar.get_laminar_span_context()
span_context = (
    laminar_span_context.model_dump(mode="json")
    if laminar_span_context
    else None
)

Impact

This bug caused 100% of PR review workflows using SDK code with PR #1988 to fail. After this fix, PR reviews should succeed again.

Testing

Added a test to verify trace data with span_context is JSON serializable, which would have caught this bug before merge.

@neubig can click here to continue refining the PR


Agent Server images for this PR

GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server

Variants & Base Images

Variant Architectures Base Image Docs / Tags
java amd64, arm64 eclipse-temurin:17-jdk Link
python amd64, arm64 nikolaik/python-nodejs:python3.12-nodejs22 Link
golang amd64, arm64 golang:1.21-bookworm Link

Pull (multi-arch manifest)

# Each variant is a multi-arch manifest supporting both amd64 and arm64
docker pull ghcr.io/openhands/agent-server:9167399-python

Run

docker run -it --rm \
  -p 8000:8000 \
  --name agent-server-9167399-python \
  ghcr.io/openhands/agent-server:9167399-python

All tags pushed for this build

ghcr.io/openhands/agent-server:9167399-golang-amd64
ghcr.io/openhands/agent-server:9167399-golang_tag_1.21-bookworm-amd64
ghcr.io/openhands/agent-server:9167399-golang-arm64
ghcr.io/openhands/agent-server:9167399-golang_tag_1.21-bookworm-arm64
ghcr.io/openhands/agent-server:9167399-java-amd64
ghcr.io/openhands/agent-server:9167399-eclipse-temurin_tag_17-jdk-amd64
ghcr.io/openhands/agent-server:9167399-java-arm64
ghcr.io/openhands/agent-server:9167399-eclipse-temurin_tag_17-jdk-arm64
ghcr.io/openhands/agent-server:9167399-python-amd64
ghcr.io/openhands/agent-server:9167399-nikolaik_s_python-nodejs_tag_python3.12-nodejs22-amd64
ghcr.io/openhands/agent-server:9167399-python-arm64
ghcr.io/openhands/agent-server:9167399-nikolaik_s_python-nodejs_tag_python3.12-nodejs22-arm64
ghcr.io/openhands/agent-server:9167399-golang
ghcr.io/openhands/agent-server:9167399-java
ghcr.io/openhands/agent-server:9167399-python

About Multi-Architecture Support

  • Each variant tag (e.g., 9167399-python) is a multi-arch manifest supporting both amd64 and arm64
  • Docker automatically pulls the correct architecture for your platform
  • Individual architecture tags (e.g., 9167399-python-amd64) are also available if needed

…bility

Laminar.get_laminar_span_context_dict() returns uuid.UUID objects which
are not JSON serializable. This caused PR review workflows to fail with:
'Object of type UUID is not JSON serializable'

Fix by using get_laminar_span_context().model_dump(mode='json') which
properly serializes UUIDs as strings.

Co-authored-by: openhands <openhands@all-hands.dev>
@neubig neubig marked this pull request as ready for review February 11, 2026 11:47
Copy link
Copy Markdown
Collaborator

@all-hands-bot all-hands-bot left a comment

Choose a reason for hiding this comment

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

🟡 Acceptable - Works but could be cleaner

Linus-Style Analysis:

This fix is pragmatic and direct - you identified a real production bug (100% PR review failure) and fixed it without over-engineering. The solution is simple: use the proper serialization method instead of the broken one.

VERDICT:Worth merging - Core logic is sound, one minor test improvement suggested

KEY INSIGHT: This is how bug fixes should be done - minimal change, direct solution, test to prevent regression. The only gap is demonstrating why the old code was broken.

Co-authored-by: openhands <openhands@all-hands.dev>
@neubig neubig requested a review from juanmichelini February 11, 2026 12:02
Copy link
Copy Markdown
Collaborator

@enyst enyst left a comment

Choose a reason for hiding this comment

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

Thank you!

@neubig neubig merged commit 12f675c into main Feb 11, 2026
28 of 29 checks passed
@neubig neubig deleted the fix-laminar-span-context-json-serialization branch February 11, 2026 13:11
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.

4 participants