fix(sdk): @agent decorator no longer overwrites enclosing @workflow name#4288
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughIn ChangesAGENT span workflow name separation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| if context_api.get_value("workflow_name") is None: | ||
| set_workflow_name(entity_name) |
There was a problem hiding this comment.
so if "workflow_name" is none we set entity_name as workflow name.
But if it's not None? It's never set?
There was a problem hiding this comment.
This was to keep the previous behavior in which agent spans that had no workflow parent were populating workflow name with the agent name itself, instead of leaving it empty.
But that's actually a wrong behavior.
After checking the web app and making sure it won't break anything. I removed this block.
It make senes that an agent span that's not part of a workflow will have empty workflow name.
The @agent decorator unconditionally called set_workflow_name(entity_name),
clobbering the workflow_name attached to the OTel context by an enclosing
@workflow. Child LLM spans then read the agent name as their workflow name,
making (agent_name, workflow_name) groupings collapse: the same agent
running under two different workflows became indistinguishable.
Summary by CodeRabbit
Summary by CodeRabbit
Bug Fixes
Tests