Skip to content

feat: propagate error categories to SGP spans - #486

Merged
jshaikScale merged 4 commits into
nextfrom
javed/error-category-producers
Aug 7, 2026
Merged

feat: propagate error categories to SGP spans#486
jshaikScale merged 4 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 canonical error categorization to traced failures.

  • Re-exports the error types supplied by scale-gp-beta.
  • Records normalized categories in span error data and maps them to SGP metadata.
  • Captures exceptions raised inside ADK span context managers before ending spans.
  • Upgrades scale-gp-beta to version 0.5.0 and expands tracing coverage.

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 Adds canonical error-type exports, category normalization, explicit precedence, and categorized span-error records.
src/agentex/lib/core/tracing/processors/sgp_tracing_processor.py Maps recorded error categories into flat SGP span metadata while defaulting legacy records to unknown.
src/agentex/lib/adk/_modules/tracing.py Integrates span-error capture into ADK tracing context-manager exception handling.
adk/pyproject.toml Raises the minimum scale-gp-beta dependency version to 0.5.0 for canonical error-category support.
uv.lock Resolves scale-gp-beta 0.5.0 and updates its distribution artifacts.
tests/lib/core/tracing/test_span_error.py Covers canonical type identity, category precedence and fallback behavior, context-manager capture, and SGP mapping.
tests/lib/adk/test_tracing_module.py Verifies ADK context managers record body exceptions before ending spans and preserve propagation.
tests/test_adk_tracing_span_error.py Updates integration expectations for categorized errors recorded and persisted by ADK spans.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    A[Exception raised in traced operation] --> B[ADK or core span context manager]
    B --> C[set_span_error]
    C --> D{Canonical categorized error?}
    D -->|Yes| E[Use application or platform category]
    D -->|No| F[Use unknown category]
    E --> G[Store error record on span]
    F --> G
    G --> H[End span]
    H --> I[SGP tracing processor]
    I --> J[Set ERROR status and flat error_category metadata]
Loading

Reviews (4): Last reviewed commit: "merge: resolve latest next tracing chang..." | 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

socket-security Bot commented Aug 5, 2026

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

error_category: ErrorCategory = ERROR_CATEGORY_UNKNOWN


class ApplicationError(CategorizedError):

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.

Why are these declared in both repos rather than agentex importing from scale_gp_beta? If it's to keep agentex's public exception API off scale_gp_beta.lib, we still need a bridge..

return None


def _error_category(

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.

are the producing classes populating the Error categories?

Preserve the newer fail-open observability handling while retaining error category metadata and updated expectations.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jshaikScale
jshaikScale merged commit f2b1808 into next Aug 7, 2026
64 checks passed
@jshaikScale
jshaikScale deleted the javed/error-category-producers branch August 7, 2026 16:23
@stainless-app stainless-app Bot mentioned this pull request Aug 7, 2026
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