Skip to content

feat: give invoke_runner and other framework entrypoint operations the CHAIN kind (RIUS-1877) - #284

Closed
PabloPardoGarcia wants to merge 1 commit into
mainfrom
pablo/rius-1877-invoke-entrypoints-chain
Closed

PabloPardoGarcia wants to merge 1 commit into
mainfrom
pablo/rius-1877-invoke-entrypoints-chain

Conversation

@PabloPardoGarcia

Copy link
Copy Markdown
Member

What

  • kind_for_operation maps a gen_ai.operation.name that starts with invoke_ and is not in the kind-by-operation table to CHAIN. invoke_agent is in the table and stays AGENT; invoke_workflow stays CHAIN. A bare invoke_ (no entrypoint name) still has no kind.
  • src/rius/_semconv_generated.py gains invoke_runner: CHAIN in _KIND_BY_OPERATION, from rius-semconv #112.
  • Tests: invoke_runner, an arbitrary invoke_crew, invoke_workflow and invoke_agent, plus operations that only look similar (invoke_, invoke, reinvoke_runner).

Why

The OpenTelemetry GenAI conventions added framework-entrypoint operations in semantic-conventions-genai#571: invoke_runner, and invoke_{framework_entrypoint} in general. A native runner span therefore got no openinference.span.kind from the normalizer. The conventions define an entrypoint as not being an agent, so it is a CHAIN span, not AGENT. The family is open-ended, so a table cannot list it and the prefix rule lives in the helper.

Vendored file: re-sync before merge

The change to src/rius/_semconv_generated.py is only the delta from rius-semconv #112, applied on top of the vendored v1.10.0 copy, so the semconv-vendored check fails on this branch until it is re-pinned. After #112 squash-merges and a rius-semconv release carries it, re-vendor with TAG=<that tag> scripts/sync-semconv.sh (that re-pin also brings in whatever v1.11 and v1.12 added).

Testing

  • uv run ruff check .: passed
  • uv run ruff format --check .: passed
  • uv run mypy: no issues in 37 source files
  • uv run pytest: 2899 passed, 22 skipped, 1 xfailed
  • scripts/sync-semconv.sh --check: fails as expected (see above)

Related: RIUS-1877

…e CHAIN kind (RIUS-1877)

The GenAI conventions added framework-entrypoint operations (invoke_runner,
and invoke_{framework_entrypoint} in general) and define an entrypoint as not
being an agent. kind_for_operation knew none of them, so a native runner span
got no openinference.span.kind.

The vendored kind-by-operation table gains invoke_runner from rius-semconv,
and kind_for_operation maps any other invoke_ operation the table does not
list to CHAIN. invoke_agent stays AGENT and invoke_workflow stays CHAIN.
@PabloPardoGarcia

Copy link
Copy Markdown
Member Author

Automated review

No blocking issues.

Correctness. kind_for_operation (src/rius/semconv.py:78) checks the table first, so invoke_agent keeps AGENT and invoke_workflow / invoke_runner resolve from the table. Any other invoke_<non-empty> returns CHAIN. A bare invoke_, invoke, reinvoke_runner, a different case (INVOKE_RUNNER) and a leading space all return None. That matches the TypeScript SDK (#249) and the sink (argus-core#764) on every edge I checked: case, bare prefix, whitespace ("invoke_ " is CHAIN in all three, " invoke_x" is unknown in all three), and table-first ordering.

Callers. Every place that derives a kind from the operation goes through kind_for_operation: normalization.taxonomy_from_operation (src/rius/normalization.py:1890) and compaction._model_call (src/rius/compaction.py:179). Nothing else compares the operation name to derive a kind. In _model_call, an invoke_* span now answers False ("not a model call") where it used to answer None ("unknown"). That is correct for an entrypoint and slightly tightens when the compaction mark is held.

Vendored file. src/rius/_semconv_generated.py equals rius-semconv v1.10.0 out/python/_semconv_generated.py plus exactly the rius-semconv#112 delta. I applied the semconv patch to the v1.10.0 output and diffed it against this branch: identical apart from the 2-line vendoring header. The failing vendored check fails only on that delta (its log shows only the comment block and the invoke_runner line). It clears once the vendored module is re-pinned to the rius-semconv release that contains #112. Nothing else in the generated file was hand-edited.

Tests. tests/test_semconv.py and tests/test_normalization*.py pass locally (639 passed). The other CI jobs are green.

Nits

  • tests/test_semconv.py:94: the new tests call kind_for_operation directly. The TypeScript PR also checks the normalized output of a native span (gen_ai.operation.name: invoke_runner gets openinference.span.kind: CHAIN). One taxonomy_from_operation / normalization assertion here would cover the path users actually hit, next to the existing rerank one in tests/test_normalization.py:399.
  • Consider one case-sensitivity case (INVOKE_RUNNER is None) so the three implementations stay pinned to the same rule.

@PabloPardoGarcia

Copy link
Copy Markdown
Member Author

Landed through #289, together with the rius-semconv v1.13.0 sync.

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.

1 participant