Skip to content

Conversation

@ajjuaire
Copy link
Contributor

@ajjuaire ajjuaire commented Nov 4, 2025

Related Issue

Issue: #9031

Description

This PR fixes an incomplete user agent string issue in AWS Bedrock CloudTrail logs. Currently, when using Bedrock, CloudTrail only shows cline/3.35.1 m/E,e, missing critical context like OS version, SDK version, and runtime details.

Root Cause: A previous fix (PR #6821 ) used defaultUserAgentProvider which replaced the entire user agent string instead of appending to it. At that time, the AWS SDK didn't properly support the customUserAgent field, but this has since been resolved in aws/aws-sdk-js-v3#7445.

Solution: This PR:

  1. Upgrades AWS SDK packages from 3.840.0 to 3.922.0 (includes the customUserAgent fix)
  2. Switches from defaultUserAgentProvider to customUserAgent in bedrock.ts to append rather than replace the user agent

Expected Result: CloudTrail logs will now show complete details:

aws-sdk-js/3.922.0 ua/2.1 os/darwin#24.6.0 lang/js md/nodejs#22.19.0 api/bedrock-runtime#3.922.0 m/E,e cline/3.35.1

Test Procedure

Testing approach:

  • Verified that the AWS SDK upgrade includes the necessary fix for customUserAgent support
  • Confirmed that changing from defaultUserAgentProvider to customUserAgent with the new SDK version will properly append rather than replace
  • The change is minimal and isolated to the Bedrock client configuration

What could break:

  • Bedrock API calls could fail if the SDK upgrade introduced breaking changes
  • Existing authentication flows could be affected

Verification plan:

  • Test some Bedrock model providers (Claude models via Bedrock)
  • Verify CloudTrail logs show the complete user agent string
  • Confirm existing functionality (streaming, tool use, etc.) works correctly
  • Test with different credential providers

Confidence: The change follows AWS SDK best practices and uses the officially recommended customUserAgent field. The SDK upgrade is a minor version bump with no breaking changes noted in the changelog.

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • ♻️ Refactor Changes
  • 💅 Cosmetic Changes
  • 📚 Documentation update
  • 🏃 Workflow Changes

Pre-flight Checklist

  • Changes are limited to a single feature, bugfix or chore (split larger changes into separate PRs)
  • Tests are passing (npm test) and code is formatted and linted (npm run format && npm run lint)
  • I have created a changeset using npm run changeset (required for user-facing changes)
  • I have reviewed contributor guidelines

Screenshots

image

Additional Notes

This fix is important for all Bedrock users who rely on CloudTrail logs for debugging and monitoring. The complete user agent string provides essential context for:

  • Identifying which SDK version is being used
  • Troubleshooting platform-specific issues
  • Monitoring usage patterns
  • Security auditing

@changeset-bot
Copy link

changeset-bot bot commented Nov 4, 2025

🦋 Changeset detected

Latest commit: fa31696

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
claude-dev Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ajjuaire ajjuaire marked this pull request as ready for review November 4, 2025 19:53
@ajjuaire
Copy link
Contributor Author

ajjuaire commented Nov 4, 2025

userAgentAppId is what we want after testing further. This fits the user agent format better.

image

Copy link
Contributor

@arafatkatze arafatkatze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On testing this PR with different models like Haiku, Sonnet and Nova Pro this PR worked.

While the Cloud trail logs were not manually tested and looked at its assumed that the author has tested that before making this PR.

Given that this does not negatively effect working bedrock config its safe to merge.

@arafatkatze arafatkatze merged commit 42c947a into cline:main Nov 5, 2025
10 of 11 checks passed
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.

2 participants