SIGN IN SIGN UP

fix: preserve configured runtime context on legacy tool call spans (#19233)

## Background

Legacy ai.toolCall spans omitted configured call-level runtime context,
preventing correlation and filtering by attributes such as requestId.

## Root Cause

LegacyOpenTelemetry stored selected runtime context in
baseTelemetryAttributes, but tool-span construction did not copy those
attributes. The reproduction confirmed requestId appeared on
ai.generateText but not ai.toolCall.

## Summary

Added selected ai.settings.context.* attributes to legacy tool call
spans and included a patch changeset for @ai-sdk/otel.

## Testing

Added regression coverage verifying selected runtime context is included
on tool call spans while unselected context remains excluded.

## End-to-end Validation

- `pnpm -C examples/ai-functions exec tsx
src/reproduction/issue-8529-tool-call-telemetry-metadata.ts` exited
successfully and reported the expected requestId on both ai.generateText
and ai.toolCall.

## Related Issues

Fixes #8529

Closes #17071

---------

Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com>
Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com>
Co-authored-by: zWingz <13031838+zWingz@users.noreply.github.com>
A
ai-sdk-factory[bot] committed
0651c5fdcc6f7e3ccb1a97a19e7a7fe41e6e3073
Parent: 7de3612
Committed by GitHub <noreply@github.com> on 8/25/2026, 4:26:30 AM