Skip to content

fix(tracing): isolate trace summary rendering failures - #7682

Open
wangtaotaotao95 wants to merge 2 commits into
crewAIInc:mainfrom
wangtaotaotao95:fix/trace-summary-rendering
Open

wangtaotaotao95 wants to merge 2 commits into
crewAIInc:mainfrom
wangtaotaotao95:fix/trace-summary-rendering

Conversation

@wangtaotaotao95

Copy link
Copy Markdown
Contributor

Summary

Fixes #7681.

Trace export can succeed and then fail the enclosing crew/flow during cleanup if Rich cannot render the post-export summary. This keeps that presentation step best-effort:

  • wraps trace-summary construction and printing in an exception boundary;
  • logs only the exception type, without trace URLs, credentials, or console content;
  • preserves the existing one-shot summary behavior;
  • adds an authenticated end-to-end regression proving a BrokenPipeError cannot escape end_execution() after a successful upload.

Verification

  • lib/crewai/tests/telemetry/test_session_trace_export.py: 81 passed
  • Ruff check: passed
  • Ruff format check: passed
  • git diff --check: passed

This contribution was prepared with AI assistance. I do not have permission to apply the repository's llm-generated label; a maintainer will need to add it.

@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: acc56863-4b47-41ef-ac81-64f9fcb15bca

📥 Commits

Reviewing files that changed from the base of the PR and between 53ee8b3 and 1de7eee.

📒 Files selected for processing (2)
  • lib/crewai/src/crewai/telemetry/tracing/grants.py
  • lib/crewai/tests/telemetry/test_session_trace_export.py

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The trace link renderer now catches console errors, logs the exception type, and allows execution cleanup to continue. A test verifies that a BrokenPipeError does not prevent trace export.

Changes

Trace link resilience

Layer / File(s) Summary
Best-effort trace link rendering
lib/crewai/src/crewai/telemetry/tracing/grants.py, lib/crewai/tests/telemetry/test_session_trace_export.py
_show_trace_link() catches errors during link construction or console output and logs a warning with the exception type. The test verifies continued batch export and the expected log message after BrokenPipeError.

Suggested reviewers: lorenzejay

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 1de7e

Trace-link display failures no longer fail otherwise successful executions, while trace export continues. The change is mergeable.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: isolating trace summary rendering failures during tracing.
Description check ✅ Passed The description explains the issue, solution, security behavior, regression test, and verification results. It includes the linked issue and required summary and verification information, although it …
Linked Issues check ✅ Passed The changes satisfy #7681. GrantSpanExporter._show_trace_link() catches failures while constructing and printing the trace link. It logs only the exception type and prevents the rendering failure fr…
Out of Scope Changes check ✅ Passed The changes stay within #7681. The production change adds the required best-effort boundary for trace-summary rendering. The test verifies execution preservation and safe logging. No unrelated changes…
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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.

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.

[BUG] Trace summary rendering errors can fail an otherwise successful execution

1 participant