Skip to content

feat(tracing): port enterprise event sessions to OSS - #7461

Closed
lorenzejay wants to merge 1 commit into
mainfrom
codex/enterprise-session-tracing-port
Closed

lorenzejay wants to merge 1 commit into
mainfrom
codex/enterprise-session-tracing-port

Conversation

@lorenzejay

Copy link
Copy Markdown
Collaborator

Related issue

OSS-144: Export authenticated execution spans directly to Wharf

OSS-145: Buffer ephemeral spans locally and export only after consent

Revised port for review alongside #7359.

Summary

Port enterprise deployment tracing into OSS using its event-driven telemetry_session model. Crew, Flow, and standalone Agent kickoffs create an execution session whose handlers preserve enterprise span names, attributes, event timestamps, parenting, and human-feedback resume links.

  • Bring over enterprise's event handlers, semantic conventions, and GenAI message shapes. Expose telemetry_session with host provider, logging, resource, and redaction hooks. Registration is session-specific so existing application listeners survive; the event bus and process-global OpenTelemetry provider are unchanged. This revision adds no native operation() wrappers.
  • Exchange authenticated AMP credentials for short-lived execution grants and export OTLP directly to Wharf. Renew grants and enforce the collector's span-count and encoded-body limits; invalid credentials do not downgrade to anonymous export.
  • Keep anonymous and first-run spans in a bounded local buffer. Request a grant and upload only after affirmative post-execution consent. Decline, timeout, cancellation, failure, and disabling a deferred trace discard the buffer. CLI/TUI consent uses the same path.
  • Preserve deferred conversation lifetimes and persisted HITL resume links, including nested Flows. Route new execution sessions away from legacy batch uploads and update tracing documentation in English, Arabic, Korean, and Portuguese.

Verification

  • Tests added or updated for the changed behavior
  • Relevant tests and quality checks pass locally

Combined regression suite: 717 passed, 2 existing skips. Covers telemetry, enterprise provider compatibility, local mock AMP/Wharf HTTP collectors and decoded OTLP payloads, grants/export bounds, consent, execution IDs, Flow conversations, legacy tracing compatibility, and the CLI/TUI. External networking was blocked during tests.

Ruff, formatting, strict mypy for all 18 changed source files, whitespace checks, and repository commit hooks passed.

An additional feedback/event suite had 309 passes and 4 initialization failures because the local environment lacks the optional LiteLLM and Anthropic providers. No live enterprise deployment or production collector was exercised.

Additional context

The enterprise repository is unchanged. Its adapter migration to the shared OSS session API is separate; the provider compatibility tests exercise the host contract locally. End-to-end rollout depends on the AMP grant endpoint and Wharf grant support.

The grant response does not supply a viewer URL, so the TUI no longer derives a trace link from the legacy batch uploader.

@mintlify

mintlify Bot commented Sep 14, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
crewai 🟢 Ready View Preview Sep 14, 2026, 6:49 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

crewai_event_bus.emit(flow_source, during)
raise RuntimeError("host execution failed")

crewai_event_bus.emit(flow_source, after)
crewai_event_bus.emit(flow_source, after)
assert crewai_event_bus.flush()

expected = [before.event_id, during.event_id, after.event_id]
):
record(session)
raise failure("execution failed")
consent.assert_not_called()


class ConsentApp(CrewRunApp):
def on_mount(self, event):
providers = HostProviders()
received = []
checkpoint_events = []
execution_before = get_execution_uuid()
checkpoint_listener.__module__ = "crewai.state.checkpoint_listener"
before = FlowStartedEvent(flow_name=flow_source.name)
during = FlowStartedEvent(flow_name=flow_source.name)
after = FlowStartedEvent(flow_name=flow_source.name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant