fix(hermes-agent): create entry span from session source#216
Open
sipercai wants to merge 2 commits into
Open
Conversation
dc0d39f to
c438bc4
Compare
ralf0131
approved these changes
Jun 17, 2026
ralf0131
left a comment
Collaborator
There was a problem hiding this comment.
Review by github-manager-bot
Summary
Fixes missing ENTRY spans for platform-less AIAgent calls by mirroring Hermes's own session source resolution: AIAgent.platform, then HERMES_SESSION_SOURCE env var, then cli default. Previously, platform-less runs emitted only AGENT; now they correctly emit ENTRY -> AGENT. Also adds hermes-agent to CI lint/test workflows.
Findings
- [Info]
helpers.py— Theresolve_entry_platform()fallback chain (platform, env,cli) correctly mirrors Hermes's session source logic. Renaming from_entry_platformto the publicresolve_entry_platformand removingshould_create_entry_for_agent()is clean since the function now always returns a truthy value. - [Info]
wrappers.py— Theentry_platformvariable is resolved once and used consistently for the entry-creation guard. The TODO comment about passingentry_platformintoEntryInvocationwhen the upstream util adds a session source field is appropriately forward-looking. - [Info] Tests —
pytest.importorskipforhermes_stateandrun_agentintest_agent_features.py/test_live_llm_calls.pyis the right approach to avoid hard failures in CI without the Hermes runtime source. - [Info]
test_telemetry_spec.py— Comprehensive new tests for all resolution paths: TUI platform, env session source preference, env over platform, CLI default, and the behavioral change for platform-less agents.
Tests
Excellent coverage: the renamed test test_agent_without_platform_or_env_uses_cli_default_entry_source now asserts ENTRY -> AGENT instead of AGENT-only, matching the intended behavioral change.
LGTM. Well-documented behavioral change with thorough test coverage and clean CI integration.
Automated review by github-manager-bot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AIAgent.platformis present.AIAgentcalls:platform, thenHERMES_SESSION_SOURCE, thencli.ENTRY -> AGENTinstead ofAGENTonly.Validation Evidence
Spec and Scope
loongsuite-instrumentation-hermes-agentcode, docs, changelog, and tests.Local Checks
python "$PIPELINE_SKILL_DIR/scripts/check_loongsuite_pr_readiness.py" --repo .tox -e precommitPYTHONPATH="instrumentation-loongsuite/loongsuite-instrumentation-hermes-agent/src:util/opentelemetry-util-genai/src:opentelemetry-api/src:opentelemetry-sdk/src:opentelemetry-semantic-conventions/src:opentelemetry-instrumentation/src" python -m pytest instrumentation-loongsuite/loongsuite-instrumentation-hermes-agent/tests/test_telemetry_spec.py -qReal E2E Matrix
AIAgent.platform=NoneproducedENTRY -> AGENTtest_state_is_isolated_across_concurrent_invocationstest_entry_span_fails_when_agent_fail_cleanup_raisesTelemetry and Weaver
ENTRY -> AGENTtest_entry_span_omits_messages_when_content_capture_disabledtest_state_is_isolated_across_concurrent_invocationsweaver registry live-check -r /tmp/loongsuite-semantic-conventions/model --input-source /tmp/hermes-pr216-weaver-entry-sample.json --input-format json --format json --no-stream true --advice-profile loongsuite-genai --skip-policies truegen_ai.agent.systemregistry gap outside this PRCI
tox -e typecheckon the rebased head currently fails inutil/opentelemetry-util-genai/.../extended_handler.py; this file is not changed by this PR. Currentmainchecks forde65b325were queued when verified.