Skip to content

feat: propagate error categories to SGP spans - #486

Open
jshaikScale wants to merge 2 commits into
nextfrom
javed/error-category-producers
Open

feat: propagate error categories to SGP spans#486
jshaikScale wants to merge 2 commits into
nextfrom
javed/error-category-producers

Conversation

@jshaikScale

@jshaikScale jshaikScale commented Aug 3, 2026

Copy link
Copy Markdown

Summary

  • capture exceptions raised inside ADK span context managers before ending the span
  • define and export typed ApplicationError and PlatformError ownership markers with documented boundaries
  • keep ordinary or unreliable failures classified as unknown
  • emit flat error_category metadata alongside SGP status=ERROR, while remaining compatible with legacy records
  • add coverage for typed classification, explicit precedence, fallback behavior, ADK capture, and SGP mapping

Test plan

  • .venv/bin/pytest -n 0 tests/lib/core/tracing/test_span_error.py tests/lib/adk/test_tracing_module.py tests/lib/core/tracing/processors/test_sgp_tracing_processor.py (65 passed)
  • Ruff checks on changed files
  • Pyright checks on changed implementation files

Greptile Summary

Adds categorized span-error propagation across ADK tracing and SGP telemetry.

  • Captures exceptions raised inside ADK span context managers before ending spans.
  • Normalizes error ownership to application, platform, or unknown.
  • Maps categorized errors to flat SGP error_category metadata.
  • Exposes categorized exception classes and expands tracing tests.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/agentex/lib/adk/_modules/tracing.py Captures and records exceptions from ADK span bodies before ending the span and re-raising.
src/agentex/lib/core/tracing/span_error.py Introduces categorized exception types and normalized category storage in span error metadata.
src/agentex/lib/core/tracing/processors/sgp_tracing_processor.py Adds normalized error-category metadata when converting failed Agentex spans to SGP spans.
src/agentex/lib/core/tracing/init.py Publicly exports the new categorized tracing exception classes.
tests/lib/adk/test_tracing_module.py Covers ADK context-manager error capture, span finalization, and exception propagation.
tests/lib/core/tracing/test_span_error.py Covers category normalization, explicit precedence, fallback behavior, and SGP metadata mapping.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    A[Exception raised in span body] --> B[set_span_error]
    B --> C[Span data __error__]
    C --> D[SGP tracing processor]
    D --> E[SGP status ERROR]
    D --> F[error_category metadata]
    B --> G[Original exception re-raised]
Loading

Reviews (2): Last reviewed commit: "fix: make error ownership classification..." | Re-trigger Greptile

Capture ADK failures and preserve producer ownership metadata so SGP can distinguish application, platform, and unknown errors.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread src/agentex/lib/core/tracing/span_error.py
Comment thread src/agentex/lib/core/tracing/span_error.py
@jshaikScale jshaikScale changed the title Propagate error categories to SGP spans feat: propagate error categories to SGP spans Aug 4, 2026
@jshaikScale
jshaikScale changed the base branch from main to next August 4, 2026 15:31
Provide typed application and platform error classes with documented ownership boundaries instead of relying on arbitrary exception attributes.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

2 participants