Skip to content

Conversation

@neelay-aign
Copy link
Collaborator

No description provided.

Comment on lines +277 to 279
# # given some setting do not inject token_provider into client
return None
return get_token(use_cache=cache_token)
Copy link

Choose a reason for hiding this comment

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

Bug: The token_provider() function incorrectly returns None, preventing token retrieval and causing all API calls to fail.
Severity: CRITICAL | Confidence: High

🔍 Detailed Analysis

The token_provider() function at src/aignostics/platform/_client.py:277-279 contains an active return None statement, making the subsequent get_token() call unreachable. This violates the -> str type contract and causes _OAuth2TokenProviderConfiguration to receive None, leading to missing authentication headers in all API requests. Consequently, all API calls will fail with 401 Unauthorized errors.

💡 Suggested Fix

Remove the return None statement from token_provider() at src/aignostics/platform/_client.py:277-279 to allow the get_token() function to execute and return the actual token.

🤖 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: src/aignostics/platform/_client.py#L277-L279

Potential issue: The `token_provider()` function at
`src/aignostics/platform/_client.py:277-279` contains an active `return None` statement,
making the subsequent `get_token()` call unreachable. This violates the `-> str` type
contract and causes `_OAuth2TokenProviderConfiguration` to receive `None`, leading to
missing authentication headers in all API requests. Consequently, all API calls will
fail with 401 Unauthorized errors.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 3751515

@codecov
Copy link

codecov bot commented Dec 7, 2025

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 7, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
3 New issues

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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.

3 participants