Fix TraceBatchManager authentication handling for issue #3559 #3560
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.
Fix TraceBatchManager authentication handling for issue #3559
Summary
Fixes a critical backward compatibility issue where crews would crash with an
AuthErrorwhen no authentication token is present. The root cause was thatget_auth_token()was called outside the existing try-catch block inTraceBatchManager.__init__(), causing the exception to bubble up and crash crew initialization.Key change: Moved the
get_auth_token()call inside the existing try-catch block so that when authentication fails, the system gracefully falls back to using an empty API key for ephemeral batch operation.This restores the expected behavior where crews can run without authentication by using ephemeral traces instead of crashing during initialization.
Review & Testing Checklist for Human
🔴 High Priority - 4 critical items to verify:
TraceBatchManagerwith empty API key successfully creates ephemeral batches and handles 401 responses gracefullyPlusAPI(api_key="")doesn't cause downstream issues or unexpected behavior in tracing operationsNotes
Link to Devin session: https://app.devin.ai/sessions/cee3d4ea212a4651884b1c66686ef9d4
Requested by: João ([email protected]) via Slack