Skip to content

feat: propagate error categories to SGP spans - #486

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

feat: propagate error categories to SGP spans#486
jshaikScale wants to merge 3 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
  • require scale-gp-beta>=0.5.0 and re-export its canonical ErrorCategory, CategorizedError, ApplicationError, and PlatformError types
  • 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 canonical type identity, 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 (66 passed)
  • Ruff checks on changed files
  • Pyright checks on changed implementation files

Greptile Summary

Adds typed error ownership propagation to tracing spans.

  • Re-exports canonical application and platform error markers from scale-gp-beta.
  • Captures exceptions raised inside ADK span context managers before ending spans.
  • Adds normalized error_category metadata to SGP error spans with legacy fallback behavior.
  • Updates the ADK dependency and tests for classification, precedence, capture, and mapping.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/agentex/lib/core/tracing/span_error.py Uses canonical SGP error types and records a normalized category alongside each captured span error.
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/processors/sgp_tracing_processor.py Maps recorded categories into flat SGP metadata while defaulting legacy records to unknown.
src/agentex/lib/core/tracing/init.py Exposes the canonical error classification types through the core tracing package.
adk/pyproject.toml Raises the scale-gp-beta minimum version required by the SDK for canonical tracing error types.

Sequence Diagram

sequenceDiagram
    participant App
    participant ADK as ADK Span Context
    participant Error as Error Classifier
    participant Processor as SGP Processor
    participant SGP
    App->>ADK: Execute operation inside span
    App--xADK: Raise exception
    ADK->>Error: set_span_error(span, exception)
    Error-->>ADK: Store type, message, category
    ADK->>Processor: End span
    Processor->>Processor: Set status ERROR and error_category metadata
    Processor->>SGP: Emit span
    ADK--xApp: Re-raise exception
Loading

Reviews (3): Last reviewed commit: "refactor: use canonical SGP error catego..." | 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 Outdated
Comment thread src/agentex/lib/core/tracing/span_error.py Outdated
@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
jshaikScale and others added 2 commits August 4, 2026 11:33
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>
Require the released tracing SDK types so Agentex no longer maintains a duplicate ownership taxonomy that can drift.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jshaikScale

Copy link
Copy Markdown
Author

Updated after scale-gp-beta==0.5.0 was released: Agentex now bumps its minimum dependency and imports/re-exports the SDK taxonomy instead of maintaining duplicate error-category and exception definitions.

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedpypi/​scale-gp-beta@​0.2.0 ⏵ 0.5.099 +1100100100100

View full report

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