Skip to content

Add detached-trace invocation span (0061)#168

Merged
chris-colinsky merged 2 commits into
mainfrom
feature/0061-detached-invocation-span
Jun 18, 2026
Merged

Add detached-trace invocation span (0061)#168
chris-colinsky merged 2 commits into
mainfrom
feature/0061-detached-invocation-span

Conversation

@chris-colinsky

Copy link
Copy Markdown
Member

What

The OTel observer now synthesizes an openarmature.invocation span at the root of each detached trace (a detached subgraph, and each detached fan-out instance). The synthesized span carries the parent invocation's shared invocation_id and the detached unit's own entry_node, with the detached subgraph/instance span nested beneath it.

A raising detached subgraph surfaces ERROR status, the error category, and an exception event on both the parent dispatch span and the detached invocation span. The OTel SDK's "OK overrides ERROR" behaviour is handled explicitly so a synthetic close cannot downgrade an already-errored span.

Scope

Observer-side only: no graph-engine change, and the Langfuse observer is unchanged.

Spec and conformance

Pins the spec submodule to v0.61.0 and marks proposal 0061 implemented (since 0.15.0) in conformance.toml. Brings two conformance fixtures live: 008 (rewritten with the invocation-root invariants) and 058 (newly covered). Docs and the bundled AGENTS.md are regenerated to match.

__version__ stays at 0.14.0; this is the first PR of the v0.15.0 cycle, and the version bump lands at release.

The OTel observer now synthesizes an openarmature.invocation span at
the root of each detached trace (a detached subgraph and each detached
fan-out instance), carrying the parent's shared invocation_id and the
detached unit's own entry_node, with the detached subgraph/instance
span nested beneath it. A raising detached subgraph surfaces ERROR plus
the error category and an exception event on both the parent dispatch
span and the detached invocation span.

Observer-side only: no graph-engine change, and the Langfuse observer
is unchanged. Pins the spec submodule to v0.61.0 and brings conformance
fixtures 008 (rewritten) and 058 (newly covered) live.
Copilot AI review requested due to automatic review settings June 18, 2026 21:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the OpenTelemetry observer to align with spec proposal 0061 by introducing a synthetic openarmature.invocation span as the root container for each detached trace (detached subgraphs and detached fan-out instances), and propagating error status/exception information across the parent dispatch span and the detached invocation span.

Changes:

  • Add detached-trace invocation span creation and detached error propagation behavior in the OTel observer.
  • Update unit + conformance tests to assert the new detached invocation/root invariants and wire fixture 058.
  • Bump pinned spec version references to 0.61.0 across package metadata, smoke tests, docs, and conformance manifest.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/openarmature/observability/otel/observer.py Synthesizes detached-trace invocation spans, propagates detached errors, and adjusts close/drain logic for new span layer.
tests/unit/test_observability_otel.py Updates unit assertions for detached traces to include detached invocation span + shared invocation_id.
tests/conformance/test_observability.py Refactors detached fixture runner, updates fixture 008 assertions, and adds wiring/assertions for fixture 058.
tests/test_smoke.py Updates expected __spec_version__ to 0.61.0.
src/openarmature/__init__.py Bumps __spec_version__ to 0.61.0.
pyproject.toml Bumps [tool.openarmature].spec_version to 0.61.0.
docs/concepts/observability.md Documents detached trace behavior rooted in a detached invocation span with shared invocation_id.
conformance.toml Marks proposal 0061 implemented and wires related conformance fixtures.
src/openarmature/AGENTS.md Regenerates bundled agent guide references to spec v0.61.0.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/openarmature/observability/otel/observer.py
Comment thread src/openarmature/observability/otel/observer.py
Comment thread src/openarmature/observability/otel/observer.py
errored_detached_keys gates the synthetic close paths' default
set_status(OK) so a detached-trace ERROR survives export. The set is
invocation-scoped but never cleared mid-invocation, so a detached
prefix that errors and then re-runs successfully within the same
invocation (cyclic or fire-and-forget re-entry) could leave the later
success span UNSET instead of OK.

Discard the key when a fresh detached invocation span opens at it (the
only point keys are introduced), so each generation's close reflects
only its own status. Reading the live span status was rejected as it
depends on _Span.status, which is not part of the public OTel Span
interface.
@chris-colinsky chris-colinsky merged commit be2c502 into main Jun 18, 2026
6 checks passed
@chris-colinsky chris-colinsky deleted the feature/0061-detached-invocation-span branch June 18, 2026 21:50
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