Skip to content

Fix otlp session fragmentation#83

Merged
krisztianfekete merged 1 commit intomainfrom
fix/conversation_id-handling
Apr 1, 2026
Merged

Fix otlp session fragmentation#83
krisztianfekete merged 1 commit intomainfrom
fix/conversation_id-handling

Conversation

@krisztianfekete
Copy link
Copy Markdown
Contributor

This PR fixes OTLP session fragmentation when some spans in a trace lack gen_ai.conversation.id (e.g. kagent's A2A infrastructure spans vs agent spans):

  1. Pre-scan batch for conversation_id (otlp_routes.py): Before processing any spans in an OTLP batch, scan all spans across all scopes to find gen_ai.conversation.id. This ensures infrastructure spans (no conv_id) and agent spans (with conv_id) that arrive in the same HTTP request all route to the same session.
  2. Route active sessions by trace_id + absorb orphans: When a span's trace_id is already in an active session (under a different name), route there instead of creating a new session. When routing to a conversation_id session, absorb any existing orphan session for the same trace_id (merging its spans/logs, cancelling its timers, removing it from the session map).
  3. UI cleanup: Added session_removed event so the frontend removes absorbed orphan sessions from the session list.

@krisztianfekete krisztianfekete merged commit 62aa02e into main Apr 1, 2026
4 checks passed
@krisztianfekete krisztianfekete deleted the fix/conversation_id-handling branch April 1, 2026 07:27
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