Conversation
This branch has not been deployed
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.
Description
Fixes #3404.
In
openinference-instrumentation-agno,user_idandsession_idcan be provided as integers (or other non-string types) by users or framework run arguments. Currently:user.idandsession.idare defined as strings. When non-string values like123were passed, they could be exported as non-string attribute values, causing downstream UIs (such as Phoenix or Arize) that expect string IDs to surface them as blank or unindexed.if user_id:andif session_id:, numeric zero (0) was silently dropped without any warning or attribute emission.Proposed Changes
_normalize_id(value: Any, name: str) -> Optional[str]helper inopeninference.instrumentation.agno.utils:NoneifvalueisNoneor an empty/whitespace-only string.Expected <name> to be a string, but received <value> (type: <type>). Coercing to string.) and coerces to string (str(value)).0as"0"._normalize_idin:_runs_wrapper.py:_run_arguments()(normalizing bothuser_idandsession_id, checkingis not Noneinstead of truthiness) and_agent_run_attributes()(forAgentandTeamruns)._workflow_wrapper.py:_workflow_run_arguments(),_WorkflowWrapper.run(),run_stream(),arun(), and_WorkflowExecuteWrapper.execute()/aexecute().tests/test_instrumentor.py:test_run_arguments_user_and_session_id_coercion: validates string coercion, diagnostic logging viacaplog, and preservation of0.test_agent_run_attributes_session_and_user_id_coercion: validates agent instance attribute coercion and0preservation.test_workflow_run_arguments_coercion: validates workflow run arguments coercion and diagnostic warnings.test_normalize_id_unit: unit tests for_normalize_id.Verification
uv run --extra test pytestacross all 159 tests inopeninference-instrumentation-agno(100% pass).uv run --with ruff ruff checkanduv run --with ruff ruff format --check(0 issues, 100% clean).mypytype checking (Success: no issues found in 7 source files).