feat(attributes): Complete the gen_ai.tool.definitions alias group - #595
Conversation
Semver Impact of This PR🟡 Minor (new features) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Attributes
Descriptions
Names
Other
Bug Fixes 🐛
Internal Changes 🔧Deps
Names
Other
🤖 This preview updates automatically when you update the PR. |
ab9324d to
640063f
Compare
640063f to
684df12
Compare
Lms24
left a comment
There was a problem hiding this comment.
The gen_ai aliases look correct but for the ai ones please see the Seer comment
684df12 to
67174a2
Compare
67174a2 to
906fc56
Compare
906fc56 to
c424824
Compare
49d3733 to
ef2fb47
Compare
`gen_ai.request.available_tools`, `ai.tools` and `ai.prompt.tools` all replace onto `gen_ai.tool.definitions`, but none of the four named the others. `gen_ai.request.available_tools` even carried an empty `alias` array, and `ai.tools` had none at all, which is why the symmetry test stayed green. All four now list each other. Replaced by getsentry/sentry-javascript#22820 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…initions The ai.tools and ai.prompt.tools attributes are string[], while gen_ai.tool.definitions and gen_ai.request.available_tools are string. Type-diverging attributes are not aliases, so keep only the deprecation replacement chain for the ai.* attributes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ef2fb47 to
a80026e
Compare
| }, | ||
| "is_in_otel": true, | ||
| "example": "[{\"type\": \"function\", \"name\": \"get_current_weather\", \"description\": \"Get the current weather in a given location\", \"parameters\": {\"type\": \"object\", \"properties\": {\"location\": {\"type\": \"string\", \"description\": \"The city and state, e.g. San Francisco, CA\"}, \"unit\": {\"type\": \"string\", \"enum\": [\"celsius\", \"fahrenheit\"]}}, \"required\": [\"location\", \"unit\"]}}]", | ||
| "alias": ["gen_ai.request.available_tools"], | ||
| "visibility": "public", | ||
| "changelog": [ | ||
| { |
There was a problem hiding this comment.
Bug: The logic in deriveAttributeKeyChains filters out deprecated aliases, creating an asymmetric chain expansion despite symmetric alias definitions in the JSON, causing inconsistent attribute chains.
Severity: MEDIUM
Suggested Fix
The logic in deriveAttributeKeyChains should be adjusted to handle symmetric aliases involving deprecated attributes correctly. The filtering that removes deprecated aliases from a stable attribute's alias expansion should be re-evaluated to ensure that chain membership remains consistent across all members of an alias group, regardless of their deprecation status.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: model/attributes/gen_ai/gen_ai__tool__definitions.json#L7-L13
Potential issue: The introduction of a symmetric alias between the stable attribute
`gen_ai.tool.definitions` and the deprecated attribute `gen_ai.request.available_tools`
creates an inconsistency in how attribute chains are generated. The
`deriveAttributeKeyChains` function filters out deprecated aliases when expanding the
chain for a stable attribute. As a result, the chain for `gen_ai.tool.definitions` will
not include `gen_ai.request.available_tools`. Conversely,
`gen_ai.request.available_tools`, being a rewriting deprecation, will join the chain of
its replacement, `gen_ai.tool.definitions`. This asymmetry means the two attributes will
not agree on their chain membership, which is expected to cause the test 'agrees on
chain membership between every pair of chained attributes' to fail.
gen_ai.request.available_tools,ai.toolsandai.prompt.toolsall replace ontogen_ai.tool.definitions, but none of the four named the others.gen_ai.request.available_toolseven carried an emptyaliasarray andai.toolshad none at all, which is why the symmetry test stayed green. All four now list each other.Supersedes #590, which GitHub auto-closed during a rebase of the stack.
Replaced by getsentry/sentry-javascript#22820