Skip to content

fix: #2856 stop recursive trace preview truncation#2860

Merged
seratch merged 1 commit intomainfrom
fix/tracing-truncation-recursion
Apr 8, 2026
Merged

fix: #2856 stop recursive trace preview truncation#2860
seratch merged 1 commit intomainfrom
fix/tracing-truncation-recursion

Conversation

@seratch
Copy link
Copy Markdown
Member

@seratch seratch commented Apr 8, 2026

This pull request resolves #2856. It fixes a tracing sanitization bug where JSON-compatible scalar values such as None could be replaced with preview dicts that were then recursively re-truncated under tiny byte budgets, eventually raising RecursionError inside OpenAI trace payload sanitization.

The change keeps the existing preview dict shape when a preview fits within the remaining budget, but treats the scalar as terminal when that preview would still be too large so the parent container can drop the child cleanly. This preserves the current behavior for normal oversized values while preventing preview-of-a-preview recursion in deeply truncated payloads.

It also adds regression coverage for the zero-budget preview path and for an oversized generation payload containing assistant messages whose content is None, ensuring tracing sanitization terminates and stays within the field-size limit.

@seratch seratch added this to the 0.13.x milestone Apr 8, 2026
@github-actions github-actions bot added bug Something isn't working feature:tracing labels Apr 8, 2026
@seratch seratch merged commit fb67680 into main Apr 8, 2026
9 checks passed
@seratch seratch deleted the fix/tracing-truncation-recursion branch April 8, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working feature:tracing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RecursionError in tracing truncation: preview dict recursively re-truncated when message content is None

1 participant