Skip to content

feat: add trace, session, retriever to applies to - #637

Merged
namrataghadi-galileo merged 2 commits into
mainfrom
feature/SAO-18190-support-trace-session-retriever-spans
Oct 9, 2026
Merged

namrataghadi-galileo merged 2 commits into
mainfrom
feature/SAO-18190-support-trace-session-retriever-spans

Conversation

@namrataghadi-galileo

@namrataghadi-galileo namrataghadi-galileo commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Shortcut: SAO-18190

Description:

Agent Control events can apply to LLM calls, tool calls, retriever calls, traces, or sessions. The SDK previously accepted only llm_call and tool_call, so the other supported values could fail enum conversion before a control span was emitted. This change adds the three missing values to the SDK and OpenAPI models, preserves trace, session, and parent IDs on control spans, and keeps unrelated values unsupported.

Tests:

  • Unit Tests Added
  • E2E Test Added (if it's a user-facing feature, or fixing a bug)
  • Focused tests: poetry run pytest tests/test_agent_control.py tests/test_agent_control_bridge.py -q (40 passed)

@baz-reviewer

baz-reviewer Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Review this PR on Baz

Baz Summary

Extend Agent Control support to retriever, trace, and session events across SDK and OpenAPI models. Update ControlSpan and GalileoLogger.add_control_span to preserve applies_to, session, trace, and parent identifiers when emitting control spans.

Topics

TopicDetails
Control event spans Support all five Agent Control event types and preserve execution context on emitted control spans, including session, trace, parent, and applies_to identifiers.
Modified files (4)
  • openapi.yaml
  • src/galileo/logger/control.py
  • src/galileo/logger/logger.py
  • src/galileo/resources/models/control_applies_to.py
Latest Contributors(2)
UserCommitDate
namratag@cisco.comadd trace, session, re...October 08, 2026
bin@galileo.aifeat: support custom H...July 30, 2026
Control flow tests Validate supported and unsupported ControlAppliesTo values and verify bridge conversion for every supported event type.
Modified files (2)
  • tests/test_agent_control.py
  • tests/test_agent_control_bridge.py
Latest Contributors(2)
UserCommitDate
namratag@cisco.comstyle(agent-control): ...October 08, 2026
abhinav@galileo.aifeat: add Agent Contro...May 13, 2026

Merger  Activate to get a short verdict whether this PR is good to go or not

Skills  Activate Skill Maintainer to keep your skills up to date

Planner  This PR would have been improved with Baz Planner - Try it now

@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.66%. Comparing base (dd2ac16) to head (2c2ead7).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #637      +/-   ##
==========================================
+ Coverage   83.62%   83.66%   +0.03%     
==========================================
  Files         124      124              
  Lines       11037    11042       +5     
==========================================
+ Hits         9230     9238       +8     
+ Misses       1807     1804       -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines 1921 to 1924
"id": span_id or uuid.uuid4(),
"session_id": self.session_id,
"trace_id": trace_id,
"parent_id": parent_id,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Preserves stale session IDs in batch payload

Control events can send span.session_id from session A with request.session_id from session B or None if the logger changes before flush, and mixed-session batches have the same inconsistency; capture the session once at the trace/batch boundary and use it for both carriers, or prevent mixed-session batches.

Severity

Want Baz to fix this for you? Activate Fixer

Other fix methods

Fix in Cursor

Prompt for AI Agents
Before applying, verify this suggestion against the current code. In
`src/galileo/logger/logger.py` around lines 1921-1924, update
`GalileoLogger.add_control_span` and its interaction with `_flush_batch` so control
spans and their enclosing request use the same captured session ID. Capture the session
at the trace/batch boundary rather than independently reading mutable `self.session_id`,
and ensure batches cannot combine spans from different sessions or cleared sessions.

@josjeon
josjeon self-requested a review October 8, 2026 23:58
@namrataghadi-galileo
namrataghadi-galileo merged commit 7aadc4d into main Oct 9, 2026
19 checks passed
@namrataghadi-galileo
namrataghadi-galileo deleted the feature/SAO-18190-support-trace-session-retriever-spans branch October 9, 2026 17:07
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.

3 participants