agentops icon indicating copy to clipboard operation
agentops copied to clipboard

Investigate user session logging failures

Open areibman opened this issue 4 months ago • 3 comments

📥 Pull Request

📘 Description Resolves an issue where AgentOps sessions appeared to initialize (URL logged) but no data was received by the backend. This was due to an authentication race condition where spans were exported before the JWT token was available.

The fix introduces:

  • Synchronization to ensure authentication completes before allowing span exports.
  • New wait_for_auth (default True) and auth_timeout configuration options.
  • Improved exporter logic to handle pending authentication and enhance error logging.

🧪 Testing Validated the fix by creating test_auth_fix.py, which tests:

  • Session initialization with wait_for_auth enabled (default behavior).
  • Session initialization with wait_for_auth disabled (previous behavior).
  • Session initialization without an API key.

Open in Cursor Open in Web

areibman avatar Aug 11 '25 19:08 areibman

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch. Learn more about Cursor Agents

cursor[bot] avatar Aug 11 '25 19:08 cursor[bot]

Codecov Report

:x: Patch coverage is 55.26316% with 17 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
agentops/client/client.py 42.85% 12 Missing :warning:
agentops/sdk/exporters.py 66.66% 3 Missing :warning:
agentops/config.py 75.00% 2 Missing :warning:

:loudspeaker: Thoughts on this report? Let us know!

codecov[bot] avatar Aug 11 '25 19:08 codecov[bot]

This pull request has been automatically marked as stale because it has not had any activity in the last 14 days.

If no updates are made within 7 days, this PR will be automatically closed.

github-actions[bot] avatar Aug 26 '25 00:08 github-actions[bot]