Skip to content

Conversation

@dimakis
Copy link
Owner

@dimakis dimakis commented Feb 11, 2026

Summary

  • Propagate parent session into nested workflows — all 5 workflow entry points (discovery, conversation, resume_after_approval, analysis, optimization) now use session_context(get_session_id()) instead of session_context(), so nested workflows inherit the parent conversation's session ID rather than creating a new one
  • Tag traces in trace_with_uri decorator — after each traced function completes, mlflow.update_current_trace(tags={"mlflow.trace.session": session_id}) is called, ensuring tool and HA client traces are grouped with their parent session
  • Add start_experiment_run to optimization workflow — previously log_param/log_metric calls were silently dropped because no MLflow run was active
  • Send conversation_id from frontendstreamChat now passes activeSessionId as conversation_id in the request body, eliminating the need for server-side derivation via message hashing

Files Changed

File Change
src/graph/workflows/discovery.py Inherit parent session
src/graph/workflows/conversation.py Inherit parent session (2 entry points)
src/graph/workflows/analysis.py Inherit parent session
src/graph/workflows/optimization.py Inherit parent session + add start_experiment_run
src/tracing/mlflow.py Add _tag_trace_session() to trace_with_uri
ui/src/api/client/conversations.ts Add optional conversationId param
ui/src/pages/chat/index.tsx Pass activeSessionId to streamChat
tests/unit/test_tracing_context.py 3 new tests for session inheritance
tests/unit/test_tracing_mlflow.py 3 new tests for trace_with_uri tagging

Test plan

  • 2370 backend unit tests pass
  • 13 frontend streamChat SSE parser tests pass
  • No linter errors
  • Manual: verify traces in MLflow UI are grouped by session after a multi-turn conversation
  • Manual: verify nested workflow (e.g. discovery triggered from conversation) shares parent session

Made with Cursor

Traces from the same conversation were scattered across separate MLflow
sessions because nested workflows created new session IDs and
trace_with_uri didn't propagate session tags.

- Propagate parent session into nested workflows via
  session_context(get_session_id()) in all 5 workflow entry points
- Add mlflow.trace.session tag in trace_with_uri decorator so
  tool/client traces are grouped with the parent session
- Add start_experiment_run to optimization workflow so run-level
  params and metrics are actually logged
- Send conversation_id from frontend streamChat to avoid server-side
  derivation from message hashing
- Add unit tests for session propagation and trace_with_uri tagging

Co-authored-by: Cursor <cursoragent@cursor.com>
@dimakis dimakis force-pushed the fix/mlflow-session-grouping branch from 4cd91e8 to 671a6c1 Compare February 11, 2026 00:47
@dimakis dimakis merged commit 563abf8 into main Feb 11, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant